2022-01-21 07:59:36 -06:00
|
|
|
// Licensed to the .NET Foundation under one or more agreements.
|
|
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
using System;
|
2022-02-10 15:58:01 -06:00
|
|
|
using System.IO;
|
2022-01-21 07:59:36 -06:00
|
|
|
|
|
|
|
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
|
|
|
|
|
|
|
|
internal static class Config
|
|
|
|
{
|
2022-03-03 08:02:48 -06:00
|
|
|
public const string DotNetDirectoryEnv = "SMOKE_TESTS_DOTNET_DIR";
|
|
|
|
public const string ExcludeOmniSharpEnv = "SMOKE_TESTS_EXCLUDE_OMNISHARP";
|
|
|
|
public const string MsftSdkTarballPathEnv = "SMOKE_TESTS_MSFT_SDK_TARBALL_PATH";
|
2023-07-18 13:32:26 -05:00
|
|
|
public const string PoisonReportPathEnv = "SMOKE_TESTS_POISON_REPORT_PATH";
|
2022-04-07 11:34:26 -05:00
|
|
|
public const string PortableRidEnv = "SMOKE_TESTS_PORTABLE_RID";
|
2022-03-03 08:02:48 -06:00
|
|
|
public const string PrereqsPathEnv = "SMOKE_TESTS_PREREQS_PATH";
|
2022-09-08 14:23:06 -05:00
|
|
|
public const string CustomPackagesPathEnv = "SMOKE_TESTS_CUSTOM_PACKAGES_PATH";
|
2022-03-03 08:02:48 -06:00
|
|
|
public const string SdkTarballPathEnv = "SMOKE_TESTS_SDK_TARBALL_PATH";
|
2023-02-02 11:14:58 -06:00
|
|
|
public const string SourceBuiltArtifactsPathEnv = "SMOKE_TESTS_SOURCEBUILT_ARTIFACTS_PATH";
|
2022-03-03 08:02:48 -06:00
|
|
|
public const string TargetRidEnv = "SMOKE_TESTS_TARGET_RID";
|
2022-03-23 12:25:05 -05:00
|
|
|
public const string WarnSdkContentDiffsEnv = "SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS";
|
2023-10-12 09:28:42 -05:00
|
|
|
public const string WarnLicenseScanDiffsEnv = "SMOKE_TESTS_WARN_LICENSE_SCAN_DIFFS";
|
2023-02-02 11:14:58 -06:00
|
|
|
public const string RunningInCIEnv = "SMOKE_TESTS_RUNNING_IN_CI";
|
2023-10-12 09:28:42 -05:00
|
|
|
public const string LicenseScanPathEnv = "SMOKE_TESTS_LICENSE_SCAN_PATH";
|
2022-03-03 08:02:48 -06:00
|
|
|
|
|
|
|
public static string DotNetDirectory { get; } =
|
|
|
|
Environment.GetEnvironmentVariable(DotNetDirectoryEnv) ?? Path.Combine(Directory.GetCurrentDirectory(), ".dotnet");
|
|
|
|
public static string? MsftSdkTarballPath { get; } = Environment.GetEnvironmentVariable(MsftSdkTarballPathEnv);
|
2023-07-18 13:32:26 -05:00
|
|
|
public static string? PoisonReportPath { get; } = Environment.GetEnvironmentVariable(PoisonReportPathEnv);
|
2022-04-07 11:34:26 -05:00
|
|
|
public static string PortableRid { get; } = Environment.GetEnvironmentVariable(PortableRidEnv) ??
|
|
|
|
throw new InvalidOperationException($"'{Config.PortableRidEnv}' must be specified");
|
2022-03-03 08:02:48 -06:00
|
|
|
public static string? PrereqsPath { get; } = Environment.GetEnvironmentVariable(PrereqsPathEnv);
|
2022-09-08 14:23:06 -05:00
|
|
|
public static string? CustomPackagesPath { get; } = Environment.GetEnvironmentVariable(CustomPackagesPathEnv);
|
2022-03-03 08:02:48 -06:00
|
|
|
public static string? SdkTarballPath { get; } = Environment.GetEnvironmentVariable(SdkTarballPathEnv);
|
2023-10-12 09:28:42 -05:00
|
|
|
public static string? SourceBuiltArtifactsPath { get; } = Environment.GetEnvironmentVariable(SourceBuiltArtifactsPathEnv);
|
2022-03-03 08:02:48 -06:00
|
|
|
public static string TargetRid { get; } = Environment.GetEnvironmentVariable(TargetRidEnv) ??
|
|
|
|
throw new InvalidOperationException($"'{Config.TargetRidEnv}' must be specified");
|
2022-04-14 16:20:25 -05:00
|
|
|
public static string TargetArchitecture { get; } = TargetRid.Split('-')[1];
|
2022-03-23 12:25:05 -05:00
|
|
|
public static bool WarnOnSdkContentDiffs { get; } =
|
2023-07-25 10:02:06 -05:00
|
|
|
bool.TryParse(Environment.GetEnvironmentVariable(WarnSdkContentDiffsEnv), out bool warnOnSdkContentDiffs) && warnOnSdkContentDiffs;
|
2023-10-12 09:28:42 -05:00
|
|
|
public static bool WarnOnLicenseScanDiffs { get; } =
|
|
|
|
bool.TryParse(Environment.GetEnvironmentVariable(WarnLicenseScanDiffsEnv), out bool warnOnLicenseScanDiffs) && warnOnLicenseScanDiffs;
|
2023-02-02 11:14:58 -06:00
|
|
|
|
|
|
|
// Indicates whether the tests are being run in the context of a CI pipeline
|
|
|
|
public static bool RunningInCI { get; } =
|
|
|
|
bool.TryParse(Environment.GetEnvironmentVariable(RunningInCIEnv), out bool runningInCI) && runningInCI;
|
2023-10-12 09:28:42 -05:00
|
|
|
|
|
|
|
public static string? LicenseScanPath { get; } = Environment.GetEnvironmentVariable(LicenseScanPathEnv);
|
2022-01-21 07:59:36 -06:00
|
|
|
}
|