mirror of https://github.com/pulumi/pulumi.git
184 lines
8.5 KiB
XML
184 lines
8.5 KiB
XML
<?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>
|
|
<NativeRuntimeModuleDirectory>$(NodeJSSdkDirectory)\runtime\native\</NativeRuntimeModuleDirectory>
|
|
<NodeVersion>6.10.2</NodeVersion>
|
|
<NodeArch>x64</NodeArch>
|
|
<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"
|
|
WorkingDirectory="$(RepoRootDirectory)" />
|
|
</Target>
|
|
|
|
<Target Name="EnsureNodeDependencies">
|
|
<Exec Command="yarn install"
|
|
WorkingDirectory="$(NodeJSSdkDirectory)" />
|
|
</Target>
|
|
|
|
<Target Name="EnsureCustomNode"
|
|
Condition="!Exists('$(NodeJSSdkDirectory)\custom_node\node\node.exe')">
|
|
<Exec Command=""$(NodeJSSdkDirectory)\scripts\download_node.cmd""
|
|
WorkingDirectory="$(NodeJSSdkDirectory)" />
|
|
</Target>
|
|
|
|
<Target Name="ConfigureNativeRuntimeModule"
|
|
DependsOnTargets="EnsureNodeDependencies">
|
|
<Exec Command=""$(NativeRuntimeModuleDirectory)\ensure_node_v8.cmd""
|
|
WorkingDirectory="$(NativeRuntimeModuleDirectory)" />
|
|
<Exec Command=""$(NodeJSSdkDirectory)\node_modules\.bin\node-gyp.cmd" configure --msvs_version $(MSVSVersion) --devdir "$(NativeRuntimeModuleDirectory)\node_dev""
|
|
WorkingDirectory="$(NativeRuntimeModuleDirectory)" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\custom_node\node\node.lib"
|
|
DestinationFiles="$(NativeRuntimeModuleDirectory)\node_dev\$(NodeVersion)\$(NodeArch)\node.lib" />
|
|
</Target>
|
|
|
|
<Target Name="BuildNativeRuntimeModule"
|
|
DependsOnTargets="ConfigureNativeRuntimeModule">
|
|
<Exec Command=""$(NodeJSSdkDirectory)\node_modules\.bin\node-gyp.cmd" build --msvs_version $(MSVSVersion) --devdir "$(NativeRuntimeModuleDirectory)\node_dev""
|
|
WorkingDirectory="$(NativeRuntimeModuleDirectory)" />
|
|
</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="BinPlaceNodeSdkNativeRuntimeModule"
|
|
DependsOnTargets="BuildNativeRuntimeModule">
|
|
<ItemGroup>
|
|
<NodeSdkNativeRuntimeModuleFiles Include="$(NativeRuntimeModuleDirectory)\build\Release\nativeruntime-v0.11.0.node" />
|
|
<NodeSdkNativeRuntimeModuleFiles Include="$(NativeRuntimeModuleDirectory)\build\Release\nativeruntime-v0.11.0.pdb" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(NodeSdkNativeRuntimeModuleFiles)"
|
|
DestinationFolder="$(NodeJSSdkDirectory)\bin\runtime\native\build\Release" />
|
|
</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;BinPlaceNodeSdkNativeRuntimeModule;BinPlaceNodeSdkTestData;YarnLinkSdk">
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\custom_node\node\node.exe" DestinationFiles="$(PulumiBin)\pulumi-language-nodejs-node.exe" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\dist\pulumi-language-nodejs-exec.cmd" DestinationFolder="$(PulumiBin)" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\dist\pulumi-resource-pulumi-nodejs.cmd" DestinationFolder="$(PulumiBin)" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\bin\runtime\native\build\Release\nativeruntime-v0.11.0.node" DestinationFolder="$(PulumiBin)\v$(NodeVersion)" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\bin\runtime\native\build\Release\nativeruntime-v0.11.0.pdb" DestinationFolder="$(PulumiBin)\v$(NodeVersion)" />
|
|
</Target>
|
|
|
|
<Target Name="BuildNodeSdk"
|
|
DependsOnTargets="BuildNativeRuntimeModule;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;EnsureCustomNode;BuildNodeSdk;BuildGoCmds">
|
|
</Target>
|
|
|
|
<Target Name="IntegrationTest">
|
|
<Exec Command="where pulumi-language-nodejs-exec.cmd"
|
|
IgnoreExitCode="true">
|
|
<Output TaskParameter="ExitCode" PropertyName="WhereLangHostExecExitCode" />
|
|
</Exec>
|
|
|
|
<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="WhereLangHostExitCode" />
|
|
</Exec>
|
|
|
|
<Error Text="Please add "$(PulumiRoot)\bin" to your path before running integration tests."
|
|
Condition="$(WhereLangHostExitCode) != 0 Or $(WhereLangHostExecExitCode) != 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 -timeout 2m -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>
|