Skip to content

Commit 6be4d65

Browse files
committed
Merge in 'release/6.0.3xx' changes
2 parents 03ca8c1 + 2d21c66 commit 6be4d65

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

src/SourceBuild/tarball/content/build.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
SMOKE_TESTS_SDK_TARBALL_PATH=$(SdkTarballPath);
108108
SMOKE_TESTS_TARGET_RID=$(TargetRid);
109109
SMOKE_TESTS_PORTABLE_RID=$(PortableRid);
110+
SMOKE_TESTS_CUSTOM_PACKAGES_PATH=$(CustomSourceBuiltPackagesPath);
110111
$(CustomTestEnvVars)" />
111112
</Target>
112113

src/SourceBuild/tarball/content/build.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
1919

2020
MSBUILD_ARGUMENTS=("/flp:v=detailed")
2121
CUSTOM_REF_PACKAGES_DIR=''
22-
CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR=''
22+
CUSTOM_PACKAGES_DIR=''
2323
alternateTarget=false
24+
runningSmokeTests=false
2425
CUSTOM_SDK_DIR=''
2526

2627
while :; do
@@ -41,15 +42,15 @@ while :; do
4142
;;
4243
--run-smoke-test)
4344
alternateTarget=true
45+
runningSmokeTests=true
4446
MSBUILD_ARGUMENTS+=( "/t:RunSmokeTest" )
4547
;;
4648
--with-packages)
47-
CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR="$(cd -P "$2" && pwd)"
48-
if [ ! -d "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" ]; then
49-
echo "Custom prviously built packages directory '$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR' does not exist"
49+
CUSTOM_PACKAGES_DIR="$(cd -P "$2" && pwd)"
50+
if [ ! -d "$CUSTOM_PACKAGES_DIR" ]; then
51+
echo "Custom prviously built packages directory '$CUSTOM_PACKAGES_DIR' does not exist"
5052
exit 1
5153
fi
52-
MSBUILD_ARGUMENTS+=( "/p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" )
5354
shift
5455
;;
5556
--with-sdk)
@@ -82,13 +83,21 @@ while :; do
8283
shift
8384
done
8485

86+
if [ "$CUSTOM_PACKAGES_DIR" != "" ]; then
87+
if [ "$runningSmokeTests" == "true" ]; then
88+
MSBUILD_ARGUMENTS+=( "/p:CustomSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" )
89+
else
90+
MSBUILD_ARGUMENTS+=( "/p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" )
91+
fi
92+
fi
93+
8594
if [ -f "$SCRIPT_ROOT/packages/archive/archiveArtifacts.txt" ]; then
8695
ARCHIVE_ERROR=0
8796
if [ ! -d "$SCRIPT_ROOT/.dotnet" ] && [ "$CUSTOM_SDK_DIR" == "" ]; then
8897
echo "ERROR: SDK not found at $SCRIPT_ROOT/.dotnet"
8998
ARCHIVE_ERROR=1
9099
fi
91-
if [ ! -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts*.tar.gz ] && [ "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" == "" ]; then
100+
if [ ! -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts*.tar.gz ] && [ "$CUSTOM_PACKAGES_DIR" == "" ]; then
92101
echo "ERROR: Private.SourceBuilt.Artifacts artifact not found at $SCRIPT_ROOT/packages/archive/ - Either run prep.sh or pass --with-packages parameter"
93102
ARCHIVE_ERROR=1
94103
fi
@@ -120,22 +129,22 @@ fi
120129
packageVersionsPath=''
121130
restoredPackagesDir="$SCRIPT_ROOT/packages/restored"
122131

123-
if [ -d "$SCRIPT_ROOT/packages/archive" ]; then
132+
if [[ "$CUSTOM_PACKAGES_DIR" != "" && -f "$CUSTOM_PACKAGES_DIR/PackageVersions.props" ]]; then
133+
packageVersionsPath="$CUSTOM_PACKAGES_DIR/PackageVersions.props"
134+
elif [ -d "$SCRIPT_ROOT/packages/archive" ]; then
124135
sourceBuiltArchive=`find $SCRIPT_ROOT/packages/archive -maxdepth 1 -name 'Private.SourceBuilt.Artifacts*.tar.gz'`
125136
if [ -f "$SCRIPT_ROOT/packages/previously-source-built/PackageVersions.props" ]; then
126137
packageVersionsPath=$SCRIPT_ROOT/packages/previously-source-built/PackageVersions.props
127138
elif [ -f "$sourceBuiltArchive" ]; then
128139
tar -xzf "$sourceBuiltArchive" -C /tmp PackageVersions.props
129140
packageVersionsPath=/tmp/PackageVersions.props
130141
fi
131-
elif [ -f "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props" ]; then
132-
packageVersionsPath="$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props"
133142
fi
134143

135144
if [ ! -f "$packageVersionsPath" ]; then
136145
echo "Cannot find PackagesVersions.props. Debugging info:"
137146
echo " Attempted archive path: $SCRIPT_ROOT/packages/archive"
138-
echo " Attempted custom PVP path: $CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props"
147+
echo " Attempted custom PVP path: $CUSTOM_PACKAGES_DIR/PackageVersions.props"
139148
exit 1
140149
fi
141150

src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal static class Config
1515
public const string PoisonReportPathEnv = "SMOKE_TESTS_POISON_REPORT_PATH";
1616
public const string PortableRidEnv = "SMOKE_TESTS_PORTABLE_RID";
1717
public const string PrereqsPathEnv = "SMOKE_TESTS_PREREQS_PATH";
18+
public const string CustomPackagesPathEnv = "SMOKE_TESTS_CUSTOM_PACKAGES_PATH";
1819
public const string SdkTarballPathEnv = "SMOKE_TESTS_SDK_TARBALL_PATH";
1920
public const string TargetRidEnv = "SMOKE_TESTS_TARGET_RID";
2021
public const string WarnPoisonDiffsEnv = "SMOKE_TESTS_WARN_POISON_DIFFS";
@@ -27,6 +28,7 @@ internal static class Config
2728
public static string PortableRid { get; } = Environment.GetEnvironmentVariable(PortableRidEnv) ??
2829
throw new InvalidOperationException($"'{Config.PortableRidEnv}' must be specified");
2930
public static string? PrereqsPath { get; } = Environment.GetEnvironmentVariable(PrereqsPathEnv);
31+
public static string? CustomPackagesPath { get; } = Environment.GetEnvironmentVariable(CustomPackagesPathEnv);
3032
public static string? SdkTarballPath { get; } = Environment.GetEnvironmentVariable(SdkTarballPathEnv);
3133
public static string TargetRid { get; } = Environment.GetEnvironmentVariable(TargetRidEnv) ??
3234
throw new InvalidOperationException($"'{Config.TargetRidEnv}' must be specified");

src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Diagnostics;
77
using System.IO;
8+
using System.Linq;
89
using Xunit.Abstractions;
910

1011
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
@@ -66,6 +67,8 @@ private static void InitNugetConfig()
6667

6768
if (useLocalPackages)
6869
{
70+
// When using local packages this feed is always required. It contains packages that are
71+
// not produced by source-build but are required by the various project templates.
6972
if (!Directory.Exists(Config.PrereqsPath))
7073
{
7174
throw new InvalidOperationException(
@@ -74,6 +77,21 @@ private static void InitNugetConfig()
7477

7578
string nugetConfig = File.ReadAllText(nugetConfigPath);
7679
nugetConfig = nugetConfig.Replace("SMOKE_TEST_PACKAGE_FEED", Config.PrereqsPath);
80+
81+
// This package feed is optional. You can use an additional feed of source-built packages to run the
82+
// smoke-tests as offline as possible.
83+
if (Config.CustomPackagesPath != null)
84+
{
85+
if (!Directory.Exists(Config.CustomPackagesPath))
86+
{
87+
throw new ArgumentException($"Specified --with-packages {Config.CustomPackagesPath} does not exist.");
88+
}
89+
nugetConfig = nugetConfig.Replace("CUSTOM_PACKAGE_FEED", Config.CustomPackagesPath);
90+
}
91+
else
92+
{
93+
nugetConfig = string.Join(Environment.NewLine, nugetConfig.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Where(s => !s.Contains("CUSTOM_PACKAGE_FEED")).ToArray());
94+
}
7795
File.WriteAllText(nugetConfigPath, nugetConfig);
7896
}
7997
}

src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/local.NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<packageSources>
44
<clear />
55
<add key="smoke-test-prereqs" value="SMOKE_TEST_PACKAGE_FEED" />
6+
<add key="custom-packages" value="CUSTOM_PACKAGE_FEED" />
67
</packageSources>
78
</configuration>

0 commit comments

Comments
 (0)