@echo off

setlocal EnableDelayedExpansion

Rem Run UnRAVL's main entry point.
Rem Command line arguments are UnRAVL script files to execute:
Rem unravl.bat script1.json script2.json script3.json
Rem See https://github.com/sassoftware/unravl

set UNRAVL_DIR=%~dp0..
set UNRAVL_DEV_DIR=%~dp0..\..\..
Rem echo !UNRAVL_DIR!
Rem echo !UNRAVL_DEV_DIR!

if exist !UNRAVL_DIR!\lib (
  Rem This works for a distribution, where UNRAVL is deployed in !UNRAVL_DIR!
  Rem the script is in !UNRAVL_DIR!\bin,
  Rem and all the dependent jars are in  !UNRAVL_DIR\lib!
  set UNRAVL_CLASSPATH=!UNRAVL_DIR!\lib/*;
) else (
  if exist !UNRAVL_DEV_DIR!\build\output\lib (
    Rem This is for use in the build environment where the script
    Rem is in src/main/bin
    Rem Build with:
    Rem    .\gradlew clean build
    Rem Gradle will put the UnRAVL jar in build/libs
    Rem and dependent jars in build/output/lib
    set UNRAVL_JAR_DIR=!UNRAVL_DEV_DIR!\build\libs
    set UNRAVL_LIB_DIR=!UNRAVL_DEV_DIR!\build\output\lib
    set UNRAVL_CLASSPATH=!UNRAVL_LIB_DIR!/*;!UNRAVL_JAR_DIR!/*;
    Rem echo UNRAVL_CLASSPATH is !UNRAVL_CLASSPATH!
  ) else (
    echo !UNRAVL_DIR! does not contain libraries !UNRAVL_DIR! build\libs
    echo !UNRAVL_DEV_DIR! does not contain libraries in !UNRAVL_DEV_DIR!\build\libs
    echo If in development, run:
    echo   .\gradlew clean build
    exit /B 1
  )
)

if not ["%JAVA_HOME%"] == [""] (
   PATH=%JAVA_HOME%\bin;%PATH%
)

java -Dapp.name=UNRAVL ^
       -classpath "%UNRAVL_CLASSPATH%" ^
       %UNRAVL_OPT% ^
       com.sas.unravl.Main ^
       %*

endlocal

@echo off

setlocal EnableDelayedExpansion

Rem Run UnRAVL's main entry point.
Rem Command line arguments are UnRAVL script files to execute:
Rem unravl.bat script1.json script2.json script3.json
Rem See https://github.com/sassoftware/unravl

set UNRAVL_DIR=%~dp0..
set UNRAVL_DEV_DIR=%~dp0..\..\..
Rem echo !UNRAVL_DIR!
Rem echo !UNRAVL_DEV_DIR!

if exist !UNRAVL_DIR!\lib (
  Rem This works for a distribution, where UNRAVL is deployed in !UNRAVL_DIR!
  Rem the script is in !UNRAVL_DIR!\bin,
  Rem and all the dependent jars are in  !UNRAVL_DIR\lib!
  set UNRAVL_CLASSPATH=!UNRAVL_DIR!\lib/*;
) else (
  if exist !UNRAVL_DEV_DIR!\build\output\lib (
    Rem This is for use in the build environment where the script
    Rem is in src/main/bin
    Rem Build with:
    Rem    .\gradlew clean build
    Rem Gradle will put the UnRAVL jar in build\libs
    Rem and dependent jars in build\output\lib
    set UNRAVL_JAR_DIR=!UNRAVL_DEV_DIR!\build\libs
    set UNRAVL_LIB_DIR=!UNRAVL_DEV_DIR!\build\output\lib
    set UNRAVL_CLASSPATH=!UNRAVL_LIB_DIR!/*;!UNRAVL_JAR_DIR!/*;
    Rem echo UNRAVL_CLASSPATH is !UNRAVL_CLASSPATH!
  ) else (
    echo No libraries found in lib or build\libs;build\output\lib
    echo If in development, run:
    echo   .\gradlew clean build
    exit /B 1
  )
)

if not ["%JAVA_HOME%"] == [""] (
   PATH=%JAVA_HOME%\bin;%PATH%
)

java -Dapp.name=UNRAVL ^
       -classpath "%UNRAVL_CLASSPATH%" ^
       %UNRAVL_OPT% ^
       com.sas.unravl.Main ^
       %*

endlocal

improve bat script

improve bat script


cmake -DBUILD_SHARED_LIBS=ON .
cmake --build . --config=release
cmake --install . --config=release --prefix="%PREFIX%"

cmake -DBUILD_SHARED_LIBS=ON .
cmake --build . --config=release
cmake --install . --config=release --prefix="%LIBRARY_PREFIX%"

Update recipes/quartet/bld.bat

Update recipes/quartet/bld.bat

Co-authored-by: Uwe L. Korn <61df1ade108ad4f778ae80c035cf888799bb0fe0@users.noreply.github.com>


@echo off

goto entry

:usage
  echo usage: bolt build [-c^|--config CONFIG_JS] [-o^|--output OUTPUT_DIR] [-s^|--src-dir SRC_DIR]
  echo                   [-i^|--inline] [-n^|--invoke-main MAIN_MODULE] [-r^|--register]
  echo                   [-m^|--modules] [-e^|--entry-points FILE ...] [-g^|--entry-group NAME FILE ...]
  echo.
  echo options:
  echo   -c^|--config CONFIG_JS         override bolt configuration file
  echo                                    default: config/bolt/prod.js
  echo   -o^|--output OUTPUT_DIR         override output directory, note this is different
  echo                                  to the jsc compile directory, the compiled output,
  echo                                  will be located at $OUTPUT_DIR/compile
  echo                                    default: scratch/main/js
  echo   -s^|--src-dir SRC_DIR           override source directory
  echo                                    default: src/main/js
  echo   -i^|--inline                    enable generation of inline scripts (only produces output
  echo                                  in conjunction with -e or -g).
  echo   -n^|--invoke-main MAIN_MODULE   specify main module of inline scripts.
  echo   -r^|--register                  register modules in global namespace for inline scripts,
  echo                                  this will default to true unless -n is specified.
  echo   -m^|--modules                   enable generation of flat module files.
  echo   -e^|--entry-points FILE ...     specify a set of entry points, a compiled output
  echo                                  will be generated for each entry point. Multiple
  echo                                  -e flags may be specified.
  echo   -g^|--entry-group NAME FILE ... specify an entry group, a single compiled output
  echo                                  will be generated with NAME for each entry-group.
  echo                                  Multiple -g flags may be specified.
  echo.
  echo example:
  echo   Produce a bolt build for a top level application. A compiled file will be
  echo   generated for each Main module in this example.
  echo.
  echo     bolt build -e src/main/js/**/*Main.js
  echo.
  echo.
  echo   Produce a bolt build for a top level library. A self contained script registering
  echo   all modules in their namespace will be produced.
  echo.
  echo     bolt build -i -g example src/main/js/**/api/*.js
  echo.
  echo.
  echo   Produce a bolt build for a general purpose library, in this build we only want
  echo   modules to be produced, no compiled output.
  echo.
  echo     bolt build -m src/main/js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:is_dir
  setlocal
  set olddir=%CD%
  cd /D "%~1" 2>NUL
  set err=%errorlevel%
  cd /D "%olddir%"
  exit /b %err%

:entry

if "%help_mode%"=="true" call :usage && exit /b 0

set targets=
set count_targets=0
set count_entry_point=0
set count_entry_group_name=0

:parse_flags
  set flag=%~1
  if not "%flag:~0,1%"=="-" goto done_parse_flags
  shift

  if "%flag%"=="-c" goto parse_config
  if "%flag%"=="--config" goto parse_config
  if "%flag%"=="-o" goto parse_output
  if "%flag%"=="--output" goto parse_output
  if "%flag%"=="-s" goto parse_src
  if "%flag%"=="--src-dir" goto parse_src
  if "%flag%"=="-n" goto parse_invoke
  if "%flag%"=="--invoke-main" goto parse_invoke
  if "%flag%"=="-r" goto parse_register
  if "%flag%"=="--register" goto parse_register
  if "%flag%"=="-i" goto parse_inline
  if "%flag%"=="--inline" goto parse_inline
  if "%flag%"=="-m" goto parse_modules
  if "%flag%"=="--modules" goto parse_modules
  if "%flag%"=="-e" goto parse_points
  if "%flag%"=="--entry-points" goto parse_points
  if "%flag%"=="-g" goto parse_group
  if "%flag%"=="--entry-group" goto parse_group
  if "%flag%"=="--" goto done_parse_flags
  echo invalid flag [%flag%] && goto fail_usage

  goto parse_flags

  :parse_config
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set config_js=%~1
    shift
  goto parse_flags

  :parse_output
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set output_dir=%~1
    shift
  goto parse_flags

  :parse_src
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set src_dir=%~1
    shift
  goto parse_flags

  :parse_invoke
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set invoke_main_flag=-n "%~1"
    shift
  goto parse_flags

  :parse_register
    set register_modules_flag=-r
  goto parse_flags

  :parse_inline
    set generate_inline=true
  goto parse_flags

  :parse_modules
    set generate_modules=true
  goto parse_flags

  :parse_points
    :point_loop
      set entry=%~1
      if "%entry%"=="" goto end_point_loop
      if "%entry:~0,1%"=="-" goto end_point_loop
      shift

      if not exist "%entry%" echo specified file for entry point not found [%entry%] && goto fail
      call :is_dir "%entry%"
      if %errorlevel%==0 echo specified file for entry point not found [%entry%] && goto fail

      set entry_point_%count_entry_point%=%entry%
      set /a count_entry_point=%count_entry_point% + 1
    goto point_loop
    :end_point_loop
  goto parse_flags

  :parse_group
    if "%~2"=="" echo %flag% requires two arguments to be specified && goto fail_usage
    set name=%~1
    shift

    echo.%name%| findstr /C:"/" >NUL 2>&1 && echo entry group name must not contain special characters >&2 && goto fail

    set entry_group_name_%count_entry_group_name%=%name%
    set /a count_entry_group_name=%count_entry_group_name% + 1

    set safe_name=%name:-=_%
    set /a count_entry_groups_%safe_name%=0

    :group_loop
      set file=%~1
      if "%file%"=="" goto end_group_loop
      if "%file:~0,1%"=="-" goto end_group_loop
      shift

      if not exist "%file%" echo specified file for entry group not found [%file%] && goto fail
      call :is_dir "%file%"
      if %errorlevel%==0 echo specified file for entry group not found [%file%] && goto fail

      set count=!count_entry_groups_%safe_name%!
      set entry_groups_%safe_name%_%count%=%file%
      set /a count_entry_groups_%safe_name%=%count% + 1
    goto group_loop
    :end_group_loop
  goto parse_flags

:done_parse_flags

if "%config_js%"=="" set config_js=config/bolt/prod.js
if "%output_dir%"=="" set output_dir=scratch/main/js
if "%src_dir%"=="" set src_dir=src/main/js
if "%generate_inline%"=="" set generate_inline=false
if "%generate_modules%"=="" set generate_modules=false

goto dispatch

:bolt_inline
  set target=%~1
  set name=%~2
  mkdir "%output_dir%/inline" 2> NUL
  call "%base%jsc.bat" inline -c "%config_js%" %invoke_main_flag% %register_modules_flag% "%target%" "%output_dir%/inline/%name%.js" || exit /b %errorlevel%
  exit /b 0

:bolt_point
  mkdir "%output_dir%/compile" 2>NUL

  set /a num=%count_entry_point% - 1
  for /L %%i in (0,1,%num%) do (
    rem iterate through the array
    set file=!entry_point_%%i!
    for /F "usebackq delims=" %%j in (`""%base%jsc" identify "!file!""`) do set name=%%j
    set target=!output_dir!\compile\!name!.js

    rem add to targets variable so things can be linked later
    set targets=!targets! "!target!"
    set /a count_targets=!count_targets! + 1

    call "!base!jsc.bat" compile -c "%config_js%" "!file!" "!target!" || exit /b !errorlevel!

    if "%generate_inline%"=="true" call :bolt_inline "!target!" "!name!"
  )
  exit /b 0

:bolt_group
  echo bolt_group unimplemented.
  exit /b 0

:bolt_link
  call "%base%jsc.bat" link -c "%config_js%" %targets% "%output_dir%/compile/bootstrap.js" || exit /b %errorlevel%
  exit /b 0

:bolt_modules
  mkdir "%output_dir%/module" 2>NUL
  set olddir=%CD%
  cd /D "%output_dir%/module"
  for /F "usebackq delims=" %%i in (`cd`) do set module_dir=%%i
  cd /D "%olddir%"
  cd /D "%src_dir%"
  for /F "usebackq delims=" %%m in (`glob **\*.js`) do (set module=%%m) && copy "%%m" "%module_dir%\!module:\=.!" >NUL
  cd /D "%olddir%"
  exit /b 0

:dispatch

if %count_entry_point% GTR 0 call :bolt_point || exit /b %errorlevel%
if %count_entry_group_name% GTR 0 call :bolt_group || exit /b %errorlevel%
if %count_targets% GTR 0 call :bolt_link || exit /b %errorlevel%
if "%generate_modules%"=="true" call :bolt_modules || exit /b %errorlevel%

exit /b 0

@echo off

goto entry

:usage
  echo usage: bolt build [-c^|--config CONFIG_JS] [-o^|--output OUTPUT_DIR] [-s^|--src-dir SRC_DIR]
  echo                   [-i^|--inline] [-n^|--invoke-main MAIN_MODULE] [-r^|--register]
  echo                   [-m^|--modules] [-e^|--entry-points FILE ...] [-g^|--entry-group NAME FILE ...]
  echo.
  echo options:
  echo   -c^|--config CONFIG_JS         override bolt configuration file
  echo                                    default: config/bolt/prod.js
  echo   -o^|--output OUTPUT_DIR         override output directory, note this is different
  echo                                  to the jsc compile directory, the compiled output,
  echo                                  will be located at $OUTPUT_DIR/compile
  echo                                    default: scratch/main/js
  echo   -s^|--src-dir SRC_DIR           override source directory
  echo                                    default: src/main/js
  echo   -i^|--inline                    enable generation of inline scripts (only produces output
  echo                                  in conjunction with -e or -g).
  echo   -n^|--invoke-main MAIN_MODULE   specify main module of inline scripts.
  echo   -r^|--register                  register modules in global namespace for inline scripts,
  echo                                  this will default to true unless -n is specified.
  echo   -m^|--modules                   enable generation of flat module files.
  echo   -e^|--entry-points FILE ...     specify a set of entry points, a compiled output
  echo                                  will be generated for each entry point. Multiple
  echo                                  -e flags may be specified.
  echo   -g^|--entry-group NAME FILE ... specify an entry group, a single compiled output
  echo                                  will be generated with NAME for each entry-group.
  echo                                  Multiple -g flags may be specified.
  echo.
  echo example:
  echo   Produce a bolt build for a top level application. A compiled file will be
  echo   generated for each Main module in this example.
  echo.
  echo     bolt build -e src/main/js/**/*Main.js
  echo.
  echo.
  echo   Produce a bolt build for a top level library. A self contained script registering
  echo   all modules in their namespace will be produced.
  echo.
  echo     bolt build -i -g example src/main/js/**/api/*.js
  echo.
  echo.
  echo   Produce a bolt build for a general purpose library, in this build we only want
  echo   modules to be produced, no compiled output.
  echo.
  echo     bolt build -m src/main/js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:is_dir
  setlocal
  set olddir=%CD%
  cd /D "%~1" 2>NUL
  set err=%errorlevel%
  cd /D "%olddir%"
  exit /b %err%

:entry

if "%help_mode%"=="true" call :usage && exit /b 0

set targets=
set count_targets=0
set count_entry_point=0
set count_entry_group_name=0

:parse_flags
  set flag=%~1
  if not "%flag:~0,1%"=="-" goto done_parse_flags
  shift

  if "%flag%"=="-c" goto parse_config
  if "%flag%"=="--config" goto parse_config
  if "%flag%"=="-o" goto parse_output
  if "%flag%"=="--output" goto parse_output
  if "%flag%"=="-s" goto parse_src
  if "%flag%"=="--src-dir" goto parse_src
  if "%flag%"=="-n" goto parse_invoke
  if "%flag%"=="--invoke-main" goto parse_invoke
  if "%flag%"=="-r" goto parse_register
  if "%flag%"=="--register" goto parse_register
  if "%flag%"=="-i" goto parse_inline
  if "%flag%"=="--inline" goto parse_inline
  if "%flag%"=="-m" goto parse_modules
  if "%flag%"=="--modules" goto parse_modules
  if "%flag%"=="-e" goto parse_points
  if "%flag%"=="--entry-points" goto parse_points
  if "%flag%"=="-g" goto parse_group
  if "%flag%"=="--entry-group" goto parse_group
  if "%flag%"=="--" goto done_parse_flags
  echo invalid flag [%flag%] && goto fail_usage

  goto parse_flags

  :parse_config
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set config_js=%~1
    shift
  goto parse_flags

  :parse_output
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set output_dir=%~1
    shift
  goto parse_flags

  :parse_src
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set src_dir=%~1
    shift
  goto parse_flags

  :parse_invoke
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set invoke_main_flag=-n "%~1"
    shift
  goto parse_flags

  :parse_register
    set register_modules_flag=-r
  goto parse_flags

  :parse_inline
    set generate_inline=true
  goto parse_flags

  :parse_modules
    set generate_modules=true
  goto parse_flags

  :parse_points
    :point_loop
      set entry=%~1
      if "%entry%"=="" goto end_point_loop
      if "%entry:~0,1%"=="-" goto end_point_loop
      shift

      if not exist "%entry%" echo specified file for entry point not found [%entry%] && goto fail
      call :is_dir "%entry%"
      if %errorlevel%==0 echo specified file for entry point not found [%entry%] && goto fail

      set entry_point_%count_entry_point%=%entry%
      set /a count_entry_point=%count_entry_point% + 1
    goto point_loop
    :end_point_loop
  goto parse_flags

  :parse_group
    if "%~2"=="" echo %flag% requires two arguments to be specified && goto fail_usage
    set name=%~1
    shift

    echo.%name%| findstr /C:"/" >NUL 2>&1 && echo entry group name must not contain special characters >&2 && goto fail

    set entry_group_name_%count_entry_group_name%=%name%
    set current_entry_group=%count_entry_group_name%
    set /a count_entry_group_name=%count_entry_group_name% + 1

    set entry_group_files_%current_entry_group%=

    :group_loop
      set file=%~1
      if "%file%"=="" goto end_group_loop
      if "%file:~0,1%"=="-" goto end_group_loop
      shift

      if not exist "%file%" echo specified file for entry group not found [%file%] && goto fail
      call :is_dir "%file%"
      if %errorlevel%==0 echo specified file for entry group not found [%file%] && goto fail

      set entry_group_files_%current_entry_group%="%file%" !entry_group_files_%current_entry_group%!
    goto group_loop
    :end_group_loop
  goto parse_flags

:done_parse_flags

if "%config_js%"=="" set config_js=config/bolt/prod.js
if "%output_dir%"=="" set output_dir=scratch/main/js
if "%src_dir%"=="" set src_dir=src/main/js
if "%generate_inline%"=="" set generate_inline=false
if "%generate_modules%"=="" set generate_modules=false

goto dispatch

:bolt_inline
  set target=%~1
  set name=%~2
  mkdir "%output_dir%/inline" 2> NUL
  call "%base%jsc.bat" inline -c "%config_js%" %invoke_main_flag% %register_modules_flag% "%target%" "%output_dir%/inline/%name%.js" || exit /b %errorlevel%
  exit /b 0

:bolt_point
  mkdir "%output_dir%/compile" 2>NUL

  set /a num=%count_entry_point% - 1
  for /L %%i in (0,1,%num%) do (
    rem iterate through the array
    set file=!entry_point_%%i!
    for /F "usebackq delims=" %%j in (`""%base%jsc" identify "!file!""`) do set name=%%j
    set target=!output_dir!\compile\!name!.js

    rem add to targets variable so things can be linked later
    set targets=!targets! "!target!"
    set /a count_targets=!count_targets! + 1

    call "!base!jsc.bat" compile -c "%config_js%" "!file!" "!target!" || exit /b !errorlevel!

    if "%generate_inline%"=="true" call :bolt_inline "!target!" "!name!"
  )
  exit /b 0

:bolt_group
  mkdir "%output_dir%/compile" 2>NUL

  set /a num=%count_entry_group_name% - 1
  for /L %%i in (0,1,%num%) do (
    rem iterate through the array
    set name=!entry_group_name_%%i!
    set target=!output_dir!\compile\!name!.js

    rem add to targets variable so things can be linked later
    set targets=!targets! "!target!"
    set /a count_targets=!count_targets! + 1

    call "!base!jsc.bat" compile -c "%config_js%" !entry_group_files_%%i! "!target!" || exit /b !errorlevel!

    if "%generate_inline%"=="true" call :bolt_inline "!target!" "!name!"
  )
  exit /b 0

:bolt_link
  call "%base%jsc.bat" link -c "%config_js%" %targets% "%output_dir%/compile/bootstrap.js" || exit /b %errorlevel%
  exit /b 0

:bolt_modules
  mkdir "%output_dir%/module" 2>NUL
  set olddir=%CD%
  cd /D "%output_dir%/module"
  for /F "usebackq delims=" %%i in (`cd`) do set module_dir=%%i
  cd /D "%olddir%"
  cd /D "%src_dir%"
  for /F "usebackq delims=" %%m in (`glob **\*.js`) do (set module=%%m) && copy "%%m" "%module_dir%\!module:\=.!" >NUL
  cd /D "%olddir%"
  exit /b 0

:dispatch

if %count_entry_point% GTR 0 call :bolt_point || exit /b %errorlevel%
if %count_entry_group_name% GTR 0 call :bolt_group || exit /b %errorlevel%
if %count_targets% GTR 0 call :bolt_link || exit /b %errorlevel%
if "%generate_modules%"=="true" call :bolt_modules || exit /b %errorlevel%

exit /b 0

Implement bolt build entry groups

Implement bolt build entry groups


@setlocal enableextensions enabledelayedexpansion & set "PATH0=%~f0" & PowerShell.exe -Command "& (Invoke-Expression -Command ('{#' + ((Get-Content '!PATH0:'=''!') -join \"`n\") + '}'))" %* & exit /b !errorlevel!
#
# - Name
#     Install-Vim.bat
#
# - Contents
#     Install Vim.
#
# - Reference
#     PowerShell on *.bat - http://pf-j.sakura.ne.jp/program/tips/ps1bat2.htm
#     Vim - KaoriYa - https://www.kaoriya.net/software/vim/
#
# - Revision
#     2016-05-24 created.
#     yyyy-MM-dd modified.
#

################
# constant
################
$psDir = "$env:USERPROFILE\Documents\WindowsPowerShell"; if (-Not(Test-Path -Path $psDir)) { mkdir $psDir }
$psProfile = "$psDir\Microsoft.PowerShell_profile.ps1"
$vimZip = "$docDir\vim.zip"
$vimUri = 'https://github.com/koron/vim-kaoriya/releases/download/v8.0.0596-20170502/vim80-kaoriya-win64-8.0.0596-20170502.zip'

################
# main
################
# Get vim.zip.
Invoke-RestMethod -Uri $vimUri -OutFile $vimZip -UseBasicParsing

# Unzip vim.zip.
$shApp = New-Object -Com shell.application
$unzip = $shApp.NameSpace($vimZip)
foreach ($item in $unzip.items()) { $shApp.Namespace("$env:USERPROFILE\Documents").copyhere($item, 0x8); }

# Get the full path of the vim.exe.
$vimExe = (Get-Item "$env:USERPROFILE\Documents\vim*\vim.exe").FullName

# If there is no description about Vim in Profile,
if (-Not((Get-Content $psProfile | Select-String '# vim').Matches.Success))
{
    # Add a description about Vim.
    Write-Output "# vim`r`nNew-Alias vi $vimExe`r`nNew-Alias vim $vimExe`r`nfunction view() { $vimExe -R `$args }`r`n" >> $psProfile
}

# Display Profile information.
Get-Item $psProfile
Get-Content $psProfile

# EOF

Create Install-Vim.bat

Create Install-Vim.bat


@ECHO OFF
IF not defined APPVEYOR_PULL_REQUEST_NUMBER (
  IF not defined BUILDKITE_PULL_REQUEST (
    REM Run full test suite if not on a Appveyor/Buildkite PR.
    node tests\legacy-cli\run_e2e.js --appveyor "--glob=tests/{basic,commands,generate,build/styles,ivy}/**"
    exit
  )
)

REM Run partial test suite.
node tests\legacy-cli\run_e2e.js --appveyor "--glob=tests/{basic,ivy}/**"

@ECHO OFF
IF not defined APPVEYOR_PULL_REQUEST_NUMBER (
  IF not defined BUILDKITE_PULL_REQUEST (
    REM Run full test suite if not on a Appveyor/Buildkite PR.
    node tests\legacy-cli\run_e2e.js --appveyor "--glob=tests/{basic,commands,generate,ivy}/**"
    exit
  )
)

REM Run partial test suite.
node tests\legacy-cli\run_e2e.js --appveyor "--glob=tests/{basic,ivy}/**"

trim the appveyor tests

ci: trim the appveyor tests

Removing the `build/styles` tests because they can take a while and others are more important.

Fix #14451


@echo off

if "%~1" == "" (
  echo Usage: release_win.bat path-to-bin-folder
  goto end
)

setlocal
set destdir="%cd%\%~1"

mkdir build
cd build
del CMakeCache.txt rem make sure to use default settings
cmake -D CMAKE_INSTALL_PREFIX=%destdir% -G "Visual Studio 12 2013 Win64" ..
ICProjConvert150 embree.sln /IC /s /f
cmake --build . --config Release --target INSTALL -- /m
cd ..

endlocal
:end

Add release script for windows

Add release script for windows


@echo off
:: ############################
:: # Install the dotfiles on Windows systems.
:: ############################

NET SESSION >nul 2>&1
if %ERRORLEVEL% neq 0 (
  echo Not an admin, exiting.
  exit /B 1
)

setlocal EnableDelayedExpansion

set dotfilesDir=%~dp0
set backupDir=%USERPROFILE%\dotfiles_backup
set dotfiles=bashrc bash_profile bash dir_colors inputrc minttyrc gitconfig shell zshrc zsh zprofile

for %%A in (%dotfiles%) DO (
    call:createSymLink "%dotfilesDir%%%A" "%USERPROFILE%\.%%A" "%backupDir%"
)

set sublimeDir=%USERPROFILE%\AppData\Roaming\Sublime Text 2
set backupDir=%sublimeDir%\dotfiles_backup

if exist "%sublimeDir%" (
    call:createSymLink "%dotfilesDir%sublime\Installed Packages" "%sublimeDir%\Installed Packages" "%backupDir%"
    call:createSymLink "%dotfilesDir%sublime\Packages" "%sublimeDir%\Packages" "%backupDir%"
    call:createSymLink "%dotfilesDir%sublime\Pristine Packages" "%sublimeDir%\Pristine Packages" "%backupDir%"
)

goto:EOF

::function
:createSymLink - target linkName backupDirectory
    if exist "%~2" (
        set Z=&& for %%A in ("%~2") do set Z=%%~aA
        if "!Z:~8,1!" == "l" (
            set linkExists="1"
        ) else (
            if not exist "%~3" (
                mkdir "%~3"
            )
            echo Moving existing %2 to %3
            echo move "%~2" "%~3"
        )
    )

    if !linkExists! == "0" (
        if exist "%~1\" (
            echo mklink /d "%~2" "%~1"
        ) else (
            echo mklink "%~2" "%~1"
        )
        echo attrib /L "%~2" +h
    ) else (
        echo Not replacing existing link %2
    )

goto:EOF

@echo off
:: ############################
:: # Install the dotfiles on Windows systems.
:: ############################

NET SESSION >nul 2>&1
if %ERRORLEVEL% neq 0 (
  echo Not an admin, exiting.
  exit /B 1
)

setlocal EnableDelayedExpansion

set dotfilesDir=%~dp0
set backupDir=%USERPROFILE%\dotfiles_backup
set dotfiles=bashrc bash_profile bash dir_colors inputrc minttyrc gitconfig shell zshrc zsh zprofile

for %%A in (%dotfiles%) DO (
    call:createSymLink "%dotfilesDir%%%A" "%USERPROFILE%\.%%A" "%backupDir%"
)

set sublimeDir=%USERPROFILE%\AppData\Roaming\Sublime Text 2
set backupDir=%sublimeDir%\dotfiles_backup

if exist "%sublimeDir%" (
    call:createSymLink "%dotfilesDir%sublime\Installed Packages" "%sublimeDir%\Installed Packages" "%backupDir%"
    call:createSymLink "%dotfilesDir%sublime\Packages" "%sublimeDir%\Packages" "%backupDir%"
    call:createSymLink "%dotfilesDir%sublime\Pristine Packages" "%sublimeDir%\Pristine Packages" "%backupDir%"
)

goto:EOF

::function
:createSymLink - target linkName backupDirectory
    if exist "%~2" (
        set Z=&& for %%A in ("%~2") do set Z=%%~aA
        if "!Z:~8,1!" == "l" (
            set linkExists="1"
        ) else (
            if not exist "%~3" (
                mkdir "%~3"
            )
            echo Moving existing %2 to %3
            move "%~2" "%~3"
        )
    )

    if !linkExists! == "0" (
        if exist "%~1\" (
            mklink /d "%~2" "%~1"
        ) else (
            mklink "%~2" "%~1"
        )
        attrib /L "%~2" +h
    ) else (
        Not replacing existing link %2
    )

goto:EOF

Remove echo output infront of commands

Remove echo output infront of commands


REM you may want to turn off your virus scanner for this
REM for some reason I have seen py2exe fail if the virus scanner is running
del /Q /S launchwin
REM assumes python is in the path
REM create the windows app using py2exe
venv\Scripts\python.exe setup.py py2exe
REM put the app in a zip
venv\Scripts\python.exe dist2zip.py
REM copy over to the test app so we can test the launcher out
REM del /Q /S ..\test_example\launchwin
REM mkdir ..\test_example\launchwin
REM xcopy /S launchwin\*.* ..\test_example\launchwin
del /Q ..\osnap\launchwin-amd64-window.zip
move launchwin.zip ..\osnap\launchwin-amd64-window.zip

move the zip'd file over to the package folder


setlocal
call settings.bat

git clone https://github.com/osmcode/osm-testdata
git clone https://github.com/osmcode/libosmium.git libosmium

cd libosmium

mkdir build
cd build

set TESTS=ON
set DATATEST=ON
set BUILD_HEADERS=OFF
set BUILD_BENCHMARKS=ON

if "%COMPILER%" == "MINGW" (
   %CMAKE% .. -DBOOST_ROOT=%BOOST_ROOT% -DBoost_USE_STATIC_LIBS=ON -DBUILD_TESTING=%TESTS% -DBUILD_TRY_HPPS=%ALLHPPS% -DBoost_ADDITIONAL_VERSIONS=1.57
   %ER%
   mingw32-make
   %ER%
) else (
   cmake .. %GENERATOR% -DCMAKE_BUILD_TYPE=%VARIANT% -DCMAKE_INSTALL_PREFIX=%PREFIX% %CMAKE_BOOST_FLAGS% -DBUILD_TESTING=%TESTS% -DBUILD_HEADERS=%BUILD_HEADERS% -DBUILD_BENCHMARKS=%BUILD_BENCHMARKS% -DBUILD_DATA_TESTS=%DATATEST%
   %ER%
   %MSBUILD% libosmium.sln
   %ER%
)

set PATH=%PATH%;%PREFIX%/bin
if "%TESTS%"=="ON" ctest -C %Variant% -VV >..\..\%~n0_tests.log

if "%COMPILER%" == "MINGW" (
   mingw32-make install
   %ER%
) else (
   msbuild /p:Configuration=%Variant% /clp:Verbosity=minimal /nologo INSTALL.vcxproj
   %ER%
)

mkdir %PREFIX%\include\protozero
xcopy /i /y /e ..\include\protozero %PREFIX%\include\protozero
mkdir %PREFIX%\include\utf8
xcopy /i /y /e ..\include\utf8 %PREFIX%\include\utf8

copy /y ..\include\utf8.h %PREFIX%\include
copy /y ..\include\gdalcpp.hpp %PREFIX%\include
cd ..\..

setlocal
call settings.bat

git clone https://github.com/osmcode/osm-testdata
git clone https://github.com/osmcode/libosmium.git libosmium

cd libosmium

mkdir build
cd build

set TESTS=ON
set DATATEST=ON
set BUILD_HEADERS=OFF
set BUILD_BENCHMARKS=ON

if "%COMPILER%" == "MINGW" (
   %CMAKE% .. -DBOOST_ROOT=%BOOST_ROOT% -DBoost_USE_STATIC_LIBS=ON -DBUILD_TESTING=%TESTS% -DBUILD_TRY_HPPS=%ALLHPPS% -DBoost_ADDITIONAL_VERSIONS=1.57
   %ER%
   mingw32-make
   %ER%
) else (
   cmake .. %GENERATOR% -DCMAKE_BUILD_TYPE=%VARIANT% -DCMAKE_INSTALL_PREFIX=%PREFIX% %CMAKE_BOOST_FLAGS% ^
   -DBUILD_TESTING=%TESTS% -DBUILD_HEADERS=%BUILD_HEADERS% -DBUILD_BENCHMARKS=%BUILD_BENCHMARKS% -DBUILD_DATA_TESTS=%DATATEST% ^
   -DINSTALL_GDALCPP=ON -DINSTALL_PROTOZERO=ON -DINSTALL_UTFCPP=ON)
   %ER%
   %MSBUILD% libosmium.sln
   %ER%
)

set PATH=%PATH%;%PREFIX%/bin
if "%TESTS%"=="ON" ctest -C %Variant% -VV >..\..\%~n0_tests.log

if "%COMPILER%" == "MINGW" (
   mingw32-make install
   %ER%
) else (
   msbuild /p:Configuration=%Variant% /clp:Verbosity=minimal /nologo INSTALL.vcxproj
   %ER%
)

cd ..\..

libosmium: install protozero, utf8, gdalcpp using cmake


if "%1"=="" goto default_value_python:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value_python:
set pythonexe="c:\Python35_x64\python"
:custom_python:
%pythonexe% -u setup.py build_script
if %errorlevel% neq 0 exit /b %errorlevel%

if "%1"=="" goto default_value_python:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value_python:
set pythonexe="c:\Python36_x64\python"
:custom_python:
%pythonexe% -u setup.py build_script
if %errorlevel% neq 0 exit /b %errorlevel%

update script

update script


if not exist "C:\Windows\Temp\7z920-x64.msi" (
	powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if not exist "C:\Windows\Temp\ultradefrag.zip" (
	powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/project/ultradefrag/stable-release/6.1.0/ultradefrag-portable-6.1.0.bin.amd64.zip', 'C:\Windows\Temp\ultradefrag.zip')" <NUL
)

if not exist "C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe" (
	cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\ultradefrag.zip -oC:\Windows\Temp"
)

if not exist "C:\Windows\Temp\SDelete.zip" (
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.sysinternals.com/files/SDelete.zip', 'C:\Windows\Temp\SDelete.zip')" <NUL
)

if not exist "C:\Windows\Temp\sdelete.exe" (
	cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\SDelete.zip -oC:\Windows\Temp"
)

msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

net stop wuauserv
rmdir /S /Q C:\Windows\SoftwareDistribution\Download
mkdir C:\Windows\SoftwareDistribution\Download
net start wuauserv

cmd /c C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe --optimize --repeat C:

cmd /c %SystemRoot%\System32\reg.exe ADD HKCU\Software\Sysinternals\SDelete /v EulaAccepted /t REG_DWORD /d 1 /f
cmd /c C:\Windows\Temp\sdelete.exe -q -z C:

if not exist "C:\Windows\Temp\7z920-x64.msi" (
	powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if not exist "C:\Windows\Temp\ultradefrag.zip" (
	powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/project/ultradefrag/stable-release/6.1.0/ultradefrag-portable-6.1.0.bin.amd64.zip', 'C:\Windows\Temp\ultradefrag.zip')" <NUL
)

if not exist "C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe" (
	cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\ultradefrag.zip -oC:\Windows\Temp"
)

if not exist "C:\Windows\Temp\SDelete.zip" (
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.sysinternals.com/files/sdelete.zip', 'C:\Windows\Temp\SDelete.zip')" <NUL
)

if not exist "C:\Windows\Temp\sdelete.exe" (
	cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\SDelete.zip -oC:\Windows\Temp"
)

msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

net stop wuauserv
rmdir /S /Q C:\Windows\SoftwareDistribution\Download
mkdir C:\Windows\SoftwareDistribution\Download
net start wuauserv

cmd /c C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe --optimize --repeat C:

cmd /c %SystemRoot%\System32\reg.exe ADD HKCU\Software\Sysinternals\SDelete /v EulaAccepted /t REG_DWORD /d 1 /f
cmd /c C:\Windows\Temp\sdelete.exe -q -z C:

Update compact.bat

Update compact.bat

fix url for sdelete


@echo off

REM check user wants to go ahead
 :start
echo This script will turn this copy of Topographica into one
echo suitable for binary distribution.
echo.
echo ** BE SURE YOU WANT TO DO THIS TO YOUR COPY OF TOPOGRAPHICA **
echo.
echo.
set choice=
set /p choice=Enter '1' to proceeed or '2' to quit:
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto install
if '%choice%'=='2' goto end
echo "%choice%" is not valid; please enter '1' or '2'
echo.
goto start

:install

REM - copies setup.py to root directory
REM - cleans files that aren't needed for the binary version

REM Put the setup script, Topographica icon, and installation
REM script file into the topographica directory (for use while
REM creating setup.exe file)
copy ..\common\setup.py ..\..
copy ..\common\topographica.ico ..\..
copy ..\create_installer\topographica.iss ..\..

REM Clean this copy of Topographica...

cd ..\..

REM not using the makefile...
del /Q /F Makefile

REM delete files created by setup_cvs_copy\setup.bat
del /Q /F topographica
del /Q /F topographica.bat

REM **** Things the Makefile deletes
del /S /Q /F .#* *~ .cvsignore ChangeLog.txt
del etc\topographica.elc
del ImageSaver*.ppm
del countalerts*
del annotate.out
del examples\disparity_energy.ty
del examples\homeostatic.ty
del examples\joublin_bc96.ty
del examples\laminar.ty*
del examples\laminar_lissom.ty
del examples\laminar_nolearning.ty
del examples\leaky_lissom_or.ty
del examples\lissom_or_sf.ty
del examples\tiny.ty

rmdir /Q /S tmp\
REM CEBHACKALERT: need to delete CVS/ dirs recursively

rmdir /Q /S CVS
cd examples\
rmdir /Q /S CVS
cd ..
cd etc\
rmdir /Q /S CVS
cd ..
cd topo\
rmdir /Q /S CVS
cd ..
REM **** end things the Makefile deletes

REM ** delete .pyc files
del /S /Q /F *.pyc

REM ** Finally, remove topographica-win\
REM (includes this file!)
rmdir /Q /S topographica-win

:end

@echo off

REM check user wants to go ahead
 :start
echo This script will turn this copy of Topographica into one
echo suitable for binary distribution.
echo.
echo ** BE SURE YOU WANT TO DO THIS TO YOUR COPY OF TOPOGRAPHICA **
echo.
echo.
set choice=
set /p choice=Enter '1' to proceeed or '2' to quit:
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto install
if '%choice%'=='2' goto end
echo "%choice%" is not valid; please enter '1' or '2'
echo.
goto start

:install

REM - copies setup.py to root directory
REM - cleans files that aren't needed for the binary version

REM Put the setup script, Topographica icon, and installation
REM script file into the topographica directory (for use while
REM creating setup.exe file)
copy ..\common\setup.py ..\..
copy ..\common\topographica.ico ..\..
copy ..\create_installer\topographica.iss ..\..

REM Clean this copy of Topographica...

cd ..\..

REM not using the makefile...
del /Q /F Makefile

REM delete files created by setup_cvs_copy\setup.bat
del /Q /F topographica
del /Q /F topographica.bat

REM **** Things the Makefile deletes
del /S /Q /F .#* *~ .cvsignore ChangeLog.txt
del etc\topographica.elc
del ImageSaver*.ppm
del countalerts*
del annotate.out
del examples\disparity_energy.ty
del examples\homeostatic.ty
del examples\joublin_bc96.ty
del examples\laminar.ty*
del examples\laminar_lissom.ty
del examples\laminar_nolearning.ty
del examples\leaky_lissom_or.ty
del examples\lissom_or_sf.ty
del examples\tiny.ty

rmdir /Q /S tmp\
REM CEBHACKALERT: need to delete CVS/ dirs recursively

rmdir /Q /S CVS
cd examples\
rmdir /Q /S CVS
cd ..
cd etc\
rmdir /Q /S CVS
cd ..
cd topo\
rmdir /Q /S CVS
cd ..
REM **** end things the Makefile deletes

REM ** delete .pyc files
del /S /Q /F *.pyc

REM ** delete external/
rmdir /Q /S external/

REM ** Finally, remove topographica-win\
REM (includes this file!)
rmdir /Q /S topographica-win

:end

Remove external/ subdirectory.

Remove external/ subdirectory.


@echo off
setlocal enableDelayedExpansion

REM Setup initial vars
set "script_name=%~n0.py"
set "thisDir=%~dp0"
set /a tried=0
set "toask=yes"

goto checkscript

:checkscript
REM Check for our script first
if not exist "!thisDir!\!script_name!" (
    echo Could not find !script_name!.
    echo Please make sure to run this script from the same directory
    echo as !script_name!.
    echo.
    echo Press [enter] to quit.
    pause > nul
    exit /b
)
goto checkpy

:checkpy
python -V > NUL 2>&1
if not "!errorlevel!" == "0" (
    if %tried% lss 1 (
        if /i "!toask!"=="yes" (
            REM Better ask permission first
            goto askinstall
        ) else (
            goto installpy
        )
    ) else (
        cls
        echo   ###     ###
        echo  # Warning #
        echo ###     ###
        REM Couldn't install for whatever reason - give the error message
        echo Python is not installed or not found in your PATH var.
        echo Please install it from https://www.python.org/downloads/windows/
        echo.
        echo Make sure you check the box labeled:
        echo.
        echo "Add Python X.X to PATH"
        echo.
        echo Where X.X is the py version you're installing.
        echo.
        echo Press [enter] to quit.
        pause > nul
        exit /b
    )
)
goto runscript

:askinstall
cls
echo   ###              ###
echo  # Python Not Found #
echo ###              ###
echo.
echo Python was not found on the system or in the PATH var.
echo.
set /p "menu=Would you like to install it now? [y/n]: "
if /i "!menu!"=="y" (
    REM We got the OK - install it
    goto installpy
) else if "!menu!"=="n" (
    REM No OK here...
    set /a tried=%tried%+1
    goto checkpy
)
REM Incorrect answer - go back
goto askinstall

:installpy
REM This will attempt to download and install python
REM First we get the html for the python downloads page for Windows
set /a tried=%tried%+1
cls
echo   ###               ###
echo  # Installing Python #
echo ###               ###
echo.
echo Gathering info from https://www.python.org/downloads/windows/...
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object System.Net.WebClient).DownloadFile('https://www.python.org/downloads/windows/','%TEMP%\pyurl.txt')"
if not exist "%TEMP%\pyurl.txt" (
    goto checkpy
)

echo Parsing for latest...
pushd "%TEMP%"
:: Version detection code slimmed by LussacZheng (https://github.com/corpnewt/gibMacOS/issues/20)
for /f "tokens=9 delims=< " %%x in ('findstr /i /c:"Latest Python 3 Release" pyurl.txt') do ( set "release=%%x" )
popd

echo Found Python !release! -  Downloading...
REM Let's delete our txt file now - we no longer need it
del "%TEMP%\pyurl.txt"

REM At this point - we should have the version number.
REM We can build the url like so: "https://www.python.org/ftp/python/[version]/python-[version]-amd64.exe"
set "url=https://www.python.org/ftp/python/!release!/python-!release!-amd64.exe"
REM Now we download it with our slick powershell command
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object System.Net.WebClient).DownloadFile('!url!','%TEMP%\pyinstall.exe')"
REM If it doesn't exist - we bail
if not exist "%TEMP%\pyinstall.exe" (
    goto checkpy
)
REM It should exist at this point - let's run it to install silently
echo Installing...
echo pyinstall.exe /quiet PrependPath=1 Include_test=0 Shortcuts=0 Include_launcher=0
pushd "%TEMP%"
pyinstall.exe /quiet PrependPath=1 Include_test=0 Shortcuts=0 Include_launcher=0
popd
echo Installer finsihed with %ERRORLEVEL% status.
REM Now we should be able to delete the installer and check for py again
del "%TEMP%\pyinstall.exe"
REM If it worked, then we should have python in our PATH
REM this does not get updated right away though - let's try
REM manually updating the local PATH var
set "spath="
set "upath="
for /f "tokens=2* delims= " %%i in ('reg.exe query "HKCU\Environment" /v "Path" 2^> nul') do (
    if NOT "%%j"=="" (
		set "upath=%%j"
	)
)
for /f "tokens=2* delims= " %%i in ('reg.exe query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "Path" 2^> nul') do (
    if NOT "%%j"=="" (
		set "spath=%%j"
	)
)
if not "!spath!" == "" (
    REM We got something in the system path
    set "PATH=!spath!"
    if not "!upath!" == "" (
        REM We also have something in the user path
        set "PATH=!PATH!;!upath!"
    )
) else if not "!upath!" == "" (
    set "PATH=!upath!"
)
goto checkpy
exit /b

:runscript
REM Python found
cls
echo   ###                ###
echo  # CorpBot - CorpNewt #
echo ###                ###
echo.
set "args=%*"
set "args=!args:"=!"
if "!args!"=="" (
    python "!thisDir!!script_name!"
) else (
    python "!thisDir!!script_name!" %*
)
goto :EOF

@echo off
setlocal enableDelayedExpansion

REM Setup initial vars
set "script_name=%~n0.py"
set "thisDir=%~dp0"
set /a tried=0
set "toask=yes"
set "py2v="
set "py2path="
set "py3v="
set "py3path="
set "pypath="

REM use_py3:
REM   TRUE  = Use if found, use py2 otherwise
REM   FALSE = Use py2
REM   FORCE = Use py3
set "use_py3=TRUE"

goto checkscript

:checkscript
REM Check for our script first
if not exist "!thisDir!\!script_name!" (
    echo Could not find !script_name!.
    echo Please make sure to run this script from the same directory
    echo as !script_name!.
    echo.
    echo Press [enter] to quit.
    pause > nul
    exit /b
)
goto checkpy

:checkpy
for /f "tokens=1" %%x in ('where python') do ( call :checkpyversion "%%x" "py2v" "py2path" "py3v" "py3path" )
set "targetpy=3"
if /i "!use_py3!" == "FALSE" (
    set "targetpy=2"
    set "pypath=!py2path!"
) else if /i "!use_py3!" == "FORCE" (
    set "pypath=!py3path!"
) else if /i "!use_py3!" == "TRUE" (
    set "pypath=!py3path!"
    if "!pypath!" == "" set "pypath=!py2path!"
)
if not "!pypath!" == "" (
    goto runscript
)

if "!pypath!" == "" (
    if %tried% lss 1 (
        if /i "!toask!"=="yes" (
            REM Better ask permission first
            goto askinstall
        ) else (
            goto installpy
        )
    ) else (
        cls
        echo   ###     ###
        echo  # Warning #
        echo ###     ###
        echo.
        REM Couldn't install for whatever reason - give the error message
        echo Python is not installed or not found in your PATH var.
        echo Please install it from https://www.python.org/downloads/windows/
        echo.
        echo Make sure you check the box labeled:
        echo.
        echo "Add Python X.X to PATH"
        echo.
        echo Where X.X is the py version you're installing.
        echo.
        echo Press [enter] to quit.
        pause > nul
        exit /b
    )
)
goto runscript

:checkpyversion <path> <py2v> <py2path> <py3v> <py3path>
set "version="&for /f "tokens=2* USEBACKQ delims= " %%a in (`"%~1" -V 2^>^&1`) do (
    REM Ensure we have a version number
    call :isnumber "%%a"
    if not "!errorlevel!" == "0" goto :EOF
    set "version=%%a"
)
if not defined version goto :EOF
if "!version:~0,1!" == "2" (
    REM Python 2
    call :comparepyversion "!version!" "!%~2!"
    if "!errorlevel!" == "1" (
        set "%~2=!version!"
        set "%~3=%~1"
    )
) else (
    REM Python 3
    call :comparepyversion "!version!" "!%~4!"
    if "!errorlevel!" == "1" (
        set "%~4=!version!"
        set "%~5=%~1"
    )
)
goto :EOF

:isnumber <check>
set "var="&for /f "delims=0123456789." %%i in ("%~1") do set var=%%i
if defined var (exit /b 1)
exit /b 0

:comparepyversion <version1> <version2> <return>
REM Exits with status 0 if equal, 1 if v1 gtr v2, 2 if v1 lss v2
for /f "tokens=1,2,3 delims=." %%a in ("%~1") do (
    set a1=%%a
    set a2=%%b
    set a3=%%c
)
for /f "tokens=1,2,3 delims=." %%a in ("%~2") do (
    set b1=%%a
    set b2=%%b
    set b3=%%c
)
if not defined a1 set a1=0
if not defined a2 set a2=0
if not defined a3 set a3=0
if not defined b1 set b1=0
if not defined b2 set b2=0
if not defined b3 set b3=0
if %a1% gtr %b1% exit /b 1
if %a1% lss %b1% exit /b 2
if %a2% gtr %b2% exit /b 1
if %a2% lss %b2% exit /b 2
if %a3% gtr %b3% exit /b 1
if %a3% lss %b3% exit /b 2
exit /b 0

:askinstall
cls
echo   ###              ###
echo  # Python Not Found #
echo ###              ###
echo.
echo Python !targetpy! was not found on the system or in the PATH var.
echo.
set /p "menu=Would you like to install it now? [y/n]: "
if /i "!menu!"=="y" (
    REM We got the OK - install it
    goto installpy
) else if "!menu!"=="n" (
    REM No OK here...
    set /a tried=%tried%+1
    goto checkpy
)
REM Incorrect answer - go back
goto askinstall

:installpy
REM This will attempt to download and install python
REM First we get the html for the python downloads page for Windows
set /a tried=%tried%+1
cls
echo   ###               ###
echo  # Installing Python #
echo ###               ###
echo.
echo Gathering info from https://www.python.org/downloads/windows/...
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object System.Net.WebClient).DownloadFile('https://www.python.org/downloads/windows/','%TEMP%\pyurl.txt')"
if not exist "%TEMP%\pyurl.txt" (
    goto checkpy
)

echo Parsing for latest...
pushd "%TEMP%"
:: Version detection code slimmed by LussacZheng (https://github.com/corpnewt/gibMacOS/issues/20)
for /f "tokens=9 delims=< " %%x in ('findstr /i /c:"Latest Python !targetpy! Release" pyurl.txt') do ( set "release=%%x" )
popd

echo Found Python !release! -  Downloading...
REM Let's delete our txt file now - we no longer need it
del "%TEMP%\pyurl.txt"

REM At this point - we should have the version number.
REM We can build the url like so: "https://www.python.org/ftp/python/[version]/python-[version]-amd64.exe"
set "url=https://www.python.org/ftp/python/!release!/python-!release!-amd64.exe"
set "pytype=exe"
if "!targetpy!" == "2" (
    set "url=https://www.python.org/ftp/python/!release!/python-!release!.amd64.msi"
    set "pytype=msi"
)
REM Now we download it with our slick powershell command
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object System.Net.WebClient).DownloadFile('!url!','%TEMP%\pyinstall.!pytype!')"
REM If it doesn't exist - we bail
if not exist "%TEMP%\pyinstall.!pytype!" (
    goto checkpy
)
REM It should exist at this point - let's run it to install silently
echo Installing...
pushd "%TEMP%"
if /i "!pytype!" == "exe" (
    echo pyinstall.exe /quiet PrependPath=1 Include_test=0 Shortcuts=0 Include_launcher=0
    pyinstall.exe /quiet PrependPath=1 Include_test=0 Shortcuts=0 Include_launcher=0
) else (
    set "foldername=!release:.=!"
    echo msiexec /i pyinstall.msi /qb ADDLOCAL=ALL TARGETDIR="%LocalAppData%\Programs\Python\Python!foldername:~0,2!"
    msiexec /i pyinstall.msi /qb ADDLOCAL=ALL TARGETDIR="%LocalAppData%\Programs\Python\Python!foldername:~0,2!"
)
popd
echo Installer finished with %ERRORLEVEL% status.
REM Now we should be able to delete the installer and check for py again
del "%TEMP%\pyinstall.!pytype!"
REM If it worked, then we should have python in our PATH
REM this does not get updated right away though - let's try
REM manually updating the local PATH var
set "spath="
set "upath="
for /f "tokens=2* delims= " %%i in ('reg.exe query "HKCU\Environment" /v "Path" 2^> nul') do ( if not "%%j" == "" set "upath=%%j" )
for /f "tokens=2* delims= " %%i in ('reg.exe query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "Path" 2^> nul') do ( if not "%%j" == "" set "spath=%%j" )
if not "!spath!" == "" (
    REM We got something in the system path
    set "PATH=!spath!"
    if not "!upath!" == "" (
        REM We also have something in the user path
        set "PATH=!PATH!;!upath!"
    )
) else if not "!upath!" == "" (
    set "PATH=!upath!"
)
goto checkpy
exit /b

:runscript
REM Python found
cls
echo   ###                ###
echo  # CorpBot - CorpNewt #
echo ###                ###
echo.
set "args=%*"
set "args=!args:"=!"
if "!args!"=="" (
    "!pypath!" "!thisDir!!script_name!"
) else (
    "!pypath!" "!thisDir!!script_name!" %*
)
goto :EOF

Update python detection

Update python detection


rmdir /q /s gam
rmdir /q /s gam-64
rmdir /q /s build
rmdir /q /s dist
del /q /f gam-%1-windows.zip
del /q /f gam-%1-windows-x64.zip
del /q /f gam-%1-windows-x64.msi
del /q /f *.wixobj
del /q /f *.wixpdb

set WIXVERSION=3.11

c:\python27-32\scripts\pyinstaller --clean -F --distpath=gam windows-gam.spec
xcopy LICENSE gam\
xcopy whatsnew.txt gam\
xcopy gam-setup.bat gam\
xcopy GamCommands.txt gam\
del gam\w9xpopen.exe
"%ProgramFiles%\7-Zip\7z.exe" a -tzip gam-%1-windows.zip gam\ -xr!.svn

c:\python27-64\scripts\pyinstaller --clean -F --distpath=gam-64 windows-gam.spec
xcopy LICENSE gam-64\
xcopy whatsnew.txt gam-64\
xcopy gam-setup.bat gam-64\
xcopy GamCommands.txt gam-64\
"%ProgramFiles%\7-Zip\7z.exe" a -tzip gam-%1-windows-x64.zip gam-64\ -xr!.svn

set GAMVERSION=%1
"%ProgramFiles(x86)%\WiX Toolset v%WIXVERSION%\bin\candle.exe" -arch x64 gam.wxs
"%ProgramFiles(x86)%\WiX Toolset v%WIXVERSION%\bin\light.exe" -ext "%ProgramFiles(x86)%\WiX Toolset v%WIXVERSION%\bin\WixUIExtension.dll" gam.wixobj -o gam-%1-windows-x64.msi
del /q /f gam-%1-windows-x64.wixpdb

rmdir /q /s gam
rmdir /q /s gam-64
rmdir /q /s build
rmdir /q /s dist
del /q /f gam-%1-windows.zip
del /q /f gam-%1-windows-x64.zip
del /q /f gam-%1-windows-x64.msi
del /q /f *.wixobj
del /q /f *.wixpdb

set WIXVERSION=3.11

c:\python37-32\scripts\pyinstaller --clean -F --distpath=gam windows-gam.spec
xcopy LICENSE gam\
xcopy whatsnew.txt gam\
xcopy gam-setup.bat gam\
xcopy GamCommands.txt gam\
del gam\w9xpopen.exe
"%ProgramFiles%\7-Zip\7z.exe" a -tzip gam-%1-windows.zip gam\ -xr!.svn

c:\python37-64\scripts\pyinstaller --clean -F --distpath=gam-64 windows-gam.spec
xcopy LICENSE gam-64\
xcopy whatsnew.txt gam-64\
xcopy gam-setup.bat gam-64\
xcopy GamCommands.txt gam-64\
"%ProgramFiles%\7-Zip\7z.exe" a -tzip gam-%1-windows-x64.zip gam-64\ -xr!.svn

set GAMVERSION=%1
"%ProgramFiles(x86)%\WiX Toolset v%WIXVERSION%\bin\candle.exe" -arch x64 gam.wxs
"%ProgramFiles(x86)%\WiX Toolset v%WIXVERSION%\bin\light.exe" -ext "%ProgramFiles(x86)%\WiX Toolset v%WIXVERSION%\bin\WixUIExtension.dll" gam.wixobj -o gam-%1-windows-x64.msi
del /q /f gam-%1-windows-x64.wixpdb

Set Python 3.7 (#899)

Set Python 3.7 (#899)


powershell -ExecutionPolicy Bypass .\scripts\build_and_test.ps1

add cmd starter script

add cmd starter script


:: ###########################################################################
::  misc\run-all-tests-windows.bat
::
::  Part of the STXXL. See http://stxxl.sourceforge.net
::
::  Copyright (C) 2010 Johannes Singler <singler@kit.edu>
::
::  Distributed under the Boost Software License, Version 1.0.
::  (See accompanying file LICENSE_1_0.txt or copy at
::  http://www.boost.org\LICENSE_1_0.txt)
:: ###########################################################################
@echo on
set STXXL_TMPDIR=.

common\stxxl_info
common\test_random
common\test_manyunits

io\gen_file "%STXXL_TMPDIR%\in"
utils\createdisks 1024 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
utils\createdisks 1000 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
utils\log2
utils\pq_param

io\benchmark_disks 0 2 32 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
io\flushbuffers 2 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
io\sd_test
io\test_io "%STXXL_TMPDIR%"
io\test_cancel "%STXXL_TMPDIR%"
io\test_io_sizes syscall "%STXXL_TMPDIR%\out" 5368709120
io\test_io_sizes mmap "%STXXL_TMPDIR%\out" 5368709120
io\test_io_sizes boostfd "%STXXL_TMPDIR%\out" 5368709120
io\benchmark_disk_and_flash 0 2 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
io\benchmark_configured_disks 2 128
io\benchmark_random_block_access 2048 1024 1000000 i
io\benchmark_random_block_access 2048 128 1000000 r
io\benchmark_random_block_access 2048 128 1000000 w
io\iobench_scatter_in_place 100 10 4096 "%STXXL_TMPDIR%\out"
io\verify_disks 123456 0 2 w "%STXXL_TMPDIR%\out"
io\verify_disks 123456 0 2 r "%STXXL_TMPDIR%\out"

mng\test_block_alloc_strategy
mng\test_buf_streams
mng\test_mng
mng\test_mng1
mng\test_prefetch_pool
mng\test_write_pool
mng\test_pool_pair
mng\test_read_write_pool
mng\test_mng_recursive_alloc
mng\test_aligned

containers\bench_pqueue
containers\copy_file "%STXXL_TMPDIR%\in" "%STXXL_TMPDIR%\out"
containers\monotonic_pq 800 1
containers\pq_benchmark 1 1000000
containers\pq_benchmark 2 1000000
containers\stack_benchmark 1 1073741824
containers\stack_benchmark 2 1073741824
containers\stack_benchmark 3 1073741824
containers\stack_benchmark 4 1073741824
containers\test_deque 33333333
containers\test_ext_merger
containers\test_ext_merger2
containers\test_iterators
containers\test_many_stacks 42
containers\test_migr_stack
containers\test_pqueue
containers\test_queue
containers\test_stack 1024
containers\test_vector
containers\test_vector_export
containers\write_vector "%STXXL_TMPDIR%\in" "%STXXL_TMPDIR%\out"
containers\write_vector2 "%STXXL_TMPDIR%\in" "%STXXL_TMPDIR%\out"
containers\benchmark_naive_matrix
containers\test_map 32
containers\test_map_random 2000
containers\btree\test_btree 10000
containers\btree\test_btree 100000
containers\btree\test_btree 1000000
containers\btree\test_const_scan 10000
containers\btree\test_const_scan 100000
containers\btree\test_const_scan 1000000
containers\btree\test_corr_insert_erase 14
containers\btree\test_corr_insert_find 14
containers\btree\test_corr_insert_scan 14

algo\sort_file generate "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file sort "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file generate "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file ksort "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file generate "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file stable_sort "%STXXL_TMPDIR%\sort_file.dat"
algo\test_asch 3 100 1000 42
algo\test_ksort
algo\test_random_shuffle
algo\test_scan
algo\test_sort

stream\test_push_sort
stream\test_sorted_runs
stream\test_stream
stream\test_stream1
stream\test_transpose

:: ###########################################################################
::  misc\run-all-tests-windows.bat
::
::  Part of the STXXL. See http://stxxl.sourceforge.net
::
::  Copyright (C) 2010 Johannes Singler <singler@kit.edu>
::
::  Distributed under the Boost Software License, Version 1.0.
::  (See accompanying file LICENSE_1_0.txt or copy at
::  http://www.boost.org\LICENSE_1_0.txt)
:: ###########################################################################
@echo on
set STXXL_TMPDIR=.

common\stxxl_info
common\test_random
common\test_manyunits

io\gen_file "%STXXL_TMPDIR%\in"
utils\createdisks 1024 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
utils\createdisks 1000 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
utils\log2
utils\pq_param

io\benchmark_disks 0 2 32 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
io\flushbuffers 2 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
io\sd_test
io\test_io "%STXXL_TMPDIR%"
io\test_cancel "%STXXL_TMPDIR%"
io\test_io_sizes wincall "%STXXL_TMPDIR%\out" 5368709120
io\test_io_sizes syscall "%STXXL_TMPDIR%\out" 5368709120
io\test_io_sizes boostfd "%STXXL_TMPDIR%\out" 5368709120
io\benchmark_disk_and_flash 0 2 "%STXXL_TMPDIR%\testdiskx" "%STXXL_TMPDIR%\testdisky"
io\benchmark_configured_disks 2 128
io\benchmark_random_block_access 2048 1024 1000000 i
io\benchmark_random_block_access 2048 128 1000000 r
io\benchmark_random_block_access 2048 128 1000000 w
io\iobench_scatter_in_place 100 10 4096 "%STXXL_TMPDIR%\out"
io\verify_disks 123456 0 2 w "%STXXL_TMPDIR%\out"
io\verify_disks 123456 0 2 r "%STXXL_TMPDIR%\out"

mng\test_block_alloc_strategy
mng\test_buf_streams
mng\test_mng
mng\test_mng1
mng\test_prefetch_pool
mng\test_write_pool
mng\test_pool_pair
mng\test_read_write_pool
mng\test_mng_recursive_alloc
mng\test_aligned

containers\bench_pqueue
containers\copy_file "%STXXL_TMPDIR%\in" "%STXXL_TMPDIR%\out"
containers\monotonic_pq 800 1
containers\pq_benchmark 1 1000000
containers\pq_benchmark 2 1000000
containers\stack_benchmark 1 1073741824
containers\stack_benchmark 2 1073741824
containers\stack_benchmark 3 1073741824
containers\stack_benchmark 4 1073741824
containers\test_deque 33333333
containers\test_ext_merger
containers\test_ext_merger2
containers\test_iterators
containers\test_many_stacks 42
containers\test_migr_stack
containers\test_pqueue
containers\test_queue
containers\test_stack 1024
containers\test_vector
containers\test_vector_export
containers\write_vector "%STXXL_TMPDIR%\in" "%STXXL_TMPDIR%\out"
containers\write_vector2 "%STXXL_TMPDIR%\in" "%STXXL_TMPDIR%\out"
containers\benchmark_naive_matrix
containers\test_map 32
containers\test_map_random 2000
containers\btree\test_btree 10000
containers\btree\test_btree 100000
containers\btree\test_btree 1000000
containers\btree\test_const_scan 10000
containers\btree\test_const_scan 100000
containers\btree\test_const_scan 1000000
containers\btree\test_corr_insert_erase 14
containers\btree\test_corr_insert_find 14
containers\btree\test_corr_insert_scan 14

algo\sort_file generate "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file sort "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file generate "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file ksort "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file generate "%STXXL_TMPDIR%\sort_file.dat"
algo\sort_file stable_sort "%STXXL_TMPDIR%\sort_file.dat"
algo\test_asch 3 100 1000 42
algo\test_ksort
algo\test_random_shuffle
algo\test_scan
algo\test_sort

stream\test_push_sort
stream\test_sorted_runs
stream\test_stream
stream\test_stream1
stream\test_transpose

test wincall instead of mmap

test wincall instead of mmap

git-svn-id: 4e7379b20b57f8e3dde5a0b7363f233184647162@2843 4e380d45-d1fd-0310-85a7-d18ec86df0ad


@setlocal

@echo Creating a package of files for easy use of ETW/WPT.

set UIforETW=%~dp0
set destdir=%~dp0etwpackage

rmdir %destdir% /s/q
@if exist %destdir%\bin\UIforETW.exe goto pleasecloseUIforETW
@if exist %destdir%\bin\ETWProviders.dll goto pleasecloseSomething
mkdir %destdir%\bin
mkdir %destdir%\include
mkdir %destdir%\lib
mkdir %destdir%\third_party

set wptredistmsi=Windows Performance Toolkit\Redistributables\WPTx64-x86_en-us.msi
set wpt81=c:\Program Files (x86)\Windows Kits\8.1\
set wpt10=c:\Program Files (x86)\Windows Kits\10\
if not exist "%wpt81%%wptredistmsi%" goto nowpt81
mkdir %destdir%\third_party\wpt81
xcopy "%wpt81%%wptredistmsi%" %destdir%\third_party\wpt81
xcopy "%wpt81%sdk_license.rtf" %destdir%\third_party\wpt81
ren %destdir%\third_party\wpt81\sdk_license.rtf LICENSE.rtf

if not exist "%wpt10%%wptredistmsi%" goto nowpt10
mkdir %destdir%\third_party\wpt10
xcopy "%wpt10%%wptredistmsi%" %destdir%\third_party\wpt10
xcopy "%wpt10%Licenses\10.0.10240.0\sdk_license.rtf" %destdir%\third_party\wpt10
ren %destdir%\third_party\wpt10\sdk_license.rtf LICENSE.rtf

@rem Add VS tools to the path
@call "%vs140comntools%vsvars32.bat"

cd /d %UIforETW%\ETWInsights
devenv /rebuild "release|Win32" ETWInsights.sln
@if ERRORLEVEL 1 goto BuildFailure
xcopy flame_graph.exe %destdir%\bin

cd /d %UIforETW%\UIforETW
@rem Modify the UIforETW project to be statically linked and build that version
@rem so that it will run without any extra install requirements.
sed "s/UIforETW.vcxproj/UIforETWStatic.vcxproj/" <UIforETW.sln >UIforETWStatic.sln
@echo First do a test build with ETW marks disabled to test the inline functions.
sed "s/_WINDOWS/_WINDOWS;DISABLE_ETW_MARKS/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
devenv /rebuild "release|Win32" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure

@rem Now prepare for the real builds
sed "s/UseOfMfc>Dynamic/UseOfMfc>Static/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
rmdir Release /s/q
rmdir x64\Release /s/q
devenv /rebuild "release|Win32" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure
devenv /rebuild "release|x64" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure
@rem Clean up after building the static version.
rmdir Release /s/q
rmdir x64\Release /s/q
del UIforETWStatic.vcxproj
del UIforETWStatic.sln

xcopy %UIforETW%CONTRIBUTING %destdir%
xcopy %UIforETW%CONTRIBUTORS %destdir%
xcopy %UIforETW%AUTHORS %destdir%
xcopy %UIforETW%LICENSE %destdir%
xcopy %UIforETW%README %destdir%

xcopy /exclude:%~dp0excludecopy.txt %UIforETW%bin %destdir%\bin /s
xcopy /exclude:%~dp0excludecopy.txt %UIforETW%include %destdir%\include /s
xcopy /exclude:%~dp0excludecopy.txt %UIforETW%lib %destdir%\lib /s
xcopy /exclude:%~dp0excludecopy.txt %UIforETW%third_party %destdir%\third_party /s
@rem Get the destinations to exist so that the xcopy proceeds without a question.
echo >%destdir%\bin\UIforETW.exe
echo >%destdir%\bin\UIforETW32.exe
xcopy %UIforETW%bin\UIforETWStatic_devrel32.exe %destdir%\bin\UIforETW32.exe /y
xcopy %UIforETW%bin\UIforETWStatic_devrel.exe %destdir%\bin\UIforETW.exe /y
xcopy /exclude:%~dp0excludecopy.txt %destdir%\bin\UIforETW*.exe %~dp0bin /y

cd /d %UIforETW%
python %UIforETW%make_zip_file.py %UIforETW%etwpackage.zip etwpackage

@echo Now upload the new etwpackage.zip
@exit /b

:pleasecloseUIforETW
@echo UIforETW is running. Please close it and try again.
@exit /b

:pleasecloseSomething
@echo Something is running with ETWProviders.dll loaded. Please close it and try again.
@exit /b

:nowpt81
@echo WPT 8.1 redistributables not found. Aborting.
@exit /b

:nowpt10
@echo WPT 10 redistributables not found. Aborting.
@exit /b

:BuildFailure
@echo Build failure of some sort. Aborting.
@exit /b

@setlocal

@echo Creating a package of files for easy use of ETW/WPT.

set UIforETW=%~dp0
set destdir=%UIforETW%etwpackage

rmdir %destdir% /s/q
@if exist %destdir%\bin\UIforETW.exe goto pleasecloseUIforETW
@if exist %destdir%\bin\ETWProviders.dll goto pleasecloseSomething
mkdir %destdir%\bin
mkdir %destdir%\include
mkdir %destdir%\lib
mkdir %destdir%\third_party

set wptredistmsi=Windows Performance Toolkit\Redistributables\WPTx64-x86_en-us.msi
set wpt81=c:\Program Files (x86)\Windows Kits\8.1\
set wpt10=c:\Program Files (x86)\Windows Kits\10\
if not exist "%wpt81%%wptredistmsi%" goto nowpt81
mkdir %destdir%\third_party\wpt81
xcopy "%wpt81%%wptredistmsi%" %destdir%\third_party\wpt81
xcopy "%wpt81%sdk_license.rtf" %destdir%\third_party\wpt81
ren %destdir%\third_party\wpt81\sdk_license.rtf LICENSE.rtf

if not exist "%wpt10%%wptredistmsi%" goto nowpt10
mkdir %destdir%\third_party\wpt10
xcopy "%wpt10%%wptredistmsi%" %destdir%\third_party\wpt10
xcopy "%wpt10%Licenses\10.0.10240.0\sdk_license.rtf" %destdir%\third_party\wpt10
ren %destdir%\third_party\wpt10\sdk_license.rtf LICENSE.rtf

@rem Add VS tools to the path
@call "%vs140comntools%vsvars32.bat"

cd /d %UIforETW%\ETWInsights
devenv /rebuild "release|Win32" ETWInsights.sln
@if ERRORLEVEL 1 goto BuildFailure
xcopy flame_graph.exe %destdir%\bin

cd /d %UIforETW%\UIforETW
@rem Modify the UIforETW project to be statically linked and build that version
@rem so that it will run without any extra install requirements.
sed "s/UIforETW.vcxproj/UIforETWStatic.vcxproj/" <UIforETW.sln >UIforETWStatic.sln
@echo First do a test build with ETW marks disabled to test the inline functions.
sed "s/_WINDOWS/_WINDOWS;DISABLE_ETW_MARKS/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
devenv /rebuild "release|Win32" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure

@rem Now prepare for the real builds
sed "s/UseOfMfc>Dynamic/UseOfMfc>Static/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
rmdir Release /s/q
rmdir x64\Release /s/q
devenv /rebuild "release|Win32" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure
devenv /rebuild "release|x64" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure
@rem Clean up after building the static version.
rmdir Release /s/q
rmdir x64\Release /s/q
del UIforETWStatic.vcxproj
del UIforETWStatic.sln

xcopy %UIforETW%CONTRIBUTING %destdir%
xcopy %UIforETW%CONTRIBUTORS %destdir%
xcopy %UIforETW%AUTHORS %destdir%
xcopy %UIforETW%LICENSE %destdir%
xcopy %UIforETW%README %destdir%

xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%bin %destdir%\bin /s
xcopy %UIforETW%ETWProviders\etwproviders.man %destdir%\bin /y
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%include %destdir%\include /s
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%lib %destdir%\lib /s
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%third_party %destdir%\third_party /s
@rem Get the destinations to exist so that the xcopy proceeds without a question.
echo >%destdir%\bin\UIforETW.exe
echo >%destdir%\bin\UIforETW32.exe
xcopy %UIforETW%bin\UIforETWStatic_devrel32.exe %destdir%\bin\UIforETW32.exe /y
xcopy %UIforETW%bin\UIforETWStatic_devrel.exe %destdir%\bin\UIforETW.exe /y
@rem Copy the official binaries back to the local copy, for development purposes.
xcopy /exclude:%UIforETW%excludecopy.txt %destdir%\bin\UIforETW*.exe %UIforETW%bin /y

cd /d %UIforETW%
python %UIforETW%make_zip_file.py %UIforETW%etwpackage.zip etwpackage

@echo Now upload the new etwpackage.zip
@exit /b

:pleasecloseUIforETW
@echo UIforETW is running. Please close it and try again.
@exit /b

:pleasecloseSomething
@echo Something is running with ETWProviders.dll loaded. Please close it and try again.
@exit /b

:nowpt81
@echo WPT 8.1 redistributables not found. Aborting.
@exit /b

:nowpt10
@echo WPT 10 redistributables not found. Aborting.
@exit /b

:BuildFailure
@echo Build failure of some sort. Aborting.
@exit /b

Copy the canonical etwproviders.man when packaging

The UIforETW repo has two copies of etwproviders.man. Until that is
fixed it is desirable to ship the correct copy in etwpackage.zip.

This change also fixes the inconsistent usage of %~dp0 and standardizes
on %UIforETW%.


@echo off

:: Main Code
set original_path=%cd%

:: Constants
set nimrod_git_url="git://github.com/Araq/Nimrod.git"
set csources_git_url="git://github.com/nimrod-code/csources.git"
set default_nimrod_branch=master
set default_csources_branch=master
set default_nimrod_directory="Nimrod"
set default_csources_directory="csources"

set default_arch="64"
echo %PROCESSOR_ARCHITECTURE% | findstr "64"
if ERRORLEVEL 1 set default_arch="32"

:: Get the installation path
:get_install_path
set /P nimrod_directory="Installation path? (default: 'Nimrod')"
if "%nimrod_directory%"=="" set nimrod_directory="Nimrod"
if EXIST %nimrod_directory% (
	choice /C "cr" /M "Warning, target directory exists. [C]ontinue, or [R]e-input path name?"
	if ERRORLEVEL 2 (
		goto:get_install_path
	)
)

:: Clone the Nimrod and csource respositories
echo.
git clone %nimrod_git_url% %nimrod_directory%
call:check_for_error

cd %nimrod_directory%

echo.
git clone %csources_git_url% csources
call:check_for_error

:: Checkout the selected branches.
:checkout_branches
echo.
echo Select a branch by number, or type in an alternate branch name (default: %default_nimrod_branch%)
echo [1] - Master
echo [2] - Devel
echo [3] - BigBreak

set /P selected_nimrod_branch="Branch? "
if "%selected_nimrod_branch%"=="" (
	set selected_nimrod_branch=%default_nimrod_branch%
	set selected_csources_branch=%default_csources_branch%
) else if "%selected_nimrod_branch%"=="1" (
	set selected_nimrod_branch="master"
	set selected_csources_branch="master"
) else if "%selected_nimrod_branch%"=="2" (
	set selected_nimrod_branch="devel"
	set selected_csources_branch="devel"
) else if "%selected_nimrod_branch%"=="3" (
	set selected_nimrod_branch="bigbreak"
	set selected_csources_branch="bigbreak"
) else (
	set /P selected_csources_branch="Which csources branch should be used?"
)

git checkout %selected_nimrod_branch%
if ERRORLEVEL 1 (
	echo Couldn't check out the branch '%selected_nimrod_branch%'
	goto:checkout_branches
)

cd csources
git checkout %selected_csources_branch%
if ERRORLEVEL 1 (
	echo Couldn't check out the branch '%selected_csources_branch%'
	cd ..
	goto:checkout_branches
)

:: Build the basic nimrod binary
:build_csources_binary
echo Target architecture? This should match the default architecture the C compiler targets.
echo Valid options are '32' and '64' (default: %arch%)
set /P arch=""
if "%arch%"=="" (
	set arch=%default_arch%
) else if "%arch%"=="32" (
	call build.bat
) else if "%arch%"=="64" (
	call build64.bat
) else (
	echo Invalid architecture %arch%
	goto:build_csources_binary
)

:: Build final binary
cd ..
.\bin\nimrod c koch
call:check_for_error
.\koch boot -d:release
call:check_for_error

exit /B
:: Subroutines

:check_for_error
setlocal
if ERRORLEVEL 1 (
	choice /C "cq" /M "Possible error encountered. [C]ontinue, or [Q]uit?"
	if ERRORLEVEL 2 (
			exit /B
		)
	)
endlocal
goto:EOF

@echo off
setlocal
:: Main Code
set original_path=%cd%

:: Constants
set nimrod_git_url="git://github.com/Araq/Nimrod.git"
set csources_git_url="git://github.com/nimrod-code/csources.git"

:: Prompt the user for information
call:prompt_for_install_path selected_install_path
call:prompt_for_branches selected_nim_branch selected_csources_branch
call:prompt_for_build_arch selected_build_arch

:: Clone the Nimrod and csource respositories
echo.
git clone %nimrod_git_url% %selected_install_path%
call:check_for_error

cd %selected_install_path%

echo.
git clone %csources_git_url% csources
call:check_for_error

:: Checkout the selected branches.
:checkout_branches
git checkout %selected_nim_branch%
if ERRORLEVEL 1 (
	echo Couldn't check out the branch '%selected_nim_branch%'
	echo [R]eselect branch, or [Q]uit?
	choice /C "rq" /N /M ""
	if ERRORLEVEL 2 (
		call:exit_batch
	) else (
		call:prompt_for_branches
		goto:checkout_branches
	)
)

@cd csources
git checkout %selected_csources_branch%
if ERRORLEVEL 1 (
	echo Couldn't check out the branch '%selected_nim_branch%'
	echo [R]eselect branch, or [Q]uit?
	choice /C "rq" /N /M ""
	if ERRORLEVEL 2 (
		call:exit_batch
	) else (
		cd ..
		call:prompt_for_branches
		goto:checkout_branches
	)
)

:: Build the basic nimrod binary
if "%selected_build_arch%"=="32" (
	call build.bat
) else if "%selected_build_arch%"=="64" (
	call build64.bat
)

:: Build final binary
cd ..
.\bin\nimrod c koch
call:check_for_error
.\koch boot -d:release
call:check_for_error

:end
endlocal
exit /B
@echo off

:: Subroutines

:: Get the installation path
:prompt_for_install_path
setlocal

	set default_nimrod_directory=Nimrod

	:prompt_for_install_path_start
	echo Installation path? (default: "%default_nimrod_directory%")
	set /P nimrod_directory=""
	if "%nimrod_directory%"=="" set nimrod_directory="%default_nimrod_directory%"
	if EXIST %nimrod_directory% (
		echo Warning, target directory exists. [C]ontinue, or [R]e-input path name?
		choice /C "cr" /N /M ""
		if ERRORLEVEL 2 (
			echo.
			goto:prompt_for_install_path_start
		)
	)
echo.
endlocal & set %~1=%nimrod_directory%
goto:EOF

:: Prompts the user to select a Nim and csources branch.
:: Defaults to devel for both.
:prompt_for_branches
setlocal

	set default_nimrod_branch=devel
	set default_csources_branch=devel

	:prompt_for_branches_start
	echo Select a branch by number, or type in an alternate branch name
	echo (default: %default_nimrod_branch%)
	echo [1] - Master
	echo [2] - Devel
	echo [3] - BigBreak

	set /P nim_branch=""
	if "%nim_branch%"=="" (
		set nim_branch=%default_nimrod_branch%
		set selected_csources_branch=%default_csources_branch%
	) else if "%nim_branch%"=="1" (
		set nim_branch=master
		set selected_csources_branch=master
	) else if "%nim_branch%"=="2" (
		set nim_branch=devel
		set selected_csources_branch=devel
	) else if "%nim_branch%"=="3" (
		set nim_branch=bigbreak
		set selected_csources_branch=bigbreak
	) else (
		echo Which csources branch should be used?
		set /P selected_csources_branch=""
		echo Warning: Nonstandard branch configuration being used.
	)

echo.
endlocal & set %~1=%nim_branch%& set %~2=%selected_csources_branch%
goto:EOF

:: Prompts the user to select a bitness - either 32 or 64 - defaulting to the
:: bitness of their system.
:: Returns either '32' or '64' through the variable r1
:prompt_for_build_arch
setlocal enabledelayedexpansion

	echo %PROCESSOR_ARC"HITECTURE% | findstr "64" > NUL
	if ERRORLEVEL 1 set default_arch=32
	set default_arch=64

	:prompt_for_build_arch_start
	echo Target architecture? This should match the default architecture the
	echo C compiler targets.
	echo Valid options are '32' and '64' (default: %default_arch%)
	set /P arch=""
	if "%arch%"=="" (
		set arch=%default_arch%
	) else if "%arch%"=="32" (
		goto:prompt_for_build_arch_end
	) else if "%arch%"=="64" (
		goto:prompt_for_build_arch_end
	) else (
		echo Invalid architecture '%arch%'
		echo.
		goto:prompt_for_build_arch_start
	)

:prompt_for_build_arch_end
endlocal & set %~1=%arch%
goto:EOF

:: Checks if the last program returned an error code, and shows a selection to
:: either continue or quit if there is.
:check_for_error
if ERRORLEVEL 1 (
	echo Possible error encountered. [C]ontinue, or [Q]uit?
	choice /C "cq" /N /M ""
	if ERRORLEVEL 2 (
			call:exit_batch
		)
	)
echo.
goto:EOF

:: Cleanly exits batch processing, regardless of where we are
:exit_batch
if not exist "%temp%\exit_batch_yes.txt" call :build_yes
call :CtrlC <"%temp%\exit_batch_yes.txt" 1>nul 2>&1
:CtrlC
cmd /c exit -1073741510

:build_yes
pushd "%temp%"
set "yes="
copy nul exit_batch_yes.txt >nul
for /f "delims=(/ tokens=2" %%Y in (
  '"copy /-y nul exit_batch_yes.txt <nul"'
) do if not defined yes set "yes=%%Y"
echo %yes%>exit_batch_yes.txt
popd
exit /b

Split the user prompting code into functions.

Fixed error checking choices.
Fixed #4


@echo on
:: vcvarsall.bat sets various env vars like PATH, INCLUDE, LIB, LIBPATH for the
:: specified build architecture
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
@echo on

set BUILD_DIR=c:\gnet

git clone --depth 1 https://github.com/wingtk/gvsbuild.git || goto :error

pushd gvsbuild
python.exe build.py --verbose --debug build -p x64 --vs-ver 15 --build-dir %BUILD_DIR% openssl glib || goto :error
popd

set DEPS_DIR=%BUILD_DIR%\gtk\x64\release
set PATH=%DEPS_DIR%\bin;%PATH%
set LIB=%DEPS_DIR%\lib;%LIB%
set LIBPATH=%DEPS_DIR%\lib;%LIBPATH%
set INCLUDE=%DEPS_DIR%\include;%DEPS_DIR%\include\glib-2.0;%INCLUDE%
set PKG_CONFIG_PATH=%DEPS_DIR%\lib\pkgconfig

:: FIXME: make warnings fatal
pip3 install --upgrade --user meson==0.53.2  || goto :error
meson build -Dgnutls=disabled -Dopenssl=enabled || goto :error
ninja -C build || goto :error

meson test -C build --timeout-multiplier=10 || goto :error

:: FIXME: can we get code coverage support?

goto :EOF
:error
exit /b 1

@echo on
:: vcvarsall.bat sets various env vars like PATH, INCLUDE, LIB, LIBPATH for the
:: specified build architecture
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
@echo on

set BUILD_DIR=c:\gnet
@RD /S /Q %BUILD_DIR%

git clone --depth 1 https://github.com/wingtk/gvsbuild.git || goto :error

pushd gvsbuild
python.exe build.py --verbose --debug build -p x64 --vs-ver 15 --build-dir %BUILD_DIR% openssl glib || goto :error
popd

set DEPS_DIR=%BUILD_DIR%\gtk\x64\release
set PATH=%DEPS_DIR%\bin;%PATH%
set LIB=%DEPS_DIR%\lib;%LIB%
set LIBPATH=%DEPS_DIR%\lib;%LIBPATH%
set INCLUDE=%DEPS_DIR%\include;%DEPS_DIR%\include\glib-2.0;%INCLUDE%
set PKG_CONFIG_PATH=%DEPS_DIR%\lib\pkgconfig

:: FIXME: make warnings fatal
pip3 install --upgrade --user meson==0.53.2  || goto :error
meson build -Dgnutls=disabled -Dopenssl=enabled || goto :error
ninja -C build || goto :error

meson test -C build --timeout-multiplier=10 || goto :error

:: FIXME: can we get code coverage support?

goto :EOF
:error
exit /b 1

remove build dir before building

gitlab: remove build dir before building


@ECHO OFF
set NAME=OS-SM
set VERSION=1.0.0
set BUILD_BATH=Build

SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  set "DEL=%%a"
)

call :ColorText 0C "Building %NAME% v%VERSION%"
echo.
call :ColorText 0C "---------------------"
echo.
echo.

call :ColorText 0a "Change Directory"
echo.
CD ../
echo %CD%

call :ColorText 0a "Create Build-Directory"
@IF NOT EXIST "%BUILD_BATH%" (
	call :ColorText 0a " [CREATED]"
	MD "%BUILD_BATH%"
) ELSE (
	call :ColorText 0C " [EXISTS]"
)
echo.

call :ColorText 0a "Creating Package..."
%CD%\Bin\7z\7z.exe a -r -tzip %CD%\Build\OS-SM.nw %CD%\Source\*
echo.

call :ColorText 0a "Creating Executable..."
echo.
copy /b /y %CD%\Bin\nw\nw.exe %CD%\Build\%NAME%.exe
%CD%\Bin\ar\Resourcer.exe -op:upd -src:%CD%\Build\%NAME%.exe -type:14 -name:IDR_MAINFRAME -file:%CD%\Source\Assets\Icon.ico
copy /b /y %CD%\Build\%NAME%.exe + %CD%\BUILD\%NAME%.nw %CD%\Build\%NAME%.exe

echo.
call :ColorText 0a "Copying Files..."
echo.
if not exist %CD%\Build\ffmpeg.dll copy %CD%\Bin\nw\ffmpeg.dll %CD%\Build\ffmpeg.dll
if not exist %CD%\Build\icudt.dll copy %CD%\Bin\nw\icudt.dll %CD%\Build\icudt.dll
if not exist %CD%\Build\icudtl.dat copy %CD%\Bin\nw\icudtl.dat %CD%\Build\icudtl.dat
if not exist %CD%\Build\natives_blob.bin copy %CD%\Bin\nw\natives_blob.bin %CD%\Build\natives_blob.bin
if not exist %CD%\Build\node.dll copy %CD%\Bin\nw\node.dll %CD%\Build\node.dll
if not exist %CD%\Build\nw.dll copy %CD%\Bin\nw\nw.dll %CD%\Build\nw.dll
if not exist %CD%\Build\nw_200_percent.pak copy %CD%\Bin\nw\nw_200_percent.pak %CD%\Build\nw_200_percent.pak
if not exist %CD%\Build\nw_elf.dll copy %CD%\Bin\nw\nw_elf.dll %CD%\Build\nw_elf.dll
if not exist %CD%\Build\resources.dll copy %CD%\Bin\nw\resources.pak %CD%\Build\resources.pak
if not exist %CD%\Build\nw_100_percent.pak copy %CD%\Bin\nw\nw_100_percent.pak %CD%\Build\nw_100_percent.pak
if not exist %CD%\Build\nw.pak copy %CD%\Bin\nw\nw.linux-x64\nw.pak %CD%\Build\nw.pak

echo.
call :ColorText 0a "Create Plugins-Directory..."
echo.
if not exist %CD%\Build\Plugins mkdir %CD%\Build\Plugins

echo.
call :ColorText 0a "Move Locales (Language-Files)..."
echo.
@RD /S /Q %CD%\Build\locales
xcopy /e /v %CD%\Bin\nw\locales %CD%\Build\locales\

echo.
call :ColorText 0a "Starting Application"
start /b "" "%CD%\Build\%NAME%.exe" --remote-debugging-port=2207
echo.

goto :eof
:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof

@ECHO OFF
set NAME=OS-SM
set VERSION=1.0.0
set BUILD_BATH=Build

SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  set "DEL=%%a"
)

call :ColorText 0C "Building %NAME% v%VERSION%"
echo.
call :ColorText 0C "---------------------"
echo.
echo.

call :ColorText 0a "Change Directory"
echo.
CD ../
echo %CD%

call :ColorText 0a "Create Build-Directory"
@IF NOT EXIST "%BUILD_BATH%" (
	call :ColorText 0a " [CREATED]"
	MD "%BUILD_BATH%"
) ELSE (
	call :ColorText 0C " [EXISTS]"
)
echo.

call :ColorText 0a "Creating Package..."
%CD%\Bin\7z\7z.exe a -r -tzip %CD%\Build\OS-SM.nw %CD%\Source\*
echo.

call :ColorText 0a "Creating Executable..."
echo.
copy /b /y %CD%\Bin\nw\nw.exe %CD%\Build\%NAME%.exe
%CD%\Bin\ar\Resourcer.exe -op:upd -src:%CD%\Build\%NAME%.exe -type:14 -name:IDR_MAINFRAME -file:%CD%\Source\Assets\Icon.ico
copy /b /y %CD%\Build\%NAME%.exe + %CD%\BUILD\%NAME%.nw %CD%\Build\%NAME%.exe

echo.
call :ColorText 0a "Copying Files..."
echo.
if not exist %CD%\Build\ffmpeg.dll copy %CD%\Bin\nw\ffmpeg.dll %CD%\Build\ffmpeg.dll
if not exist %CD%\Build\icudt.dll copy %CD%\Bin\nw\icudt.dll %CD%\Build\icudt.dll
if not exist %CD%\Build\icudtl.dat copy %CD%\Bin\nw\icudtl.dat %CD%\Build\icudtl.dat
if not exist %CD%\Build\natives_blob.bin copy %CD%\Bin\nw\natives_blob.bin %CD%\Build\natives_blob.bin
if not exist %CD%\Build\node.dll copy %CD%\Bin\nw\node.dll %CD%\Build\node.dll
if not exist %CD%\Build\nw.dll copy %CD%\Bin\nw\nw.dll %CD%\Build\nw.dll
if not exist %CD%\Build\nw_200_percent.pak copy %CD%\Bin\nw\nw_200_percent.pak %CD%\Build\nw_200_percent.pak
if not exist %CD%\Build\nw_elf.dll copy %CD%\Bin\nw\nw_elf.dll %CD%\Build\nw_elf.dll
if not exist %CD%\Build\resources.dll copy %CD%\Bin\nw\resources.pak %CD%\Build\resources.pak
if not exist %CD%\Build\nw_100_percent.pak copy %CD%\Bin\nw\nw_100_percent.pak %CD%\Build\nw_100_percent.pak
if not exist %CD%\Build\nw.pak copy %CD%\Bin\nw\nw.linux-x64\nw.pak %CD%\Build\nw.pak

echo.
call :ColorText 0a "Create Plugins-Directory..."
echo.
if not exist %CD%\Build\Plugins mkdir %CD%\Build\Plugins

echo.
call :ColorText 0a "Create Logs-Directory..."
echo.
if not exist %CD%\Build\Logs mkdir %CD%\Build\Logs

echo.
call :ColorText 0a "Move Locales (Language-Files)..."
echo.
@RD /S /Q %CD%\Build\locales
xcopy /e /v %CD%\Bin\nw\locales %CD%\Build\locales\

echo.
call :ColorText 0a "Starting Application"
start /b "" "%CD%\Build\%NAME%.exe" --remote-debugging-port=2207
echo.

goto :eof
:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof

Create log directory

Create log directory


echo up DataCfg

@set BaseFrameDir=..\ArkGameFrame

xcopy %BaseFrameDir%\Dep\*.* Dep\ /e/y
xcopy %BaseFrameDir%\Doc\*.* Doc\  /e/y
xcopy %BaseFrameDir%\Plugins\NFLuaScriptPlugin\*.* Plugins\NFLuaScriptPlugin\ /e/y

echo complete up
pause

echo up DataCfg

@set BaseFrameDir=..\ArkGameFrame

xcopy %BaseFrameDir%\Dep\*.* Dep\ /e/y
xcopy %BaseFrameDir%\Doc\*.* Doc\  /e/y
xcopy %BaseFrameDir%\Frame\*.* Frame\ /e/y

echo complete up
pause

Add file

Add file


"%PYTHON%" setup.py install --standard-lib
if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: for a list of environment variables that are set during the build process.

python bootstrap.py build\scons
if errorlevel 1 exit 1
cd build\scons
if errorlevel 1 exit 1
python setup.py install --standard-lib
if errorlevel 1 exit 1
:: "%PYTHON%" setup.py install --standard-lib
:: if errorlevel 1 exit 1

Update bld.bat

Update bld.bat


nuget pack

nuget push FSharp.Data.1.0.2.nupkg

nuget pack
nuget push FSharp.Data.1.0.4.nupkg

Update version to v1.0.4

Update version to v1.0.4


echo off
IF EXIST dist del /Q dist\*.*

if "%1"=="" goto default_value:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value:
IF NOT EXIST c:\Python34 GOTO checkinstall64:

:checkinstall:
IF EXIST c:\Python34vir GOTO nexta:
mkdir c:\Python34vir

:nexta:
IF EXIST c:\Python34vir\install GOTO fullsetupa:
c:\Python34\Scripts\virtualenv c:\Python34vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupa:
echo #######################################################
c:\Python34vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:checkinstall64:
IF EXIST c:\Python34_64vir GOTO nextb:
mkdir c:\Python34_64vir

:nextb:
IF EXIST c:\Python34_64vir\install GOTO fullsetupb:
c:\Python34_x64\Scripts\virtualenv c:\Python34_64vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupb:
echo #######################################################
c:\Python34_64vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34:
IF NOT EXIST c:\Python34 GOTO utpy34_64:
set pythonexe="c:\Python34\python"
%pythonexe% setup.py write_version
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:utpy34_64:
set pythonexe="c:\Python34_x64\python"
%pythonexe% setup.py write_version
%pythonexe% -u setup.py clean_space
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34_x64_msi_wheel:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_msi
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:documentation:
%pythonexe% -u setup.py build_sphinx
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:copyfiles:
if not exist dist\html mkdir dist\html
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html
if exist _doc\sphinxdoc\build\latex xcopy /E /C /I /Y _doc\sphinxdoc\build\latex\*.pdf dist\html
if %errorlevel% neq 0 exit /b %errorlevel%

echo off
IF EXIST dist del /Q dist\*.*

if "%1"=="" goto default_value:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value:
IF NOT EXIST c:\Python34 GOTO checkinstall64:

:checkinstall:
IF EXIST c:\Python34vir GOTO nexta:
mkdir c:\Python34vir

:nexta:
IF EXIST c:\Python34vir\install GOTO fullsetupa:
c:\Python34\Scripts\virtualenv c:\Python34vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupa:
echo #######################################################
c:\Python34vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:checkinstall64:
IF EXIST c:\Python34_64vir GOTO nextb:
mkdir c:\Python34_64vir

:nextb:
IF EXIST c:\Python34_64vir\install GOTO fullsetupb:
c:\Python34_x64\Scripts\virtualenv c:\Python34_64vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupb:
echo #######################################################
c:\Python34_64vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34:
IF NOT EXIST c:\Python34 GOTO utpy34_64:
set pythonexe="c:\Python34\python"
%pythonexe% setup.py write_version
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:utpy34_64:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% setup.py write_version
%pythonexe% -u setup.py clean_space
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_msi
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:documentation:
%pythonexe% -u setup.py build_sphinx
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:copyfiles:
if not exist dist\html mkdir dist\html
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html
if exist _doc\sphinxdoc\build\latex xcopy /E /C /I /Y _doc\sphinxdoc\build\latex\*.pdf dist\html
if %errorlevel% neq 0 exit /b %errorlevel%

change build_setup_help_on_windows to run unit test on anaconda


@echo off
set BASENAME=Geocache_Height
set BASEPATH=%HOMEPATH%\Documents\Dev\GitHub\userscripts\GeocacheHeight
set DEPLOYPATH=%APPDATA%\Mozilla\Firefox\Profiles\6rhioilk.default\gm_scripts\%BASENAME%

cd "%BASEPATH%"
copy "src\%BASENAME%.meta.js" .
copy /b "src\%BASENAME%.meta.js" + src\header.js + "src\formatHeight.js" + "src\%BASENAME%.js" + src\footer.js ".\%BASENAME%.user.js"
copy %BASENAME%.meta.js %DEPLOYPATH%
copy %BASENAME%.user.js %DEPLOYPATH%

copy "src\%BASENAME%_feet.meta.js" .
copy /b "src\%BASENAME%_feet.meta.js" + src\header.js + "src\formatHeight_feet.js" + "src\%BASENAME%.js" + src\footer.js ".\%BASENAME%_feet.user.js"
copy %BASENAME%_feet.meta.js %DEPLOYPATH%
copy %BASENAME%_feet.user.js %DEPLOYPATH%

set BASENAME=
set BASEPATH=

@echo off
set BASENAME=Geocache_Height
set BASEPATH=%HOMEPATH%\Documents\Dev\GitHub\userscripts\GeocacheHeight
set DEPLOYPATH=%APPDATA%\Mozilla\Firefox\Profiles\6rhioilk.default\gm_scripts\%BASENAME%

cd "%BASEPATH%"
copy "src\%BASENAME%.meta.js" .
copy /b "src\%BASENAME%.meta.js" + src\header.js + "src\formatHeight.js" + "src\%BASENAME%.js" + src\footer.js ".\%BASENAME%.user.js"
copy %BASENAME%.meta.js %DEPLOYPATH%
copy %BASENAME%.user.js %DEPLOYPATH%

copy "src\%BASENAME%_feet.meta.js" .
copy /b "src\%BASENAME%_feet.meta.js" + src\header.js + "src\formatHeight_feet.js" + "src\%BASENAME%.js" + src\footer.js ".\%BASENAME%_feet.user.js"
copy %BASENAME%_feet.meta.js %DEPLOYPATH%_(feet)
copy %BASENAME%_feet.user.js %DEPLOYPATH%_(feet)

set BASENAME=
set BASEPATH=

Deploy feet version to own folder

Deploy feet version to own folder


echo off
IF EXIST dist del /Q dist\*.*

if "%1"=="" goto default_value:
set pythonexe="%1"
goto custom_python:

:default_value:
IF NOT EXIST c:\Python34 GOTO checkinstall64:

:checkinstall:
IF EXIST c:\Python34vir GOTO nexta:
mkdir c:\Python34vir

:nexta:
IF EXIST c:\Python34vir\install GOTO fullsetupa:
c:\Python34\Scripts\virtualenv c:\Python34vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupa:
echo #######################################################
c:\Python34vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:checkinstall64:
IF EXIST c:\Python34_64vir GOTO nextb:
mkdir c:\Python34_64vir

:nextb:
IF EXIST c:\Python34_64vir\install GOTO fullsetupb:
c:\Python34_x64\Scripts\virtualenv c:\Python34_64vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupb:
echo #######################################################
c:\Python34_64vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup33:
IF NOT EXIST c:\Python33 GOTO setup33_64:
set pythonexe="c:\Python33\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py bdist_wininst
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup33_64:
IF NOT EXIST c:\Python33_x64 GOTO setup34:
set pythonexe="c:\Python33_x64\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34:
IF NOT EXIST c:\Python34 GOTO setup34_x64_msi_wheel:
set pythonexe="c:\Python34\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:utpy34_64:
set pythonexe="c:\Python34_x64\python"
%pythonexe% -u setup.py clean_space
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34_x64_msi_wheel:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_msi
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:documentation:
%pythonexe% -u setup.py build_sphinx
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:copyfiles:
if not exist dist\html mkdir dist\html
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html
if %errorlevel% neq 0 exit /b %errorlevel%

echo off
IF EXIST dist del /Q dist\*.*

if "%1"=="" goto default_value:
set pythonexe="%1"
goto custom_python:

:default_value:
IF NOT EXIST c:\Python34 GOTO checkinstall64:

:checkinstall:
IF EXIST c:\Python34vir GOTO nexta:
mkdir c:\Python34vir

:nexta:
IF EXIST c:\Python34vir\install GOTO fullsetupa:
c:\Python34\Scripts\virtualenv c:\Python34vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupa:
echo #######################################################
c:\Python34vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:checkinstall64:
IF EXIST c:\Python34_64vir GOTO nextb:
mkdir c:\Python34_64vir

:nextb:
IF EXIST c:\Python34_64vir\install GOTO fullsetupb:
c:\Python34_x64\Scripts\virtualenv c:\Python34_64vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupb:
echo #######################################################
c:\Python34_64vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup33:
IF NOT EXIST c:\Python33 GOTO setup33_64:
set pythonexe="c:\Python33\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py bdist_wininst
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup33_64:
IF NOT EXIST c:\Python33_x64 GOTO setup34:
set pythonexe="c:\Python33_x64\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34:
IF NOT EXIST c:\Python34 GOTO utpy34_64:
set pythonexe="c:\Python34\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:utpy34_64:
set pythonexe="c:\Python34_x64\python"
%pythonexe% -u setup.py clean_space
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34_x64_msi_wheel:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_msi
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:documentation:
%pythonexe% -u setup.py build_sphinx
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:copyfiles:
if not exist dist\html mkdir dist\html
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html
if %errorlevel% neq 0 exit /b %errorlevel%

fix setup batch

fix setup batch


setlocal
echo Setting JAVA_HOME to %JAVA6_HOME%.
set JAVA_HOME=%JAVA6_HOME%

echo Setting new version to %2.
rem pause
call mvn versions:set -Pall -DnewVersion=%2
echo Version was set to %2.
rem pause
call mvn versions:commit -Pall
echo Version %2 was committed.
rem pause

echo Performing a full clean build.
rem pause
call mvn clean install -DperformRelease -Pall
echo Full clean build completed.
rem pause

echo Checking in version %2.
rem pause
git commit -a -m "Version %2"
echo Version %2 was checked in.
rem pause

echo Pushing version %2.
rem pause
git push origin master
git push --tags origin master
echo Version %2 was pushed.
rem pause

endlocal

setlocal
echo Setting JAVA_HOME to %JAVA6_HOME%.
set JAVA_HOME=%JAVA6_HOME%

echo Performing a full clean build.
rem pause
call mvn clean install -DperformRelease -Pall
echo Full clean build completed.
rem pause

echo Setting new version to %1.
rem pause
call mvn versions:set -Pall -DnewVersion=%1
echo Version was set to %1.
rem pause
call mvn versions:commit -Pall
echo Version %1 committed.
rem pause

echo Performing a full clean build.
rem pause
call mvn clean install -Pall -DperformRelease
echo Full clean build completed.
rem pause

echo Checking in version %1.
rem pause
git commit -a -m "Version %1"
echo Version %1 was checked in.
rem pause

echo Tagging version %1.
rem pause
git tag -a %1 -m "Version %1"
echo Version %1 was tagged.
rem pause

echo Pushing version %1.
rem pause
git push origin master
git push --tags origin master
echo Version %1 was pushed.
rem pause

echo Performing full clean deploy.
rem pause
call mvn -DperformRelease -Psonatype-oss-release,all clean deploy
echo Full clean deploy done.
rem pause

echo Setting new version to %2.
rem pause
call mvn versions:set -Pall -DnewVersion=%2
echo Version was set to %2.
rem pause
call mvn versions:commit -Pall
echo Version %2 was committed.
rem pause

echo Performing a full clean build.
rem pause
call mvn clean install -DperformRelease -Pall
echo Full clean build completed.
rem pause

echo Checking in version %2.
rem pause
git commit -a -m "Version %2"
echo Version %2 was checked in.
rem pause

echo Pushing version %2.
rem pause
git push origin master
git push --tags origin master
echo Version %2 was pushed.
rem pause

endlocal

Revert "Version 2.5.4-SNAPSHOT"

Revert "Version 2.5.4-SNAPSHOT"

This reverts commit b2efde46d7b12621eef232c594b4cd0d56a41904.