3 changed files with 63 additions and 75 deletions
@ -1,40 +1,2 @@ |
|||
@ECHO off |
|||
SETLOCAL |
|||
|
|||
SET REPO_FOLDER=%~dp0 |
|||
CD "%REPO_FOLDER%" |
|||
|
|||
SET BUILD_FOLDER=.build |
|||
SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet |
|||
SET KOREBUILD_VERSION= |
|||
|
|||
SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe |
|||
SET NUGET_VERSION=latest |
|||
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe |
|||
|
|||
IF NOT EXIST "%BUILD_FOLDER%" ( |
|||
md "%BUILD_FOLDER%" |
|||
) |
|||
|
|||
IF NOT EXIST "%NUGET_PATH%" ( |
|||
IF NOT EXIST "%CACHED_NUGET%" ( |
|||
echo Downloading latest version of NuGet.exe... |
|||
IF NOT EXIST "%LocalAppData%\NuGet" ( |
|||
md "%LocalAppData%\NuGet" |
|||
) |
|||
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" |
|||
) |
|||
|
|||
copy "%CACHED_NUGET%" "%NUGET_PATH%" > nul |
|||
) |
|||
|
|||
IF NOT EXIST "%KOREBUILD_FOLDER%" ( |
|||
SET KOREBUILD_DOWNLOAD_ARGS= |
|||
IF NOT "%KOREBUILD_VERSION%"=="" ( |
|||
SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION% |
|||
) |
|||
|
|||
"%BUILD_FOLDER%\nuget.exe" install KoreBuild-dotnet -ExcludeVersion -o "%BUILD_FOLDER%" -nocache -pre %KOREBUILD_DOWNLOAD_ARGS% |
|||
) |
|||
|
|||
"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %* |
|||
@ECHO OFF |
|||
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" |
|||
|
|||
@ -0,0 +1,36 @@ |
|||
cd $PSScriptRoot |
|||
|
|||
$repoFolder = $PSScriptRoot |
|||
$env:REPO_FOLDER = $repoFolder |
|||
|
|||
$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" |
|||
if ($env:KOREBUILD_ZIP) |
|||
{ |
|||
$koreBuildZip=$env:KOREBUILD_ZIP |
|||
} |
|||
|
|||
$buildFolder = ".build" |
|||
$buildFile="$buildFolder\KoreBuild.ps1" |
|||
|
|||
if (!(Test-Path $buildFolder)) { |
|||
Write-Host "Downloading KoreBuild from $koreBuildZip" |
|||
|
|||
$tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() |
|||
New-Item -Path "$tempFolder" -Type directory | Out-Null |
|||
|
|||
$localZipFile="$tempFolder\korebuild.zip" |
|||
|
|||
Invoke-WebRequest $koreBuildZip -OutFile $localZipFile |
|||
Add-Type -AssemblyName System.IO.Compression.FileSystem |
|||
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) |
|||
|
|||
New-Item -Path "$buildFolder" -Type directory | Out-Null |
|||
copy-item "$tempFolder\**\build\*" $buildFolder -Recurse |
|||
|
|||
# Cleanup |
|||
if (Test-Path $tempFolder) { |
|||
Remove-Item -Recurse -Force $tempFolder |
|||
} |
|||
} |
|||
|
|||
&"$buildFile" $args |
|||
@ -1,45 +1,35 @@ |
|||
#!/usr/bin/env bash |
|||
repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
|||
cd $repoFolder |
|||
|
|||
buildFolder=.build |
|||
koreBuildFolder=$buildFolder/KoreBuild-dotnet |
|||
|
|||
nugetPath=$buildFolder/nuget.exe |
|||
|
|||
if test `uname` = Darwin; then |
|||
cachedir=~/Library/Caches/KBuild |
|||
else |
|||
if [ -z $XDG_DATA_HOME ]; then |
|||
cachedir=$HOME/.local/share |
|||
else |
|||
cachedir=$XDG_DATA_HOME; |
|||
fi |
|||
koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" |
|||
if [ ! -z $KOREBUILD_ZIP ]; then |
|||
koreBuildZip=$KOREBUILD_ZIP |
|||
fi |
|||
mkdir -p $cachedir |
|||
nugetVersion=latest |
|||
cacheNuget=$cachedir/nuget.$nugetVersion.exe |
|||
|
|||
nugetUrl=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe |
|||
buildFolder=".build" |
|||
buildFile="$buildFolder/KoreBuild.sh" |
|||
|
|||
if test ! -d $buildFolder; then |
|||
echo "Downloading KoreBuild from $koreBuildZip" |
|||
|
|||
tempFolder="/tmp/KoreBuild-$(uuidgen)" |
|||
mkdir $tempFolder |
|||
|
|||
localZipFile="$tempFolder/korebuild.zip" |
|||
|
|||
wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip /dev/null |
|||
unzip -q -d $tempFolder $localZipFile |
|||
|
|||
mkdir $buildFolder |
|||
fi |
|||
|
|||
if test ! -f $nugetPath; then |
|||
if test ! -f $cacheNuget; then |
|||
wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null |
|||
cp -r $tempFolder/**/build/** $buildFolder |
|||
|
|||
chmod +x $buildFile |
|||
|
|||
# Cleanup |
|||
if test ! -d $tempFolder; then |
|||
rm -rf $tempFolder |
|||
fi |
|||
|
|||
cp $cacheNuget $nugetPath |
|||
fi |
|||
|
|||
if test ! -d $koreBuildFolder; then |
|||
mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre |
|||
chmod +x $koreBuildFolder/build/KoreBuild.sh |
|||
fi |
|||
|
|||
makeFile=makefile.shade |
|||
if [ ! -e $makeFile ]; then |
|||
makeFile=$koreBuildFolder/build/makefile.shade |
|||
fi |
|||
|
|||
./$koreBuildFolder/build/KoreBuild.sh -n $nugetPath -m $makeFile "$@" |
|||
$buildFile -r $repoFolder "$@" |
|||
Loading…
Reference in new issue