c04341edb2
This change adds a GetRequiredPlugins RPC method to the language host, enabling us to query it for its list of plugin requirements. This is language-specific because it requires looking at the set of dependencies (e.g., package.json files). It also adds a call up front during any update/preview operation to compute the set of plugins and require that they are present. These plugins are populated in the cache and will be used for all subsequent plugin-related operations during the engine's activity. We now cache the language plugins, so that we may load them eagerly too, which we never did previously due to the fact that we needed to pass the monitor address at load time. This was a bit bizarre anyhow, since it's really the Run RPC function that needs this information. So, to enable caching and eager loading -- which we need in order to invoke GetRequiredPlugins -- the "phone home" monitor RPC address is passed at Run time. In a subsequent change, we will switch to faulting in the plugins that are missing -- rather than erroring -- in addition to supporting the `pulumi plugin install` CLI command.
185 lines
8.1 KiB
XML
185 lines
8.1 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="CopyNodeSdkProtos">
|
|
<ItemGroup>
|
|
<NodeSdkProtos Include="$(SdkDirectory)\proto\nodejs\**\*" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(NodeSdkProtos)"
|
|
DestinationFolder="$(NodeJSSdkDirectory)\proto" />
|
|
</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="yarn run tsc"
|
|
WorkingDirectory="$(NodeJSSdkDirectory)" />
|
|
</Target>
|
|
|
|
<Target Name="GoCompileNodeSdk">
|
|
<ItemGroup>
|
|
<GoPackagesToBuild Include="github.com/pulumi/pulumi/sdk/nodejs/cmd/pulumi-langhost-nodejs" />
|
|
</ItemGroup>
|
|
|
|
<Exec Command="git describe --tags 2>nul" 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>
|
|
<NodeSdkProtosForBinplace Include="$(NodeSdkDirectory)\proto\nodejs\**\*" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(NodeSdkProtos)"
|
|
DestinationFolder="$(NodeJSSdkDirectory)\bin\proto" />
|
|
</Target>
|
|
|
|
<Target Name="BinPlaceNodeSdkNativeRuntimeModule"
|
|
DependsOnTargets="BuildNativeRuntimeModule">
|
|
<ItemGroup>
|
|
<NodeSdkNativeRuntimeModuleFiles Include="$(NativeRuntimeModuleDirectory)\build\Release\nativeruntime.node" />
|
|
<NodeSdkNativeRuntimeModuleFiles Include="$(NativeRuntimeModuleDirectory)\build\Release\nativeruntime.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">
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\package.json"
|
|
DestinationFiles="$(NodeJSSdkDirectory)\bin\package.json" />
|
|
<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-langhost-nodejs-node.exe" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\pulumi-langhost-nodejs-exec.cmd" DestinationFolder="$(PulumiBin)" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\pulumi-provider-pulumi-nodejs.cmd" DestinationFolder="$(PulumiBin)" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\bin\runtime\native\build\Release\nativeruntime.node" DestinationFolder="$(PulumiBin)\v$(NodeVersion)" />
|
|
<Copy SourceFiles="$(NodeJSSdkDirectory)\bin\runtime\native\build\Release\nativeruntime.pdb" DestinationFolder="$(PulumiBin)\v$(NodeVersion)" />
|
|
</Target>
|
|
|
|
<Target Name="BuildNodeSdk"
|
|
DependsOnTargets="CopyNodeSdkProtos;BuildNativeRuntimeModule;TypeScriptCompileNodeSdk;GoCompileNodeSdk;BinPlaceNodeSdk">
|
|
</Target>
|
|
|
|
<Target Name="BuildGoCmds">
|
|
<ItemGroup>
|
|
<GoCmdsToBuild Include="github.com/pulumi/pulumi" />
|
|
</ItemGroup>
|
|
|
|
<Exec Command="git describe --tags 2>nul" 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>
|
|
|
|
<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>
|