318 lines
14 KiB
XML
318 lines
14 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>
|
|
<DotNetSdkDirectory>$(SdkDirectory)\dotnet\</DotNetSdkDirectory>
|
|
<PythonSdkDirectory>$(SdkDirectory)\python\</PythonSdkDirectory>
|
|
<TestParallelism>20</TestParallelism>
|
|
<MSVSVersion>2019</MSVSVersion>
|
|
<PulumiRoot Condition="'$(PulumiRoot)' == ''">C:\Pulumi\</PulumiRoot>
|
|
<PulumiBin>$(PulumiRoot)\bin</PulumiBin>
|
|
</PropertyGroup>
|
|
|
|
<UsingTask TaskName="ReplaceFileText" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
|
|
<ParameterGroup>
|
|
<InputFilename ParameterType="System.String" Required="true" />
|
|
<OutputFilename ParameterType="System.String" Required="true" />
|
|
<MatchExpression ParameterType="System.String" Required="true" />
|
|
<ReplacementText ParameterType="System.String" Required="true" />
|
|
</ParameterGroup>
|
|
<Task>
|
|
<Using Namespace="System" />
|
|
<Using Namespace="System.IO" />
|
|
<Using Namespace="System.Text.RegularExpressions" />
|
|
<Code Type="Fragment" Language="cs">
|
|
<![CDATA[
|
|
File.WriteAllText(
|
|
OutputFilename,
|
|
Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
|
|
);
|
|
]]>
|
|
</Code>
|
|
</Task>
|
|
</UsingTask>
|
|
|
|
<!-- Conventions
|
|
Each of the SDKs have their own section in this file and follow the format:
|
|
* BuildLanguageSdk
|
|
|
|
The BuildLangaugeSDK then dependes on a number of subtargets that differ based on the langage we are building. They follow
|
|
the structure:
|
|
* LanguageDependencies
|
|
* LanguageBuild (Required)
|
|
* LanguageInstallPackage (Required)
|
|
* LanguageInstallPlugin
|
|
|
|
There may be an additional step for copying packages around.
|
|
-->
|
|
|
|
<!-- This section is where we build and package the DotNet SDK -->
|
|
<Target Name="BuildDotNetSDK"
|
|
DependsOnTargets="DotNetBuild;DotNetInstallPlugin;CopyNugetPackages">
|
|
</Target>
|
|
|
|
<Target Name="DotNetBuild">
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
|
|
</Exec>
|
|
<PropertyGroup>
|
|
<VersionPart>$(Version.Split("-")[0])</VersionPart>
|
|
<VersionPrefix>$(VersionPart.Replace("v",""))</VersionPrefix>
|
|
</PropertyGroup>
|
|
<Exec Command="dotnet build dotnet.sln /p:VersionPrefix=$(VersionPrefix) /p:VersionSuffix=preview"
|
|
WorkingDirectory="$(DotNetSdkDirectory)" />
|
|
<ItemGroup>
|
|
<DotNetPackagesToBuild Include="github.com/pulumi/pulumi/sdk/dotnet/cmd/pulumi-language-dotnet" />
|
|
</ItemGroup>
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(DotNetPackagesToBuild.Identity)" />
|
|
</Target>
|
|
|
|
<Target Name="DotNetInstallPlugin">
|
|
<ItemGroup>
|
|
<DotNetPackagesToBuild Include="github.com/pulumi/pulumi/sdk/dotnet/cmd/pulumi-language-dotnet" />
|
|
</ItemGroup>
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
|
|
</Exec>
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(DotNetPackagesToBuild.Identity)"
|
|
EnvironmentVariables="GOBIN=$(PulumiBin)"/>
|
|
</Target>
|
|
|
|
<Target Name="CopyNugetPackages">
|
|
<ItemGroup>
|
|
<DotNetNupkgFile Include="$(DotNetSdkDirectory)\**\*.nupkg" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(DotNetNupkgFile)"
|
|
DestinationFolder="$(PulumiRoot)\nuget" />
|
|
</Target>
|
|
|
|
<!-- This is where we build and install the Go SDK -->
|
|
<Target Name="BuildGoSDK"
|
|
DependsOnTargets="GoBuild;GoInstallPlugin">
|
|
</Target>
|
|
|
|
<Target Name="GoBuild">
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
|
|
</Exec>
|
|
<ItemGroup>
|
|
<GoPackagesToBuild Include="github.com/pulumi/pulumi/sdk/go/pulumi-language-go" />
|
|
</ItemGroup>
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(GoPackagesToBuild.Identity)" />
|
|
</Target>
|
|
|
|
<Target Name="GoInstallPlugin">
|
|
<ItemGroup>
|
|
<GoPackagesToBuild Include="github.com/pulumi/pulumi/sdk/go/pulumi-language-go" />
|
|
</ItemGroup>
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
|
|
</Exec>
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(GoPackagesToBuild.Identity)"
|
|
EnvironmentVariables="GOBIN=$(PulumiBin)"/>
|
|
</Target>
|
|
|
|
<!-- This is where we build and install the NodeJS SDK -->
|
|
<Target Name="BuildNodeJSSDK"
|
|
DependsOnTargets="NodeJSDependencies;NodeJSBuild;NodeJSInstallPlugin;CopyNodeJSPackages">
|
|
</Target>
|
|
|
|
<Target Name="NodeJSDependencies">
|
|
<Exec Command="yarn install"
|
|
WorkingDirectory="$(NodeJSSdkDirectory)" />
|
|
</Target>
|
|
|
|
<Target Name="NodeJSBuild">
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<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)" />
|
|
<!-- Copy Protos -->
|
|
<ItemGroup>
|
|
<NodeSdkProtos Include="$(NodeJSSdkDirectory)\proto\*.js" />
|
|
</ItemGroup>
|
|
<Copy SourceFiles="@(NodeSdkProtos)"
|
|
DestinationFolder="$(NodeJSSdkDirectory)\bin\proto" />
|
|
<!-- Copy Language Cases -->
|
|
<ItemGroup>
|
|
<NodeSdkTestDataFiles Include="$(NodeJSSdkDirectory)\tests\runtime\langhost\cases\**\*" />
|
|
</ItemGroup>
|
|
<Copy SourceFiles="@(NodeSdkTestDataFiles)"
|
|
DestinationFolder="$(NodeJSSdkDirectory)\bin\tests\runtime\langhost\cases" />
|
|
<ItemGroup>
|
|
<NodeJSPackagesToBuild Include="github.com/pulumi/pulumi/sdk/nodejs/cmd/pulumi-language-nodejs" />
|
|
</ItemGroup>
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(NodeJSPackagesToBuild.Identity)" />
|
|
</Target>
|
|
|
|
<Target Name="NodeJSInstallPlugin">
|
|
<ItemGroup>
|
|
<NodeJSDistFiles Include="$(NodeJSSdkDirectory)\dist\*.cmd" />
|
|
</ItemGroup>
|
|
<Copy SourceFiles="@(NodeJSDistFiles)"
|
|
DestinationFolder="$(PulumiBin)\" />
|
|
<ItemGroup>
|
|
<NodeJSPackagesToBuild Include="github.com/pulumi/pulumi/sdk/nodejs/cmd/pulumi-language-nodejs" />
|
|
</ItemGroup>
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
|
|
</Exec>
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(NodeJSPackagesToBuild.Identity)"
|
|
EnvironmentVariables="GOBIN=$(PulumiBin)"/>
|
|
</Target>
|
|
|
|
<Target Name="CopyNodeJSPackages">
|
|
<MakeDir Directories="$(PulumiRoot)\node_modules\@pulumi\pulumi"/>
|
|
<ItemGroup>
|
|
<BinFiles Include="$(NodeJSSdkDirectory)\bin\**\*.*" />
|
|
</ItemGroup>
|
|
<Copy
|
|
SourceFiles="@(BinFiles)"
|
|
DestinationFiles="@(BinFiles->'$(PulumiRoot)\node_modules\@pulumi\pulumi\%(RecursiveDir)%(Filename)%(Extension)')" />
|
|
<ItemGroup>
|
|
<YarnFile Include="$(NodeJSSdkDirectory)\yarn.lock" />
|
|
</ItemGroup>
|
|
<Copy SourceFiles="@(YarnFile)"
|
|
DestinationFolder="$(PulumiRoot)\node_modules\@pulumi\pulumi" />
|
|
<RemoveDir Directories="$(PulumiRoot)\node_modules\@pulumi\pulumi\node_modules" />
|
|
<Exec Command="yarn install --prefer-offline --production && (yarn unlink > NUL || true) && yarn link"
|
|
WorkingDirectory="$(PulumiRoot)\node_modules\@pulumi\pulumi" />
|
|
</Target>
|
|
|
|
<!-- This is where we build and install the Python SDK -->
|
|
<Target Name="BuildPythonSDK"
|
|
DependsOnTargets="PythonDependencies;PythonBuild;PythonInstallPlugin">
|
|
</Target>
|
|
|
|
<Target Name="PythonDependencies">
|
|
<MakeDir Directories="$(PythonSdkDirectory)\env\src"/>
|
|
<Exec Command="pipenv install"
|
|
WorkingDirectory="$(PythonSdkDirectory)\env\src" />
|
|
</Target>
|
|
|
|
<Target Name="PythonBuild">
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
|
|
</Exec>
|
|
<ItemGroup>
|
|
<PythonLibFiles Include="$(PythonSdkDirectory)\lib\**\*.*" />
|
|
</ItemGroup>
|
|
<Copy
|
|
SourceFiles="@(PythonLibFiles)"
|
|
DestinationFiles="@(PythonLibFiles->'$(PythonSdkDirectory)\env\src\%(RecursiveDir)%(Filename)%(Extension)')" />
|
|
<ReplaceFileText
|
|
InputFilename="$(PythonSdkDirectory)\env\src\setup.py"
|
|
OutputFilename="$(PythonSdkDirectory)\env\src\setup.py"
|
|
MatchExpression="\$\{VERSION\}"
|
|
ReplacementText="$(VERSION)" />
|
|
<ItemGroup>
|
|
<ReadMeFile Include="$(RepoRootDirectory)\README.md" />
|
|
</ItemGroup>
|
|
<Copy SourceFiles="@(ReadMeFile)"
|
|
DestinationFolder="$(PythonSdkDirectory)\env\src" />
|
|
<Exec Command="pipenv run python setup.py build bdist_wheel --universal"
|
|
WorkingDirectory="$(PythonSdkDirectory)\env\src" />
|
|
<ItemGroup>
|
|
<PythonPackagesToBuild Include="github.com/pulumi/pulumi/sdk/python/cmd/pulumi-language-python" />
|
|
</ItemGroup>
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(PythonPackagesToBuild.Identity)" />
|
|
</Target>
|
|
|
|
<Target Name="PythonInstallPlugin">
|
|
<ItemGroup>
|
|
<PythonLanguageExecFiles Include="$(PythonSdkDirectory)\cmd\pulumi-language-python-exec" />
|
|
</ItemGroup>
|
|
<Copy SourceFiles="@(PythonLanguageExecFiles)"
|
|
DestinationFolder="$(PulumiBin)\" />
|
|
<ItemGroup>
|
|
<PythonDistFiles Include="$(PythonSdkDirectory)\dist\pulumi-resource-pulumi-python.cmd" />
|
|
</ItemGroup>
|
|
<Copy SourceFiles="@(PythonDistFiles)"
|
|
DestinationFolder="$(PulumiBin)\" />
|
|
<ItemGroup>
|
|
<PythonPackagesToBuild Include="github.com/pulumi/pulumi/sdk/python/cmd/pulumi-language-python" />
|
|
</ItemGroup>
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
|
|
</Exec>
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(PythonPackagesToBuild.Identity)"
|
|
EnvironmentVariables="GOBIN=$(PulumiBin)"/>
|
|
</Target>
|
|
|
|
<!-- Install the Pulumi SDK -->
|
|
<Target Name="InstallPulumiPlugin">
|
|
<ItemGroup>
|
|
<PulumiPackagesToBuild Include="github.com/pulumi/pulumi" />
|
|
</ItemGroup>
|
|
|
|
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\get-version.cmd"" ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
|
|
</Exec>
|
|
|
|
<Exec Command="go install -ldflags "-X github.com/pulumi/pulumi/sdk/go/common/version.Version=$(Version)" %(PulumiPackagesToBuild.Identity)"
|
|
EnvironmentVariables="GOBIN=$(PulumiBin)"/>
|
|
</Target>
|
|
|
|
<!-- Build -->
|
|
<Target Name="Build"
|
|
DependsOnTargets="BuildDotNetSDK;BuildGoSDK;BuildNodeJSSDK;BuildPythonSDK;InstallPulumiPlugin">
|
|
</Target>
|
|
|
|
<!-- Release Build
|
|
This is used to create the dependencies required for shipping the binary to the end user.
|
|
In the old scripts `BuildNodeJSSDK` was called `BuildNodeSdk` and included tasks for
|
|
* TypeScriptCompileNodeSdk (now called NodeJSBuild)
|
|
* GoCompileNodeSdk (now called NodeJSBuild)
|
|
* BinPlaceNodeSdk (included as part of NodeJSBuild)
|
|
The old task `BuildGoCmds` has now been renamed to `InstallPulumiPlugin`
|
|
-->
|
|
<Target Name="ReleaseBuild"
|
|
DependsOnTargets="BuildNodeJSSDK;InstallPulumiPlugin">
|
|
</Target>
|
|
|
|
<!-- Tests -->
|
|
<Target Name="Tests">
|
|
<Exec Command="go test -v -timeout 5m -parallel $(TestParallelism) .\pkg\backend\..."
|
|
IgnoreExitCode="true"
|
|
WorkingDirectory="$(RepoRootDirectory)">
|
|
<Output TaskParameter="ExitCode" PropertyName="BackendTestsExitCode" />
|
|
</Exec>
|
|
|
|
<Error Text="backend tests (.\pkg\backend) failed"
|
|
Condition="$(BackendTestsExitCode) != 0"/>
|
|
|
|
<Exec Command="go test -v -timeout 40m -cover -parallel $(TestParallelism) .\examples"
|
|
IgnoreExitCode="true"
|
|
WorkingDirectory="$(RepoRootDirectory)">
|
|
<Output TaskParameter="ExitCode" PropertyName="ExamplesTestExitCode" />
|
|
</Exec>
|
|
|
|
<Error Text="examples tests (.\examples) failed"
|
|
Condition="$(ExamplesTestExitCode) != 0"/>
|
|
|
|
<Exec Command="go test -v -timeout 40m -cover -parallel $(TestParallelism) .\tests\integration"
|
|
IgnoreExitCode="true"
|
|
WorkingDirectory="$(RepoRootDirectory)">
|
|
<Output TaskParameter="ExitCode" PropertyName="IntegrationTestExitCode" />
|
|
</Exec>
|
|
|
|
<Error Text="integration tests (.\tests\integration) failed"
|
|
Condition="$(IntegrationTestExitCode) != 0"/>
|
|
</Target>
|
|
|
|
<Target Name="Publish">
|
|
<Exec Command=""$(RepoRootDirectory)\scripts\publish.cmd" />
|
|
</Target>
|
|
|
|
<Target Name="ReleaseProcess"
|
|
DependsOnTargets="ReleaseBuild;Publish" />
|
|
|
|
<Target Name="CIBuild"
|
|
DependsOnTargets="Build;Tests" />
|
|
</Project>
|