Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable POGO builds in MBv2 daily config, automatic NuGet generation and publication. Add build composition script. #863

Merged
merged 1 commit into from
Apr 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Build/Microsoft.ChakraCore.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
<tags>Chakra,ChakraCore</tags>
</metadata>
<files>
<file src="VcBuild\bin\x86_release\ChakraCore.dll" target="x86\ChakraCore.dll" />
<file src="VcBuild\bin\x86_release\ChakraCore.pdb" target="x86\ChakraCore.pdb" />
<file src="VcBuild\bin\x86_release\ch.exe" target="x86\ch.exe" />
<file src="VcBuild\bin\x86_release\ch.pdb" target="x86\ch.pdb" />
<file src="VcBuild\bin\x64_release\ChakraCore.dll" target="x64\ChakraCore.dll" />
<file src="VcBuild\bin\x64_release\ChakraCore.pdb" target="x64\ChakraCore.pdb" />
<file src="VcBuild\bin\x64_release\ch.exe" target="x64\ch.exe" />
<file src="VcBuild\bin\x64_release\ch.pdb" target="x64\ch.pdb" />
<file src="..\x86_release\ChakraCore.dll" target="x86\ChakraCore.dll" />
<file src="..\x86_release\ChakraCore.pdb" target="x86\ChakraCore.pdb" />
<file src="..\x86_release\ch.exe" target="x86\ch.exe" />
<file src="..\x86_release\ch.pdb" target="x86\ch.pdb" />
<file src="..\x64_release\ChakraCore.dll" target="x64\ChakraCore.dll" />
<file src="..\x64_release\ChakraCore.pdb" target="x64\ChakraCore.pdb" />
<file src="..\x64_release\ch.exe" target="x64\ch.exe" />
<file src="..\x64_release\ch.pdb" target="x64\ch.pdb" />
</files>
</package>
56 changes: 56 additions & 0 deletions Build/scripts/compose_build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#-------------------------------------------------------------------------------------------------------
# Copyright (C) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
#-------------------------------------------------------------------------------------------------------

# Compose Build script
#
# Aggregate metadata about a build and produce a file with useful information about the build
# for tools to consume and get a quick overview of the status of a completed build.

param (
[Parameter(Mandatory=$True)]
[string]$rootPath
)

#
# Clean up the sentinel which previously marked this build as incomplete.
#

$buildIncompleteFile = Join-Path $rootPath "build.incomplete"
if (Test-Path $buildIncompleteFile) {
Remove-Item -Path $buildIncompleteFile -Force
}

#
# Aggregate build metadata and produce build.json
#

$outputJsonFile = Join-Path -Path $rootPath -ChildPath "build.json"
$buildInfo = New-Object System.Object

$changeJson = (Get-ChildItem -Path $rootPath "change.json" -Recurse)[0] | % { $_.FullName }
$changeInfo = (Get-Content $changeJson) -join "`n" | ConvertFrom-Json

# Determine the overall build status. Mark the build as "passed" until "failed" is encountered.
$overallBuildStatus = "passed"

$files = Get-ChildItem -Path $rootPath "*.json" -Recurse `
| ? { ($_.Name -ne "change.json") -and ($_.Name -ne "build.json") } `
| % { $_.FullName }
$builds = New-Object System.Collections.ArrayList
foreach ($file in $files) {
$json = (Get-Content $file) -join "`n" | ConvertFrom-Json
$_ = $builds.Add($json)

if ($json.status -eq "failed") {
$overallBuildStatus = "failed"
}
}

$buildInfo | Add-Member -type NoteProperty -name status -value $overallBuildStatus
$buildInfo | Add-Member -type NoteProperty -name change -value $changeInfo
$buildInfo | Add-Member -type NoteProperty -name builds -value $builds

$buildInfo | ConvertTo-Json | Write-Output
$buildInfo | ConvertTo-Json | Out-File $outputJsonFile -Encoding ascii
16 changes: 14 additions & 2 deletions Build/scripts/init_build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ $buildPushIdPart1 = [int]([math]::Floor($buildPushId / 65536))
$buildPushIdPart2 = [int]($buildPushId % 65536)

$PushID = "{0}.{1}" -f $buildPushIdPart1.ToString("00000"), $buildPushIdPart2.ToString("00000")
$FullVersionString = "${Env:VERSION_MAJOR}.${Env:VERSION_MINOR}.${PushID}"
$VersionString = "${Env:VERSION_MAJOR}.${Env:VERSION_MINOR}.${PushID}"
$PreviewVersionString = "${VersionString}-preview"

#
# (end code borrowed from pre_build.ps1)
Expand Down Expand Up @@ -105,6 +106,13 @@ if (-not (Test-Path $flavorBuildIncompleteFile)) {
| Out-File $flavorBuildIncompleteFile -Encoding Ascii
}

$PogoConfig = "False"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pass as argument which flavor we want to pogo.
This is okay for the time being, but we should consider changing it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we can follow up on desired changes for future iterations.

if (((${Env:BuildPlatform} -eq "x64") -or (${Env:BuildPlatform} -eq "x86")) `
-and (${Env:BuildConfiguration} -eq "release"))
{
$PogoConfig = "True"
}

# Write the $envconfig script.

@"
Expand All @@ -114,17 +122,21 @@ set YearAndMonth=${YearAndMonth}
set BuildIdentifier=${BuildIdentifier}

set PushID=${PushID}
set FullVersionString=${FullVersionString}
set VersionString=${VersionString}
set PreviewVersionString=${PreviewVersionString}
set PushDate=${PushDate}
set CommitTime=${CommitTime}
set Username=${Username}
set CommitHash=${CommitHash}

set OutputPath=${OutputPath}
set FullOutputPath=${FullOutputPath}
set FlavorName=${FlavorName}

set BuildIncompleteFile=${buildIncompleteFile}
set FlavorBuildIncompleteFile=${flavorBuildIncompleteFile}

set PogoConfig=${PogoConfig}
"@ `
| Out-File $envconfig -Encoding Ascii

Expand Down
18 changes: 11 additions & 7 deletions Build/scripts/pgo/pogo_training.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
param (
[string[]]$scenarios = @(),

[string]$vcinstallroot = ${env:ProgramFiles(x86)},
[string]$vcbinpath = "Microsoft Visual Studio 14.0\VC\bin",
[string]$dllname = "pgort140.dll",

[Parameter(Mandatory=$True)]
[string]$binary,

Expand All @@ -27,9 +23,18 @@ param (

# force callers to specify this in case of future use
[Parameter(Mandatory=$True)]
[string]$flavor = ""
[string]$flavor,

[string]$vcinstallroot = ${env:ProgramFiles(x86)},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to remove these in favor of a prebuild step. We can talk about it in person if you want

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we can follow up on desired changes for future iterations. We can talk in person today or Monday about this.

[string]$vcbinpath = "Microsoft Visual Studio 14.0\VC\bin",
[string]$dllname = "pgort140.dll"
)

if (${Env:PogoConfig} -eq "False") {
Write-Host "---- Not a Pogo Config. Skipping step."
return 0
}

$binpath = Split-Path -Path $binary -Parent
$pgoOutDll = Join-Path $binpath $dllname;
if (-not (Test-Path ($pgoOutDll))) {
Expand All @@ -49,8 +54,7 @@ for ($i = 0; $i -lt $scenarios.Length; $i = $i + 1) {
if (Test-Path $path -PathType Container) {
# *.js files in directories
$items = Get-ChildItem -Path $path -Filter "*.js" | % {join-path $path $_ }
}
else {
} else {
$items = @($path)
}

Expand Down
7 changes: 7 additions & 0 deletions Build/scripts/pgo/post_pgi.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
:: - build (using PGO profile)
:: - post_pgo.cmd

@echo off

if "%PogoConfig%"=="False" (
echo ---- Not a Pogo Config. Skipping step.
exit /b 0
)

set _LINK_=
set POGO_TYPE=

Expand Down
10 changes: 9 additions & 1 deletion Build/scripts/pgo/post_pgo.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@
:: - build (using PGO profile)
:: * post_pgo.cmd

@echo off

if "%PogoConfig%"=="False" (
echo ---- Not a Pogo Config. Skipping step.
exit /b 0
)

set binpath_pgo=%1

if "%binpath_pgo%"=="" (
goto:usage
)

set POGO_TYPE=
REM Clean binaries we no longer need

REM Clean binaries we no longer need
if exist %binpath_pgo%\*.pgc ( del %binpath_pgo%\*.pgc )
if exist %binpath_pgo%\*.pgd ( del %binpath_pgo%\*.pgd )
if exist %binpath_pgo%\pgort* ( del %binpath_pgo%\pgort* )
Expand Down
5 changes: 5 additions & 0 deletions Build/scripts/pgo/pre_pgi.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

@echo off

if "%PogoConfig%"=="False" (
echo ---- Not a Pogo Config. Skipping step.
exit /b 0
)

set arch_pgi=%1
set flavor_pgi=%2
set binpath_pgi=%3
Expand Down
7 changes: 7 additions & 0 deletions Build/scripts/pgo/pre_pgo.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
:: - build (using PGO profile)
:: - post_pgo.cmd

@echo off

if "%PogoConfig%"=="False" (
echo ---- Not a Pogo Config. Skipping step.
exit /b 0
)

REM Optimize build with PGO data
set POGO_TYPE=PGO

Expand Down