From 73436261e3d6795b2c5dd8a23b46cb64e6b40284 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 13 Sep 2022 09:20:55 -0400 Subject: [PATCH 1/3] GetRuntimeInformation.targets: determine PortableProductMonikerRid based on OSName and Architecture. (backports #12516) --- src/redist/targets/GetRuntimeInformation.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets index 5133c3a38..01f704c7d 100644 --- a/src/redist/targets/GetRuntimeInformation.targets +++ b/src/redist/targets/GetRuntimeInformation.targets @@ -28,6 +28,8 @@ '$(Rid)' == 'linux-musl-x64' ">$(Rid) $(OSName)-$(Architecture) + $(HostOSName)-$(Architecture) + dotnet-sdk-internal$(PgoTerm) dotnet-sdk$(PgoTerm) From 88bc331e880f561979f76c1d0d53fc824d9bb5a5 Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Wed, 5 Oct 2022 14:45:05 -0700 Subject: [PATCH 2/3] Fix emsdk hash I noticed in the codeflow from 3xx to 4xx that the hash got messed up in the process and set to the 6.0.9 one. We don't believe the version needs to be updated but the hashes should match so reverting this. --- eng/Version.Details.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b08566090..ba9c724da 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -168,7 +168,7 @@ https://github.com/dotnet/emsdk - 3f6c45a2580cd9387b643163de8136a9691764c8 + 52e9452f82e26f9fcae791e84c082ae22f1ef66f https://github.com/dotnet/source-build From b389d53439cefec821ddc774d11cf002a85d004b Mon Sep 17 00:00:00 2001 From: Chris Rummel Date: Tue, 11 Oct 2022 13:43:26 -0500 Subject: [PATCH 3/3] Add support for using --with-packages with smoke-tests. (#14387) (#14587) * Add support for using --with-packages with smoke-tests. * Use a better variable name for custom packages directory. * Swap conditions so we don't have to delete the archive directory. Fixes https://github.com/dotnet/source-build/issues/2900. * Update src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs Co-authored-by: Michael Simons * Address review feedback. Co-authored-by: Michael Simons Co-authored-by: Michael Simons --- src/SourceBuild/tarball/content/build.proj | 1 + src/SourceBuild/tarball/content/build.sh | 29 ++++++++++++------- .../Config.cs | 2 ++ .../DotNetHelper.cs | 18 ++++++++++++ .../assets/local.NuGet.Config | 1 + 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/SourceBuild/tarball/content/build.proj b/src/SourceBuild/tarball/content/build.proj index 5976d8446..3cef840dc 100644 --- a/src/SourceBuild/tarball/content/build.proj +++ b/src/SourceBuild/tarball/content/build.proj @@ -107,6 +107,7 @@ SMOKE_TESTS_SDK_TARBALL_PATH=$(SdkTarballPath); SMOKE_TESTS_TARGET_RID=$(TargetRid); SMOKE_TESTS_PORTABLE_RID=$(PortableRid); + SMOKE_TESTS_CUSTOM_PACKAGES_PATH=$(CustomSourceBuiltPackagesPath); $(CustomTestEnvVars)" /> diff --git a/src/SourceBuild/tarball/content/build.sh b/src/SourceBuild/tarball/content/build.sh index 39e5fbd11..02a288a00 100755 --- a/src/SourceBuild/tarball/content/build.sh +++ b/src/SourceBuild/tarball/content/build.sh @@ -19,8 +19,9 @@ SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)" MSBUILD_ARGUMENTS=("/flp:v=detailed") CUSTOM_REF_PACKAGES_DIR='' -CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR='' +CUSTOM_PACKAGES_DIR='' alternateTarget=false +runningSmokeTests=false CUSTOM_SDK_DIR='' while :; do @@ -41,15 +42,15 @@ while :; do ;; --run-smoke-test) alternateTarget=true + runningSmokeTests=true MSBUILD_ARGUMENTS+=( "/t:RunSmokeTest" ) ;; --with-packages) - CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR="$(cd -P "$2" && pwd)" - if [ ! -d "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" ]; then - echo "Custom prviously built packages directory '$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR' does not exist" + CUSTOM_PACKAGES_DIR="$(cd -P "$2" && pwd)" + if [ ! -d "$CUSTOM_PACKAGES_DIR" ]; then + echo "Custom prviously built packages directory '$CUSTOM_PACKAGES_DIR' does not exist" exit 1 fi - MSBUILD_ARGUMENTS+=( "/p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" ) shift ;; --with-sdk) @@ -82,13 +83,21 @@ while :; do shift done +if [ "$CUSTOM_PACKAGES_DIR" != "" ]; then + if [ "$runningSmokeTests" == "true" ]; then + MSBUILD_ARGUMENTS+=( "/p:CustomSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" ) + else + MSBUILD_ARGUMENTS+=( "/p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" ) + fi +fi + if [ -f "$SCRIPT_ROOT/packages/archive/archiveArtifacts.txt" ]; then ARCHIVE_ERROR=0 if [ ! -d "$SCRIPT_ROOT/.dotnet" ] && [ "$CUSTOM_SDK_DIR" == "" ]; then echo "ERROR: SDK not found at $SCRIPT_ROOT/.dotnet" ARCHIVE_ERROR=1 fi - if [ ! -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts*.tar.gz ] && [ "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" == "" ]; then + if [ ! -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts*.tar.gz ] && [ "$CUSTOM_PACKAGES_DIR" == "" ]; then echo "ERROR: Private.SourceBuilt.Artifacts artifact not found at $SCRIPT_ROOT/packages/archive/ - Either run prep.sh or pass --with-packages parameter" ARCHIVE_ERROR=1 fi @@ -120,7 +129,9 @@ fi packageVersionsPath='' restoredPackagesDir="$SCRIPT_ROOT/packages/restored" -if [ -d "$SCRIPT_ROOT/packages/archive" ]; then +if [[ "$CUSTOM_PACKAGES_DIR" != "" && -f "$CUSTOM_PACKAGES_DIR/PackageVersions.props" ]]; then + packageVersionsPath="$CUSTOM_PACKAGES_DIR/PackageVersions.props" +elif [ -d "$SCRIPT_ROOT/packages/archive" ]; then sourceBuiltArchive=`find $SCRIPT_ROOT/packages/archive -maxdepth 1 -name 'Private.SourceBuilt.Artifacts*.tar.gz'` if [ -f "$SCRIPT_ROOT/packages/previously-source-built/PackageVersions.props" ]; then packageVersionsPath=$SCRIPT_ROOT/packages/previously-source-built/PackageVersions.props @@ -128,14 +139,12 @@ if [ -d "$SCRIPT_ROOT/packages/archive" ]; then tar -xzf "$sourceBuiltArchive" -C /tmp PackageVersions.props packageVersionsPath=/tmp/PackageVersions.props fi -elif [ -f "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props" ]; then - packageVersionsPath="$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props" fi if [ ! -f "$packageVersionsPath" ]; then echo "Cannot find PackagesVersions.props. Debugging info:" echo " Attempted archive path: $SCRIPT_ROOT/packages/archive" - echo " Attempted custom PVP path: $CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props" + echo " Attempted custom PVP path: $CUSTOM_PACKAGES_DIR/PackageVersions.props" exit 1 fi diff --git a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs index fc077fb19..b2ed5661f 100644 --- a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs +++ b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs @@ -15,6 +15,7 @@ internal static class Config public const string PoisonReportPathEnv = "SMOKE_TESTS_POISON_REPORT_PATH"; public const string PortableRidEnv = "SMOKE_TESTS_PORTABLE_RID"; public const string PrereqsPathEnv = "SMOKE_TESTS_PREREQS_PATH"; + public const string CustomPackagesPathEnv = "SMOKE_TESTS_CUSTOM_PACKAGES_PATH"; public const string SdkTarballPathEnv = "SMOKE_TESTS_SDK_TARBALL_PATH"; public const string TargetRidEnv = "SMOKE_TESTS_TARGET_RID"; public const string WarnPoisonDiffsEnv = "SMOKE_TESTS_WARN_POISON_DIFFS"; @@ -27,6 +28,7 @@ internal static class Config public static string PortableRid { get; } = Environment.GetEnvironmentVariable(PortableRidEnv) ?? throw new InvalidOperationException($"'{Config.PortableRidEnv}' must be specified"); public static string? PrereqsPath { get; } = Environment.GetEnvironmentVariable(PrereqsPathEnv); + public static string? CustomPackagesPath { get; } = Environment.GetEnvironmentVariable(CustomPackagesPathEnv); public static string? SdkTarballPath { get; } = Environment.GetEnvironmentVariable(SdkTarballPathEnv); public static string TargetRid { get; } = Environment.GetEnvironmentVariable(TargetRidEnv) ?? throw new InvalidOperationException($"'{Config.TargetRidEnv}' must be specified"); diff --git a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs index a9361453e..ae5508aa4 100644 --- a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs +++ b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs @@ -5,6 +5,7 @@ using System; using System.Diagnostics; using System.IO; +using System.Linq; using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests; @@ -66,6 +67,8 @@ internal class DotNetHelper if (useLocalPackages) { + // When using local packages this feed is always required. It contains packages that are + // not produced by source-build but are required by the various project templates. if (!Directory.Exists(Config.PrereqsPath)) { throw new InvalidOperationException( @@ -74,6 +77,21 @@ internal class DotNetHelper string nugetConfig = File.ReadAllText(nugetConfigPath); nugetConfig = nugetConfig.Replace("SMOKE_TEST_PACKAGE_FEED", Config.PrereqsPath); + + // This package feed is optional. You can use an additional feed of source-built packages to run the + // smoke-tests as offline as possible. + if (Config.CustomPackagesPath != null) + { + if (!Directory.Exists(Config.CustomPackagesPath)) + { + throw new ArgumentException($"Specified --with-packages {Config.CustomPackagesPath} does not exist."); + } + nugetConfig = nugetConfig.Replace("CUSTOM_PACKAGE_FEED", Config.CustomPackagesPath); + } + else + { + nugetConfig = string.Join(Environment.NewLine, nugetConfig.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Where(s => !s.Contains("CUSTOM_PACKAGE_FEED")).ToArray()); + } File.WriteAllText(nugetConfigPath, nugetConfig); } } diff --git a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/local.NuGet.Config b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/local.NuGet.Config index 78195779b..feac553a9 100644 --- a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/local.NuGet.Config +++ b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/local.NuGet.Config @@ -3,5 +3,6 @@ +