Skip to content
Snippets Groups Projects
Commit 63113a76 authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

New: better build script

parent 54288ca0
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,7 @@ var projectPaths = projects.Select(project => project.GetDirectory()); ...@@ -21,7 +21,7 @@ var projectPaths = projects.Select(project => project.GetDirectory());
var artifactsDir = Directory("./Artifacts"); var artifactsDir = Directory("./Artifacts");
var solutionFile = GetFiles("./**/*.sln").First(); var solutionFile = GetFiles("./**/*.sln").First();
var projectName = solutionFile.GetFilenameWithoutExtension().ToString(); var projectName = solutionFile.GetFilenameWithoutExtension().ToString();
var assemblyInfoSubPath = "/Properties/AssemblyInfo.cs"; var assemblyInfoSubPath = "Properties/AssemblyInfo.cs";
// get latest MSBuild version // get latest MSBuild version
var vsLatest = VSWhereLatest(); var vsLatest = VSWhereLatest();
...@@ -30,6 +30,9 @@ var msBuildPathX64 = (vsLatest == null) ? null : vsLatest.CombineWithFilePath(". ...@@ -30,6 +30,9 @@ var msBuildPathX64 = (vsLatest == null) ? null : vsLatest.CombineWithFilePath(".
// Error rules for resharper // Error rules for resharper
// Example: {"InconsistentNaming", "RedundantUsingDirective"}; // Example: {"InconsistentNaming", "RedundantUsingDirective"};
string[] resharperErrorRules = {}; string[] resharperErrorRules = {};
// Paths to exclude from dupFinder
List<string> dupFinderExcludePatterns = projectPaths.Select( x => $"{x.ToString()}/{assemblyInfoSubPath}").ToList();
string[] dupFinderExcludeCodeRegionsByNameSubstring = { "DupFinder Exclusion" };
Action <NpxSettings> requiredSemanticVersionPackages = settings => Action <NpxSettings> requiredSemanticVersionPackages = settings =>
settings.AddPackage("semantic-release") settings.AddPackage("semantic-release")
...@@ -62,14 +65,14 @@ Task("Clean") ...@@ -62,14 +65,14 @@ Task("Clean")
Force = true Force = true
}; };
// Clean solution directories. var directoriesToDelete = new List<DirectoryPath>();
foreach(var path in projectPaths) { foreach(var path in projectPaths) {
Information($"Cleaning path {path} ..."); directoriesToDelete.Add(Directory($"{path}/obj"));
var directoriesToDelete = new DirectoryPath[] { directoriesToDelete.Add(Directory($"{path}/bin"));
Directory($"{path}/obj"), }
Directory($"{path}/bin"),
artifactsDir directoriesToDelete.Add(artifactsDir);
};
foreach(var dir in directoriesToDelete) { foreach(var dir in directoriesToDelete) {
if (DirectoryExists(dir)) { if (DirectoryExists(dir)) {
...@@ -77,7 +80,6 @@ Task("Clean") ...@@ -77,7 +80,6 @@ Task("Clean")
DeleteDirectory(dir, settings); DeleteDirectory(dir, settings);
} }
} }
}
}); });
Task("Restore") Task("Restore")
...@@ -96,9 +98,8 @@ Task("DupFinder") ...@@ -96,9 +98,8 @@ Task("DupFinder")
ShowStats = true, ShowStats = true,
ShowText = true, ShowText = true,
OutputFile = $"{artifactsDir}/dupfinder.xml", OutputFile = $"{artifactsDir}/dupfinder.xml",
ExcludeCodeRegionsByNameSubstring = new string[] { ExcludeCodeRegionsByNameSubstring = dupFinderExcludeCodeRegionsByNameSubstring,
"DupFinder Exclusion" ExcludePattern = dupFinderExcludePatterns.ToArray(),
},
ThrowExceptionOnFindingDuplicates = true ThrowExceptionOnFindingDuplicates = true
}; };
DupFinder(solutionFile, settings); DupFinder(solutionFile, settings);
...@@ -160,7 +161,7 @@ Task("UpdateAssemblyInfo") ...@@ -160,7 +161,7 @@ Task("UpdateAssemblyInfo")
var assemblyVersion = $"{nextSemanticVersionNumber}.0"; var assemblyVersion = $"{nextSemanticVersionNumber}.0";
foreach(var project in projects) { foreach(var project in projects) {
CreateAssemblyInfo(project.GetDirectory() + assemblyInfoSubPath, new AssemblyInfoSettings { CreateAssemblyInfo($"project.GetDirectory()/{assemblyInfoSubPath}", new AssemblyInfoSettings {
Product = project.GetFilenameWithoutExtension().ToString(), Product = project.GetFilenameWithoutExtension().ToString(),
Title = project.GetFilenameWithoutExtension().ToString(), Title = project.GetFilenameWithoutExtension().ToString(),
Company = "IT Center, RWTH Aachen University", Company = "IT Center, RWTH Aachen University",
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment