Update the build scripts
This commit is contained in:
Родитель
82d3269b45
Коммит
e4e39b686f
41
build.cmd
41
build.cmd
|
@ -1,39 +1,2 @@
|
||||||
@ECHO off
|
@ECHO OFF
|
||||||
SETLOCAL
|
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*"
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
SET KOREBUILD_DOWNLOAD_ARGS=
|
|
||||||
IF NOT "%KOREBUILD_VERSION%"=="" (
|
|
||||||
SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION%
|
|
||||||
)
|
|
||||||
IF NOT EXIST %KOREBUILD_FOLDER% (
|
|
||||||
%BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS%
|
|
||||||
)
|
|
||||||
|
|
||||||
"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %*
|
|
|
@ -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
|
60
build.sh
60
build.sh
|
@ -1,45 +1,35 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
cd $repoFolder
|
||||||
|
|
||||||
buildFolder=.build
|
koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
|
||||||
koreBuildFolder=$buildFolder/KoreBuild-dotnet
|
if [ ! -z $KOREBUILD_ZIP ]; then
|
||||||
|
koreBuildZip=$KOREBUILD_ZIP
|
||||||
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
|
|
||||||
fi
|
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
|
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
|
mkdir $buildFolder
|
||||||
fi
|
cp -r $tempFolder/**/build/** $buildFolder
|
||||||
|
|
||||||
if test ! -f $nugetPath; then
|
chmod +x $buildFile
|
||||||
if test ! -f $cacheNuget; then
|
|
||||||
wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null
|
# Cleanup
|
||||||
|
if test ! -d $tempFolder; then
|
||||||
|
rm -rf $tempFolder
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp $cacheNuget $nugetPath
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test ! -d $koreBuildFolder; then
|
$buildFile -r $repoFolder "$@"
|
||||||
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 "$@"
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче