зеркало из https://github.com/aspnet/KoreBuild.git
tidy up and restructure the repo (#95)
* tidy up and restructuring the repo * change the channel
This commit is contained in:
Родитель
7659f3eab6
Коммит
062ea0b015
|
@ -1,3 +0,0 @@
|
|||
# What is this?
|
||||
|
||||
A temporary parallel `build` folder for use by those using the new MSBuild-based KoreBuild. Things that are shared by both (CLI version, etc.) are still in the original folder.
|
|
@ -0,0 +1,5 @@
|
|||
# Just here to isolate the build template from having to know anything about the interior structure of KoreBuild.
|
||||
# You can move pretty much everything else in this repo EXCEPT this file.
|
||||
$KoreBuildRoot = Convert-Path (Split-Path -Parent $PSScriptRoot)
|
||||
$KoreBuild = Join-Path "$KoreBuildRoot" "src\Microsoft.AspNetCore.Build\scripts\KoreBuild.ps1"
|
||||
& "$KoreBuild" @args
|
|
@ -0,0 +1,4 @@
|
|||
# Just here to isolate the build template from having to know anything about the interior structure of KoreBuild.
|
||||
# You can move pretty much everything else in this repo EXCEPT this file.
|
||||
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
||||
"$ROOT/src/Microsoft.AspNetCore.Build/scripts/KoreBuild.sh" "$@"
|
|
@ -76,7 +76,7 @@ if(!$KoreBuildUrl) {
|
|||
}
|
||||
|
||||
if($Local) {
|
||||
$TemplateSource = Join-Path $PSScriptRoot "template2"
|
||||
$TemplateSource = Join-Path (Split-Path -Parent $PSScriptRoot) "template2"
|
||||
Write-Host -ForegroundColor Green "Copying template files from $TemplateSource ..."
|
||||
dir $TemplateSource | ForEach-Object {
|
||||
$dest = Join-Path (Get-Location) $_.Name
|
||||
|
@ -93,7 +93,6 @@ else {
|
|||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
$zip = [System.IO.Compression.ZipFile]::OpenRead($KoreBuildZip)
|
||||
try {
|
||||
|
||||
# Copy the template files over top of existing files.
|
||||
Write-Host -ForegroundColor Green "Copying template files from $KoreBuildZip ..."
|
||||
$zip.Entries | ForEach-Object {
|
|
@ -1,8 +1,28 @@
|
|||
Write-Host -ForegroundColor Green "Starting KoreBuild 2.0 ..."
|
||||
|
||||
if($env:KOREBUILD_COMPATIBILITY -eq "1") {
|
||||
# Rewrite arguments to handle compatibility with 1.0
|
||||
$new_args = $args | ForEach-Object {
|
||||
if($_ -eq "--quiet") {
|
||||
"/v:m"
|
||||
}
|
||||
elseif($_.StartsWith("--")) {
|
||||
# Other unknown switch
|
||||
Write-Warning "Unknown KoreBuild 1.0 switch: $_. If this switch took an argument, you'll have a bad problem :)"
|
||||
} else {
|
||||
$target = [char]::ToUpper($_[0]) + $_.Substring(1)
|
||||
"/t:$target"
|
||||
}
|
||||
}
|
||||
Write-Host -ForegroundColor DarkGray "KoreBuild 1.0 Compatibility Mode Enabled"
|
||||
Write-Host -ForegroundColor DarkGray "KoreBuild 1.0 Command Line: $args"
|
||||
$args = $new_args
|
||||
Write-Host -ForegroundColor DarkGray "KoreBuild 2.0 Command Line: $args"
|
||||
}
|
||||
|
||||
$RepositoryRoot = Convert-Path (Get-Location)
|
||||
$BuildRoot = Join-Path $RepositoryRoot ".build"
|
||||
$KoreBuildRoot = Split-Path -Parent $PSScriptRoot
|
||||
$KoreBuildRoot = (Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)))
|
||||
|
||||
$env:REPO_FOLDER = $RepositoryRoot
|
||||
$env:KOREBUILD_FOLDER = $KoreBuildRoot
|
||||
|
@ -32,7 +52,7 @@ function exec($cmd) {
|
|||
|
||||
function EnsureDotNet() {
|
||||
$dotnetVersionFile = "$KoreBuildRoot\build\cli.version.win"
|
||||
$dotnetChannel = "preview"
|
||||
$dotnetChannel = "rel-1.0.0"
|
||||
$dotnetVersion = Get-Content $dotnetVersionFile
|
||||
|
||||
if ($env:KOREBUILD_DOTNET_CHANNEL)
|
||||
|
@ -46,7 +66,7 @@ function EnsureDotNet() {
|
|||
|
||||
$dotnetLocalInstallFolder = "$env:LOCALAPPDATA\Microsoft\dotnet\"
|
||||
$newPath = "$dotnetLocalInstallFolder;$env:PATH"
|
||||
if ($env:KOREBUILD_SKIP_RUNTIME_INSTALL -eq "1")
|
||||
if ($env:KOREBUILD_SKIP_RUNTIME_INSTALL -eq "1")
|
||||
{
|
||||
Write-Host -ForegroundColor Green "Skipping runtime installation because KOREBUILD_SKIP_RUNTIME_INSTALL = 1"
|
||||
# Add to the _end_ of the path in case preferred .NET CLI is not in the default location.
|
||||
|
@ -72,7 +92,7 @@ function EnsureMSBuild() {
|
|||
if(!(Test-Path $MSBuildDir)) {
|
||||
try {
|
||||
mkdir $MSBuildDir | Out-Null
|
||||
$content = [IO.File]::ReadAllText((Convert-Path "$KoreBuildRoot\build2\msbuild.project.json.template"))
|
||||
$content = [IO.File]::ReadAllText((Convert-Path "$PSScriptRoot\msbuild.project.template.json"))
|
||||
$content = $content.Replace("RUNTIME", $RID)
|
||||
|
||||
[IO.File]::WriteAllText((Join-Path $MSBuildDir "project.json"), $content);
|
29
build2/KoreBuild.sh → src/Microsoft.AspNetCore.Build/scripts/KoreBuild.sh
Normal file → Executable file
29
build2/KoreBuild.sh → src/Microsoft.AspNetCore.Build/scripts/KoreBuild.sh
Normal file → Executable file
|
@ -12,11 +12,34 @@ RESET="\033[0m"
|
|||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
echo -e "${GREEN}Preparing KoreBuild 2.0...${RESET}"
|
||||
|
||||
if [ "$KOREBUILD_COMPATIBILITY" = "1" ]; then
|
||||
MSBUILD_ARGS=()
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--quiet)
|
||||
MSBUILD_ARGS=(${MSBUILD_ARGS[@]} -v:m)
|
||||
;;
|
||||
--*)
|
||||
echo "Unknown KoreBuild 1.0 switch: $arg. If this switch took an argument, you'll have a bad problem :)"
|
||||
;;
|
||||
*)
|
||||
TARGET="-t:$(echo "${arg[@]:0:1}" | tr "[:lower:]" "[:upper:]")${arg[@]:1}"
|
||||
MSBUILD_ARGS=(${MSBUILD_ARGS[@]} "$TARGET")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo -e "${BLACK}KoreBuild 1.0 Compatibility Mode Enabled${RESET}"
|
||||
echo -e "${BLACK}KoreBuild 1.0 Command Line: ${@}${RESET}"
|
||||
echo -e "${BLACK}KoreBuild 2.0 Command Line: ${MSBUILD_ARGS[@]}${RESET}"
|
||||
else
|
||||
MSBUILD_ARGS=("$@")
|
||||
fi
|
||||
|
||||
export REPO_FOLDER=$PWD
|
||||
export KOREBUILD_FOLDER="$(dirname $DIR)"
|
||||
|
||||
BUILD_ROOT="$REPO_FOLDER/.build"
|
||||
KOREBUILD_ROOT="$( cd "$DIR/.." && pwd)"
|
||||
KOREBUILD_ROOT="$( cd "$DIR/../../.." && pwd)"
|
||||
|
||||
DOTNET_INSTALL="$KOREBUILD_ROOT/build/dotnet/dotnet-install.sh"
|
||||
DOTNET_VERSION_DIR="$KOREBUILD_ROOT/build"
|
||||
|
@ -82,7 +105,7 @@ ensure_msbuild() {
|
|||
RID=`dotnet --info | grep "RID" | awk '{ print $2 }'`
|
||||
|
||||
mkdir -p $MSBUILD_DIR
|
||||
cat "$KOREBUILD_ROOT/build2/msbuild.project.json.template" | sed "s/RUNTIME/$RID/g" > "$MSBUILD_DIR/project.json"
|
||||
cat "$KOREBUILD_ROOT/src/Microsoft.AspNetCore.Build/scripts/msbuild.project.template.json" | sed "s/RUNTIME/$RID/g" > "$MSBUILD_DIR/project.json"
|
||||
cp "$KOREBUILD_ROOT/NuGet.config" "$MSBUILD_DIR"
|
||||
|
||||
echo -e "${GREEN}Preparing MSBuild ...${RESET}"
|
||||
|
@ -112,4 +135,4 @@ MSBUILD_LOG="$BUILD_ROOT/korebuild.msbuild.log"
|
|||
|
||||
echo -e "${GREEN}Starting build...${RESET}"
|
||||
echo -e "${CYAN}> msbuild $PROJ $@${RESET}"
|
||||
"$MSBUILD_DIR/bin/pub/corerun" "$MSBUILD_DIR/bin/pub/MSBuild.exe" -nologo $PROJ -p:KoreBuildTargetsPath="$KOREBUILD_TARGETS_ROOT" -p:KoreBuildTasksPath="$MSBUILD_DIR/bin/pub/" -fl -flp:logFile="$MSBUILD_LOG;verbosity=diagnostic" "$@"
|
||||
"$MSBUILD_DIR/bin/pub/corerun" "$MSBUILD_DIR/bin/pub/MSBuild.exe" -nologo $PROJ -p:KoreBuildTargetsPath="$KOREBUILD_TARGETS_ROOT" -p:KoreBuildTasksPath="$MSBUILD_DIR/bin/pub/" -fl -flp:logFile="$MSBUILD_LOG;verbosity=diagnostic" "${MSBUILD_ARGS[@]}"
|
|
@ -20,7 +20,8 @@ param(
|
|||
[Alias("r")][switch]$ResetKoreBuild,
|
||||
[Parameter(ParameterSetName="DownloadByUrl")][Alias("u")][string]$KoreBuildUrl,
|
||||
[Parameter(ParameterSetName="DownloadByBranch")][Alias("b")][string]$KoreBuildBranch,
|
||||
[Parameter(ParameterSetName="DownloadFromFolder")]$KoreBuildFolder)
|
||||
[Parameter(ParameterSetName="DownloadFromFolder")]$KoreBuildFolder,
|
||||
[Parameter(ValueFromRemainingArguments=$true)][string[]]$KoreBuildArgs)
|
||||
|
||||
function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries)
|
||||
{
|
||||
|
@ -62,7 +63,7 @@ if ($PSCmdlet.ParameterSetName -eq "DownloadDefault") {
|
|||
|
||||
$BuildFolder = Join-Path $PSScriptRoot ".build"
|
||||
$KoreBuildRoot = Join-Path $BuildFolder "KoreBuild"
|
||||
$BuildFile = Join-Path $KoreBuildRoot "build2\KoreBuild.ps1"
|
||||
$BuildFile = Join-Path $KoreBuildRoot "scripts\KoreBuild.ps1"
|
||||
|
||||
if ($ResetKoreBuild -and (Test-Path $BuildFolder)) {
|
||||
Write-Host -ForegroundColor Green "Cleaning old Build folder to force a reset ..."
|
||||
|
@ -94,14 +95,14 @@ if (!(Test-Path $KoreBuildRoot)) {
|
|||
}
|
||||
}
|
||||
|
||||
if(($MSBuildArgs -contains "-t:") -or ($MSBuildArgs -contains "-p:")) {
|
||||
if(($KoreBuildArgs -contains "-t:") -or ($KoreBuildArgs -contains "-p:")) {
|
||||
throw "Due to PowerShell weirdness, you need to use '/t:' and '/p:' to pass targets and properties to MSBuild"
|
||||
}
|
||||
|
||||
# Launch KoreBuild
|
||||
try {
|
||||
pushd $PSScriptRoot
|
||||
& "$BuildFile" @args
|
||||
& "$BuildFile" @KoreBuildArgs
|
||||
} finally {
|
||||
popd
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ fi
|
|||
|
||||
BUILD_FOLDER="$DIR/.build"
|
||||
KOREBUILD_ROOT="$BUILD_FOLDER/KoreBuild"
|
||||
BUILD_FILE="$KOREBUILD_ROOT/build2/KoreBuild.sh"
|
||||
BUILD_FILE="$KOREBUILD_ROOT/scripts/KoreBuild.sh"
|
||||
|
||||
if [[ -d $BUILD_FOLDER && $KOREBUILD_RESET = "1" ]]; then
|
||||
echo -e "${GREEN}Cleaning old KoreBuild folder to force a reset ...${RESET}"
|
||||
|
|
Загрузка…
Ссылка в новой задаче