File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
11
11
Namespace = c . GlobalOptions . TryGetValue ( "build_property.ThisAssemblyNamespace" , out var ns )
12
12
&& ! string . IsNullOrEmpty ( ns ) ? ns : null ,
13
13
IsDirty = c . GlobalOptions . TryGetValue ( "build_property.GitIsDirty" , out var dirty )
14
- && dirty == "1" ? true : false
14
+ && dirty == "1" ? true : false ,
15
+ NoThisAssembly = c . GlobalOptions . TryGetValue ( "build_property.GitThisAssembly" , out var value )
16
+ && bool . TryParse ( value , out var thisassembly ) && ! thisassembly ? true : false
15
17
} ) ;
16
18
17
19
context . RegisterSourceOutput ( ns ,
@@ -21,6 +23,9 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
21
23
if ( ! string . IsNullOrEmpty ( state . Namespace ) )
22
24
return ;
23
25
26
+ if ( state . NoThisAssembly )
27
+ return ;
28
+
24
29
c . AddSource ( "ThisAssembly.Git.IsDirty.g" ,
25
30
$$ """
26
31
//------------------------------------------------------------------------------
Original file line number Diff line number Diff line change 33
33
</GitThisAssemblyDependsOn >
34
34
</PropertyGroup >
35
35
36
+ <ItemGroup >
37
+ <CompilerVisibleProperty Include =" GitIsDirty" />
38
+ <CompilerVisibleProperty Include =" GitThisAssembly" />
39
+ </ItemGroup >
40
+
36
41
<Target Name =" GitThisAssembly" DependsOnTargets =" $(GitThisAssemblyDependsOn)"
37
42
BeforeTargets =" PrepareConstants;GenerateMSBuildEditorConfigFileShouldRun" Condition =" '$(GitThisAssembly)' == 'true'" >
38
43
39
44
<ItemGroup >
40
- <CompilerVisibleProperty Include =" GitIsDirty" />
41
-
42
45
<Constant Include =" IsDirtyString" Value =" true" Root =" Git" Condition =" $(GitIsDirty) == '1'" />
43
46
<Constant Include =" IsDirtyString" Value =" false" Root =" Git" Condition =" $(GitIsDirty) == '0'" />
44
47
You can’t perform that action at this time.
0 commit comments