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:
authorPranav K <prkrishn@hotmail.com>2017-11-28 21:55:08 +0300
committerPranav K <prkrishn@hotmail.com>2017-11-28 22:54:09 +0300
commit12e6e99d923815dc8897054a67733367e7674519 (patch)
treece4435ec0b50d96d9ce4b780987a4518957a0f13
parent5274867cb7eaff89988010fee3a13d154c82578d (diff)
Add support for restore sources and package version props url
Fixes #654 Fixes #656
-rw-r--r--build/repo.targets14
-rw-r--r--run.ps132
-rwxr-xr-xrun.sh43
3 files changed, 73 insertions, 16 deletions
diff --git a/build/repo.targets b/build/repo.targets
index 9dc0ecd702..36076b77a0 100644
--- a/build/repo.targets
+++ b/build/repo.targets
@@ -92,20 +92,22 @@
<_LineupPackages Include="%(ArtifactInfo.PackageId)" Version="%(ArtifactInfo.Version)" Condition=" '%(ArtifactInfo.ArtifactType)' == 'NuGetPackage' " />
<_LineupPackages Include="Microsoft.AspNetCore.All" Version="$(PackageVersion)" />
- <_LineupSources Include="$(DependencyPackageDir)" Condition="'$(DependencyPackageDir)' != '' AND Exists('$(DependencyPackageDir)')" />
- <_LineupSources Include="$(BuildDir)" />
- <_LineupSources Include="$(IntermediateExternalPackageDir)" />
- <_LineupSources Include="$(IntermediateMirrorPackageDir)" />
+ <_RestoreSources Include="$(DotNetRestoreSources)" Condition="'$(DotNetRestoreSources)' != ''" />
+ <_RestoreSources Include="$(DependencyPackageDir)" Condition="'$(DependencyPackageDir)' != '' AND Exists('$(DependencyPackageDir)')" />
+ <_RestoreSources Include="$(BuildDir)" />
+ <_RestoreSources Include="$(IntermediateExternalPackageDir)" />
+ <_RestoreSources Include="$(IntermediateMirrorPackageDir)" />
</ItemGroup>
<GeneratePackageVersionPropsFile
Packages="@(_LineupPackages)"
- OutputPath="$(GeneratedPackageVersionPropsPath)" />
+ OutputPath="$(GeneratedPackageVersionPropsPath)"
+ AdditionalImports="$(DotNetPackageVersionPropsPath)" />
<Copy SourceFiles="$(GeneratedPackageVersionPropsPath)" DestinationFolder="$(ArtifactsDir)" />
<RepoTasks.GenerateRestoreSourcesPropsFile
- Sources="@(_LineupSources)"
+ Sources="@(_RestoreSources)"
OutputPath="$(GeneratedRestoreSourcesPropsPath)" />
<PackNuSpec NuSpecPath="$(MSBuildThisFileDirectory)lineups\Internal.AspNetCore.Universe.Lineup.nuspec"
diff --git a/run.ps1 b/run.ps1
index 49c2899856..e46d790b60 100644
--- a/run.ps1
+++ b/run.ps1
@@ -29,8 +29,17 @@ Updates KoreBuild to the latest version even if a lock file is present.
.PARAMETER ConfigFile
The path to the configuration file that stores values. Defaults to korebuild.json.
-.PARAMETER Arguments
-Arguments to be passed to the command
+.PARAMETER PackageVersionPropsUrl
+(optional) the url of the package versions props path containing dependency versions.
+
+.PARAMETER AccessTokenSuffix
+(optional) the query string to append to any blob store access for PackageVersionPropsUrl, if any.
+
+.PARAMETER RestoreSources
+(optional) Semi-colon delimited list of additional NuGet feeds to use as part of restore.
+
+.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.
@@ -63,8 +72,11 @@ param(
[Alias('u')]
[switch]$Update,
[string]$ConfigFile,
+ [string]$PackageVersionPropsUrl = $null,
+ [string]$AccessTokenSuffix = $null,
+ [string]$RestoreSources = $null,
[Parameter(ValueFromRemainingArguments = $true)]
- [string[]]$Arguments
+ [string[]]$MSBuildArguments
)
Set-StrictMode -Version 2
@@ -177,6 +189,18 @@ if (!$DotNetHome) {
if (!$Channel) { $Channel = 'dev' }
if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' }
+if ($PackageVersionPropsUrl) {
+ $IntermediateDir = Join-Path $PSScriptRoot 'obj'
+ $PropsFilePath = Join-Path $IntermediateDir 'external-dependencies.props'
+ New-Item -ItemType Directory $IntermediateDir -ErrorAction Ignore | Out-Null
+ Get-RemoteFile "${PackageVersionPropsUrl}${AccessTokenSuffix}" $PropsFilePath
+ $MSBuildArguments += "-p:DotNetPackageVersionPropsPath=$PropsFilePath"
+}
+
+if ($RestoreSources) {
+ $MSBuildArguments = "-p:DotNetRestoreSources=$RestoreSources"
+}
+
# Execute
$korebuildPath = Get-KoreBuild
@@ -184,7 +208,7 @@ Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1')
try {
Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $Path -ConfigFile $ConfigFile
- Invoke-KoreBuildCommand $Command @Arguments
+ Invoke-KoreBuildCommand $Command @MSBuildArguments
}
finally {
Remove-Module 'KoreBuild' -ErrorAction Ignore
diff --git a/run.sh b/run.sh
index c278423acc..aa561a34fb 100755
--- a/run.sh
+++ b/run.sh
@@ -17,6 +17,10 @@ update=false
repo_path="$DIR"
channel=''
tools_source=''
+package_version_props_url=''
+access_token_suffix=''
+restore_sources=''
+msbuild_args=''
#
# Functions
@@ -35,6 +39,9 @@ __usage() {
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 " -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."
+ echo " --restore-sources <Sources> Semi-colon delimited list of additional NuGet feeds to use as part of restore."
echo " -u|--update Update to the latest KoreBuild even if the lock file is present."
echo ""
echo "Description:"
@@ -164,18 +171,29 @@ while [[ $# -gt 0 ]]; do
tools_source="${1:-}"
[ -z "$tools_source" ] && __usage
;;
+ --package-version-props-url|-PackageVersionPropsUrl)
+ shift
+ package_version_props_url="${1:-}"
+ [ -z "$package_version_props_url" ] && __usage
+ ;;
+ --access-token-suffix|-AccessTokenSuffix)
+ shift
+ access_token_suffix="${1:-}"
+ [ -z "$access_token_suffix" ] && __usage
+ ;;
+ --restore-sources|-RestoreSources)
+ shift
+ resourceSources="${1:-}"
+ [ -z "$restore_sources" ] && __usage
+ ;;
-u|--update|-Update)
update=true
;;
--verbose|-Verbose)
verbose=true
;;
- --)
- shift
- break
- ;;
*)
- break
+ msbuild_args+="\"$1\" "
;;
esac
shift
@@ -215,9 +233,22 @@ if [ -f "$config_file" ]; then
[ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source"
fi
+if [ "$package_version_props_url" ]; then
+ intermediate_dir="$repo_path/obj"
+ props_file_path="$intermediate_dir/external-dependencies.props"
+ mkdir -p "$intermediate_dir"
+ __get_remote_file "$package_version_props_url" "$props_file_path"
+ msbuild_args+="-p:DotNetPackageVersionPropsPath=\"$props_file_path\" "
+fi
+
+if [ "$restore_sources" ]; then
+ msbuild_args+="-p:DotNetRestoreSources=\"$restore_sources\" "
+fi
+
[ -z "$channel" ] && channel='dev'
[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
get_korebuild
set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$repo_path" "$config_file"
-invoke_korebuild_command "$command" "$@"
+
+invoke_korebuild_command "$command" "$msbuild_args"