Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set RestoreConfigFile in environment #46101

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/SourceBuild/content/repo-projects/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@

<!-- Need to be passed in as an env var so that custom Exec tasks in the repo's DotNetBuild.props receive this setting. -->
<EnvironmentVariables Include="DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)" />

<!-- Needed for miscellanous projects in various repos - see https://github.com/dotnet/source-build/issues/4081-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What has changed to address dotnet/source-build#4081?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing yet. This PR was essentially to go find the places that need alteration.

<EnvironmentVariables Include="RestoreConfigFile=$(NuGetConfigFile)" Condition="'$(NuGetConfigFile)' != ''" />
</ItemGroup>

<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
Expand Down
2 changes: 2 additions & 0 deletions src/SourceBuild/content/repo-projects/aspnetcore.proj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<!-- Enable building installers on Windows and Linux. ASP.NET Core doesn't produce installers on Mac -->
<BuildActions Condition="'$(BuildOS)' == 'windows'">$(BuildActions) $(FlagParameterPrefix)BuildInstallers</BuildActions>
<BuildActions Condition="'$(BuildOS)' == 'linux'">$(BuildActions) $(FlagParameterPrefix)build-installers</BuildActions>
<BuildActions Condition="'$(NuGetConfigFile)' != '' and '$(BuildOS)' == 'windows'">$(BuildActions) $(FlagParameterPrefix)RestoreConfigFile "$(NuGetConfigFile)"</BuildActions>
<BuildActions Condition="'$(NuGetConfigFile)' != '' and '$(BuildOS)' != 'windows'">$(BuildActions) $(FlagParameterPrefix)restore-config-file "$(NuGetConfigFile)"</BuildActions>
<!-- In a source-only build, we don't pass -all, so we need to explicitly opt-in to managed components here. -->
<BuildActions Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(BuildOS)' == 'linux'">$(BuildActions) $(FlagParameterPrefix)build-managed</BuildActions>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Matt Mitchell (.NET) (from Dev Box)" <[email protected]>
Date: Wed, 22 Jan 2025 14:58:12 -0800
Subject: [PATCH] Add restore config file param

Backport: https://github.com/dotnet/aspnetcore/pull/60004

---
eng/DotNetBuild.props | 2 +-
eng/build.ps1 | 11 +++++++++++
eng/build.sh | 14 ++++++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/eng/DotNetBuild.props b/eng/DotNetBuild.props
index 9c4eb173ed..c4827cbcb4 100644
--- a/eng/DotNetBuild.props
+++ b/eng/DotNetBuild.props
@@ -32,7 +32,7 @@
<_AdditionalRepoTaskBuildArgs />
<_AdditionalRepoTaskBuildArgs Condition="'$(DotNetRuntimeSourceFeed)' != ''" >$(_AdditionalRepoTaskBuildArgs) --runtimesourcefeed $(DotNetRuntimeSourceFeed)</_AdditionalRepoTaskBuildArgs>
<_AdditionalRepoTaskBuildArgs Condition="'$(DotNetRuntimeSourceFeedKey)' != ''" >$(_AdditionalRepoTaskBuildArgs) --runtimesourcefeedkey $(DotNetRuntimeSourceFeedKey)</_AdditionalRepoTaskBuildArgs>
- <_AdditionalRepoTaskBuildArgs Condition="'$(RestoreConfigFile)' != ''" >$(_AdditionalRepoTaskBuildArgs) /p:RestoreConfigFile=$(RestoreConfigFile)</_AdditionalRepoTaskBuildArgs>
+ <_AdditionalRepoTaskBuildArgs Condition="'$(RestoreConfigFile)' != ''" >$(_AdditionalRepoTaskBuildArgs) --restore-config-file $(RestoreConfigFile)</_AdditionalRepoTaskBuildArgs>
</PropertyGroup>

<ItemGroup>
diff --git a/eng/build.ps1 b/eng/build.ps1
index 15fe87ac6f..9b34eec7f4 100644
--- a/eng/build.ps1
+++ b/eng/build.ps1
@@ -99,6 +99,9 @@ Additional feed that can be used when downloading .NET runtimes and SDKs
.PARAMETER RuntimeSourceFeedKey
Key for feed that can be used when downloading .NET runtimes and SDKs

+.PARAMETER RestoreConfigFile
+NuGet.config that should be passed to build commands (via /p:RestoreConfigFile)
+
.EXAMPLE
Building both native and managed projects.

@@ -196,6 +199,8 @@ param(
[Alias('DotNetRuntimeSourceFeedKey')]
[string]$RuntimeSourceFeedKey,

+ [string]$RestoreConfigFile,
+
# Capture the rest
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$MSBuildArguments
@@ -288,6 +293,12 @@ if ($RuntimeSourceFeed -or $RuntimeSourceFeedKey) {
$ToolsetBuildArguments += $runtimeFeedKeyArg
}

+if ($RestoreConfigFile) {
+ $restoreConfigFileArg = "/p:RestoreConfigFile=$RestoreConfigFile"
+ $MSBuildArguments += $restoreConfigFileArg
+ $ToolsetBuildArguments += $restoreConfigFileArg
+}
+
# Split build categories between dotnet msbuild and desktop msbuild. Use desktop msbuild as little as possible.
[string[]]$dotnetBuildArguments = ''
[string[]]$MSBuildOnlyArguments = ''
diff --git a/eng/build.sh b/eng/build.sh
index a27eaad468..0ffb000c57 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -35,6 +35,7 @@ target_arch='x64'
configuration=''
runtime_source_feed=''
runtime_source_feed_key=''
+restore_config_file=''

if [ "$(uname)" = "Darwin" ]; then
target_os_name='osx'
@@ -88,6 +89,8 @@ Options:
--runtime-source-feed Additional feed that can be used when downloading .NET runtimes and SDKs
--runtime-source-feed-key Key for feed that can be used when downloading .NET runtimes and SDKs

+ --restore-config-file NuGet.config file to use when building the repository
+
Description:
This build script installs required tools and runs an MSBuild command on this repository
This script can be used to invoke various targets, such as targets to produce packages
@@ -242,6 +245,11 @@ while [[ $# -gt 0 ]]; do
[ -z "${1:-}" ] && __error "Missing value for parameter --runtime-source-feed-key" && __usage
runtime_source_feed_key="${1:-}"
;;
+ -restore-config-file|-restoreconfigfile)
+ shift
+ [ -z "${1:-}" ] && __error "Missing value for parameter --restore-config-file" && __usage
+ restore_config_file="${1:-}"
+ ;;
*)
msbuild_args[${#msbuild_args[*]}]="$1"
;;
@@ -330,6 +338,12 @@ if [ ! -z "$runtime_source_feed$runtime_source_feed_key" ]; then
toolset_build_args[${#toolset_build_args[*]}]=$runtimeFeedKeyArg
fi

+if [ ! -z "$restore_config_file" ]; then
+ restoreConfigFileArg="/p:RestoreConfigFile=$restore_config_file"
+ msbuild_args[${#msbuild_args[*]}]=$restoreConfigFileArg
+ toolset_build_args[${#toolset_build_args[*]}]=$restoreConfigFileArg
+fi
+
# Initialize global variables need to be set before the import of Arcade is imported
restore=$run_restore

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Matt Mitchell (.NET) (from Dev Box)" <[email protected]>
Date: Wed, 22 Jan 2025 15:31:13 -0800
Subject: [PATCH] Pass restore config file arg to bootstrap build

Backport PR: https://github.com/dotnet/fsharp/pull/18260

---
eng/DotNetBuild.props | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/eng/DotNetBuild.props b/eng/DotNetBuild.props
index d16818033..b44b8bae3 100644
--- a/eng/DotNetBuild.props
+++ b/eng/DotNetBuild.props
@@ -31,6 +31,7 @@
<PropertyGroup>
<SourceBuildBootstrapTfmArg Condition="$(SourceBuildBootstrapTfm) != ''">--tfm $(SourceBuildBootstrapTfm)</SourceBuildBootstrapTfmArg>
<DotNetBuildUseMonoRuntime Condition="'$(DotNetBuildUseMonoRuntime)' == ''">false</DotNetBuildUseMonoRuntime>
+ <SourceBuildBootstrapRestoreConfigFileArg Condition="'$(RestoreConfigFile)' != ''" >/p:RestoreConfigFile=$(RestoreConfigFile)</SourceBuildBootstrapRestoreConfigFileArg>
</PropertyGroup>

<!-- this runs the source-build bootstrap path as described in https://github.com/dotnet/fsharp/blob/95df49e380ea8dbf33653fa4209f89dba29413f5/eng/build.sh#L247
@@ -41,7 +42,7 @@
-bl enables the binlogs for the tools and Proto builds, which make debugging failures here easier
-->
<Exec
- Command="./build.sh --bootstrap --skipBuild -bl $(SourceBuildBootstrapTfmArg) /p:DotNetBuildUseMonoRuntime=$(DotNetBuildUseMonoRuntime) /p:DotNetBuildSourceOnly=true /p:DotNetBuildInnerRepo=true /p:DotNetBuildRepo=true /p:DotNetBuildOrchestrator=$(DotNetBuildOrchestrator)"
+ Command="./build.sh --bootstrap --skipBuild -bl $(SourceBuildBootstrapTfmArg) $(SourceBuildBootstrapRestoreConfigFileArg) /p:DotNetBuildUseMonoRuntime=$(DotNetBuildUseMonoRuntime) /p:DotNetBuildSourceOnly=true /p:DotNetBuildInnerRepo=true /p:DotNetBuildRepo=true /p:DotNetBuildOrchestrator=$(DotNetBuildOrchestrator)"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
EnvironmentVariables="@(InnerBuildEnv)" />
</Target>
Loading