This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
forked from tommarien/NHibernate.ByteCode
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.cake
122 lines (104 loc) · 4.45 KB
/
setup.cake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var solution = "src/NHibernate.ByteCode.sln";
var AssemblyInfoPath = "src/NHibernate.ByteCode.Castle/AssemblyInfoVersion.cs";
var target = Argument ("target", "Default");
var configuration = Argument ("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task ("Clean")
.Does (() => {
CleanDirectories(
$"./**/bin/"
);
CleanDirectories(
$"./**/obj/"
);
});
GitVersion versionInfo = null;
Task ("Version")
.Does(() => {
versionInfo = GitVersion(new GitVersionSettings{
UpdateAssemblyInfo = false,
UpdateAssemblyInfoFilePath = AssemblyInfoPath,
OutputType = GitVersionOutput.Json,
NoFetch = true
});
CreateAssemblyInfo(AssemblyInfoPath, new AssemblyInfoSettings {
InformationalVersion = versionInfo.InformationalVersion,
FileVersion = versionInfo.AssemblySemFileVer,
Version = versionInfo.AssemblySemVer
});
GitVersion(new GitVersionSettings{
UpdateAssemblyInfo = true,
UpdateAssemblyInfoFilePath = AssemblyInfoPath,
OutputType = GitVersionOutput.Json,
NoFetch = true
});
});
Task("Build")
.IsDependentOn ("Version")
.Does (() => {
MSBuild (solution, new MSBuildSettings{
Configuration = configuration,
MaxCpuCount = 0,
Restore = true
});
});
Task("Package")
.IsDependentOn("Build")
.Does(() => {
if(versionInfo == null){
versionInfo = GitVersion(new GitVersionSettings{
UpdateAssemblyInfo = false,
UpdateAssemblyInfoFilePath = AssemblyInfoPath,
OutputType = GitVersionOutput.Json,
NoFetch = true
});
}
EnsureDirectoryExists("./artifacts");
CleanDirectories("./artifacts");
var directories = GetSubDirectories("./src/");
foreach(var directoryPath in directories){
FileInfo fi = new FileInfo(directoryPath.ToString());
if (fi.Name.StartsWith("NHibernate.") && !fi.Name.EndsWith(".Tests")){
Information($"Copying {fi.Name} info artifacts");
CopyDirectory($"./src/{fi.Name}/bin/", "artifacts");
}
}
var filesToBeDeleted = GetFiles("./artifacts/**/Iesi.Collections.dll");
DeleteFiles(filesToBeDeleted);
filesToBeDeleted = GetFiles("./artifacts/**/Castle.Core.dll");
DeleteFiles(filesToBeDeleted);
filesToBeDeleted = GetFiles("./artifacts/**/NHibernate.dll");
DeleteFiles(filesToBeDeleted);
var nugetPackSettings = new NuGetPackSettings {
Id = "Economic.NHibernate.ByteCode",
Version = versionInfo.NuGetVersionV2,
Title = "Economic.NHibernate.ByteCode",
Authors = new[] {"e-conomic"},
Owners = new[] {"e-conomic"},
Description = "Collection of Economic Libraries for consuming micro-services, and other stuff",
ProjectUrl = new Uri("https://github.com/e-conomic/NHibernate.ByteCode"),
Tags = new [] {"NHibernate.ByteCode"},
RequireLicenseAcceptance= false,
Symbols = true,
NoPackageAnalysis = true,
Files = new [] {
new NuSpecContent {Source = "**/*", Target = "lib"}
},
Dependencies = new [] {
new NuSpecDependency {Id = "Castle.Core", Version="4.3.1", TargetFramework="net461"},
new NuSpecDependency {Id = "NHibernate", Version="3.3.3.4000", TargetFramework="net461"},
new NuSpecDependency {Id = "Iesi.Collections", Version="3.3.1.4000", TargetFramework="net461"}
},
BasePath = "./artifacts/",
OutputDirectory = "."
};
NuGetPack(nugetPackSettings);
});
Task ("Default")
.IsDependentOn("Package");
RunTarget (target);