Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate McMaster <natemcmaster@users.noreply.github.com>2018-12-21 03:52:15 +0300
committerGitHub <noreply@github.com>2018-12-21 03:52:15 +0300
commitc3beb1f9b1497078974525ef8987a35da74376b3 (patch)
tree288dbabb023181ad0c682994d9ad23aa7886138c /run.ps1
parentd73d6e8546dfb3ea6558d711681662cc14aa96e0 (diff)
build.cmd/sh changes (#5958)
Update the build scripts to support building subfolders or subgroups of projects * Add build scripts for ci * Remove obsolete scripts * Add flags like --test and --pack to control running just test or packaging * Add flags like --managed and --native to control building sub-types of projects * Remove KoreBuild bootstrapper flags * Update to extensions 3.0.0-preview.18619.1 (needed to get a fix for aspnet/Extensions#815 to make this change work on MSBuild.exe)
Diffstat (limited to 'run.ps1')
-rw-r--r--run.ps1207
1 files changed, 0 insertions, 207 deletions
diff --git a/run.ps1 b/run.ps1
deleted file mode 100644
index aa08c6485b..0000000000
--- a/run.ps1
+++ /dev/null
@@ -1,207 +0,0 @@
-#!/usr/bin/env powershell
-#requires -version 4
-
-<#
-.SYNOPSIS
-Executes KoreBuild commands.
-
-.DESCRIPTION
-Downloads korebuild if required. Then executes the KoreBuild command. To see available commands, execute with `-Command help`.
-
-.PARAMETER Command
-The KoreBuild command to run.
-
-.PARAMETER Path
-The folder to build. Defaults to the folder containing this script.
-
-.PARAMETER LockFile
-The path to the korebuild-lock.txt file. Defaults to $Path/korebuild-lock.txt
-
-.PARAMETER Channel
-The channel of KoreBuild to download. Overrides the value from the config file.
-
-.PARAMETER DotNetHome
-The directory where .NET Core tools will be stored.
-
-.PARAMETER ToolsSource
-The base url where build tools can be downloaded. Overrides the value from the config file.
-
-.PARAMETER Update
-Updates KoreBuild to the latest version even if a lock file is present.
-
-.PARAMETER Reinstall
-Re-installs KoreBuild
-
-.PARAMETER ConfigFile
-The path to the configuration file that stores values. Defaults to korebuild.json.
-
-.PARAMETER CI
-Sets up CI specific settings and variables.
-
-.PARAMETER MSBuildArguments
-Additional MSBuild arguments to be passed through.
-
-.NOTES
-This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be.
-When the lockfile is not present, KoreBuild will create one using latest available version from $Channel.
-
-The $ConfigFile is expected to be an JSON file. It is optional, and the configuration values in it are optional as well. Any options set
-in the file are overridden by command line parameters.
-
-.EXAMPLE
-Example config file:
-```json
-{
- "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json",
- "channel": "master",
- "toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools"
-}
-```
-#>
-[CmdletBinding(PositionalBinding = $false)]
-param(
- [Parameter(Mandatory=$true, Position = 0)]
- [string]$Command,
- [string]$Path = $PSScriptRoot,
- [string]$LockFile,
- [Alias('c')]
- [string]$Channel,
- [Alias('d')]
- [string]$DotNetHome,
- [Alias('s')]
- [string]$ToolsSource,
- [Alias('u')]
- [switch]$Update,
- [switch]$Reinstall,
- [string]$ConfigFile = $null,
- [switch]$CI,
- [Parameter(ValueFromRemainingArguments = $true)]
- [string[]]$MSBuildArguments
-)
-
-Set-StrictMode -Version 2
-$ErrorActionPreference = 'Stop'
-
-#
-# Functions
-#
-
-function Get-KoreBuild {
-
- if (!(Test-Path $LockFile) -or $Update) {
- Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $LockFile
- }
-
- $version = Get-Content $LockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1
- if (!$version) {
- Write-Error "Failed to parse version from $LockFile. Expected a line that begins with 'version:'"
- }
- $version = $version.TrimStart('version:').Trim()
- $korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version)
-
- if ($Reinstall -and (Test-Path $korebuildPath)) {
- Remove-Item -Force -Recurse $korebuildPath
- }
-
- if (!(Test-Path $korebuildPath)) {
- Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version"
- New-Item -ItemType Directory -Path $korebuildPath | Out-Null
- $remotePath = "$ToolsSource/korebuild/artifacts/$version/korebuild.$version.zip"
-
- try {
- $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip"
- Get-RemoteFile $remotePath $tmpfile
- if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) {
- # Use built-in commands where possible as they are cross-plat compatible
- Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath
- }
- else {
- # Fallback to old approach for old installations of PowerShell
- Add-Type -AssemblyName System.IO.Compression.FileSystem
- [System.IO.Compression.ZipFile]::ExtractToDirectory($tmpfile, $korebuildPath)
- }
- }
- catch {
- Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore
- throw
- }
- finally {
- Remove-Item $tmpfile -ErrorAction Ignore
- }
- }
-
- return $korebuildPath
-}
-
-function Join-Paths([string]$path, [string[]]$childPaths) {
- $childPaths | ForEach-Object { $path = Join-Path $path $_ }
- return $path
-}
-
-function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) {
- if ($RemotePath -notlike 'http*') {
- Copy-Item $RemotePath $LocalPath
- return
- }
-
- $retries = 10
- while ($retries -gt 0) {
- $retries -= 1
- try {
- Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath
- return
- }
- catch {
- Write-Verbose "Request failed. $retries retries remaining"
- }
- }
-
- Write-Error "Download failed: '$RemotePath'."
-}
-
-#
-# Main
-#
-
-# Load configuration or set defaults
-
-$Path = Resolve-Path $Path
-if (!$ConfigFile) { $ConfigFile = Join-Path $Path 'korebuild.json' }
-
-if (Test-Path $ConfigFile) {
- try {
- $config = Get-Content -Raw -Encoding UTF8 -Path $ConfigFile | ConvertFrom-Json
- if ($config) {
- if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel }
- if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource}
- }
- } catch {
- Write-Warning "$ConfigFile could not be read. Its settings will be ignored."
- Write-Warning $Error[0]
- }
-}
-
-if (!$DotNetHome) {
- $DotNetHome = if ($env:DOTNET_HOME) { $env:DOTNET_HOME } `
- elseif ($CI) { Join-Path $PSScriptRoot '.dotnet' } `
- elseif ($env:USERPROFILE) { Join-Path $env:USERPROFILE '.dotnet'} `
- elseif ($env:HOME) {Join-Path $env:HOME '.dotnet'}`
- else { Join-Path $PSScriptRoot '.dotnet'}
-}
-
-if (!$LockFile) { $LockFile = Join-Path $Path 'korebuild-lock.txt' }
-if (!$Channel) { $Channel = 'master' }
-if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' }
-
-# Execute
-
-$korebuildPath = Get-KoreBuild
-Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1')
-
-try {
- Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $Path -ConfigFile $ConfigFile -CI:$CI
- Invoke-KoreBuildCommand $Command @MSBuildArguments
-}
-finally {
- Remove-Module 'KoreBuild' -ErrorAction Ignore
-}