Make many fixes to closure serialization Primary things that i've done as part of this change: Added support for cyclic objects. Properly serialize objects that are shared across different function. previously you would get multiple copies, now you properly reference the same copy. Remove the usages of 'hashes' for functions. Because we track identity of objects, we no longer need them. Serialize properties of functions (if they have any). Handle Objects/Functions with different __proto__s than normal. i.e. classes/constructors. but also anything the user may have done themselves to the object. Handle generator functions. Handle functions with 'computed' names. Handle functions with 'symbol' names. Handle serializing Promises as Promises. Removed the dual Closure/AsyncClosure tree. One existed solely so we could have a tree without promises (for use in testing maybe?). Because this all exists in a part of our codebase that is entirely async, it's fine to have promises in the tree, and to await them when serializing the Closure to a string. Handle serializing class-constructors and methods. Including properly handling 'super' calls.
54 lines
2.4 KiB
PowerShell
54 lines
2.4 KiB
PowerShell
# make_release.ps1 will create a build package ready for publishing.
|
|
Set-StrictMode -Version 2.0
|
|
$ErrorActionPreference="Stop"
|
|
|
|
$NodeVersion = "v6.10.2"
|
|
$Root=Join-Path $PSScriptRoot ".."
|
|
$PublishDir=New-Item -ItemType Directory -Path "$env:TEMP\$([System.IO.Path]::GetRandomFileName())"
|
|
$GitHash=$(git rev-parse HEAD)
|
|
$PublishFile="$(Split-Path -Parent -Path $PublishDir)\$GitHash.zip"
|
|
$Version = $(git describe --tags --dirty 2>$null)
|
|
$Branch = $(if (Test-Path env:APPVEYOR_REPO_BRANCH) { $env:APPVEYOR_REPO_BRANCH } else { $(git rev-parse --abbrev-ref HEAD) })
|
|
$PublishTargets = @($GitHash, $Version, $Branch)
|
|
|
|
function RunGoBuild($goPackage) {
|
|
$binRoot = New-Item -ItemType Directory -Force -Path "$PublishDir\bin"
|
|
$outputName = Split-Path -Leaf $(go list -f "{{.Target}}" $goPackage)
|
|
go build -ldflags "-X github.com/pulumi/pulumi/pkg/version.Version=$Version" -o "$binRoot\$outputName" $goPackage
|
|
}
|
|
|
|
function CopyPackage($pathToModule, $moduleName) {
|
|
$moduleRoot = New-Item -ItemType Directory -Force -Path "$PublishDir\node_modules\$moduleName"
|
|
Copy-Item -Recurse $pathToModule\* $moduleRoot
|
|
if (Test-Path "$moduleRoot\node_modules") {
|
|
Remove-Item -Recurse -Force "$moduleRoot\node_modules"
|
|
}
|
|
if (Test-Path "$moduleRoot\tests") {
|
|
Remove-Item -Recurse -Force "$moduleRoot\tests"
|
|
}
|
|
}
|
|
|
|
RunGoBuild "github.com/pulumi/pulumi"
|
|
RunGoBuild "github.com/pulumi/pulumi/sdk/nodejs/cmd/pulumi-language-nodejs"
|
|
CopyPackage "$Root\sdk\nodejs\bin" "pulumi"
|
|
|
|
Copy-Item "$Root\sdk\nodejs\dist\pulumi-language-nodejs-exec.cmd" "$PublishDir\bin"
|
|
Copy-Item "$Root\sdk\nodejs\dist\pulumi-resource-pulumi-nodejs.cmd" "$PublishDir\bin"
|
|
Copy-Item "$Root\sdk\nodejs\custom_node\node\node.exe" "$PublishDir\bin\pulumi-language-nodejs-node.exe"
|
|
|
|
$NodeFolder = "$PublishDir\bin\$NodeVersion"
|
|
New-Item -ItemType Directory -Force -Path $NodeFolder | Out-Null
|
|
Copy-Item "$Root\sdk\nodejs\runtime\native\build\Release\nativeruntime-v0.11.0.node" $NodeFolder
|
|
Copy-Item "$Root\sdk\nodejs\runtime\native\build\Release\nativeruntime-v0.11.0.pdb" $NodeFolder
|
|
|
|
# By default, if the archive already exists, 7zip will just add files to it, so blow away the existing
|
|
# archive if it exists.
|
|
if (Test-Path $PublishFile) {
|
|
Remove-Item -Force $PublishFile
|
|
}
|
|
|
|
7z a "$PublishFile" "$PublishDir\." | Out-Null
|
|
|
|
Remove-Item -Recurse -Force $PublishDir
|
|
|
|
New-Object PSObject -Property @{ArchivePath=$PublishFile;Targets=$PublishTargets}
|