forked from pulumi/pulumi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.proj
142 lines (115 loc) · 5.95 KB
/
build.proj
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RepoRootDirectory>$(MSBuildThisFileDirectory)</RepoRootDirectory>
<SdkDirectory>$(RepoRootDirectory)\sdk\</SdkDirectory>
<NodeJSSdkDirectory>$(SdkDirectory)\nodejs\</NodeJSSdkDirectory>
<TestParallelism>10</TestParallelism>
<MSVSVersion>2017</MSVSVersion>
<PulumiRoot Condition="'$(PulumiRoot)' == ''">C:\Pulumi\</PulumiRoot>
<PulumiBin>$(PulumiRoot)\bin</PulumiBin>
</PropertyGroup>
<Target Name="EnsureGoDependencies">
<Exec Command="dep ensure -v"
Condition="Exists('Gopkg.toml')"
WorkingDirectory="$(RepoRootDirectory)" />
<Exec Command="(set GO111MODULE=on) & go mod vendor"
Condition="Exists('go.mod')"
WorkingDirectory="$(RepoRootDirectory)" />
</Target>
<Target Name="EnsureNodeDependencies">
<Exec Command="yarn install"
WorkingDirectory="$(NodeJSSdkDirectory)" />
</Target>
<Target Name="TypeScriptCompileNodeSdk">
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true" Condition="'$(Version)' == ''">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="yarn run tsc" WorkingDirectory="$(NodeJSSdkDirectory)" />
<Copy SourceFiles="$(NodeJSSdkDirectory)\package.json" DestinationFiles="$(NodeJSSdkDirectory)\bin\package.json" />
<Exec Command="node "$(RepoRootDirectory)\scripts\reversion.js" "$(NodeJSSdkDirectory)\bin\package.json" $(Version)" />
<Exec Command="node "$(RepoRootDirectory)\scripts\reversion.js" "$(NodeJSSdkDirectory)\bin\version.js" $(Version)" />
</Target>
<Target Name="GoCompileNodeSdk">
<ItemGroup>
<GoPackagesToBuild Include="github.com/pulumi/pulumi/sdk/nodejs/cmd/pulumi-language-nodejs" />
</ItemGroup>
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true" Condition="'$(Version)' == ''">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/pkg/version.Version=$(Version)" %(GoPackagesToBuild.Identity)"
EnvironmentVariables="GOBIN=$(PulumiBin)"/>
</Target>
<Target Name="BinplaceNodeSdkProtos">
<ItemGroup>
<NodeSdkProtos Include="$(NodeJSSdkDirectory)\proto\*.js" />
</ItemGroup>
<Copy SourceFiles="@(NodeSdkProtos)"
DestinationFolder="$(NodeJSSdkDirectory)\bin\proto" />
</Target>
<Target Name="BinPlaceNodeSdkTestData">
<ItemGroup>
<NodeSdkTestDataFiles Include="$(NodeJSSdkDirectory)\tests\runtime\langhost\cases\**\*" />
</ItemGroup>
<Copy SourceFiles="@(NodeSdkTestDataFiles)"
DestinationFolder="$(NodeJSSdkDirectory)\bin\tests\runtime\langhost\cases" />
</Target>
<Target Name="YarnLinkSdk">
<Exec Command="yarn link"
WorkingDirectory="$(NodeJSSdkDirectory)\bin" />
</Target>
<Target Name="BinPlaceNodeSdk"
DependsOnTargets="BinPlaceNodeSdkProtos;BinPlaceNodeSdkTestData;YarnLinkSdk">
<Copy SourceFiles="$(NodeJSSdkDirectory)\dist\pulumi-resource-pulumi-nodejs.cmd" DestinationFolder="$(PulumiBin)" />
</Target>
<Target Name="BuildNodeSdk"
DependsOnTargets="TypeScriptCompileNodeSdk;GoCompileNodeSdk;BinPlaceNodeSdk">
</Target>
<Target Name="BuildGoCmds">
<ItemGroup>
<GoCmdsToBuild Include="github.com/pulumi/pulumi" />
</ItemGroup>
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true" Condition="'$(Version)' == ''">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/pkg/version.Version=$(Version)" %(GoCmdsToBuild.Identity)"
EnvironmentVariables="GOBIN=$(PulumiBin)"/>
</Target>
<Target Name="Build"
DependsOnTargets="EnsureGoDependencies;EnsureNodeDependencies;BuildNodeSdk;BuildGoCmds">
</Target>
<Target Name="IntegrationTest">
<Exec Command="where pulumi-language-nodejs"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="WhereLangHostExitCode" />
</Exec>
<Exec Command="where pulumi-resource-pulumi-nodejs.cmd"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="WhereDynamicProviderExitCode" />
</Exec>
<Error Text="Please add "$(PulumiRoot)\bin" to your path before running integration tests."
Condition="$(WhereLangHostExitCode) != 0 Or $(WhereDynamicProviderExitCode) != 0"/>
<!-- Ignore the exit code (but retain it) so we can kill all the lingering node processes even when go test
fails. Otherwise, the AppVeyor job would hang until it reached the timeout -->
<Exec Command="go test -count=1 -timeout 10m -cover -parallel $(TestParallelism) .\examples"
IgnoreExitCode="true"
WorkingDirectory="$(RepoRootDirectory)">
<Output TaskParameter="ExitCode" PropertyName="GoTestExitCode" />
</Exec>
<!-- Work around pulumi/pulumi#371 by killing all lingering node.exe processes. Yes, in the limit
this may kill too much, but we assume for now folks hacking on pulumi on windows are not running
additional node.exe processes -->
<Exec Command="taskkill /f /im node.exe"
IgnoreStandardErrorWarningFormat="true"
IgnoreExitCode="true" />
<Error Text="go test failed, exit code: $(GoTestExitCode)"
Condition="'$(GoTestExitCode)' != '0'"/>
</Target>
<Target Name="Publish">
<Exec Command=""$(RepoRootDirectory)\scripts\publish.cmd" />
</Target>
<Target Name="AppVeyorPush"
DependsOnTargets="Build;Publish;IntegrationTest" />
<Target Name="AppVeyorPullRequest"
DependsOnTargets="Build;IntegrationTest" />
</Project>