mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-08 23:09:40 +00:00
Added offline build mode for local build script (#806)
This commit is contained in:
1 parent
0ea63a16c0
commit
e4fa1cd72a
3 files changed
+85
-52
No files matched your search
@@ -7,6 +7,7 @@ namespace Build.Tools;
|
||||
public static class Environment
|
||||
{
|
||||
public const string DOTNET_VERSION = "net9.0";
|
||||
public const string BUILD_OFFLINE_ENVIRONMENT_VARIABLE = "AI_STUDIO_BUILD_OFFLINE";
|
||||
public static readonly Encoding UTF8_NO_BOM = new UTF8Encoding(false);
|
||||
|
||||
private static readonly Dictionary<RID, string> ALL_RIDS = Enum.GetValues<RID>().Select(rid => new KeyValuePair<RID, string>(rid, rid.AsMicrosoftRid())).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
|
||||
@@ -47,6 +48,19 @@ public static class Environment
|
||||
return Path.GetFullPath(directory);
|
||||
}
|
||||
|
||||
public static bool IsOfflineBuildRequested(bool offlineOption)
|
||||
{
|
||||
if (offlineOption)
|
||||
return true;
|
||||
|
||||
var environmentValue = global::System.Environment.GetEnvironmentVariable(BUILD_OFFLINE_ENVIRONMENT_VARIABLE);
|
||||
return environmentValue?.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"1" or "true" or "yes" or "on" => true,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
public static string? GetOS()
|
||||
{
|
||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
|
||||
Reference in new issue
Block a user