4
4
var target = Argument ( "target" , "Default" ) ;
5
5
var outputDir = "./artifacts/" ;
6
6
7
- void UpdateProjectJsonVersion ( string projectName ) {
8
- var proj = string . Format ( "./src/{0}/project.json" , projectName ) ;
9
- var updatedProjectJson = System . IO . File . ReadAllText ( proj )
10
- . Replace ( "1.0.0-*" , versionInfo . NuGetVersion ) ;
11
-
12
- System . IO . File . WriteAllText ( proj , updatedProjectJson ) ;
13
- }
14
-
15
7
Task ( "Clean" )
16
8
. Does ( ( ) => {
17
9
if ( DirectoryExists ( outputDir ) )
@@ -20,64 +12,61 @@ Task("Clean")
20
12
}
21
13
} ) ;
22
14
23
- Task ( "Restore" )
24
- . Does ( ( ) => {
25
- DotNetCoreRestore ( ) ;
26
- } ) ;
15
+
27
16
28
17
GitVersion versionInfo = null ;
29
18
Task ( "Version" )
30
19
. Does ( ( ) => {
31
20
GitVersion ( new GitVersionSettings {
32
- UpdateAssemblyInfo = true ,
21
+ UpdateAssemblyInfo = false ,
33
22
OutputType = GitVersionOutput . BuildServer
34
23
} ) ;
35
24
versionInfo = GitVersion ( new GitVersionSettings { OutputType = GitVersionOutput . Json } ) ;
36
- UpdateProjectJsonVersion ( "dbup-core" ) ;
37
- UpdateProjectJsonVersion ( "dbup-firebird" ) ;
38
- UpdateProjectJsonVersion ( "dbup-mysql" ) ;
39
- UpdateProjectJsonVersion ( "dbup-postgresql" ) ;
40
- UpdateProjectJsonVersion ( "dbup-sqlce" ) ;
41
- UpdateProjectJsonVersion ( "dbup-sqlite" ) ;
42
- UpdateProjectJsonVersion ( "dbup-sqlite-mono" ) ;
43
- UpdateProjectJsonVersion ( "dbup-sqlserver" ) ;
25
+ } ) ;
26
+
27
+ Task ( "Restore" )
28
+ . IsDependentOn ( "Version" )
29
+ . Does ( ( ) => {
30
+ DotNetCoreRestore ( "src" , new DotNetCoreRestoreSettings ( ) {
31
+ ArgumentCustomization = args => args . Append ( "/p:Version=" + versionInfo . NuGetVersion )
32
+ } ) ;
44
33
} ) ;
45
34
46
35
Task ( "Build" )
47
36
. IsDependentOn ( "Clean" )
48
37
. IsDependentOn ( "Version" )
49
38
. IsDependentOn ( "Restore" )
50
39
. Does ( ( ) => {
51
- MSBuild ( "./src/DbUp.sln" ) ;
40
+ var settings = new MSBuildSettings ( )
41
+ . SetConfiguration ( "Release" )
42
+ . UseToolVersion ( MSBuildToolVersion . VS2017 )
43
+ . WithProperty ( "Version" , versionInfo . NuGetVersion )
44
+ . WithProperty ( "PackageOutputPath" , System . IO . Path . GetFullPath ( outputDir ) )
45
+ . WithTarget ( "Build" )
46
+ . WithTarget ( "Pack" ) ;
47
+
48
+ MSBuild ( "./src/DbUp.sln" , settings ) ;
52
49
} ) ;
53
50
54
51
Task ( "Test" )
55
52
. IsDependentOn ( "Build" )
56
53
. Does ( ( ) => {
57
- DotNetCoreTest ( "./src/dbup-tests" ) ;
54
+ DotNetCoreTest ( "./src/dbup-tests/dbup-tests.csproj" , new DotNetCoreTestSettings
55
+ {
56
+ Configuration = "Release" ,
57
+ NoBuild = true
58
+ } ) ;
58
59
} ) ;
59
60
60
61
Task ( "Package" )
61
- . IsDependentOn ( "Test " )
62
+ . IsDependentOn ( "Build " )
62
63
. Does ( ( ) => {
63
- var settings = new DotNetCorePackSettings
64
- {
65
- OutputDirectory = outputDir ,
66
- NoBuild = true
67
- } ;
68
64
69
- DotNetCorePack ( "./src/dbup-core/project.json" , settings ) ;
70
- DotNetCorePack ( "./src/dbup-firebird/project.json" , settings ) ;
71
- DotNetCorePack ( "./src/dbup-mysql/project.json" , settings ) ;
72
- DotNetCorePack ( "./src/dbup-postgresql/project.json" , settings ) ;
73
- DotNetCorePack ( "./src/dbup-sqlce/project.json" , settings ) ;
74
- DotNetCorePack ( "./src/dbup-sqlite/project.json" , settings ) ;
75
- DotNetCorePack ( "./src/dbup-sqlite-mono/project.json" , settings ) ;
76
- DotNetCorePack ( "./src/dbup-sqlserver/project.json" , settings ) ;
65
+ DeleteFile ( outputDir + "dbup-test.*" ) ;
77
66
78
67
var githubToken = Argument < string > ( "githubToken" ) ;
79
68
var releaseNotesExitCode = StartProcess (
80
- @"tools\GitReleaseNotes\tools\gitreleasenotes.exe" ,
69
+ @"tools\GitReleaseNotes\tools\gitreleasenotes.exe" ,
81
70
new ProcessSettings { Arguments = ". /o artifacts/releasenotes.md /repoToken " + githubToken } ) ;
82
71
if ( string . IsNullOrEmpty ( System . IO . File . ReadAllText ( "./artifacts/releasenotes.md" ) ) )
83
72
System . IO . File . WriteAllText ( "./artifacts/releasenotes.md" , "No issues closed since last release" ) ;
0 commit comments