set IDES_HOME=%HOME%/ides
set ECLIPSE_VERSION_NAME=lunajee
set ECLIPSE_HOME=
set IDES_HOME=%HOME%/ides
set ECLIPSE_VERSION_NAME=lunajee
set ECLIPSE_HOME=%IDES_HOME%/eclipse/%ECLIPSE_VERSION_NAME%/eclipse
set WORKSPACES_HOME=%HOME%/workspaces
set WORKSPACE_HOME=%WORKSPACES_HOME%/jaulp.core
set ECLIPSE_EXECUTABLE=%ECLIPSE_HOME%/eclipse
set JAVA_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/jni/libsvnjavahl-1.so
set VM_ARGS=-Xms384m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=512M
%ECLIPSE_EXECUTABLE% /i /max /high -data %WORKSPACE_HOME% -showlocation vmargs %VM_ARGS% -javaagent:%ECLIPSE_HOME%/lombok.jar -Xbootclasspath/a:%ECLIPSE_HOME%/lombok.jar -Djava.library.path=%JAVA_LIBRARY_PATH%IDES_HOME%/eclipse/%ECLIPSE_VERSION_NAME%/eclipse

set IDES_HOME="%HOME%/ides"
set ECLIPSE_VERSION_NAME="lunajee"
set ECLIPSE_HOME="%IDES_HOME%/eclipse/%ECLIPSE_VERSION_NAME%/eclipse"
set WORKSPACES_HOME="%HOME%/wss"
set WORKSPACE_HOME="%WORKSPACES_HOME%/jaulp-core"
set ECLIPSE_EXECUTABLE="%ECLIPSE_HOME%/eclipse.exe"
set VM_ARGS="-Xms384m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=512M"
%ECLIPSE_EXECUTABLE% /i /max /high -data %WORKSPACE_HOME% -showlocation vmargs %VM_ARGS%

Update start-eclipse.bat

Update start-eclipse.bat


set J11_HOME=%1
set J14_HOME=%2

set APP_VERSION=%3
set APP_NAME=%4
set APP_DESCRIPTION=%5
set APP_VENDOR=%6
set APP_MAIN_JAR=%7
set APP_MAIN_CLASS=%8
set IMAGE_TYPE=%9
set BUILD_DIR=%10
set INPUT=%11
set OUTPUT=%12
set APP_ICON=%13
set JVM_ARGS=%14

call "%J11_HOME%\bin\jlink" --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules ALL-MODULE-PATH --output %BUILD_DIR%\java-runtime
REM call "%J11_HOME%\bin\jlink" --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules java.base,java.desktop,java.sql,java.logging,jdk.unsupported,java.xml,java.prefs,javafx.base,javafx.controls,javafx.graphics,javafx.swing --output %BUILD_DIR%\java-runtime

call "%J14_HOME%\bin\jpackage" ^
  --app-version %APP_VERSION% ^
  --name %APP_NAME% ^
  --description %APP_DESCRIPTION% ^
  --vendor %APP_VENDOR% ^
  --main-jar %APP_MAIN_JAR% ^
  --main-class %APP_MAIN_CLASS% ^
  --type %IMAGE_TYPE% ^
  --input %INPUT% ^
  --dest %OUTPUT% ^
  --java-options "%JVM_ARGS%" ^
  --icon %APP_ICON% ^
  --runtime-image "%BUILD_DIR%/java-runtime" ^
  --win-shortcut --win-menu ^
  --verbose

REM call "%J14_HOME%\bin\jpackage.exe" ^
REM   --type exe ^
REM   --app-version %VERSION% ^
REM   --input %INPUT% ^
REM   --name "pdf-map" ^
REM   --description "PDF Mapping tool" ^
REM   --vendor "iTo" ^
REM   --main-jar %JAR% ^
REM   --main-class "lt.ito.pdfmap.MainKt" ^
REM   --dest %OUTPUT% ^
REM   --java-options "-splash:$APPDIR/resources/splash.png -Xmx600m -Xms128m" ^
REM   --icon %APP_ICON% ^
REM   --temp %BUILD_DIR%\tmp ^
REM   --runtime-image %BUILD_DIR%\java-runtime ^
REM   --win-shortcut --win-menu ^
REM   --verbose

set J11_HOME=%1
set J14_HOME=%2

set APP_VERSION=%3
set APP_NAME=%4
set APP_DESCRIPTION=%5
set APP_VENDOR=%6
set APP_MAIN_JAR=%7
set APP_MAIN_CLASS=%8
set IMAGE_TYPE=%9

REM https://stackoverflow.com/questions/8328338/how-do-you-utilize-more-than-9-arguments-when-calling-a-label-in-a-cmd-batch-scr%
REM Shift arguments after 9
shift
set BUILD_DIR=%9
shift
set INPUT=%9
shift
set OUTPUT=%9
shift
set APP_ICON=%9
shift
set JVM_ARGS=%9

call %J11_HOME%\bin\jlink.exe --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules ALL-MODULE-PATH --output %BUILD_DIR%\java-runtime
REM call "%J11_HOME%\bin\jlink" --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules java.base,java.desktop,java.sql,java.logging,jdk.unsupported,java.xml,java.prefs,javafx.base,javafx.controls,javafx.graphics,javafx.swing --output %BUILD_DIR%\java-runtime

call %J14_HOME%\bin\jpackage.exe ^
  --app-version %APP_VERSION% ^
  --name %APP_NAME% ^
  --description %APP_DESCRIPTION% ^
  --vendor %APP_VENDOR% ^
  --main-jar %APP_MAIN_JAR% ^
  --main-class %APP_MAIN_CLASS% ^
  --type %IMAGE_TYPE% ^
  --input %INPUT% ^
  --dest %OUTPUT% ^
  --java-options "%JVM_ARGS%" ^
  --icon %APP_ICON% ^
  --runtime-image %BUILD_DIR%\java-runtime ^
  --win-shortcut --win-menu ^
  --verbose

REM call "%J14_HOME%\bin\jpackage.exe" ^
REM   --type exe ^
REM   --app-version %VERSION% ^
REM   --input %INPUT% ^
REM   --name "pdf-map" ^
REM   --description "PDF Mapping tool" ^
REM   --vendor "iTo" ^
REM   --main-jar %JAR% ^
REM   --main-class "lt.ito.pdfmap.MainKt" ^
REM   --dest %OUTPUT% ^
REM   --java-options "-splash:$APPDIR/resources/splash.png -Xmx600m -Xms128m" ^
REM   --icon %APP_ICON% ^
REM   --temp %BUILD_DIR%\tmp ^
REM   --runtime-image %BUILD_DIR%\java-runtime ^
REM   --win-shortcut --win-menu ^
REM   --verbose

Update script

Update script


@rem Copyright 2017 gRPC authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem     http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

setlocal

cd /d %~dp0\..\..\..

mkdir cmake
cd cmake
mkdir build
cd build

cmake -DgRPC_BUILD_TESTS=ON "%*" ../.. || goto :error

endlocal

goto :EOF

:error
echo Failed!
exit /b %errorlevel%

@rem Copyright 2017 gRPC authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem     http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

setlocal

cd /d %~dp0\..\..\..

mkdir cmake
cd cmake
mkdir build
cd build

cmake -DgRPC_BUILD_TESTS=ON %* ../.. || goto :error

endlocal

goto :EOF

:error
echo Failed!
exit /b %errorlevel%

fix pre_build_cmake.bat

fix pre_build_cmake.bat


SET "AIR_SDK=%USERPROFILE%\Documents\AdobeAIRSDK"
set "STEAM_SDK=%USERPROFILE%\Documents\Steam\sdk"
SET ANE_PATH=..\..\lib\bin

set "PATH=%STEAM_SDK%\redistributable_bin;%PATH%"
"%AIR_SDK%\bin\adl.exe" -extdir "%ANE_PATH%" FRESteamWorksTest-app.xml

Add run script for Windows

Add run script for Windows


@echo off

REM Unpack arguments
SET WORKER_IMAGE=%1
SET PLATFORM=%2
SET CONFIG=%3
SET TOOLCHAIN=%4
SET PYTHON_PATH=%5

echo Worker image: %WORKER_IMAGE%
echo Platform: %PLATFORM%
echo Config: %CONFIG%
echo Toolchain: %TOOLCHAIN%
echo Python path: %PYTHON_PATH%

REM Convert the build image and toolchain into our compiler string
IF /i %TOOLCHAIN%==msvc GOTO :msvc
IF /i %TOOLCHAIN%==clang GOTO :clang

echo Unknown toolchain: %TOOLCHAIN%
exit /B 1

:msvc
IF /i %WORKER_IMAGE%=="Visual Studio 2015" SET COMPILER=vs2015
IF /i %WORKER_IMAGE%=="Visual Studio 2017" SET COMPILER=vs2017
IF /i %WORKER_IMAGE%=="Visual Studio 2019" SET COMPILER=vs2019
IF /i %WORKER_IMAGE%=="Previous Visual Studio 2019" SET COMPILER=vs2019
GOTO :next

:clang
IF /i %WORKER_IMAGE%=="Visual Studio 2019" SET COMPILER=vs2019-clang
IF /i %WORKER_IMAGE%=="Previous Visual Studio 2019" SET COMPILER=vs2019-clang
GOTO :next

:next
REM Set our switch if we need to run unit tests
SET UNIT_TEST_FLAG=-unit_test
IF /i %PLATFORM%==arm64 SET UNIT_TEST_FLAG=

REM If PYTHON_PATH isn't set, assume it is in PATH
IF NOT DEFINED PYTHON_PATH SET PYTHON_PATH=python.exe

REM Build and run unit tests
%PYTHON_PATH% make.py -build %UNIT_TEST_FLAG% -compiler %COMPILER% -config %CONFIG% -cpu %PLATFORM% -clean
IF NOT %ERRORLEVEL% EQU 0 GOTO :build_failure

%PYTHON_PATH% make.py -build %UNIT_TEST_FLAG% -compiler %COMPILER% -config %CONFIG% -cpu %PLATFORM% -nosimd
IF NOT %ERRORLEVEL% EQU 0 GOTO :build_failure

REM Done!
exit /B 0

:build_failure
echo Build failed!
exit /B 1

@echo off

REM Unpack arguments
SET WORKER_IMAGE=%1
SET PLATFORM=%2
SET CONFIG=%3
SET TOOLCHAIN=%4
SET PYTHON_PATH=%5

echo Worker image: %WORKER_IMAGE%
echo Platform: %PLATFORM%
echo Config: %CONFIG%
echo Toolchain: %TOOLCHAIN%
echo Python path: %PYTHON_PATH%

REM Convert the build image and toolchain into our compiler string
IF /i %TOOLCHAIN%==msvc GOTO :msvc
IF /i %TOOLCHAIN%==clang GOTO :clang

echo Unknown toolchain: %TOOLCHAIN%
exit /B 1

:msvc
IF /i %WORKER_IMAGE%=="Visual Studio 2015" SET COMPILER=vs2015
IF /i %WORKER_IMAGE%=="Visual Studio 2017" SET COMPILER=vs2017
IF /i %WORKER_IMAGE%=="Visual Studio 2019" SET COMPILER=vs2019
IF /i %WORKER_IMAGE%=="Previous Visual Studio 2019" SET COMPILER=vs2019
GOTO :next

:clang
IF /i %WORKER_IMAGE%=="Visual Studio 2019" SET COMPILER=vs2019-clang
IF /i %WORKER_IMAGE%=="Previous Visual Studio 2019" SET COMPILER=vs2019-clang

REM HACK!!! Disable clang build for now with appveyor since vcpkg breaks the compiler detection of cmake
REM Fake build success
echo VS2019 clang build is disabled for now due to issues with vcpkg breaking compiler detection with cmake
exit /B 0

GOTO :next

:next
REM Set our switch if we need to run unit tests
SET UNIT_TEST_FLAG=-unit_test
IF /i %PLATFORM%==arm64 SET UNIT_TEST_FLAG=

REM If PYTHON_PATH isn't set, assume it is in PATH
IF NOT DEFINED PYTHON_PATH SET PYTHON_PATH=python.exe

REM Build and run unit tests
%PYTHON_PATH% make.py -build %UNIT_TEST_FLAG% -compiler %COMPILER% -config %CONFIG% -cpu %PLATFORM% -clean
IF NOT %ERRORLEVEL% EQU 0 GOTO :build_failure

%PYTHON_PATH% make.py -build %UNIT_TEST_FLAG% -compiler %COMPILER% -config %CONFIG% -cpu %PLATFORM% -nosimd
IF NOT %ERRORLEVEL% EQU 0 GOTO :build_failure

REM Done!
exit /B 0

:build_failure
echo Build failed!
exit /B 1

disable clang with appveyor

chore: disable clang with appveyor

vcpkg breaks the clang compiler detection of cmake


@@setlocal
@@set POWERSHELL_BAT_ARGS=%*
@@if defined POWERSHELL_BAT_ARGS set POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%
@@powershell.exe -Command Invoke-Expression $('$args=@(^&{$args} %POWERSHELL_BAT_ARGS%);'+[String]::Join([char]10, $((Get-Content '%~f0') -notmatch '^^@@'))) & goto :EOF

Function Main($rootPath, $name)
{
    $fullPath = "$rootPath\$name";
    $exists = Test-Path $fullPath;
    if (!$exists)
    {
        New-Item $fullPath -Type Directory | Out-Null;
    }

    $projects = CreateProjects $name;
    WriteProjects $fullPath $projects;
    WriteStyleCopSettings "$fullPath\StyleCop.settings";
    WriteSolutionFile "$fullPath\$name.sln" $projects;
}

Function CreateProjects($name)
{
    $app = CreateProject "$name.App" "source" $false;
    $core = CreateProject "$name.Core" "source" $false;
    $test = CreateProject "$name.Test.Unit" "test" $true;

    $app.ProjectReferences += $core;
    $test.ProjectReferences += $core;

    return ($app, $core, $test);
}

Function CreateProject($name, $folderName, $isUnitTest)
{
    $path = "$folderName\$name\$name.csproj";
    $properties =
    @{
        "Name" = $name;
        "Path" = $path;
        "Id" = [guid]::NewGuid();
        "IsUnitTest" = $isUnitTest;
        "ProjectReferences" = @();
    };

    return New-Object PSObject -Property $properties;
}

Function WriteProjects($rootPath, [psobject[]]$projects)
{
    foreach ($project in $projects)
    {
        $file = New-Object -Type "System.IO.FileInfo" -ArgumentList ("$rootPath\" + $project.Path);
        Write-Host "Writing project file '$file'...";
        $parentDir = $file.Directory;
        if (!$parentDir.Exists)
        {
            $parentDir.Create();
        }

        "-- TODO --" | Out-File $file.FullName -Encoding "UTF8";
    }
}

Function WriteSolutionFile($fullPath, [psobject[]]$projects)
{
    Write-Host "Writing solution file '$fullPath'...";
    $headerText = @"

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1

"@;
    $projectsText = "";
    $globalSectionText = @"
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution

"@;
    $footerText = @"
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal
"@;

    foreach ($project in $projects)
    {
        $name = $project.Name;
        $path = $project.Path;
        $id = $project.Id.ToString("B").ToUpperInvariant();
        $projectsText += @"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "$name", "$path", "$id"
EndProject

"@;
        $globalSectionText += @"
		$id.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		$id.Debug|Any CPU.Build.0 = Debug|Any CPU
		$id.Release|Any CPU.ActiveCfg = Release|Any CPU
		$id.Release|Any CPU.Build.0 = Release|Any CPU

"@;
    }

    $text = $headerText + $projectsText + $globalSectionText + $footerText;
    $text = $text -Replace "`n", "`r`n";
    $text | Out-File $fullPath -Encoding "UTF8";
}

Function WriteStyleCopSettings($fullPath)
{
    Write-Host "Writing StyleCop settings file '$fullPath'...";
    $text = @"
<StyleCopSettings Version="105">
  <GlobalSettings>
    <BooleanProperty Name="AutoCheckForUpdate">False</BooleanProperty>
  </GlobalSettings>
  <Parsers>
    <Parser ParserId="Microsoft.StyleCop.CSharp.CsParser">
      <ParserSettings>
        <CollectionProperty Name="GeneratedFileFilters">
          <Value>\.g\.cs$</Value>
          <Value>\.generated\.cs$</Value>
          <Value>\.g\.i\.cs$</Value>
          <Value>TemporaryGeneratedFile_.*\.cs$</Value>
        </CollectionProperty>
      </ParserSettings>
    </Parser>
  </Parsers>
  <Analyzers>
    <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
      <Rules>
        <Rule Name="ElementsMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PartialElementsMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="EnumerationItemsMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationMustContainValidXml">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustHaveSummary">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PartialElementDocumentationMustHaveSummary">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustHaveSummaryText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PartialElementDocumentationMustHaveSummaryText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementParametersMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementParameterDocumentationMustMatchElementParameters">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementParameterDocumentationMustDeclareParameterName">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementParameterDocumentationMustHaveText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementReturnValueMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementReturnValueDocumentationMustHaveText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="VoidReturnValueMustNotBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParametersMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParameterDocumentationMustHaveText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PropertySummaryDocumentationMustMatchAccessors">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationTextMustNotBeEmpty">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationTextMustContainWhitespace">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationMustMeetCharacterPercentage">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationHeadersMustNotContainBlankLines">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="IncludedDocumentationXPathDoesNotExist">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="InheritDocMustBeUsedWithInheritingClass">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustBeSpelledCorrectly">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
      </Rules>
      <AnalyzerSettings />
    </Analyzer>
  </Analyzers>
</StyleCopSettings>
"@;
    $text = $text -Replace "`n", "`r`n";
    $text | Out-File $fullPath -Encoding "UTF8";
}

Function PrintUsage()
{
    Write-Host "InitProjects.cmd <root-path> <project-name>";
    Write-Host "";
    Write-Host "Creates a simple project structure using the provided root path and project name.";
}

if ($args.Length -ne 2)
{
    PrintUsage;
    Exit 1;
}

Main $args[0] $args[1];

@@setlocal
@@set POWERSHELL_BAT_ARGS=%*
@@if defined POWERSHELL_BAT_ARGS set POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%
@@powershell.exe -Command Invoke-Expression $('$args=@(^&{$args} %POWERSHELL_BAT_ARGS%);'+[String]::Join([char]10, $((Get-Content '%~f0') -notmatch '^^@@'))) & goto :EOF

$ProjectConsole = 1;
$ProjectLibrary = 2;
$ProjectUnitTest = 3;

Function Main($rootPath, $name)
{
    $fullPath = "$rootPath\$name";
    $exists = Test-Path $fullPath;
    if (!$exists)
    {
        New-Item $fullPath -Type Directory | Out-Null;
    }

    $projects = CreateProjects $name;
    WriteProjects $name $fullPath $projects;
    WriteStyleCopSettings "$fullPath\StyleCop.settings";
    WriteSolutionFile "$fullPath\$name.sln" $projects;
}

Function CreateProjects($name)
{
    $app = CreateProject "$name.App" "source" $ProjectConsole "Program.cs";
    $core = CreateProject "$name.Core" "source" $ProjectLibrary "Class1.cs";
    $test = CreateProject "$name.Test.Unit" "test" $ProjectUnitTest "Test1.cs";

    $app.ProjectReferences += $core;
    $test.ProjectReferences += $core;

    return ($app, $core, $test);
}

Function CreateProject($name, $folderName, $type, $fileToInclude)
{
    $path = "$folderName\$name\$name.csproj";
    $properties =
    @{
        "Name" = $name;
        "Path" = $path;
        "Id" = [guid]::NewGuid().ToString("B").ToUpperInvariant();
        "ProjectType" = $type;
        "ProjectReferences" = @();
        "FileToInclude" = $fileToInclude;
    };

    return New-Object PSObject -Property $properties;
}

Function WriteProjects($solutionName, $rootPath, [psobject[]]$projects)
{
    foreach ($project in $projects)
    {
        $file = New-Object -Type "System.IO.FileInfo" -ArgumentList ("$rootPath\" + $project.Path);
        Write-Host "Writing project file '$file'...";
        $parentDir = $file.Directory;
        if (!$parentDir.Exists)
        {
            $parentDir.Create();
        }

        GetProjectText $solutionName $project | Out-File $file.FullName -Encoding "UTF8";
    }
}

Function GetProjectText($solutionName, $project)
{
    $id = $project.Id;
    $name = $project.Name;
    $afterHeaderText = "";
    $fileToInclude = $project.FileToInclude;
    $filesText = "";
    if ($project.ProjectType -eq $ProjectConsole)
    {
        $outputType = "Exe";
        $rootNamespace = $solutionName;
        $afterHeaderText +=
@'
    <PlatformTarget>AnyCPU</PlatformTarget>
    <Prefer32Bit>false</Prefer32Bit>

'@;
    }
    elseif ($project.ProjectType -eq $ProjectLibrary)
    {
        $outputType = "Library";
        $rootNamespace = $solutionName;
    }
    else
    {
        $outputType = "Library";
        $rootNamespace = "$solutionName.Test.Unit";
    }

    $headerText =
@'
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
'@;
    $headerText +=
@"
    <ProjectGuid>$id</ProjectGuid>
    <OutputType>$outputType</OutputType>
    <RootNamespace>$rootNamespace</RootNamespace>
    <AssemblyName>$name</AssemblyName>

"@;

    $headerText +=
@'
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <OutputPath>..\..\bin\$(Configuration)\</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>

'@;

    $afterHeaderText +=
@'
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Properties\AssemblyInfo.cs" />

'@;

    $filesText =
@"
    <Compile Include="$fileToInclude" />
  </ItemGroup>

"@;

    $projectReferencesText = "";
    if ($project.ProjectReferences.Length -gt 0)
    {
        $projectReferencesText += @'
  <ItemGroup>

'@;
        foreach ($refProject in $project.ProjectReferences)
        {
            $includePath = GetIncludePath $project.Path $refProject.Path;
            $refName = $refProject.Name;
            $refId = $refProject.Id;
            $projectReferencesText +=
@"
    <ProjectReference Include="$includePath">
      <Project>$refId</Project>
      <Name>$refName</Name>
    </ProjectReference>

"@;
        }

        $projectReferencesText += @'
  </ItemGroup>

'@;
    }

    $footerText =
@'
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\StyleCop\v4.7\StyleCop.Targets" />
</Project>
'@;

    $text = $headerText + $afterHeaderText + $filesText + $projectReferencesText + $footerText;
    $text = $text -Replace "`n", "`r`n";
    return $text;
}

Function GetIncludePath($source, $dest)
{
    $tree = @{};
    $current = $tree;
    $depth = 0;
    foreach ($part in $source.Split('\'))
    {
        $current[$part] = @{};
        $current = $current[$part];
        ++$depth;
    }

    $current = $tree;
    $includePathParts = @();
    $stillMatches = $true;
    foreach ($part in $dest.Split('\'))
    {
        if ($stillMatches)
        {
            if ($current.ContainsKey($part))
            {
                --$depth;
                $current = $current[$part];
            }
            else
            {
                $stillMatches = $false;
                for ($i = 1; $i -lt $depth; ++$i)
                {
                    $includePathParts += "..";
                }
            }
        }

        if (!$stillMatches)
        {
            $includePathParts += $part;
        }
    }

    return [string]::Join('\', $includePathParts);
}

Function WriteSolutionFile($fullPath, [psobject[]]$projects)
{
    Write-Host "Writing solution file '$fullPath'...";
    $headerText =
@"

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1

"@;
    $projectsText = "";
    $globalSectionText =
@"
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution

"@;
    $footerText =
@"
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal
"@;

    foreach ($project in $projects)
    {
        $name = $project.Name;
        $path = $project.Path;
        $id = $project.Id;
        $projectsText +=
@"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "$name", "$path", "$id"
EndProject

"@;
        $globalSectionText +=
@"
		$id.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		$id.Debug|Any CPU.Build.0 = Debug|Any CPU
		$id.Release|Any CPU.ActiveCfg = Release|Any CPU
		$id.Release|Any CPU.Build.0 = Release|Any CPU

"@;
    }

    $text = $headerText + $projectsText + $globalSectionText + $footerText;
    $text = $text -Replace "`n", "`r`n";
    $text | Out-File $fullPath -Encoding "UTF8";
}

Function WriteStyleCopSettings($fullPath)
{
    Write-Host "Writing StyleCop settings file '$fullPath'...";
    $text =
@"
<StyleCopSettings Version="105">
  <GlobalSettings>
    <BooleanProperty Name="AutoCheckForUpdate">False</BooleanProperty>
  </GlobalSettings>
  <Parsers>
    <Parser ParserId="Microsoft.StyleCop.CSharp.CsParser">
      <ParserSettings>
        <CollectionProperty Name="GeneratedFileFilters">
          <Value>\.g\.cs$</Value>
          <Value>\.generated\.cs$</Value>
          <Value>\.g\.i\.cs$</Value>
          <Value>TemporaryGeneratedFile_.*\.cs$</Value>
        </CollectionProperty>
      </ParserSettings>
    </Parser>
  </Parsers>
  <Analyzers>
    <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
      <Rules>
        <Rule Name="ElementsMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PartialElementsMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="EnumerationItemsMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationMustContainValidXml">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustHaveSummary">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PartialElementDocumentationMustHaveSummary">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustHaveSummaryText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PartialElementDocumentationMustHaveSummaryText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementParametersMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementParameterDocumentationMustMatchElementParameters">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementParameterDocumentationMustDeclareParameterName">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementParameterDocumentationMustHaveText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementReturnValueMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementReturnValueDocumentationMustHaveText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="VoidReturnValueMustNotBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParametersMustBeDocumented">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="GenericTypeParameterDocumentationMustHaveText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PropertySummaryDocumentationMustMatchAccessors">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationTextMustNotBeEmpty">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationTextMustContainWhitespace">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationMustMeetCharacterPercentage">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="DocumentationHeadersMustNotContainBlankLines">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="IncludedDocumentationXPathDoesNotExist">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="InheritDocMustBeUsedWithInheritingClass">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementDocumentationMustBeSpelledCorrectly">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
      </Rules>
      <AnalyzerSettings />
    </Analyzer>
  </Analyzers>
</StyleCopSettings>
"@;
    $text = $text -Replace "`n", "`r`n";
    $text | Out-File $fullPath -Encoding "UTF8";
}

Function PrintUsage()
{
    Write-Host "InitProjects.cmd <root-path> <project-name>";
    Write-Host "";
    Write-Host "Creates a simple project structure using the provided root path and project name.";
}

if ($args.Length -ne 2)
{
    PrintUsage;
    Exit 1;
}

Main $args[0] $args[1];

Add basic csproj generation

Add basic csproj generation


:: This script assumes the standard setup on tensorflow Jenkins windows machines.
:: It is NOT guaranteed to work on any other machine. Use at your own risk!
::
:: REQUIREMENTS:
:: * All installed in standard locations:
::   - JDK8, and JAVA_HOME set.
::   - Microsoft Visual Studio 2015 Community Edition
::   - Msys2
::   - Anaconda3
::   - CMake
:: * Before running this script, you have to set BUILD_CC_TESTS and BUILD_PYTHON_TESTS
::   variables to either "ON" or "OFF".
:: * Either have the REPO_ROOT variable set, or run this from the repository root directory.

:: Check and set REPO_ROOT
IF [%REPO_ROOT%] == [] (
  SET REPO_ROOT=%cd%
)

:: Import all bunch of variables Visual Studio needs.
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
:: Turn echo back on, above script turns it off.
ECHO ON

:: Some common variables to be shared between runs.
SET CMAKE_EXE="C:\Program Files\cmake\bin\cmake.exe"
SET SWIG_EXE="C:\ProgramData\chocolatey\bin\swig.exe"
SET PY_EXE="C:\Program Files\Anaconda3\python.exe"
SET PY_LIB="C:\Program Files\Anaconda3\libs\python35.lib"

SET CMAKE_DIR=%REPO_ROOT%\tensorflow\contrib\cmake
SET MSBUILD_EXE="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"

:: Run cmake to create Visual Studio Project files.
%CMAKE_EXE% %CMAKE_DIR% -A x64 -DSWIG_EXECUTABLE=%SWIG_EXE% -DPYTHON_EXECUTABLE=%PY_EXE% -DCMAKE_BUILD_TYPE=Release -DPYTHON_LIBRARIES=%PY_LIB% -Dtensorflow_BUILD_PYTHON_TESTS=%BUILD_PYTHON_TESTS% -Dtensorflow_BUILD_CC_TESTS=%BUILD_CC_TESTS%

:: Run msbuild in the resulting VS project files to build a pip package.
%MSBUILD_EXE% /p:Configuration=Release /maxcpucount:32 tf_python_build_pip_package.vcxproj

:: This script assumes the standard setup on tensorflow Jenkins windows machines.
:: It is NOT guaranteed to work on any other machine. Use at your own risk!
::
:: REQUIREMENTS:
:: * All installed in standard locations:
::   - JDK8, and JAVA_HOME set.
::   - Microsoft Visual Studio 2015 Community Edition
::   - Msys2
::   - Anaconda3
::   - CMake
:: * Before running this script, you have to set BUILD_CC_TESTS and BUILD_PYTHON_TESTS
::   variables to either "ON" or "OFF".
:: * Either have the REPO_ROOT variable set, or run this from the repository root directory.

:: Check and set REPO_ROOT
IF [%REPO_ROOT%] == [] (
  SET REPO_ROOT=%cd%
)

:: Import all bunch of variables Visual Studio needs.
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
:: Turn echo back on, above script turns it off.
ECHO ON

:: Some common variables to be shared between runs.
SET CMAKE_EXE="C:\Program Files\cmake\bin\cmake.exe"
SET SWIG_EXE="C:\swigwin-3.0.10\swig.exe"
SET PY_EXE="C:\Program Files\Anaconda3\python.exe"
SET PY_LIB="C:\Program Files\Anaconda3\libs\python35.lib"

SET CMAKE_DIR=%REPO_ROOT%\tensorflow\contrib\cmake
SET MSBUILD_EXE="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"

:: Run cmake to create Visual Studio Project files.
%CMAKE_EXE% %CMAKE_DIR% -A x64 -DSWIG_EXECUTABLE=%SWIG_EXE% -DPYTHON_EXECUTABLE=%PY_EXE% -DCMAKE_BUILD_TYPE=Release -DPYTHON_LIBRARIES=%PY_LIB% -Dtensorflow_BUILD_PYTHON_TESTS=%BUILD_PYTHON_TESTS% -Dtensorflow_BUILD_CC_TESTS=%BUILD_CC_TESTS%

:: Run msbuild in the resulting VS project files to build a pip package.
%MSBUILD_EXE% /p:Configuration=Release /maxcpucount:32 tf_python_build_pip_package.vcxproj

Use a more recent version of SWIG

[Windows/CMake] Use a more recent version of SWIG

This fixes `reader_ops_test.py`, which was suffering from a bug in older versions of SWIG when using Python 3.5 and a SWIG-wrapped generator object.


@ECHO OFF
SETLOCAL

SET build_dir=build

SET cc=clang
SET cflags=-Wall -Wextra -Werror -pedantic -Wno-deprecated-declarations ^
	-Wno-unused-parameter -Wno-gnu-zero-variadic-macro-arguments -std=c17 ^
	-Os -iquoteCinyTest -v

RMDIR /S /Q %build_dir%

MKDIR %build_dir%
%cc% %cflags% src\*.c -LCinyTest -lcinytest -o %build_dir%\recttests.exe

ENDLOCAL
EXIT /B %ERRORLEVEL%

@ECHO OFF
SETLOCAL

SET build_dir=build

SET cc=clang
SET cflags=-Wall -Wextra -Werror -pedantic -Wno-deprecated-declarations ^
	-Wno-unused-parameter -Wno-gnu-zero-variadic-macro-arguments -std=c17 ^
	-Os -iquote. -v

RMDIR /S /Q %build_dir%

MKDIR %build_dir%
%cc% %cflags% src\*.c -L. -lcinytest -o %build_dir%\recttests.exe

ENDLOCAL
EXIT /B %ERRORLEVEL%

update winbuild to use current dir for include/lib


echo off
rem To simplify using pre on multiple sites/directories, install this bat file in the Windows path.
php pre.php %1 %2 %3

Add comments (REM) to bat file.

Add comments (REM) to bat file.


@REM @file
@REM   Windows batch file to build BIOS ROM
@REM
@REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
@REM This program and the accompanying materials
@REM are licensed and made available under the terms and conditions of the BSD License
@REM which accompanies this distribution.  The full text of the license may be found at
@REM http://opensource.org/licenses/bsd-license.php
@REM
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@REM

@echo off
setlocal EnableDelayedExpansion EnableExtensions
echo.
echo %date%  %time%
echo.

::**********************************************************************
:: Initial Setup
::**********************************************************************
set WORKSPACE=%CD%
if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
set /a build_threads=1
set "Build_Flags= "
set exitCode=0
set Arch=X64
set Source=0

:: Clean up previous build files.
if exist %WORKSPACE%\edk2.log del %WORKSPACE%\edk2.log
if exist %WORKSPACE%\unitool.log del %WORKSPACE%\unitool.log
if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt
if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt
if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt
if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
if exist conf\.cache rmdir /q/s conf\.cache

:: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf
:: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding
call edksetup.bat > nul
@echo off

:: Define platform specific environment variables.
set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt

set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg

::create new AutoPlatformCFG.txt file
copy /y nul %auto_config_inc% >nul

::**********************************************************************
:: Parse command line arguments
::**********************************************************************

:: Optional arguments
:OptLoop
if /i "%~1"=="/?" goto Usage

if /i "%~1"=="/l" (
    set Build_Flags=%Build_Flags% -j EDK2.log
    shift
    goto OptLoop
)
if /i "%~1" == "/c" (
    echo Removing previous build files ...
    if exist build (
        del /f/s/q build > null
        rmdir /s/q build
    )
    if exist conf\.cache (
        del /f/s/q conf\.cache > null
        rmdir /s/q conf\.cache
    )
    echo.
    shift
    goto OptLoop
)

if /i "%~1"=="/x64" (
    set Arch=X64
    shift
    goto OptLoop
)
if /i "%~1"=="/IA32" (
    set Arch=IA32
    shift
    goto OptLoop
)

:: Required argument(s)
if "%~1"=="" goto Usage

::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
if "%Arch%"=="IA32" (
    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env
    echo DEFINE X64_CONFIG = FALSE  >> %auto_config_inc%
) else if "%Arch%"=="X64" (
    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env
    echo DEFINE X64_CONFIG = TRUE  >> %auto_config_inc%
)

:: -- Build flags settings for each Platform --
echo Setting  %1  platform configuration and BIOS ID...
if /i "%~1" == "MNW2" (
    echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
    echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%

) else (
    echo Error - Unsupported PlatformType: %1
    goto Usage
)
set Platform_Type=%~1

if /i "%~2" == "RELEASE" (
    set target=RELEASE
    echo BUILD_TYPE = R >> Conf\BiosId.env
) else (
    set target=DEBUG
    echo BUILD_TYPE = D >> Conf\BiosId.env
)

::**********************************************************************
:: Additional EDK Build Setup/Configuration
::**********************************************************************
echo.
echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...
if defined VS90COMNTOOLS (
   if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
   if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
      set TOOL_CHAIN_TAG=VS2008
   ) else (
      set TOOL_CHAIN_TAG=VS2008x86
   )
 ) else if defined VS100COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
  if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2010
  ) else (
    set TOOL_CHAIN_TAG=VS2010x86
  )
) else if defined VS110COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
  if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2012
  ) else (
    set TOOL_CHAIN_TAG=VS2012x86
  )
) else if defined VS120COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
  if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2013
  ) else (
    set TOOL_CHAIN_TAG=VS2013x86
  )
) else (
  echo  --ERROR: VS2008/VS2010/VS2012/VS2013 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS not defined ^^!
  echo.
  goto :BldFail
)

echo Ensuring correct build directory is present for GenBiosId...
set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%

echo Modifing Conf files for this build...
:: Remove lines with these tags from target.txt
findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp

echo TARGET          = %TARGET%                                  >> Conf\target.txt.tmp
if "%Arch%"=="IA32" (
    echo TARGET_ARCH = IA32                                      >> Conf\target.txt.tmp
) else if "%Arch%"=="X64" (
    echo TARGET_ARCH = IA32 X64                                  >> Conf\target.txt.tmp
)
echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> Conf\target.txt.tmp
echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> Conf\target.txt.tmp
if %Source% == 0 (
  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> Conf\target.txt.tmp
) else (
  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  >> Conf\target.txt.tmp
)
echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> Conf\target.txt.tmp

move /Y Conf\target.txt.tmp Conf\target.txt >nul

::**********************************************************************
:: Build BIOS
::**********************************************************************

echo Creating BiosId...
pushd %PLATFORM_PACKAGE%
if not exist ..\%BUILD_PATH%\IA32  mkdir ..\%BUILD_PATH%\IA32
  GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat
if "%Arch%"=="X64" (
   if not exist ..\%BUILD_PATH%\X64  mkdir ..\%BUILD_PATH%\X64
   GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat
)
popd

if %ERRORLEVEL% NEQ 0 goto BldFail

echo.
echo Invoking EDK2 build...
call build %Build_Flags%

if %ERRORLEVEL% NEQ 0 goto BldFail

::**********************************************************************
:: Post Build processing and cleanup
::**********************************************************************

echo Running fce...

pushd %PLATFORM_PACKAGE%
:: Extract Hii data from build and store in HiiDefaultData.txt
fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt

:: save changes to VlvXXX.fd
fce update -i ..\%BUILD_PATH%\FV\Vlv.fd -s ..\%BUILD_PATH%\FV\HiiDefaultData.txt -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd

popd

if %ERRORLEVEL% NEQ 0 goto BldFail
::echo FD successfully updated with default Hii values.

:: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
find /v "#" Conf\BiosId.env > ver_strings
for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
del /f/q ver_strings >nul

set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd  %WORKSPACE%\%BIOS_Name% >nul
copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd  %BUILD_PATH%\FV\Vlv.ROM >nul

echo.
echo Build location:     %BUILD_PATH%
echo BIOS ROM Created:   %BIOS_Name%
echo.
echo -------------------- The EDKII BIOS build has successfully completed. --------------------
echo.

@REM build capsule here
if "%openssl_path%" == "" goto Exit
echo > %BUILD_PATH%\FV\SYSTEMFIRMWAREUPDATECARGO.Fv
build -p %PLATFORM_PACKAGE%\PlatformCapsule.dsc

goto Exit

:Usage
echo.
echo ***************************************************************************
echo Build BIOS rom for VLV platforms.
echo.
echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
echo.
echo    /c    CleanAll before building
echo    /IA32 Set Arch to IA32 (default: X64)
echo    /X64  Set Arch to X64 (default: X64)
echo.
echo        Platform Types:  MNW2
echo        Build Targets:   Debug, Release  (default: Debug)
echo.
echo Examples:
echo    bld_vlv.bat MNW2                 : X64 Debug build for MinnowMax
echo    bld_vlv.bat /IA32 MNW2 release   : IA32 Release build for MinnowMax
echo.
echo ***************************************************************************
set exitCode=1
goto Exit

:BldFail
set exitCode=1
echo  -- Error:  EDKII BIOS Build has failed!
echo See EDK2.log for more details

:Exit
echo %date%  %time%
exit /b %exitCode%

EndLocal

@REM @file
@REM   Windows batch file to build BIOS ROM
@REM
@REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
@REM This program and the accompanying materials
@REM are licensed and made available under the terms and conditions of the BSD License
@REM which accompanies this distribution.  The full text of the license may be found at
@REM http://opensource.org/licenses/bsd-license.php
@REM
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@REM

@echo off
setlocal EnableDelayedExpansion EnableExtensions
echo.
echo %date%  %time%
echo.

::**********************************************************************
:: Initial Setup
::**********************************************************************
set WORKSPACE=%CD%
if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
set /a build_threads=1
set "Build_Flags= "
set exitCode=0
set Arch=X64
set Source=0

:: Clean up previous build files.
if exist %WORKSPACE%\edk2.log del %WORKSPACE%\edk2.log
if exist %WORKSPACE%\unitool.log del %WORKSPACE%\unitool.log
if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt
if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt
if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt
if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
if exist conf\.cache rmdir /q/s conf\.cache

:: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf
:: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding
call edksetup.bat > nul
@echo off

:: Define platform specific environment variables.
set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt

set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg

::create new AutoPlatformCFG.txt file
copy /y nul %auto_config_inc% >nul

::**********************************************************************
:: Parse command line arguments
::**********************************************************************

:: Optional arguments
:OptLoop
if /i "%~1"=="/?" goto Usage

if /i "%~1"=="/l" (
    set Build_Flags=%Build_Flags% -j EDK2.log
    shift
    goto OptLoop
)
if /i "%~1" == "/c" (
    echo Removing previous build files ...
    if exist build (
        del /f/s/q build > nul
        rmdir /s/q build
    )
    if exist conf\.cache (
        del /f/s/q conf\.cache > nul
        rmdir /s/q conf\.cache
    )
    echo.
    shift
    goto OptLoop
)

if /i "%~1"=="/x64" (
    set Arch=X64
    shift
    goto OptLoop
)
if /i "%~1"=="/IA32" (
    set Arch=IA32
    shift
    goto OptLoop
)

:: Required argument(s)
if "%~1"=="" goto Usage

::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
if "%Arch%"=="IA32" (
    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env
    echo DEFINE X64_CONFIG = FALSE  >> %auto_config_inc%
) else if "%Arch%"=="X64" (
    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env
    echo DEFINE X64_CONFIG = TRUE  >> %auto_config_inc%
)

:: -- Build flags settings for each Platform --
echo Setting  %1  platform configuration and BIOS ID...
if /i "%~1" == "MNW2" (
    echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
    echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%

) else (
    echo Error - Unsupported PlatformType: %1
    goto Usage
)
set Platform_Type=%~1

if /i "%~2" == "RELEASE" (
    set target=RELEASE
    echo BUILD_TYPE = R >> Conf\BiosId.env
) else (
    set target=DEBUG
    echo BUILD_TYPE = D >> Conf\BiosId.env
)

::**********************************************************************
:: Additional EDK Build Setup/Configuration
::**********************************************************************
echo.
echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...
if defined VS90COMNTOOLS (
   if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
   if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
      set TOOL_CHAIN_TAG=VS2008
   ) else (
      set TOOL_CHAIN_TAG=VS2008x86
   )
 ) else if defined VS100COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
  if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2010
  ) else (
    set TOOL_CHAIN_TAG=VS2010x86
  )
) else if defined VS110COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
  if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2012
  ) else (
    set TOOL_CHAIN_TAG=VS2012x86
  )
) else if defined VS120COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
  if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2013
  ) else (
    set TOOL_CHAIN_TAG=VS2013x86
  )
) else (
  echo  --ERROR: VS2008/VS2010/VS2012/VS2013 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS not defined ^^!
  echo.
  goto :BldFail
)

echo Ensuring correct build directory is present for GenBiosId...
set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%

echo Modifing Conf files for this build...
:: Remove lines with these tags from target.txt
findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp

echo TARGET          = %TARGET%                                  >> Conf\target.txt.tmp
if "%Arch%"=="IA32" (
    echo TARGET_ARCH = IA32                                      >> Conf\target.txt.tmp
) else if "%Arch%"=="X64" (
    echo TARGET_ARCH = IA32 X64                                  >> Conf\target.txt.tmp
)
echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> Conf\target.txt.tmp
echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> Conf\target.txt.tmp
if %Source% == 0 (
  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> Conf\target.txt.tmp
) else (
  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  >> Conf\target.txt.tmp
)
echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> Conf\target.txt.tmp

move /Y Conf\target.txt.tmp Conf\target.txt >nul

::**********************************************************************
:: Build BIOS
::**********************************************************************

echo Creating BiosId...
pushd %PLATFORM_PACKAGE%
if not exist ..\%BUILD_PATH%\IA32  mkdir ..\%BUILD_PATH%\IA32
  GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat
if "%Arch%"=="X64" (
   if not exist ..\%BUILD_PATH%\X64  mkdir ..\%BUILD_PATH%\X64
   GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat
)
popd

if %ERRORLEVEL% NEQ 0 goto BldFail

echo.
echo Invoking EDK2 build...
call build %Build_Flags%

if %ERRORLEVEL% NEQ 0 goto BldFail

::**********************************************************************
:: Post Build processing and cleanup
::**********************************************************************

echo Running fce...

pushd %PLATFORM_PACKAGE%
:: Extract Hii data from build and store in HiiDefaultData.txt
fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt

:: save changes to VlvXXX.fd
fce update -i ..\%BUILD_PATH%\FV\Vlv.fd -s ..\%BUILD_PATH%\FV\HiiDefaultData.txt -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd

popd

if %ERRORLEVEL% NEQ 0 goto BldFail
::echo FD successfully updated with default Hii values.

:: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
find /v "#" Conf\BiosId.env > ver_strings
for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
del /f/q ver_strings >nul

set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd  %WORKSPACE%\%BIOS_Name% >nul
copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd  %BUILD_PATH%\FV\Vlv.ROM >nul

echo.
echo Build location:     %BUILD_PATH%
echo BIOS ROM Created:   %BIOS_Name%
echo.
echo -------------------- The EDKII BIOS build has successfully completed. --------------------
echo.

@REM build capsule here
if "%openssl_path%" == "" goto Exit
echo > %BUILD_PATH%\FV\SYSTEMFIRMWAREUPDATECARGO.Fv
build -p %PLATFORM_PACKAGE%\PlatformCapsule.dsc

goto Exit

:Usage
echo.
echo ***************************************************************************
echo Build BIOS rom for VLV platforms.
echo.
echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
echo.
echo    /c    CleanAll before building
echo    /IA32 Set Arch to IA32 (default: X64)
echo    /X64  Set Arch to X64 (default: X64)
echo.
echo        Platform Types:  MNW2
echo        Build Targets:   Debug, Release  (default: Debug)
echo.
echo Examples:
echo    bld_vlv.bat MNW2                 : X64 Debug build for MinnowMax
echo    bld_vlv.bat /IA32 MNW2 release   : IA32 Release build for MinnowMax
echo.
echo ***************************************************************************
set exitCode=1
goto Exit

:BldFail
set exitCode=1
echo  -- Error:  EDKII BIOS Build has failed!
echo See EDK2.log for more details

:Exit
echo %date%  %time%
exit /b %exitCode%

EndLocal

Fix typo in name of nul output file

Vlv2TbltDevicePkg: Fix typo in name of nul output file

https://bugzilla.tianocore.org/show_bug.cgi?id=272

Fix typo in script file.  To prevent output from being
shown, then output file should be 'nul', not 'null'.

Cc: Jiewen Yao <364a90bfebd1f362ebb7b48e4bf8ec010adef203@intel.com>
Cc: David Wei <b5f26b2a2cdf37ab487a7004176f1783629975b0@intel.com>
Cc: Mang Guo <5bf9b8c1f0e7223caca76136b1fa9e22cce4e371@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <fd20bc543a9f65bb633fac7d08a403c1f1c8eb6c@intel.com>
Reviewed-by: Jiewen Yao <364a90bfebd1f362ebb7b48e4bf8ec010adef203@intel.com>


REM #!/bin/bash

set JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

rem # Restolino configuration
set RESTOLINO_STATIC="src/main/resources/files"
rem set RESTOLINO_STATIC="target/classes/files"
set RESTOLINO_CLASSES="target/classes"
set PACKAGE_PREFIX=com.github.onsdigital

rem # Elasticsearch
set BONSAI_URL=http://localhost:9200
set BONSAI_CLUSTERNAME=elasticsearch
set BONSAI_HOSTNAME=localhost
set BONSAI_TRANSPORT_PORT=9300

rem # Generate taxonomy
rem #mvn clean compile dependency:copy-dependencies && ^
rem #rm -rf src/main/taxonomy && ^
rem #java -cp "target/classes:target/dependency/*" com.github.onsdigital.generator.Csv

rem # Now build the JAR:
mvn -Dmaven.test.skip=true package && ^
^
rem # Development: reloadable ^
java $JAVA_OPTS -Drestolino.files=$RESTOLINO_STATIC -Drestolino.classes=$RESTOLINO_CLASSES -Drestolino.packageprefix=$PACKAGE_PREFIX -cp "target/dependency/*" com.github.davidcarboni.restolino.Main

rem # Production: non-reloadable
rem #java $JAVA_OPTS -jar target/*-jar-with-dependencies.jar

REM #!/bin/bash

set JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

rem # Restolino configuration
set RESTOLINO_STATIC="src/main/resources/files"
rem set RESTOLINO_STATIC="target/classes/files"
set RESTOLINO_CLASSES="target/classes"
set PACKAGE_PREFIX=com.github.onsdigital

rem # Elasticsearch
set BONSAI_URL=http://localhost:9200
set BONSAI_CLUSTERNAME=elasticsearch
set BONSAI_HOSTNAME=localhost
set BONSAI_TRANSPORT_PORT=9300

rem # Generate taxonomy
rem #mvn clean compile dependency:copy-dependencies && ^
rem #rm -rf src/main/taxonomy && ^
rem #java -cp "target/classes:target/dependency/*" com.github.onsdigital.generator.Csv

rem # Now build the JAR:
mvn -Dmaven.test.skip=true package && ^
rem # Development: reloadable ^
java $JAVA_OPTS -Drestolino.files=$RESTOLINO_STATIC -Drestolino.classes=$RESTOLINO_CLASSES -Drestolino.packageprefix=$PACKAGE_PREFIX -cp "target/dependency/*" com.github.davidcarboni.restolino.Main

rem # Production: non-reloadable
rem #java $JAVA_OPTS -jar target/*-jar-with-dependencies.jar

Tweak because it wasn't running

Tweak because it wasn't running


@ECHO OFF

SET target=Build
SET prerelease=

:: Check if NuGet package should be built
IF NOT '%1'=='' (
    SET target=MakeNuGetPackage

    :: Build a prerelease package
    IF NOT '%1'=='stable' (
        SET prerelease=%1
    )
)

SET MSBuildUseNoSolutionCache=1
SET msbuildexe="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"

%msbuildexe% Fluent.Ribbon.msbuild /target:%target% /property:Configuration=Release /property:Prerelease=%prerelease% /v:m /nologo

IF NOT ERRORLEVEL 0 EXIT /B %ERRORLEVEL%

@ECHO OFF

SET target=Build
SET prerelease=

:: Check if NuGet package should be built
IF NOT '%1'=='' (
    SET target=MakeNuGetPackage

    :: Build a prerelease package
    IF NOT '%1'=='stable' (
        SET prerelease=%1
    )
)

SET MSBuildUseNoSolutionCache=1
SET msbuildexe="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"

%msbuildexe% Fluent.Ribbon.msbuild /target:Build /property:Configuration=Debug /property:Prerelease=%prerelease% /v:m /nologo
%msbuildexe% Fluent.Ribbon.msbuild /target:%target% /property:Configuration=Release /property:Prerelease=%prerelease% /v:m /nologo

IF NOT ERRORLEVEL 0 EXIT /B %ERRORLEVEL%

pause

Build script now builds debug and release configuration


rem This script use MinGW to build the MDSP.
rem But still we use certain CygWin utilities: SVN

PATH=C:\mingw\bin\;c:\mingw\mingw32\bin\;c:\mingw\msys\1.0\bin;C:\MinGW\libexec\gcc\mingw32\4.5.0\;C:\cygwin\bin\;c:\buildbot\bin;%PATH%

set HOME=/c/buildbot/

bash mdsp_test_suite.sh mail

rem This script use MinGW to build the MDSP.
rem But still we use certain CygWin utilities: SVN

rem Currently MingGW version is disabled - we don't have validated Boost libs version for it.
exit

PATH=C:\mingw\bin\;c:\mingw\mingw32\bin\;c:\mingw\msys\1.0\bin;C:\MinGW\libexec\gcc\mingw32\4.5.0\;C:\cygwin\bin\;c:\buildbot\bin;%PATH%

set HOME=/c/buildbot/

bash mdsp_test_suite.sh mail

[trunk] Disable MinGW test - currently we don't have Boost libs verified for it.


@echo off
rem
rem function install
rem

setlocal ENABLEEXTENSIONS

set serviceName=Neo4j-Server
set serviceDisplayName="Neo4j Graph Database"
set serviceStartType=auto
set classpath="-DserverClasspath=lib/*.jar;system/lib/*.jar;plugins/**/*.jar;./conf*"
set mainclass="-DserverMainClass=org.neo4j.server.Bootstrapper"
set configFile="conf\neo4j-wrapper.conf"
set loggingProperties="-Djava.util.logging.config.file=conf\windows-wrapper-logging.properties"
set wrapperJarFilename=windows-service-wrapper-5.jar

goto :main %1

:getStatus
  set status=""

  rem get the state line from the sc output
  for /F "tokens=1,2 delims=:" %%a in ('sc query %serviceName%^|findstr "STATE"') do set status=%%b

  rem Remove ALL space, concatenating the numerical and the string - no prob
  set status=%status: =%

  rem done, if non existent it will be empty
  rem note that the strings we compare to normally
  rem have two spaces between numerical and
  rem string description. The substitution
  rem above swallowed these, though
  if "%status%" == "4RUNNING" (
    set status="RUNNING"
  ) else if "%status%" == "1STOPPED" (
    set status="STOPPED"
  ) else (
    set status="NOT INSTALLED"
  )
  goto:eof

:status
  call :getStatus
  echo %status%
  goto :eof

:install
  call "%~dps0functions.bat" :findJavaHome

  rem Remove quotes from javaPath so that it can have /bin/java appended to it
  rem See http://ss64.com/nt/syntax-esc.html, "Removing quotes"
  set javaPath=###%javaPath%###
  set javaPath=%javaPath:"###=%
  set javaPath=%javaPath:###"=%
  set javaPath=%javaPath:###=%

  set binPath="\"%javaPath%\bin\java.exe\" %loggingProperties% -DworkingDir="%~dp0.." -DconfigFile=%configFile% %classpath% %mainclass% -Dorg.neo4j.cluster.logdirectory="%~dps0..\data\log" -jar %~dps0%wrapperJarFilename%  %serviceName%"

  sc create "%serviceName%" binPath= %binPath% DisplayName= "%serviceDisplayName:"=%" start= %serviceStartType%
  sc start %serviceName%
  @echo off
  goto :eof

:remove
  call :stop
  sc delete %serviceName%
  goto :eof

:start
  call :getStatus
  if %status% == "NOT INSTALLED" (
    call:console
  ) else if %status% == "RUNNING" (
    echo Service is already running, no action taken
  ) else (
    sc start %serviceName%
  )
  goto :eof

:stop
  sc stop %serviceName%
  goto:eof

:restart
  call :stop
  call :start
  goto :eof

:usage
  echo Usage: %~0Neo4jInstaller.bat ^<install^|remove^>
  goto:eof

:main
  if "%1" == "" goto :usage
  if "%1" == "remove"  goto :remove
  if "%1" == "install" goto :install
  if "%1" == "stop" goto :stop
  if "%1" == "start" goto :start
  if "%1" == "status" goto :status
  call :usage
  goto :eof

rem end function remove

@echo off
rem
rem function install
rem

setlocal ENABLEEXTENSIONS

set serviceName=Neo4j-Server
set serviceDisplayName="Neo4j Graph Database"
set serviceStartType=auto
set classpath="-DserverClasspath=lib/*.jar;system/lib/*.jar;plugins/**/*.jar;./conf*"
set mainclass="-DserverMainClass=org.neo4j.server.Bootstrapper"
set configFile="conf\neo4j-wrapper.conf"
set loggingProperties="-Djava.util.logging.config.file=conf\windows-wrapper-logging.properties"
set wrapperJarFilename=windows-service-wrapper-5.jar

goto :main %1

:getStatus
  set status=""

  rem get the state line from the sc output
  for /F "tokens=1,2 delims=:" %%a in ('sc query %serviceName%^|findstr "STATE"') do set status=%%b

  rem Remove ALL space, concatenating the numerical and the string - no prob
  set status=%status: =%

  rem done, if non existent it will be empty
  rem note that the strings we compare to normally
  rem have two spaces between numerical and
  rem string description. The substitution
  rem above swallowed these, though
  if "%status%" == "4RUNNING" (
    set status="RUNNING"
  ) else if "%status%" == "1STOPPED" (
    set status="STOPPED"
  ) else (
    set status="NOT INSTALLED"
  )
  goto:eof

:status
  call :getStatus
  echo %status%
  goto :eof

:install
  call "%~dps0functions.bat" :findJavaHome
  if not "%javaHomeError%" == "" (
    echo %javaHomeError%
    call:instructions
    goto:eof
  )

  call:verifySupportedJavaVersion
  if not "%javaVersionError%" == "" (
    echo %javaVersionError%
    call:instructions
    goto:eof
  )
  rem Remove quotes from javaPath so that it can have /bin/java appended to it
  rem See http://ss64.com/nt/syntax-esc.html, "Removing quotes"
  set javaPath=###%javaPath%###
  set javaPath=%javaPath:"###=%
  set javaPath=%javaPath:###"=%
  set javaPath=%javaPath:###=%

  set binPath="\"%javaPath%\bin\java.exe\" %loggingProperties% -DworkingDir="%~dp0.." -DconfigFile=%configFile% %classpath% %mainclass% -Dorg.neo4j.cluster.logdirectory="%~dps0..\data\log" -jar %~dps0%wrapperJarFilename%  %serviceName%"

  sc create "%serviceName%" binPath= %binPath% DisplayName= "%serviceDisplayName:"=%" start= %serviceStartType%
  sc start %serviceName%
  @echo off
  goto :eof

:remove
  call :stop
  sc delete %serviceName%
  goto :eof

:start
  call :getStatus
  if %status% == "NOT INSTALLED" (
    call:console
  ) else if %status% == "RUNNING" (
    echo Service is already running, no action taken
  ) else (
    sc start %serviceName%
  )
  goto :eof

:stop
  sc stop %serviceName%
  goto:eof

:restart
  call :stop
  call :start
  goto :eof

:usage
  echo Usage: %~0Neo4jInstaller.bat ^<install^|remove^>
  goto:eof

:main
  if "%1" == "" goto :usage
  if "%1" == "remove"  goto :remove
  if "%1" == "install" goto :install
  if "%1" == "stop" goto :stop
  if "%1" == "start" goto :start
  if "%1" == "status" goto :status
  call :usage
  goto :eof

rem end function remove

:verifySupportedJavaVersion

  set javaVersionError=
  set javaCommand=%javaPath:"=%\bin\java.exe

  rem Remove leading spaces
  for /f "tokens=* delims= " %%a in ("%javaCommand%") do set javaCommand=%%a

  rem Find version
  for /f "usebackq tokens=3" %%g in (`"%javaCommand%" -version 2^>^&1`) do (
      set JAVAVER=%%g
      goto:breakJavaVersionLoop
  )
  :breakJavaVersionLoop

  set JAVAVER=%JAVAVER:"=%
  set "JAVAVER=%JAVAVER:~0,3%"

  if "%JAVAVER%"=="1.7" goto:eof
  if "%JAVAVER%"=="1.8" (
    echo ERROR! You are using an unsupported version of Java, please use Oracle HotSpot 1.7.
    goto:eof
  )
  set javaVersionError=ERROR! You are using an unsupported version of Java, please use Oracle HotSpot 1.7.
  goto:eof

:instructions
  echo * Please use Oracle(R) Java(TM) 7 to run Neo4j Server. Download "Java Platform (JDK) 7" from:
  echo   http://www.oracle.com/technetwork/java/javase/downloads/index.html
  echo * Please see http://docs.neo4j.org/ for Neo4j Server installation instructions.
  goto:eof

Make Neo4jInstaller.bat handle missing Java or wrong Java version


rmdir package\lib\net45 /s /q
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe" ..\Fitbit\Fitbit.sln /p:Configuration=Release /m
mkdir .\package\lib\net45
copy ..\Fitbit\bin\Release\* .\package\lib\net45\
nuget pack .\package\Fitbit.nuspec

rmdir package\lib\net45 /s /q
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" ..\Fitbit\Fitbit.sln /p:Configuration=Release /m
mkdir .\package\lib\net45
copy ..\Fitbit.Portable\bin\Release\* .\package\lib\net45\
nuget pack .\package\Fitbit.Public.nuspec -properties buildOutputPath=\lib\net45

fix for VS2017 MsBuild refs

fix for VS2017 MsBuild refs


@echo off

set PSDKDir=%PROGRAMFILES%\Microsoft SDKs\Windows\v6.1\a

for /F "tokens=2* delims=	 " %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1\WinSDKWin32Tools" /v InstallationFolder') do set PSDKDir=%%B

if exist "%PSDKDir%bin\SetEnvVS8.Cmd" (
  call "%PSDKDir%bin\SetEnvVS8.Cmd" %1 %2 %3 %4
) else (
  call "%PSDKDir%bin\SetEnv.Cmd" %1 %2 %3 %4
)

cl.exe 2> "%TEMP%\clver.txt" 1> NUL

for /F "tokens=7,8* delims=. " %%A in (%TEMP%\clver.txt) do (
  if "%%A"=="Version" (
    if "%KH_CLVER%"=="" (
      if "%%B"=="14" set KH_CLVER=vc8
      if "%%B"=="15" set KH_CLVER=vc9
      if "%%B"=="16" set KH_CLVER=vc10
    )
  ) else (
    if "%KH_CLVER%"=="" (
      if "%%A"=="14" set KH_CLVER=vc8
      if "%%A"=="15" set KH_CLVER=vc9
      if "%%A"=="16" set KH_CLVER=vc10
    )
  )
)

if "%KH_CLVER%"=="" echo Can't determine Visual C compiler version.  Please set KH_CLVER manually to vc8, vc9 or vc10.

del /q "%TEMP%\clver.txt"

set KH_ROOT=%CD%

set NODOCBUILD=1
if "%NODEBUG%"=="1" (
set KH_BUILD=RETAIL
) else (
set KH_BUILD=DEBUG
)
set KH_NO_W2K=1

set KH_RELEASE=PRIVATE

set KH_AUXCFLAGS=/wd4512 /wd4267 /wd4389 /wd4245 /wd4311 /wd4127 /wd4115 /wd4100

rem ------------------------------------------------------
rem setupbuild.local.cmd
rem ------------------------------------------------------
rem
rem  Use a setupbuild.local.cmd file to setup variables
rem  that are specific for your build environment.
rem  The following are required:
rem
rem  - perl.exe should on the system path
rem  - KH_DOXYFULLPATH should be the full path to doxygen.exe
rem  - KH_HHCFULLPATH should be the full path to hhc.exe
rem  - WIXDIR should be the directory containing WiX 2.x
rem  - ZIP should be the full path to 7-Zip command line executable
rem  - KH_KFWPATH should be the path to the MIT Kerberos for Windows installation
rem  - PISMERE Should be the pismere directory
rem  - CODESIGN Can be set to the command used to sign binaries

if exist setupbuild.local.cmd call setupbuild.local.cmd

@echo off
echo. Warning! If the mkdir being used is not what ships with Windows
echo  clean builds will fail due to Cygwin mkdir not supporting
echo  recursive directory creation.
echo.
echo  Also, the compiler may generate lots of warnings.  To suppress some
echo  of them, the KH_AUXCFLAGS environment variable was specified with
echo  a number of /wdxxxx flags.

@echo off

set PSDKDir=%PROGRAMFILES%\Microsoft SDKs\Windows\v6.1\

for /F "tokens=2* delims=	 " %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1\WinSDKWin32Tools" /v InstallationFolder') do set PSDKDir=%%B

if exist "%PSDKDir%bin\SetEnvVS8.Cmd" (
  call "%PSDKDir%bin\SetEnvVS8.Cmd" %1 %2 %3 %4
) else (
  call "%PSDKDir%bin\SetEnv.Cmd" %1 %2 %3 %4
)

cl.exe 2> "%TEMP%\clver.txt" 1> NUL

for /F "tokens=7,8* delims=. " %%A in (%TEMP%\clver.txt) do (
  if "%%A"=="Version" (
    if "%KH_CLVER%"=="" (
      if "%%B"=="14" set KH_CLVER=vc8
      if "%%B"=="15" set KH_CLVER=vc9
      if "%%B"=="16" set KH_CLVER=vc10
    )
  ) else (
    if "%KH_CLVER%"=="" (
      if "%%A"=="14" set KH_CLVER=vc8
      if "%%A"=="15" set KH_CLVER=vc9
      if "%%A"=="16" set KH_CLVER=vc10
    )
  )
)

if "%KH_CLVER%"=="" echo Can't determine Visual C compiler version.  Please set KH_CLVER manually to vc8, vc9 or vc10.

del /q "%TEMP%\clver.txt"

set KH_ROOT=%CD%

set NODOCBUILD=1
if "%NODEBUG%"=="1" (
set KH_BUILD=RETAIL
) else (
set KH_BUILD=DEBUG
)
set KH_NO_W2K=1

set KH_RELEASE=PRIVATE

set KH_AUXCFLAGS=/wd4512 /wd4267 /wd4389 /wd4245 /wd4311 /wd4127 /wd4115 /wd4100

rem ------------------------------------------------------
rem setupbuild.local.cmd
rem ------------------------------------------------------
rem
rem  Use a setupbuild.local.cmd file to setup variables
rem  that are specific for your build environment.
rem  The following are required:
rem
rem  - perl.exe should on the system path
rem  - KH_DOXYFULLPATH should be the full path to doxygen.exe
rem  - KH_HHCFULLPATH should be the full path to hhc.exe
rem  - WIXDIR should be the directory containing WiX 2.x
rem  - ZIP should be the full path to 7-Zip command line executable
rem  - KH_KFWPATH should be the path to the MIT Kerberos for Windows installation
rem  - PISMERE Should be the pismere directory
rem  - CODESIGN Can be set to the command used to sign binaries

if exist setupbuild.local.cmd call setupbuild.local.cmd

@echo off
echo. Warning! If the mkdir being used is not what ships with Windows
echo  clean builds will fail due to Cygwin mkdir not supporting
echo  recursive directory creation.
echo.
echo  Also, the compiler may generate lots of warnings.  To suppress some
echo  of them, the KH_AUXCFLAGS environment variable was specified with
echo  a number of /wdxxxx flags.

title NetIDMgr %CPU% %KH_BUILD% %KH_RELEASE%

Fix default path for Windows SDK and set title

setupbuild.cmd was using an incorrect default path for the Windows
SDK.

Also, the title of the command window for a Network Identity Manager
build environment now shows the target CPU, build type and the release
type.

Change-Id: Ic83354cf26fce08543229b039b2762d477d1c611


git config user.email "%1@outlook.com"
git config user.name "%1"
git remote set-url origin https://%1:%2@github.com/wasteam/waslibs.git
git checkout %3
git tag -a "%PackageVersionTag%" -m "Version built. %PackageVersionTag%"
git push origin %PackageVersionTag%

git config user.email "%1@outlook.com"
git config user.name "%1"
git remote set-url origin https://%1:%2@github.com/wasteam/waslibs.git
git tag -a "%3-%PackageVersionTag%" -m "Version built. %PackageVersionTag%"
git push origin %3-%PackageVersionTag%

Add build source

Add build source


@echo off
:: Copyright 2017 The Chromium Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.

REM Execute whatever is printed by autoninja.py.
REM Also print it to reassure that the right settings are being used.
FOR /f "usebackq tokens=*" %%a in (`python %~dp0autoninja.py "%*"`) do echo %%a & %%a

@echo off
:: Copyright 2017 The Chromium Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.

REM Execute whatever is printed by autoninja.py.
REM Also print it to reassure that the right settings are being used.
FOR /f "usebackq tokens=*" %%a in (`python %~dp0autoninja.py %*`) do echo %%a & %%a

Revert "Fix autoninja.bat to not swallow ^^ sequences"

This reverts commit ee3946be4e5237f443a5cc2aa2ec2fa75495539b.

Reason for revert: This broke autoninja. The arguments all come in as one and aren't recognized. I think I can fix but I'm reverting for now.

Original change's description:
> Fix autoninja.bat to not swallow ^^ sequences
>
> Ninja uses the '^' character to indicate that ninja should build the
> targets that are generated from the specified file, rather than
> building the specified file. On Windows '^^' is needed because '^' is
> the line continuation character. However autoninja.bat complicates
> things because the multiple levels of batch files successfully swallow
> pairs of '^' characters.
>
> By adding quotes around %* in autoninja.bat it becomes possible to
> invoke autoninja.bat normally. That is, this works:
>
>     autoninja -C out\debug_component ..\..\base\win\enum_variant.cc^^
>
> It can be convenient to have a ninja.bat file which starts goma and lets
> users keep typing the same build commands. However even with this fix
> the previously recommended ninja.bat file requires four '^' characters.
> If that is too much then the new recommended ninja.bat is to copy
> autoninja.bat and modify as needed, perhaps like this:
>
>     @echo off
>     call python c:\goma\goma-win64\goma_ctl.py ensure_start >nul
>     FOR /f "usebackq tokens=*" %%a in (`python c:\src\depot_tools\autoninja.py "%*"`) do echo %%a & %%a
>
> BUG=758725
>
> Change-Id: I648cf42675af2f946be7aa4033956b015d953829
> Reviewed-on: https://chromium-review.googlesource.com/651826
> Reviewed-by: Sébastien Marchand <sebmarchand@chromium.org>
> Reviewed-by: Dirk Pranke <6693ee08b084bb2ffa767f664c99b689395e0e4b@chromium.org>
> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>

TBR=6693ee08b084bb2ffa767f664c99b689395e0e4b@chromium.org,brucedawson@chromium.org,sebmarchand@chromium.org

Change-Id: I131b9ba00882acb5a2d009a2a444f186740d7394
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 758725
Reviewed-on: https://chromium-review.googlesource.com/654117
Commit-Queue: Dirk Pranke <6693ee08b084bb2ffa767f664c99b689395e0e4b@chromium.org>
Reviewed-by: Dirk Pranke <6693ee08b084bb2ffa767f664c99b689395e0e4b@chromium.org>


@echo off

%PHP_SDK_PHP_CMD% %~dp0dllmap.php %*

add wrapper for dllmap.php

add wrapper for dllmap.php


@set result=0

set boxname=%1

@if "%boxname%x"=="x" (
  echo "No boxname given!"
  result = 5
  goto :done
)

vagrant plugin install vagrant-serverspec

rem use a local box
vagrant box add box-cutter/ubuntu1404-desktop http://roecloudsrv001/vagrant/ubuntu1404-desktop_vmware.box --force

rem create and test the box
vagrant up --provider=vmware_workstation
if ERRORLEVEL 1 set result=%ERRORLEVEL%

@echo Take a screenshot
set /p vmx=< .vagrant\machines\default\vmware_workstation\id
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" -gu vagrant -gp vagrant captureScreen %vmx% screenshot.png

vagrant halt

set ova=%boxname%.ova
del /F "%ova%"
@echo Create OVA from VMX
ovftool "%vmx%" "%ova%"
if ERRORLEVEL 1 set result=%ERRORLEVEL%

rem vagrant destroy -f

rem remove the local box
vagrant box remove box-cutter/ubuntu1404-desktop --provider=vmware_desktop

:done
exit %result%

@set result=0

set boxname=%1

@if "%boxname%x"=="x" (
  echo "No boxname given!"
  result = 5
  goto :done
)

vagrant plugin install vagrant-serverspec

rem use a local box
vagrant box add box-cutter/ubuntu1404-desktop http://roecloudsrv001/vagrant/ubuntu1404-desktop_vmware.box --force

rem create and test the box
vagrant up --provider=vmware_workstation
if ERRORLEVEL 1 set result=%ERRORLEVEL%

@echo Take a screenshot
set /p vmx=< .vagrant\machines\default\vmware_workstation\id
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" -gu vagrant -gp vagrant captureScreen %vmx% screenshot.png

vagrant halt

set ova=%boxname%.ova
del /F "%ova%"
@echo Create OVA from VMX
ovftool "%vmx%" "%ova%"
if ERRORLEVEL 1 set result=%ERRORLEVEL%

vagrant destroy -f

rem remove the local box
vagrant box remove box-cutter/ubuntu1404-desktop --provider=vmware_desktop

:done
exit %result%

destroy vm

destroy vm


@if not defined _echo @echo off
setlocal

if not defined BuildConfiguration SET BuildConfiguration=Debug

SET CMDHOME=%~dp0
@REM Remove trailing backslash \
set CMDHOME=%CMDHOME:~0,-1%

:: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and
:: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69).
set Platform=

:: Disable multilevel lookup https://github.com/dotnet/core-setup/blob/main/Documentation/design-docs/multilevel-sharedfx-lookup.md
set DOTNET_MULTILEVEL_LOOKUP=0

pushd "%CMDHOME%"
@cd

SET TestResultDir=%CMDHOME%\Binaries\%BuildConfiguration%\TestResults

if not exist %TestResultDir% md %TestResultDir%

SET _Directory=bin\%BuildConfiguration%\net461\win10-x64

set TESTS=^
'%CMDHOME%\test\Extensions\TesterAzureUtils',^
'%CMDHOME%\test\TesterInternal',^
'%CMDHOME%\test\Tester',^
'%CMDHOME%\test\DefaultCluster.Tests',^
'%CMDHOME%\test\NonSilo.Tests',^
'%CMDHOME%\test\Extensions\AWSUtils.Tests',^
'%CMDHOME%\test\Extensions\Consul.Tests',^
'%CMDHOME%\test\Extensions\ServiceBus.Tests',^
'%CMDHOME%\test\Extensions\TestServiceFabric',^
'%CMDHOME%\test\Extensions\TesterAdoNet',^
'%CMDHOME%\test\Extensions\TesterZooKeeperUtils',^
'%CMDHOME%\test\Transactions\Orleans.Transactions.Tests',^
'%CMDHOME%\test\Transactions\Orleans.Transactions.Azure.Test',^
'%CMDHOME%\test\TestInfrastructure\Orleans.TestingHost.Tests',^
'%CMDHOME%\test\DependencyInjection.Tests',^
'%CMDHOME%\test\Orleans.Connections.Security.Tests',^
'%CMDHOME%\test\Analyzers.Tests'"

@Echo Test assemblies = %TESTS%

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& ./Parallel-Tests.ps1 -directories %TESTS% -dotnet '%_dotnet%'"
set testresult=%errorlevel%
popd
endlocal&set testresult=%testresult%
exit /B %testresult%

@if not defined _echo @echo off
setlocal

if not defined BuildConfiguration SET BuildConfiguration=Debug

SET CMDHOME=%~dp0
@REM Remove trailing backslash \
set CMDHOME=%CMDHOME:~0,-1%

:: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and
:: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69).
set Platform=

:: Disable multilevel lookup https://github.com/dotnet/core-setup/blob/main/Documentation/design-docs/multilevel-sharedfx-lookup.md
set DOTNET_MULTILEVEL_LOOKUP=0

pushd "%CMDHOME%"
@cd

SET TestResultDir=%CMDHOME%\Binaries\%BuildConfiguration%\TestResults

if not exist %TestResultDir% md %TestResultDir%

SET _Directory=bin\%BuildConfiguration%\net461\win10-x64

set TESTS=^
'%CMDHOME%\test\Extensions\TesterAzureUtils',^
'%CMDHOME%\test\TesterInternal',^
'%CMDHOME%\test\Tester',^
'%CMDHOME%\test\DefaultCluster.Tests',^
'%CMDHOME%\test\NonSilo.Tests',^
'%CMDHOME%\test\Extensions\AWSUtils.Tests',^
'%CMDHOME%\test\Extensions\Consul.Tests',^
'%CMDHOME%\test\Extensions\ServiceBus.Tests',^
'%CMDHOME%\test\Extensions\TesterAdoNet',^
'%CMDHOME%\test\Extensions\TesterZooKeeperUtils',^
'%CMDHOME%\test\Transactions\Orleans.Transactions.Tests',^
'%CMDHOME%\test\Transactions\Orleans.Transactions.Azure.Test',^
'%CMDHOME%\test\TestInfrastructure\Orleans.TestingHost.Tests',^
'%CMDHOME%\test\DependencyInjection.Tests',^
'%CMDHOME%\test\Orleans.Connections.Security.Tests',^
'%CMDHOME%\test\Analyzers.Tests'"

@Echo Test assemblies = %TESTS%

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& ./Parallel-Tests.ps1 -directories %TESTS% -dotnet '%_dotnet%'"
set testresult=%errorlevel%
popd
endlocal&set testresult=%testresult%
exit /B %testresult%

Remove TestServiceFabric from Test.cmd (#7822)


@echo off
REM Run tests on Windows.
REM
REM To run these tests, you should set up your Windows machine with the same
REM paths that are used in AppVeyor.

set tests=test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*/*.vader

REM Use the first argument for selecting tests to run.
if not "%1"=="" set tests=%1

set VADER_OUTPUT_FILE=%~dp0\vader_output
type nul > "%VADER_OUTPUT_FILE%"
C:\vim\vim\vim80\vim.exe -u test/vimrc "+Vader! %tests%"
type "%VADER_OUTPUT_FILE%"
del "%VADER_OUTPUT_FILE%"

Add a Batch script for running tests on Windows


use the simple nodejs http-server

use the simple nodejs http-server


@echo off

REM ELMAH - Error Logging Modules and Handlers for ASP.NET
REM Copyright (c) 2007 Atif Aziz. All rights reserved.
REM
REM  Author(s):
REM
REM      Atif Aziz, http://www.raboof.com
REM
REM This library is free software; you can redistribute it and/or modify it
REM under the terms of the New BSD License, a copy of which should have
REM been delivered along with this distribution.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
REM PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
REM OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
REM SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
REM LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
REM DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
REM THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
REM (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
REM OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
REM
REM -------------------------------------------------------------------------
REM

setlocal

REM Check if delayed evaluation of environment variables is enabled.
REM If not then re-start the script with them enabled.

set DELAY_TEST=test
if not "!DELAY_TEST!"=="test" (
    cmd /v /c "%0"
    goto :eof
)
pushd "%~dp0"

set LIB_PATH_x64=lib\x64
set BIN_PATH=bin\net-2.0\Release
set DEMO_PATH=samples\Demo
set DEMO_BIN_PATH=%DEMO_PATH%\bin
set DEMO_PORT=54321
set TOOLS_PATH=tools

if exist "%SystemRoot%\Microsoft.NET\Framework\v2.0.50727" goto go

echo The .NET Framework 2.0 does not appear to be installed on this
echo machine, which is required to run the demo Web site.
set /p answer=Proceed anyway?
if "%answer%"=="y" goto go
if "%answer%"=="Y" goto go
exit /b 1

:go
if not exist "%BIN_PATH%" call build 2.0
if not exist "%DEMO_BIN_PATH%" md "%DEMO_BIN_PATH%"
copy /y "%BIN_PATH%" "%DEMO_BIN_PATH%"

if %PROCESSOR_ARCHITECTURE%==AMD64 copy /y "%LIB_PATH_x64%\System.Data.SQLite.DLL" "%DEMO_BIN_PATH%"

set MAIL_PATH=%DEMO_PATH%\Mails
if not exist "%MAIL_PATH%" md "%MAIL_PATH%"
if not exist "%DEMO_PATH%\App_Data" md "%DEMO_PATH%\App_Data"
if exist "%DEMO_PATH%\Web.config" del "%DEMO_PATH%\Web.config"
for /f "tokens=* delims=" %%i in (%DEMO_PATH%\Web.config.template) do (
    set LINE=%%i
    echo !LINE:{pickupDirectoryLocation}=%cd%\%MAIL_PATH%! >> "%DEMO_PATH%\Web.config"
)

start /min %TOOLS_PATH%\Cassini\Cassini "%cd%\%DEMO_PATH%" %DEMO_PORT% --launch

popd

@echo off

REM ELMAH - Error Logging Modules and Handlers for ASP.NET
REM Copyright (c) 2007 Atif Aziz. All rights reserved.
REM
REM  Author(s):
REM
REM      Atif Aziz, http://www.raboof.com
REM
REM This library is free software; you can redistribute it and/or modify it
REM under the terms of the New BSD License, a copy of which should have
REM been delivered along with this distribution.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
REM PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
REM OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
REM SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
REM LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
REM DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
REM THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
REM (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
REM OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
REM
REM -------------------------------------------------------------------------
REM

setlocal
pushd "%~dp0"
call :main %*
popd
goto :EOF

:main
set DEMO_PORT=51296
set IIS_EXPRESS_PATH=%ProgramFiles%\IIS Express\iisexpress.exe
if not exist "%IIS_EXPRESS_PATH%" (
    echo The demo site requires Microsoft IIS Express for hosting but IIS Express does
    echo not appear to be installed on this system. Download and install IIS Express
    echo and then try to run this script again. Use the following Google search to
    echo look for IIS Express downloads on microsoft.com:
    echo.
    echo   https://www.google.com/search?q=site:microsoft.com+iis+express+download
    exit /b 1
)
call prestore ^
  && msbuild Elmah.sln "/p:Configuration=NETFX 4.5 Debug;AspNetConfiguration=Debug" /v:m ^
  && start "ELMAH Demo on IIS Express" /min "%IIS_EXPRESS_PATH%" "/path:%cd%\samples\Demo" /port:%DEMO_PORT% ^
  && echo The demo web site will launching in a moment...^
  && timeout /t:3 ^
  && start http://localhost:%DEMO_PORT%/
goto :EOF

REM Check if delayed evaluation of environment variables is enabled.
REM If not then re-start the script with them enabled.

set DELAY_TEST=test
if not "!DELAY_TEST!"=="test" (
    cmd /v /c "%0"
    goto :eof
)
pushd "%~dp0"

set LIB_PATH_x64=lib\x64
set BIN_PATH=bin\net-2.0\Release
set DEMO_PATH=samples\Demo
set DEMO_BIN_PATH=%DEMO_PATH%\bin
set DEMO_PORT=54321
set TOOLS_PATH=tools

if exist "%SystemRoot%\Microsoft.NET\Framework\v2.0.50727" goto go

echo The .NET Framework 2.0 does not appear to be installed on this
echo machine, which is required to run the demo Web site.
set /p answer=Proceed anyway?
if "%answer%"=="y" goto go
if "%answer%"=="Y" goto go
exit /b 1

:go
call build
if not exist "%DEMO_BIN_PATH%" md "%DEMO_BIN_PATH%"
copy /y "%BIN_PATH%" "%DEMO_BIN_PATH%"

if %PROCESSOR_ARCHITECTURE%==AMD64 copy /y "%LIB_PATH_x64%\System.Data.SQLite.DLL" "%DEMO_BIN_PATH%"

set MAIL_PATH=%DEMO_PATH%\Mails
if not exist "%MAIL_PATH%" md "%MAIL_PATH%"
if not exist "%DEMO_PATH%\App_Data" md "%DEMO_PATH%\App_Data"
if exist "%DEMO_PATH%\Web.config" del "%DEMO_PATH%\Web.config"
for /f "tokens=* delims=" %%i in (%DEMO_PATH%\Web.config.template) do (
    set LINE=%%i
    echo !LINE:{pickupDirectoryLocation}=%cd%\%MAIL_PATH%! >> "%DEMO_PATH%\Web.config"
)

start /min %TOOLS_PATH%\Cassini\Cassini "%cd%\%DEMO_PATH%" %DEMO_PORT% --launch

popd

Use IIE Express instead of Cassini for demo site