Skip to content

Commit 02c741f

Browse files
committed
Merge branch 'release/0.14.0'
* release/0.14.0: (#66) Add shouldGenerateSolutionVersionCSharpFile (maint) Formatting (maint) Tidy up of parameters/toolsettings files
2 parents 459c640 + 35282b0 commit 02c741f

File tree

3 files changed

+329
-325
lines changed

3 files changed

+329
-325
lines changed

Chocolatey.Cake.Recipe/Content/gitversion.cake

+43-35
Original file line numberDiff line numberDiff line change
@@ -152,51 +152,59 @@ public class BuildVersion
152152
context.Information("There is a tag.");
153153
}
154154

155-
// create SolutionVersion.cs file...
156-
var assemblyInfoSettings = new AssemblyInfoSettings {
157-
ComVisible = BuildParameters.ProductComVisible,
158-
CLSCompliant = BuildParameters.ProductClsCompliant,
159-
Company = BuildParameters.ProductCompany,
160-
Version = fileVersion,
161-
FileVersion = fileVersion,
162-
InformationalVersion = informationalVersion,
163-
Product = BuildParameters.ProductName,
164-
Description = BuildParameters.ProductDescription,
165-
Trademark = BuildParameters.ProductTrademark,
166-
Copyright = BuildParameters.ProductCopyright
167-
};
168-
169-
if (BuildParameters.ProductCustomAttributes != null)
155+
if (BuildParameters.ShouldGenerateSolutionVersionCSharpFile)
170156
{
171-
assemblyInfoSettings.CustomAttributes = BuildParameters.ProductCustomAttributes;
172-
}
173-
else
174-
{
175-
assemblyInfoSettings.CustomAttributes = new List<AssemblyInfoCustomAttribute>();
157+
context.Information("Generating SolutionVersion.cs file...");
158+
159+
var assemblyInfoSettings = new AssemblyInfoSettings {
160+
ComVisible = BuildParameters.ProductComVisible,
161+
CLSCompliant = BuildParameters.ProductClsCompliant,
162+
Company = BuildParameters.ProductCompany,
163+
Version = fileVersion,
164+
FileVersion = fileVersion,
165+
InformationalVersion = informationalVersion,
166+
Product = BuildParameters.ProductName,
167+
Description = BuildParameters.ProductDescription,
168+
Trademark = BuildParameters.ProductTrademark,
169+
Copyright = BuildParameters.ProductCopyright
170+
};
176171

177-
if (BuildParameters.ShouldStrongNameOutputAssemblies)
172+
if (BuildParameters.ProductCustomAttributes != null)
178173
{
179-
var assemblyKeyFileAttribute = new AssemblyInfoCustomAttribute
174+
assemblyInfoSettings.CustomAttributes = BuildParameters.ProductCustomAttributes;
175+
}
176+
else
177+
{
178+
assemblyInfoSettings.CustomAttributes = new List<AssemblyInfoCustomAttribute>();
179+
180+
if (BuildParameters.ShouldStrongNameOutputAssemblies)
180181
{
181-
Name = "AssemblyKeyFile",
182-
Value = BuildParameters.StrongNameKeyPath.Replace("\\", "\\\\"),
182+
var assemblyKeyFileAttribute = new AssemblyInfoCustomAttribute
183+
{
184+
Name = "AssemblyKeyFile",
185+
Value = BuildParameters.StrongNameKeyPath.Replace("\\", "\\\\"),
186+
NameSpace = "System.Reflection"
187+
};
188+
189+
assemblyInfoSettings.CustomAttributes.Add(assemblyKeyFileAttribute);
190+
}
191+
192+
var obfuscateAssemblyAttribute = new AssemblyInfoCustomAttribute
193+
{
194+
Name = "ObfuscateAssembly",
195+
Value = BuildParameters.ObfuscateAssembly,
183196
NameSpace = "System.Reflection"
184197
};
185198

186-
assemblyInfoSettings.CustomAttributes.Add(assemblyKeyFileAttribute);
199+
assemblyInfoSettings.CustomAttributes.Add(obfuscateAssemblyAttribute);
187200
}
188201

189-
var obfuscateAssemblyAttribute = new AssemblyInfoCustomAttribute
190-
{
191-
Name = "ObfuscateAssembly",
192-
Value = BuildParameters.ObfuscateAssembly,
193-
NameSpace = "System.Reflection"
194-
};
195-
196-
assemblyInfoSettings.CustomAttributes.Add(obfuscateAssemblyAttribute);
202+
context.CreateAssemblyInfo(BuildParameters.Paths.Files.SolutionInfoFilePath, assemblyInfoSettings);
203+
}
204+
else
205+
{
206+
context.Information("Skipping generation of SolutionVersion.cs file.");
197207
}
198-
199-
context.CreateAssemblyInfo(BuildParameters.Paths.Files.SolutionInfoFilePath, assemblyInfoSettings);
200208

201209
context.Information("Calculated Major.Minor.Patch: {0}", majorMinorPatch);
202210
context.Information("Calculated Sem Version: {0}", semVersion);

0 commit comments

Comments
 (0)