Skip to content

Commit

Permalink
Low tech build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
hnrkndrssn committed Jun 6, 2015
1 parent b2a4cfe commit 840649b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 66 deletions.
45 changes: 14 additions & 31 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
@echo off
cd %~dp0

RMDIR /S /Q src\JabbR\wwwroot\lib\*
IF EXIST artifacts\ RMDIR /S /Q artifacts\
IF EXIST src\JabbR\wwwroot\lib\ RMDIR /S /Q src\JabbR\wwwroot\lib\

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe
SET CACHED_DNVM=%USERPROFILE%\.dnx\bin\dnvm.cmd
SET DNX_UNSTABLE_FEED=https://www.myget.org/F/aspnetrelease/api/v2

IF EXIST %CACHED_NUGET% goto copynuget
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://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
IF EXIST %CACHED_DNVM% GOTO dnvminstall
echo Installing dnvm
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul
:dnvminstall
echo Installing dnx...
CALL dnvm install 1.0.0-beta5-11911 -u

:restore
IF EXIST packages\KoreBuild goto run
IF DEFINED BUILDCMD_RELEASE (
.nuget\NuGet.exe install KoreBuild -version 0.2.1-%BUILDCMD_RELEASE% -ExcludeVersion -o packages -nocache -pre
) ELSE (
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre -source https://www.myget.org/F/aspnetmaster/api/v2
)
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion
echo Restoring...
CALL dnu restore src/JabbR

IF "%SKIP_DNX_INSTALL%"=="1" goto run
IF DEFINED BUILDCMD_RELEASE (
CALL packages\KoreBuild\build\dnvm install 1.0.0-%BUILDCMD_RELEASE% -runtime CLR -arch x86 -a default
) ELSE (
CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86
)
CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86

:run
CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

CALL packages\KoreBuild\build\dnu publish src/JabbR --no-source --out artifacts/build/jabbr --runtime active
echo Publishing...
CALL dnu publish src/JabbR --no-source --out artifacts/build/jabbr --runtime active
43 changes: 8 additions & 35 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,15 @@
#!/bin/bash

rm -rf src/JabbR/wwwroot/lib

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
mkdir -p $cachedir

url=https://www.nuget.org/nuget.exe

if test ! -f $cachedir/nuget.exe; then
wget -O $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null
fi

if test ! -e .nuget; then
mkdir .nuget
cp $cachedir/nuget.exe .nuget/nuget.exe
fi

if test ! -d packages/KoreBuild; then
mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion
fi
rm -rf artifacts/* src/JabbR/wwwroot/lib/*

if ! type dnvm > /dev/null 2>&1; then
source packages/KoreBuild/build/dnvm.sh
fi

if ! type dnx > /dev/null 2>&1; then
dnvm upgrade
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | sh && source ~/.dnx/dnvm/dnvm.sh
fi
export DNX_UNSTABLE_FEED=https://www.myget.org/F/aspnetrelease/api/v2
dnvm install 1.0.0-beta5-11911 -u
dnu restore src/JabbR

mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi

dnu publish src/JabbR --no-source --out artifacts/build/jabbr --runtime active
dnu publish src/JabbR --no-source --out artifacts/build/jabbr --runtime active 2>&1 | tee buildlog
grep "Build succeeded" buildlog

0 comments on commit 840649b

Please sign in to comment.