Explorar o código

Addressed review comments: pgo script folder, sign ch.exe, generalize parameters, create packages.config files dynamically, doc comments.

Doug Ilijev %!s(int64=10) %!d(string=hai) anos
pai
achega
b9b0457986

+ 6 - 1
Build/scripts/finalize_build.ps1

@@ -3,8 +3,13 @@
 # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 #-------------------------------------------------------------------------------------------------------
 
+# Finalize Build Script
 #
-# Clean up the sentinel which previously marked the build as incomplete.
+# This script is run as the final step in a build definition
+# to clean up and produce metadata about the build.
+
+#
+# Clean up the sentinel which previously marked this build flavor as incomplete.
 #
 
 Remove-Item -Path ${Env:FlavorBuildIncompleteFile} -Force

+ 7 - 0
Build/scripts/init_build.ps1

@@ -3,6 +3,13 @@
 # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 #-------------------------------------------------------------------------------------------------------
 
+# Init Build Script
+#
+# Run this as the very first step in the build to configure the environment.
+# This is distinct from the Pre-Build script as there may be more non-script steps that need to be
+# taken before setting up and running the build.
+# For example, this script creates a cmd script which should be run to initialize environment variables.
+
 param (
     [string]$envconfig = "ComputedEnvironment.cmd",
 

+ 62 - 0
Build/scripts/pgo/pogo_training.ps1

@@ -0,0 +1,62 @@
+#-------------------------------------------------------------------------------------------------------
+# Copyright (C) Microsoft. All rights reserved.
+# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+#-------------------------------------------------------------------------------------------------------
+
+# PGO Build Workflow:
+# - pre_pgi.cmd
+# - build (with PGI instrumentation enabled)
+# - post_pgi.cmd
+# * pogo_training.ps1
+# - pre_pgo.cmd
+# - build (using PGO profile)
+# - post_pgo.cmd
+
+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,
+
+    [Parameter(Mandatory=$True)]
+    [string]$arch,
+
+    # force callers to specify this in case of future use
+    [Parameter(Mandatory=$True)]
+    [string]$flavor = ""
+)
+
+$binpath = Split-Path -Path $binary -Parent
+$pgoOutDll = Join-Path $binpath $dllname;
+if (-not (Test-Path ($pgoOutDll))) {
+    if ($arch -eq "x64") {
+        $dllname = Join-Path "amd64" $dllname
+    } elseif ($arch -eq "arm") {
+        $dllname = Join-Path "arm" $dllname
+    }
+    $pgoSrcDll = Join-Path $vcinstallroot (Join-Path $vcbinpath $dllname)
+    Copy-Item $pgoSrcDll $pgoOutDll
+}
+
+for ($i = 0; $i -lt $scenarios.Length; $i = $i + 1) {
+    $path = $scenarios[$i]
+
+    $items = @()
+    if (Test-Path $path -PathType Container) {
+        # *.js files in directories
+        $items = Get-ChildItem -Path $path -Filter "*.js" | % {join-path $path $_ }
+    }
+    else {
+        $items = @($path)
+    }
+
+    for ($j = 0; $j -lt $items.Length; $j = $j + 1) {
+        $testFile = $items[$j]
+        Write-Host "$binary $testFile"
+        iex "$binary $testFile"
+    }
+}

+ 6 - 3
Build/scripts/post_pgi.cmd → Build/scripts/pgo/post_pgi.cmd

@@ -4,12 +4,15 @@
 ::-------------------------------------------------------------------------------------------------------
 
 :: PGO Build Workflow:
-:: - init_pgi.cmd
+:: - pre_pgi.cmd
 :: - build (with PGI instrumentation enabled)
-:: * init_pgo.cmd
+:: * post_pgi.cmd
+:: - pogo_training.ps1
+:: - pre_pgo.cmd
 :: - build (using PGO profile)
+:: - post_pgo.cmd
 
 set _LINK_=
 set POGO_TYPE=
 
-goto:eof
+goto:eof

+ 7 - 3
Build/scripts/post_pgo.cmd → Build/scripts/pgo/post_pgo.cmd

@@ -4,10 +4,14 @@
 ::-------------------------------------------------------------------------------------------------------
 
 :: PGO Build Workflow:
-:: - init_pgi.cmd
+:: - pre_pgi.cmd
 :: - build (with PGI instrumentation enabled)
-:: * init_pgo.cmd
+:: - post_pgi.cmd
+:: - pogo_training.ps1
+:: - pre_pgo.cmd
 :: - build (using PGO profile)
+:: * post_pgo.cmd
+
 set binpath_pgo=%1
 
 if "%binpath_pgo%"=="" (
@@ -28,4 +32,4 @@ goto:eof
   echo Usage: post_pgo.cmd ^<binary_path^>
   echo   - binary_path: output path of your binaries
 
-exit /b 1
+exit /b 1

+ 6 - 2
Build/scripts/pre_pgi.cmd → Build/scripts/pgo/pre_pgi.cmd

@@ -4,10 +4,14 @@
 ::-------------------------------------------------------------------------------------------------------
 
 :: PGO Build Workflow:
-:: * init_pgi.cmd
+:: * pre_pgi.cmd
 :: - build (with PGI instrumentation enabled)
-:: - init_pgo.cmd
+:: - post_pgi.cmd
+:: - pogo_training.ps1
+:: - pre_pgo.cmd
 :: - build (using PGO profile)
+:: - post_pgo.cmd
+
 @echo off
 
 set arch_pgi=%1

+ 7 - 4
Build/scripts/pre_pgo.cmd → Build/scripts/pgo/pre_pgo.cmd

@@ -4,12 +4,15 @@
 ::-------------------------------------------------------------------------------------------------------
 
 :: PGO Build Workflow:
-:: - init_pgi.cmd
+:: - pre_pgi.cmd
 :: - build (with PGI instrumentation enabled)
-:: * init_pgo.cmd
+:: - post_pgi.cmd
+:: - pogo_training.ps1
+:: * pre_pgo.cmd
 :: - build (using PGO profile)
+:: - post_pgo.cmd
 
- REM Optimize build with pgo data
+REM Optimize build with PGO data
 set POGO_TYPE=PGO
 
-goto:eof
+goto:eof

+ 0 - 45
Build/scripts/pogo_training.ps1

@@ -1,45 +0,0 @@
-param (
-    [string[]]$scenarios = @(),
-
-    [Parameter(Mandatory=$True)]
-    [string]$binary,
-
-    [Parameter(Mandatory=$True)]
-    [string]$arch,
-
-    # force callers to specify this in case of future use
-    [Parameter(Mandatory=$True)]
-    [string]$flavor = ""
-)
-
-$binpath = Split-Path -Path $binary -Parent
-$pgodll = Join-Path $binpath "pgort140.dll";
-if (-not (Test-Path ($pgodll))) {
-    $vcarchpath = ""
-    if ($arch -eq "x64") {
-        $vcarchpath = "amd64"
-    } elseif ($arch -eq "arm") {
-        $vcarchpath = "arm"
-    }
-    $pgoSrcDll = Join-Path ${env:ProgramFiles(x86)} (Join-Path (Join-Path "Microsoft Visual Studio 14.0\VC\bin" $vcarchpath) "pgort140.dll")
-    Copy-Item $pgoSrcDll $pgodll
-}
-
-for ($i=0; $i -lt $scenarios.Length; $i = $i+1) {
-    $path = $scenarios[$i]
-
-    $items = @()
-    if (Test-Path $path -PathType Container) {
-        # *.js files in directories
-        $items = Get-ChildItem -Path $path -Filter "*.js" | % {join-path $path $_ }
-    }
-    else {
-        $items = @($path)
-    }
-
-    for ($j=0; $j -lt $items.Length; $j = $j+1) {
-        $testFile = $items[$j]
-        Write-Host "$binary $testFile"
-        iex "$binary $testFile"
-    }
-}

+ 9 - 0
Build/scripts/post_build.ps1

@@ -3,6 +3,15 @@
 # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 #-------------------------------------------------------------------------------------------------------
 
+# Post-Build Script
+#
+# Run this script after the build step to consume the artifacts produced by the build,
+# run tests, and process and deploy build logs.
+#
+# There may be more non-script tasks in the build definition following this script.
+# Any final tasks that need to be done at the end of the build are contained in the
+# Finalize Build Script, which should be invoked at the very end of the build.
+
 param (
     [ValidateSet("x86", "x64", "arm", "*")]
     [string]$arch = "*",

+ 27 - 1
Build/scripts/pre_build.ps1

@@ -3,7 +3,6 @@
 # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 #-------------------------------------------------------------------------------------------------------
 
-#
 # Pre-Build script
 #
 # This script is fairly simple. It checks if it's running
@@ -53,6 +52,30 @@ if (($logFile -eq "") -and (Test-Path Env:\TF_BUILD_BINARIESDIRECTORY)) {
 
 WriteCommonArguments;
 
+#
+# Create packages.config files
+#
+
+$packagesConfigFileText = @"
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
+</packages>
+"@
+
+$PackagesFiles = Get-ChildItem -Path ${Env:TF_BUILD_SOURCESDIRECTORY} *.vcxproj -Recurse `
+    | % { Join-Path $_.DirectoryName "packages.config" }
+
+foreach ($file in $PackagesFiles) {
+    if (-not (Test-Path $file)) {
+        Write-Output $packagesConfigFileText | Out-File $file -Encoding utf8
+    }
+}
+
+#
+# Create build metadata
+#
+
 if (Test-Path Env:\TF_BUILD_SOURCEGETVERSION)
 {
     $commitHash = ($Env:TF_BUILD_SOURCEGETVERSION).split(':')[2]
@@ -142,7 +165,10 @@ if (Test-Path Env:\TF_BUILD_SOURCEGETVERSION)
     Write-Output ($propsFile -f $binpath, $objpath, $buildPushIdPart1, $buildPushIdPart2, $buildCommit, $buildDate) | Out-File $buildInfoOutputFile
 }
 
+#
 # Clean up code analysis summary files in case they get left behind
+#
+
 if (Test-Path $objpath) {
     Get-ChildItem $objpath -include vc.nativecodeanalysis.all.xml -recurse | Remove-Item
 }

+ 1 - 1
bin/ChakraCore/ChakraCore.vcxproj

@@ -77,7 +77,7 @@
   </ItemGroup>
   <PropertyGroup Condition="'$(IsPogoBuild)'=='true'" Label="Configuration">
     <WholeProgramOptimization Condition="'$(POGO_TYPE)'=='PGI'">PGInstrument</WholeProgramOptimization>
-    <WholeProgramOptimization Condition="'$(POGO_TYPE)'=='PGO'">PGOnstrument</WholeProgramOptimization>
+    <WholeProgramOptimization Condition="'$(POGO_TYPE)'=='PGO'">PGOptimize</WholeProgramOptimization>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(IsPogoBuild)'=='true'">
     <Link>

+ 0 - 4
bin/GCStress/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 6 - 0
bin/ch/ch.vcxproj

@@ -77,6 +77,12 @@
       <Project>{1876e800-ad77-48c4-a2f7-e5265f24ac38}</Project>
     </ProjectReference>
   </ItemGroup>
+  <!-- Conditionally include the group of files to sign because MBv2 knows what to do with this but the old build definition gets confused. -->
+  <ItemGroup Condition="'$(VSO_MICROBUILD_V2)'=='True'">
+    <FilesToSign Include="$(OutDir)\ch.exe">
+      <Authenticode>Microsoft</Authenticode>
+    </FilesToSign>
+  </ItemGroup>
   <Import Project="$(BuildConfigPropsPath)Chakra.Build.targets" Condition="exists('$(BuildConfigPropsPath)Chakra.Build.targets')" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 0 - 4
bin/ch/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
bin/rl/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 1 - 0
jenkins/check_copyright.sh

@@ -29,6 +29,7 @@ git diff --name-only `git merge-base origin/master HEAD` HEAD |
     grep -v -E '\.vcxproj$' |
     grep -v -E '\.filters$' |
     grep -v -E '\.targets$' |
+    grep -v -E '\.nuspec$' |
     grep -v -E '\.def$' |
     grep -v -E '\.inc$' |
     grep -v -E 'test/benchmarks/.*\.js$' |

+ 0 - 4
lib/Backend/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Common/Codex/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Common/Common/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Common/Core/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Common/DataStructures/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Common/Exceptions/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Common/Memory/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Common/Util/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Jsrt/Core/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Jsrt/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Parser/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Runtime/Base/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Runtime/ByteCode/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Runtime/Debug/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Runtime/Language/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Runtime/Library/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Runtime/Math/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>

+ 0 - 4
lib/Runtime/Types/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" />
-</packages>