Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 9a0df8f

Browse files
author
Victor Hurdugaci
committed
Update the build scripts
1 parent 5cccc0a commit 9a0df8f

3 files changed

Lines changed: 63 additions & 74 deletions

File tree

build.cmd

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,2 @@
1-
@ECHO off
2-
SETLOCAL
3-
4-
SET REPO_FOLDER=%~dp0
5-
CD "%REPO_FOLDER%"
6-
7-
SET BUILD_FOLDER=.build
8-
SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet
9-
SET KOREBUILD_VERSION=
10-
11-
SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe
12-
SET NUGET_VERSION=latest
13-
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
14-
15-
IF NOT EXIST %BUILD_FOLDER% (
16-
md %BUILD_FOLDER%
17-
)
18-
19-
IF NOT EXIST %NUGET_PATH% (
20-
IF NOT EXIST %CACHED_NUGET% (
21-
echo Downloading latest version of NuGet.exe...
22-
IF NOT EXIST %LocalAppData%\NuGet (
23-
md %LocalAppData%\NuGet
24-
)
25-
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"
26-
)
27-
28-
copy %CACHED_NUGET% %NUGET_PATH% > nul
29-
)
30-
31-
SET KOREBUILD_DOWNLOAD_ARGS=
32-
IF NOT "%KOREBUILD_VERSION%"=="" (
33-
SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION%
34-
)
35-
IF NOT EXIST %KOREBUILD_FOLDER% (
36-
%BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS%
37-
)
38-
39-
"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %*
1+
@ECHO OFF
2+
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*"

build.ps1

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
cd $PSScriptRoot
2+
3+
$repoFolder = $PSScriptRoot
4+
$env:REPO_FOLDER = $repoFolder
5+
6+
$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
7+
if ($env:KOREBUILD_ZIP)
8+
{
9+
$koreBuildZip=$env:KOREBUILD_ZIP
10+
}
11+
12+
$buildFolder = ".build"
13+
$buildFile="$buildFolder\KoreBuild.ps1"
14+
15+
if (!(Test-Path $buildFolder)) {
16+
Write-Host "Downloading KoreBuild from $koreBuildZip"
17+
18+
$tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid()
19+
New-Item -Path "$tempFolder" -Type directory | Out-Null
20+
21+
$localZipFile="$tempFolder\korebuild.zip"
22+
23+
Invoke-WebRequest $koreBuildZip -OutFile $localZipFile
24+
Add-Type -AssemblyName System.IO.Compression.FileSystem
25+
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)
26+
27+
New-Item -Path "$buildFolder" -Type directory | Out-Null
28+
copy-item "$tempFolder\**\build\*" $buildFolder -Recurse
29+
30+
# Cleanup
31+
if (Test-Path $tempFolder) {
32+
Remove-Item -Recurse -Force $tempFolder
33+
}
34+
}
35+
36+
&"$buildFile" $args

build.sh

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,35 @@
11
#!/usr/bin/env bash
2+
repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3+
cd $repoFolder
24

3-
buildFolder=.build
4-
koreBuildFolder=$buildFolder/KoreBuild-dotnet
5-
6-
nugetPath=$buildFolder/nuget.exe
7-
8-
if test `uname` = Darwin; then
9-
cachedir=~/Library/Caches/KBuild
10-
else
11-
if [ -z $XDG_DATA_HOME ]; then
12-
cachedir=$HOME/.local/share
13-
else
14-
cachedir=$XDG_DATA_HOME;
15-
fi
5+
koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
6+
if [ ! -z $KOREBUILD_ZIP ]; then
7+
koreBuildZip=$KOREBUILD_ZIP
168
fi
17-
mkdir -p $cachedir
18-
nugetVersion=latest
19-
cacheNuget=$cachedir/nuget.$nugetVersion.exe
209

21-
nugetUrl=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe
10+
buildFolder=".build"
11+
buildFile="$buildFolder/KoreBuild.sh"
2212

2313
if test ! -d $buildFolder; then
14+
echo "Downloading KoreBuild from $koreBuildZip"
15+
16+
tempFolder="/tmp/KoreBuild-$(uuidgen)"
17+
mkdir $tempFolder
18+
19+
localZipFile="$tempFolder/korebuild.zip"
20+
21+
wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip /dev/null
22+
unzip -q -d $tempFolder $localZipFile
23+
2424
mkdir $buildFolder
25-
fi
26-
27-
if test ! -f $nugetPath; then
28-
if test ! -f $cacheNuget; then
29-
wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null
25+
cp -r $tempFolder/**/build/** $buildFolder
26+
27+
chmod +x $buildFile
28+
29+
# Cleanup
30+
if test ! -d $tempFolder; then
31+
rm -rf $tempFolder
3032
fi
31-
32-
cp $cacheNuget $nugetPath
33-
fi
34-
35-
if test ! -d $koreBuildFolder; then
36-
mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre
37-
chmod +x $koreBuildFolder/build/KoreBuild.sh
38-
fi
39-
40-
makeFile=makefile.shade
41-
if [ ! -e $makeFile ]; then
42-
makeFile=$koreBuildFolder/build/makefile.shade
4333
fi
4434

45-
./$koreBuildFolder/build/KoreBuild.sh -n $nugetPath -m $makeFile "$@"
35+
$buildFile -r $repoFolder "$@"

0 commit comments

Comments
 (0)