Skip to content
代码片段 群组 项目
未验证 提交 a673bfd7 编辑于 作者: Nate McMaster's avatar Nate McMaster
浏览文件

Add build script and CI config for the DataProtection folder

上级 4dfd351c
No related branches found
No related tags found
无相关合并请求
......@@ -15,3 +15,14 @@ phases:
- template: .vsts-pipelines/templates/project-ci.yml@buildtools
parameters:
buildArgs: "/t:CheckUniverse"
- phase: DataProtection
queue: Hosted VS2017
steps:
- script: src/DataProtection/build.cmd -ci
displayName: Run src/DataProtection/build.cmd
- task: PublishTestResults@2
displayName: Publish test results
condition: always()
inputs:
testRunner: vstest
testResultsFiles: 'src/DataProtection/artifacts/logs/**/*.trx'
......@@ -14,6 +14,9 @@ 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.
......@@ -75,6 +78,7 @@ param(
[Parameter(Mandatory=$true, Position = 0)]
[string]$Command,
[string]$Path = $PSScriptRoot,
[string]$LockFile,
[Alias('c')]
[string]$Channel,
[Alias('d')]
......@@ -104,15 +108,13 @@ $ErrorActionPreference = 'Stop'
function Get-KoreBuild {
$lockFile = Join-Path $Path 'korebuild-lock.txt'
if (!(Test-Path $lockFile) -or $Update) {
Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile
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
$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:'"
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)
......@@ -207,6 +209,7 @@ if (!$DotNetHome) {
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' }
......
......@@ -15,6 +15,7 @@ verbose=false
update=false
reinstall=false
repo_path="$DIR"
lockfile_path=''
channel=''
tools_source=''
ci=false
......@@ -41,6 +42,7 @@ __usage() {
echo " --config-file <FILE> The path to the configuration file that stores values. Defaults to korebuild.json."
echo " -d|--dotnet-home <DIR> The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet."
echo " --path <PATH> The directory to build. Defaults to the directory containing the script."
echo " --lockfile <PATH> The path to the korebuild-lock.txt file. Defaults to \$repo_path/korebuild-lock.txt"
echo " -s|--tools-source|-ToolsSource <URL> The base url where build tools can be downloaded. Overrides the value from the config file."
echo " --package-version-props-url <URL> The url of the package versions props path containing dependency versions."
echo " --access-token <Token> The query string to append to any blob store access for PackageVersionPropsUrl, if any."
......@@ -61,13 +63,12 @@ __usage() {
get_korebuild() {
local version
local lock_file="$repo_path/korebuild-lock.txt"
if [ ! -f "$lock_file" ] || [ "$update" = true ]; then
__get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file"
if [ ! -f "$lockfile_path" ] || [ "$update" = true ]; then
__get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lockfile_path"
fi
version="$(grep 'version:*' -m 1 "$lock_file")"
version="$(grep 'version:*' -m 1 "$lockfile_path")"
if [[ "$version" == '' ]]; then
__error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'"
__error "Failed to parse version from $lockfile_path. Expected a line that begins with 'version:'"
return 1
fi
version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
......@@ -176,6 +177,11 @@ while [[ $# -gt 0 ]]; do
repo_path="${1:-}"
[ -z "$repo_path" ] && __error "Missing value for parameter --path" && __usage
;;
--[Ll]ock[Ff]ile)
shift
lockfile_path="${1:-}"
[ -z "$lockfile_path" ] && __error "Missing value for parameter --lockfile" && __usage
;;
-s|--tools-source|-ToolsSource)
shift
tools_source="${1:-}"
......@@ -296,6 +302,7 @@ if [ ! -z "$product_build_id" ]; then
msbuild_args[${#msbuild_args[*]}]="-p:DotNetProductBuildId=$product_build_id"
fi
[ -z "$lockfile_path" ] && lockfile_path="$repo_path/korebuild-lock.txt"
[ -z "$channel" ] && channel='master'
[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
......
@ECHO OFF
SET RepoRoot="%~dp0..\.."
%RepoRoot%\build.cmd -LockFile %RepoRoot%\korebuild-lock.txt -Path %~dp0 %*
#!/usr/bin/env bash
set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
repo_root="$DIR/../.."
"$repo_root/build.sh" --path "$DIR" --lockfile "$repo_root/korebuild-lock.txt" "$@"
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册