-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
70 lines (60 loc) · 2.77 KB
/
build.ps1
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
[string] $cakeBootstrapper = './v0.0.5-alpha-cake.ps1'
[string] $cakeBootstrapperUrl = 'https://raw.githubusercontent.com/devlead/Cake.Bridge/v0.0.5-alpha/src/cake.ps1'
if (!(Test-Path $cakeBootstrapper))
{
Invoke-RestMethod $cakeBootstrapperUrl -OutFile $cakeBootstrapper
}
. $cakeBootstrapper
######################################################################
## GLOBALS
######################################################################
[FilePath] $solution = [Enumerable]::FirstOrDefault([GlobbingAliases]::GetFiles($context, "./src/*.sln"))
[string] $configuration = "Release"
[DirectoryPath] $nugetRoot = [DirectoryAliases]::MakeAbsolute($context, "./nuget");
######################################################################
## SETUP / TEARDOWN
######################################################################
Setup([Action[ICakeContext]]{
param([ICakeContext] $ctx)
})
Teardown([Action[ITeardownContext]]{
param([ITeardownContext] $ctx)
})
######################################################################
## TASKS
######################################################################
$cleanTask = "Clean" |`
Task |`
Does -Action ({
[DirectoryAliases]::CleanDirectories($context, "./src/**/bin/$configuration")
[DirectoryAliases]::CleanDirectories($context, "./src/**/obj/$configuration")
[DirectoryAliases]::CleanDirectory($context, $nugetRoot)
})
$restoreTask = "Restore" |`
Task |`
IsDependentOn -Dependency $cleanTask |`
Does -Action ({
[DotNetCoreAliases]::DotNetCoreRestore($context, $solution.FullPath)
})
$buildTask = "Build" |`
Task |`
IsDependentOn -Dependency $restoreTask |`
Does -Action ({
[DotNetCoreAliases]::DotNetCoreBuild($context, $solution.FullPath)
})
$packTask = "Pack" |`
Task |`
IsDependentOn -Dependency $buildTask |`
Does -Action ({
[DotNetCorePackSettings] $packSettings = [DotNetCorePackSettings]::new()
$packSettings.OutputDirectory = $nugetRoot
[DotNetCoreAliases]::DotNetCorePack(
$context,
$solution.FullPath,
$packSettings
)
})
######################################################################
## EXECUTION
######################################################################
$packTask | RunTarget