Skip to content

Commit 0ee229f

Browse files
author
Jianchun Xu
committed
swb: merge master into swb
2 parents 87cecd6 + 77d2f10 commit 0ee229f

File tree

761 files changed

+55154
-10697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

761 files changed

+55154
-10697
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.cmd -crlf
33
test/**/*.js -crlf
44
test/es6/HTMLComments.js binary diff=cpp
5+
*.wasm binary

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Build/VCBuild/
4040
buildchk.*
4141
buildfre.*
4242
BuildLinux/
43+
_DROP/
4344

4445
# Generated Files
4546
*.bc
@@ -56,6 +57,7 @@ test/*/*.baseline.rebase
5657
test/benchmarks/*.dpl
5758
test/benchmarks/*.txt
5859
testout*
60+
packages.config
5961

6062
# CMake Files
6163
cmake_install.cmake

Build/Chakra.Build.Clang.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<ClCompile>
55
<AdditionalOptions>
66
%(AdditionalOptions)
7-
-msse4.1
7+
-msse4.2
88
-Qunused-arguments
99
-Wno-unknown-pragmas
1010
-Wno-writable-strings

Build/Chakra.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="Common.Build.props"/>
3+
<Import Project="Common.Build.props"/>
44
<PropertyGroup>
55
<Win32_WinNTVersion Condition="'$(NtTargetVersion)'=='$(NtTargetVersion_Win7)'">0x0601</Win32_WinNTVersion>
66
<Win32_WinNTVersion Condition="'$(NtTargetVersion)'=='$(NtTargetVersion_Win8)'">0x0602</Win32_WinNTVersion>

Build/Chakra.Core.sln

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rl", "..\bin\rl\rl.vcxproj"
8383
EndProject
8484
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chakra.Runtime.Base", "..\lib\Runtime\Base\Chakra.Runtime.Base.vcxproj", "{706083F7-6AA4-4558-A153-6352EF9110EE}"
8585
EndProject
86+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chakra.WasmReader", "..\lib\WasmReader\Chakra.WasmReader.vcxproj", "{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}"
87+
EndProject
8688
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GCStress", "..\bin\GCStress\GCStress.vcxproj", "{73CE5C59-E0BA-413D-A73C-3EECE067891B}"
8789
EndProject
8890
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chakra.Runtime.PlatformAgnostic", "..\lib\Runtime\PlatformAgnostic\Chakra.Runtime.PlatformAgnostic.vcxproj", "{129AC184-877C-441F-AC49-A692CE700E62}"
@@ -486,6 +488,24 @@ Global
486488
{706083F7-6AA4-4558-A153-6352EF9110EE}.Test|x64.Build.0 = Test|x64
487489
{706083F7-6AA4-4558-A153-6352EF9110EE}.Test|x86.ActiveCfg = Test|Win32
488490
{706083F7-6AA4-4558-A153-6352EF9110EE}.Test|x86.Build.0 = Test|Win32
491+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Debug|ARM.ActiveCfg = Debug|ARM
492+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Debug|ARM.Build.0 = Debug|ARM
493+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Debug|x64.ActiveCfg = Debug|x64
494+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Debug|x64.Build.0 = Debug|x64
495+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Debug|x86.ActiveCfg = Debug|Win32
496+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Debug|x86.Build.0 = Debug|Win32
497+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Release|ARM.ActiveCfg = Release|ARM
498+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Release|ARM.Build.0 = Release|ARM
499+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Release|x64.ActiveCfg = Release|x64
500+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Release|x64.Build.0 = Release|x64
501+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Release|x86.ActiveCfg = Release|Win32
502+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Release|x86.Build.0 = Release|Win32
503+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Test|ARM.ActiveCfg = Test|ARM
504+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Test|ARM.Build.0 = Test|ARM
505+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Test|x64.ActiveCfg = Test|x64
506+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Test|x64.Build.0 = Test|x64
507+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Test|x86.ActiveCfg = Test|Win32
508+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD}.Test|x86.Build.0 = Test|Win32
489509
{73CE5C59-E0BA-413D-A73C-3EECE067891B}.Debug|ARM.ActiveCfg = Debug|ARM
490510
{73CE5C59-E0BA-413D-A73C-3EECE067891B}.Debug|ARM.Build.0 = Debug|ARM
491511
{73CE5C59-E0BA-413D-A73C-3EECE067891B}.Debug|x64.ActiveCfg = Debug|x64
@@ -625,6 +645,7 @@ Global
625645
{0216C4BE-86CE-478D-A134-23EAEE545B9D} = {D3BA0BFC-4757-4B73-994F-3556950884A1}
626646
{80A70F57-0F89-458F-AFD3-CE2159EB9BB1} = {D3BA0BFC-4757-4B73-994F-3556950884A1}
627647
{706083F7-6AA4-4558-A153-6352EF9110EE} = {DDF436E7-0A8E-41AA-82B3-902B5D2D0809}
648+
{53D52B0B-86D9-4D31-AD09-0D6B3C063ADD} = {D8216B93-BD6E-4293-8D98-79CEF7CF66BC}
628649
{73CE5C59-E0BA-413D-A73C-3EECE067891B} = {D3BA0BFC-4757-4B73-994F-3556950884A1}
629650
{129AC184-877C-441F-AC49-A692CE700E62} = {DDF436E7-0A8E-41AA-82B3-902B5D2D0809}
630651
{FFD0FA88-7A39-407E-A92D-D3A06273E1AC} = {D8216B93-BD6E-4293-8D98-79CEF7CF66BC}

Build/Common.Build.Default.props

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
<PlatformPathNameAlt Condition="'$(Platform)'=='x64'">amd64</PlatformPathNameAlt>
5454
</PropertyGroup>
5555

56-
5756
<!-- Default output directories -->
5857
<PropertyGroup>
5958
<OutBaseDir Condition="'$(OutBaseDir)'!=''">$(OutBaseDir)\$(SolutionName)</OutBaseDir>
@@ -64,7 +63,11 @@
6463
</PropertyGroup>
6564

6665
<!-- Import generated build info -->
67-
<Import Project="$(TF_BUILD_BUILDDIRECTORY)\Chakra.Generated.BuildInfo.props" Condition="'$(TF_BUILD_BUILDDIRECTORY)' != '' AND exists('$(TF_BUILD_BUILDDIRECTORY)\Chakra.Generated.BuildInfo.props')" />
66+
<PropertyGroup>
67+
<ObjectDirectory Condition="'$(TF_BUILD_BUILDDIRECTORY)'!=''">$(TF_BUILD_BUILDDIRECTORY)</ObjectDirectory>
68+
<ObjectDirectory Condition="'$(TF_BUILD_BUILDDIRECTORY)'==''">$(IntBaseDir)\obj\$(PlatformPathName.ToLower())_$(Configuration.ToLower())</ObjectDirectory>
69+
</PropertyGroup>
70+
<Import Project="$(ObjectDirectory)\Chakra.Generated.BuildInfo.props" Condition="'$(ObjectDirectory)'!='' AND exists('$(ObjectDirectory)\Chakra.Generated.BuildInfo.props')" />
6871

6972
<!-- Output directories -->
7073
<PropertyGroup>

Build/scripts/finalize_build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ $buildFlavorJson | Add-Member -type NoteProperty -name flavor -value $Env:BuildC
101101
$buildFlavorJson | Add-Member -type NoteProperty -name subtype -value $Env:BuildSubtype
102102

103103
$buildFlavorJson | ConvertTo-Json | Write-Output
104-
$buildFlavorJson | ConvertTo-Json | Out-File $buildFlavorJsonFile -Encoding ascii
104+
$buildFlavorJson | ConvertTo-Json | Out-File $buildFlavorJsonFile -Encoding utf8
105105

106106
#
107107
# Copy outputs to metadata directory

Build/scripts/init_build.ps1

Lines changed: 110 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,47 @@
1212
# before running the Pre-Build script.
1313

1414
param (
15+
[ValidateSet("x86", "x64", "arm", "")]
16+
[string]$arch = "",
17+
[ValidateSet("debug", "release", "test", "codecoverage", "")]
18+
[string]$flavor = "",
19+
[ValidateSet("default", "codecoverage", "pogo")]
20+
[string]$subtype = "default",
21+
[string]$buildtype,
22+
1523
[string]$envConfigScript = "ComputedEnvironment.cmd",
1624

1725
[string[]]$supportedPogoBuildTypes = @("x64_release", "x86_release"),
1826

19-
[Parameter(Mandatory=$True)]
27+
[string]$verMajor = "",
28+
[string]$verMinor = "",
29+
[string]$verPatch = "",
30+
[string]$verSecurity = "",
31+
32+
[string]$dropRoot,
33+
34+
[switch]$cleanBinDir,
35+
2036
[string]$oauth
2137
)
2238

23-
# If $Env:BuildType is specified, extract BuildPlatform and BuildConfiguration
24-
# Otherwise, if $Env:BuildPlatform and $Env:BuildConfiguration are specified, construct $BuildType
25-
$BuildPlatform = $Env:BuildPlatform
26-
$BuildConfiguration = $Env:BuildConfiguration
27-
$BuildType = $Env:BuildType
28-
$BuildSubtype = "default" # will remain as "default" or become e.g. "pogo", "codecoverage"
39+
#
40+
# Define values for variables based on parameters and environment variables
41+
# with default values in case the environment variables are not defined.
42+
#
43+
44+
. $PSScriptRoot\util.ps1
45+
$gitExe = GetGitPath
46+
47+
$BuildType = UseValueOrDefault $buildtype $Env:BuildType
48+
$BuildPlatform = UseValueOrDefault $arch $Env:BuildPlatform
49+
$BuildConfiguration = UseValueOrDefault $flavor $Env:BuildConfiguration
50+
$BuildSubtype = UseValueOrDefault $subtype $Env:BuildSubtype
2951

30-
if (Test-Path Env:\BuildType) {
31-
$BuildType = $Env:BuildType
52+
# If $BuildType is specified, extract BuildPlatform and BuildConfiguration
53+
# Otherwise, if $BuildPlatform and $BuildConfiguration are specified, construct $BuildType
54+
# $BuildSubtype will remain as "default" if not already specified, or become e.g. "pogo", "codecoverage"
55+
if ($BuildType) {
3256
$buildTypeSegments = $BuildType.split("_")
3357
$BuildPlatform = $buildTypeSegments[0]
3458
$BuildConfiguration = $buildTypeSegments[1]
@@ -42,12 +66,10 @@ if (Test-Path Env:\BuildType) {
4266
$BuildSubtype = "codecoverage" # keep information about codecoverage in the subtype
4367
}
4468

45-
if (-not ($BuildSubtype -in @("default","pogo","codecoverage"))) {
69+
if (-not ($BuildSubtype -in @("default", "pogo", "codecoverage"))) {
4670
Write-Error "Unsupported BuildSubtype: $BuildSubtype"
4771
}
48-
} elseif ((Test-Path Env:\BuildPlatform) -and (Test-Path Env:\BuildConfiguration)) {
49-
$BuildPlatform = $Env:BuildPlatform
50-
$BuildConfiguration = $Env:BuildConfiguration
72+
} elseif ($BuildPlatform -and $BuildConfiguration) {
5173
$BuildType = "${BuildPlatform}_${BuildConfiguration}"
5274
} else {
5375
Write-Error (@"
@@ -56,67 +78,92 @@ if (Test-Path Env:\BuildType) {
5678
BuildType={0}
5779
BuildPlatform={1}
5880
BuildConfiguration={2}
81+
BuildSubtype={3}
5982
60-
"@ -f $Env:BuildType, $Env:BuildPlatform, $Env:BuildConfiguration)
83+
"@ -f $BuildType, $BuildPlatform, $BuildConfiguration, $BuildSubtype)
6184

6285
exit 1
6386
}
6487

88+
$CommitHash = UseValueOrDefault $Env:BUILD_SOURCEVERSION $(iex "${gitExe} rev-parse HEAD")
89+
90+
$branchFullName = UseValueOrDefault $Env:BUILD_SOURCEBRANCH $(iex "${gitExe} rev-parse --symbolic-full-name HEAD")
91+
92+
$SourcesDirectory = UseValueOrDefault $Env:BUILD_SOURCESDIRECTORY $(GetRepoRoot)
93+
$BinariesDirectory = UseValueOrDefault (Join-Path $SourcesDirectory "Build\VcBuild")
94+
$ObjectDirectory = Join-Path $BinariesDirectory "obj\${BuildPlatform}_${BuildConfiguration}"
95+
96+
$DropRoot = UseValueOrDefault $dropRoot $Env:DROP_ROOT (Join-Path $(GetRepoRoot) "_DROP")
97+
6598
# set up required variables and import pre_post_util.ps1
6699
$arch = $BuildPlatform
67100
$flavor = $BuildConfiguration
68101
$OuterScriptRoot = $PSScriptRoot # Used in pre_post_util.ps1
69102
. "$PSScriptRoot\pre_post_util.ps1"
70103

71-
$gitExe = GetGitPath
72-
73104
$BuildName = ConstructBuildName -arch $BuildPlatform -flavor $BuildConfiguration -subtype $BuildSubtype
74105

75-
$branch = $Env:BUILD_SOURCEBRANCH
76-
if (-not $branch) {
77-
$branch = iex "$gitExe rev-parse --symbolic-full-name HEAD"
78-
}
79-
80-
$BranchName = $branch.split('/',3)[2]
106+
$BranchName = $branchFullName.split('/',3)[2]
81107
$BranchPath = $BranchName.replace('/','\')
82-
$CommitHash = $Env:BUILD_SOURCEVERSION
108+
83109
if (-not $CommitHash) {
84-
$CommitHash = iex "$gitExe rev-parse HEAD"
110+
$CommitHash = iex "${gitExe} rev-parse HEAD"
85111
}
112+
$CommitShortHash = $(iex "${gitExe} rev-parse --short $CommitHash")
86113

87-
$Username = (iex "$gitExe log $CommitHash -1 --pretty=%ae").split('@')[0]
88-
$CommitDateTime = [DateTime]$(iex "$gitExe log $CommitHash -1 --pretty=%aD")
114+
$Username = (iex "${gitExe} log $CommitHash -1 --pretty=%ae").split('@')[0]
115+
$CommitDateTime = [DateTime]$(iex "${gitExe} log $CommitHash -1 --pretty=%aD")
89116
$CommitTime = Get-Date $CommitDateTime -Format yyMMdd.HHmm
90117

91118
#
92119
# Get Build Info
93120
#
94121

95-
$info = GetBuildInfo $oauth $CommitHash
122+
$buildPushDate = $null
123+
$buildPushIdString = $null
96124

97-
$BuildPushDate = [datetime]$info.push.date
98-
$PushDate = Get-Date $BuildPushDate -Format yyMMdd.HHmm
125+
if (-not $oauth)
126+
{
127+
$buildPushIdPart1 = 65535
128+
$buildPushIdPart2 = 65535
129+
$buildPushIdString = "65535.65535"
130+
$buildPushDate = [DateTime]$CommitDateTime
131+
}
132+
else
133+
{
134+
$info = GetBuildInfo $oauth $CommitHash
135+
$_, $buildPushIdPart1, $buildPushIdPart2, $buildPushIdString = GetBuildPushId $info
136+
$buildPushDate = [DateTime]$info.push.date
137+
}
138+
139+
$PushDate = Get-Date $buildPushDate -Format yyMMdd.HHmm
140+
141+
$VersionMajor = UseValueOrDefault $verMajor $Env:VERSION_MAJOR (GetVersionField "CHAKRA_CORE_MAJOR_VERSION") "0"
142+
$VersionMinor = UseValueOrDefault $verMinor $Env:VERSION_MINOR (GetVersionField "CHAKRA_CORE_MINOR_VERSION") "0"
143+
$VersionPatch = UseValueOrDefault $verPatch $Env:VERSION_PATCH (GetVersionField "CHAKRA_CORE_PATCH_VERSION") "0"
144+
$VersionSecurity = UseValueOrDefault $verSecurity $Env:VERSION_QFE (GetVersionField "CHAKRA_CORE_VERSION_RELEASE_QFE") "0"
99145

100-
$buildPushId, $buildPushIdPart1, $buildPushIdPart2, $buildPushIdString = GetBuildPushId $info
146+
$VersionString = "${VersionMajor}.${VersionMinor}.${VersionPatch}" # Only use MAJOR.MINOR.PATCH to align with SemVer
101147

102-
$VersionMajor = UseValueOrDefault "$Env:VERSION_MAJOR" "1"
103-
$VersionMinor = UseValueOrDefault "$Env:VERSION_MINOR" "2"
104-
$VersionPatch = UseValueOrDefault "$Env:VERSION_PATCH" "0"
105-
$VersionQFE = UseValueOrDefault "$Env:VERSION_QFE" "0"
148+
$buildVersionString = "{0}-{1}" -f $buildPushIdPart1.ToString("00000"), $buildPushIdPart2.ToString("00000")
149+
$PreviewVersionString = "${VersionString}-preview-${buildVersionString}"
106150

107-
$VersionString = "${VersionMajor}.${VersionMinor}.${VersionPatch}.${VersionQFE}"
108-
$PreviewVersionString = "${VersionString}-preview"
151+
$ShortBranch = "commit"
152+
if ($BranchName -eq "master") {
153+
$ShortBranch = "master"
154+
} elseif ($BranchName.StartsWith("release")) {
155+
$ShortBranch = $BranchName.replace("release/","")
156+
}
109157

110158
# unless it is a build branch, subdivide the output directory by month
111159
if ($BranchPath.StartsWith("build")) {
112160
$YearAndMonth = ""
113161
} else {
114-
$YearAndMonth = (Get-Date $BuildPushDate -Format yyMM) + "\"
162+
$YearAndMonth = (Get-Date $buildPushDate -Format yyMM) + "\"
115163
}
116164

117165
$BuildIdentifier = "${buildPushIdString}_${PushDate}_${Username}_${CommitHash}"
118166
$ComputedDropPathSegment = "${BranchPath}\${YearAndMonth}${BuildIdentifier}"
119-
$BinariesDirectory = "${Env:BUILD_SOURCESDIRECTORY}\Build\VcBuild"
120167
$ObjectDirectory = "${BinariesDirectory}\obj\${BuildPlatform}_${BuildConfiguration}"
121168

122169
# Create a sentinel file for each build flavor to track whether the build is complete.
@@ -128,36 +175,43 @@ This could mean that the build is in progress, or that it was unable to run to c
128175
The contents of this directory should not be relied on until the build completes.
129176
"@
130177

131-
$DropPath = Join-Path $Env:DROP_ROOT $ComputedDropPathSegment
178+
$DropPath = Join-Path $DropRoot $ComputedDropPathSegment
132179
New-Item -ItemType Directory -Force -Path $DropPath
133-
New-Item -ItemType Directory -Force -Path (Join-Path $Env:BUILD_SOURCESDIRECTORY "test\logs")
180+
New-Item -ItemType Directory -Force -Path (Join-Path $SourcesDirectory "test\logs")
134181
New-Item -ItemType Directory -Force -Path (Join-Path $BinariesDirectory "buildlogs")
135182
New-Item -ItemType Directory -Force -Path (Join-Path $BinariesDirectory "logs")
136183

137184
$FlavorBuildIncompleteFile = Join-Path $DropPath "${BuildType}.incomplete"
138185

139186
if (-not (Test-Path $FlavorBuildIncompleteFile)) {
140187
($buildIncompleteFileContentsString -f "Build of ${BuildType}") `
141-
| Out-File $FlavorBuildIncompleteFile -Encoding Ascii
188+
| Out-File $FlavorBuildIncompleteFile -Encoding utf8
142189
}
143190

144-
$PogoConfig = $supportedPogoBuildTypes -contains "${Env:BuildPlatform}_${Env:BuildConfiguration}"
191+
$PogoConfig = $supportedPogoBuildTypes -contains "${BuildPlatform}_${BuildConfiguration}"
145192

146193
# Write the $envConfigScript
147194

148195
@"
149196
set BranchName=${BranchName}
197+
set ShortBranch=${ShortBranch}
150198
set BranchPath=${BranchPath}
151199
set YearAndMonth=${YearAndMonth}
152200
set BuildIdentifier=${BuildIdentifier}
153201
154-
set buildPushIdString=${buildPushIdString}
202+
set VersionMajor=${VersionMajor}
203+
set VersionMinor=${VersionMinor}
204+
set VersionPatch=${VersionPatch}
205+
set VersionSecurity=${VersionSecurity}
206+
207+
set BuildPushIdString=${buildPushIdString}
155208
set VersionString=${VersionString}
156209
set PreviewVersionString=${PreviewVersionString}
157210
set PushDate=${PushDate}
158211
set CommitTime=${CommitTime}
159212
set Username=${Username}
160213
set CommitHash=${CommitHash}
214+
set CommitShortHash=${CommitShortHash}
161215
162216
set ComputedDropPathSegment=${ComputedDropPathSegment}
163217
set BinariesDirectory=${BinariesDirectory}
@@ -174,24 +228,30 @@ set FlavorBuildIncompleteFile=${FlavorBuildIncompleteFile}
174228
set PogoConfig=${PogoConfig}
175229
176230
"@ `
177-
| Out-File $envConfigScript -Encoding Ascii
231+
| Out-File $envConfigScript -Encoding ASCII
178232

179233
# Use the VSTS environment vars to construct a backwards-compatible VSO build environment
180234
# for the sake of reusing the pre-build and post-build scripts as they are.
181235

182236
@"
183-
set TF_BUILD_SOURCEGETVERSION=LG:${branch}:${CommitHash}
237+
set TF_BUILD_SOURCEGETVERSION=LG:${branchFullName}:${CommitHash}
184238
set TF_BUILD_DROPLOCATION=${BinariesDirectory}
185239
186-
set TF_BUILD_SOURCESDIRECTORY=${Env:BUILD_SOURCESDIRECTORY}
240+
set TF_BUILD_SOURCESDIRECTORY=${SourcesDirectory}
187241
set TF_BUILD_BUILDDIRECTORY=${ObjectDirectory}
188242
set TF_BUILD_BINARIESDIRECTORY=${BinariesDirectory}
189243
244+
REM The following variables are only used for logging build metadata.
190245
set TF_BUILD_BUILDDEFINITIONNAME=${Env:BUILD_DEFINITIONNAME}
191246
set TF_BUILD_BUILDNUMBER=${Env:BUILD_BUILDNUMBER}
192247
set TF_BUILD_BUILDURI=${Env:BUILD_BUILDURI}
193248
"@ `
194-
| Out-File $envConfigScript -Encoding Ascii -Append
249+
| Out-File $envConfigScript -Encoding ASCII -Append
250+
251+
# Print contents of $envConfigScript as a sanity check
252+
Write-Output ""
253+
Get-Content $envConfigScript | Write-Output
254+
Write-Output ""
195255

196256
# Export VSO variables that can be consumed by other VSO tasks where the task
197257
# definition in VSO itself needs to know the value of the variable.
@@ -216,10 +276,10 @@ Write-Output "Setting VSO variable VSO_VersionString = ${VersionString}"
216276
Write-Output "##vso[task.setvariable variable=VSO_VersionString;]${VersionString}"
217277

218278
#
219-
# Clean up files that might have been left behind from a previous build.
279+
# Optionally ($cleanBinDir): clean up files that might have been left behind from a previous build.
220280
#
221281

222-
if ((Test-Path Env:\BUILD_BINARIESDIRECTORY) -and (Test-Path "$Env:BUILD_BINARIESDIRECTORY"))
282+
if ($BinariesDirectory -and (Test-Path "$BinariesDirectory") -and $cleanBinDir)
223283
{
224-
Remove-Item -Verbose "${Env:BUILD_BINARIESDIRECTORY}\*" -Recurse
284+
Remove-Item -Verbose "${BinariesDirectory}\*" -Recurse
225285
}

0 commit comments

Comments
 (0)