Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/DynamoDS/Dynamo into REVI…
Browse files Browse the repository at this point in the history
…T-214263
  • Loading branch information
sm6srw committed Oct 30, 2023
2 parents 73c2944 + 923663e commit 8c0d9b9
Show file tree
Hide file tree
Showing 31 changed files with 121 additions and 486 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/dynamoAllNet6.0_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,10 @@ jobs:
cd "$Env:GITHUB_WORKSPACE\Dynamo\bin\AnyCPU\Release"
echo "***Locating DynamoCLI for Windows!***"
test ".\DynamoCLI.exe" && echo "DynamoCLI exists!"
- name: Set artifact name
run: |
if ("${{ github.event_name }}" -eq 'pull_request') {
echo "ARTIFACT_NAME=DynamoSandbox-${{ github.event.pull_request.number }}" >> $env:GITHUB_ENV
} else {
echo "ARTIFACT_NAME=DynamoSandbox-$(git -C ./Dynamo rev-parse --short HEAD)" >> $env:GITHUB_ENV
}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
name: DynamoSandbox
path: ${{ github.workspace }}\Dynamo\bin\AnyCPU\Release
if-no-files-found: warn
retention-days: 3
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ env:

jobs:
ui_smoke_tests:
name: UI Smoke tests
name: UI Smoke Tests
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: DynamoDS/DynamoTestCompleteTests
token: ${{ secrets.DYNAMO_TESTS_TOKEN }}
ref: master
repository: DynamoDS/DynamoTestCompleteTests
token: ${{ secrets.DYNAMO_TESTS_TOKEN }}
ref: master
- name: Download TestExecute
run: Invoke-WebRequest -Uri "${{ env.TEST_EXECUTE_DOWNLOAD_URL }}" -OutFile ".\TE.exe"
- name: Install TestExecute
Expand All @@ -30,12 +30,13 @@ jobs:
- name: Download Artifact
uses: dawidd6/action-download-artifact@v2
with:
name: DynamoSandbox
workflow: ${{ github.event.workflow_run.workflow_id }}
path: ${{ github.workspace }}\build
- name: Run Tests
shell: cmd
run: .github\scripts\run_tests.bat ${{ secrets.TEST_EXECUTE_ACCESS_KEY }} Dynamo\Dynamo.pjs DynamoSandbox SmokeTests
- name: Test Report
- name: UI Smoke Tests Report
uses: dorny/[email protected]
if: always()
with:
Expand All @@ -46,3 +47,5 @@ jobs:
if: always()
run: |
type summary.md | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
echo "" >> $GITHUB_STEP_SUMMARY
echo ":package: Trigerred by: [${{ github.event.workflow_run.name }}](${{ github.event.workflow_run.html_url }})" >> $env:GITHUB_STEP_SUMMARY
7 changes: 5 additions & 2 deletions src/DynamoApplications/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand All @@ -11,4 +11,7 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("72464112-159f-4542-88c9-55734f67074e")]

[assembly:InternalsVisibleTo("IntegrationTests")]
[assembly:InternalsVisibleTo("IntegrationTests")]
[assembly: InternalsVisibleTo("DynamoSandbox")]
[assembly: InternalsVisibleTo("DynamoCLI")]
[assembly: InternalsVisibleTo("DynamoWPFCLI")]
75 changes: 32 additions & 43 deletions src/DynamoApplications/StartupUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Dynamo.Configuration;
using Dynamo.Core;
using Dynamo.Interfaces;
using Dynamo.Logging;
using Dynamo.Models;
using Dynamo.Scheduler;
using Dynamo.Updates;
Expand Down Expand Up @@ -52,8 +53,10 @@ internal class CMDLineOptions
public string CommonDataFolder { get; set; } = String.Empty;
[Option("HostName", Required = false, HelpText = "Identify Dynamo variation associated with host.")]
public string HostName { get; set; } = String.Empty;
[Option("DisableAnalytics", Required = false, HelpText = "Disables analytics in Dynamo for the process liftime.")]
[Option("DisableAnalytics", Required = false, HelpText = "Disables analytics in Dynamo for the process lifetime.")]
public bool DisableAnalytics { get; set; }
[Option("NoNetworkMode", Required = false, HelpText = "Disables network traffic in Dynamo at startup. Disables some features such as Notifications, Sign In, and ML Node Autocomplete for process lifetime.")]
public bool NoNetworkMode { get; set; }
[Option('p', "ParentId", Required = false, HelpText = "Identify Dynamo host analytics parent id.")]
public string ParentId { get; set; } = String.Empty;
[Option('s', "SessionId", Required = false, HelpText = "Identify Dynamo host analytics session id.")]
Expand All @@ -64,7 +67,7 @@ internal class CMDLineOptions
public bool ServiceMode { get; set; }
}

public class StartupUtils
public static class StartupUtils
{
//TODO internal?
/// <summary>
Expand Down Expand Up @@ -142,13 +145,22 @@ public static CommandLineArguments Parse(string[] args)
UserDataFolder = cmdArgs.UserDataFolder,
CommonDataFolder = cmdArgs.CommonDataFolder,
DisableAnalytics = cmdArgs.DisableAnalytics,
NoNetworkMode = cmdArgs.NoNetworkMode,
AnalyticsInfo = new HostAnalyticsInfo() { HostName = cmdArgs.HostName, ParentId = cmdArgs.ParentId, SessionId = cmdArgs.SessionId },
CERLocation = cmdArgs.CERLocation,
ServiceMode = cmdArgs.ServiceMode
};
}, errs => new CommandLineArguments());
}

internal void SetDisableAnalytics()
{
if (DisableAnalytics || NoNetworkMode)
{
Analytics.DisableAnalytics = true;
}
}

public string Locale { get; set; }
public string CommandFilePath { get; set; }
public string OpenFilePath { get; set; }
Expand All @@ -164,6 +176,7 @@ public static CommandLineArguments Parse(string[] args)
[Obsolete("This property will be removed in Dynamo 3.0 - please use AnalyticsInfo")]
public string HostName { get; set; }
public bool DisableAnalytics { get; set; }
public bool NoNetworkMode { get; set; }
public HostAnalyticsInfo AnalyticsInfo { get; set; }
public string CERLocation { get; set; }

Expand Down Expand Up @@ -227,22 +240,19 @@ private static IUpdateManager InitializeUpdateManager()
// Preload ASM and display corresponding message on splash screen
DynamoModel.OnRequestUpdateLoadBarStatus(new SplashScreenLoadEventArgs(Resources.SplashScreenPreLoadingAsm, 10));
var isASMloaded = PreloadASM(asmPath, out string geometryFactoryPath, out string preloaderLocation);
var model = StartDynamoWithDefaultConfig(true, userDataFolder, commonDataFolder, geometryFactoryPath, preloaderLocation, info);
var model = StartDynamoWithDefaultConfig(true, userDataFolder, commonDataFolder, geometryFactoryPath, preloaderLocation, false, info);
model.IsASMLoaded = isASMloaded;
return model;
}

/// <summary>
/// Use this overload to construct a DynamoModel in CLI context when the location of ASM to use is known, host analytics info is known and you want to set data paths.
/// </summary>
/// <param name="asmPath">Path to directory containing geometry library binaries</param>
/// <param name="userDataFolder">Path to be used by PathResolver for UserDataFolder</param>
/// <param name="commonDataFolder">Path to be used by PathResolver for CommonDataFolder</param>
/// <param name="info">Host analytics info specifying Dynamo launching host related information.</param>
/// <param name="isServiceMode">Boolean indication of launching Dynamo in service mode, this mode is optimized for minimal launch time.</param>
/// <param name="cmdLineArgs"></param>
/// <returns></returns>
public static DynamoModel MakeCLIModel(string asmPath, string userDataFolder, string commonDataFolder, HostAnalyticsInfo info = new HostAnalyticsInfo(), bool isServiceMode = false)
public static DynamoModel MakeCLIModel(CommandLineArguments cmdLineArgs)
{
var asmPath = String.IsNullOrEmpty(cmdLineArgs.ASMPath) ? string.Empty : cmdLineArgs.ASMPath;
IPathResolver pathResolver = CreatePathResolver(false, string.Empty, string.Empty, string.Empty);
PathManager.Instance.AssignHostPathAndIPathResolver(string.Empty, pathResolver);
DynamoModel.SetUICulture(PreferenceSettings.Instance.Locale);
Expand All @@ -251,7 +261,8 @@ private static IUpdateManager InitializeUpdateManager()
// Preload ASM and display corresponding message on splash screen
DynamoModel.OnRequestUpdateLoadBarStatus(new SplashScreenLoadEventArgs(Resources.SplashScreenPreLoadingAsm, 10));
var isASMloaded = PreloadASM(asmPath, out string geometryFactoryPath, out string preloaderLocation);
var model = StartDynamoWithDefaultConfig(true, userDataFolder, commonDataFolder, geometryFactoryPath, preloaderLocation, info, isServiceMode);
var model = StartDynamoWithDefaultConfig(true, cmdLineArgs.UserDataFolder, cmdLineArgs.CommonDataFolder,
geometryFactoryPath, preloaderLocation, cmdLineArgs.NoNetworkMode, cmdLineArgs.AnalyticsInfo, cmdLineArgs.ServiceMode);
model.IsASMLoaded = isASMloaded;
return model;
}
Expand All @@ -266,7 +277,8 @@ private static IUpdateManager InitializeUpdateManager()
public static DynamoModel MakeModel(bool CLImode, string asmPath = "", string hostName ="")
{
var isASMloaded = PreloadASM(asmPath, out string geometryFactoryPath, out string preloaderLocation);
var model = StartDynamoWithDefaultConfig(CLImode, string.Empty, string.Empty, geometryFactoryPath, preloaderLocation, new HostAnalyticsInfo() { HostName = hostName });
var model = StartDynamoWithDefaultConfig(CLImode, string.Empty, string.Empty,
geometryFactoryPath, preloaderLocation, false, new HostAnalyticsInfo() { HostName = hostName });
model.IsASMLoaded = isASMloaded;
return model;
}
Expand All @@ -275,10 +287,11 @@ public static DynamoModel MakeModel(bool CLImode, string asmPath = "", string ho
/// Use this overload to construct a DynamoModel when the location of ASM to use is known and host analytics info is known.
/// </summary>
/// <param name="CLImode">CLI mode starts the model in test mode and uses a separate path resolver.</param>
/// <param name="noNetworkMode">Option to initialize Dynamo in no-network mode</param>
/// <param name="asmPath">Path to directory containing geometry library binaries</param>
/// <param name="info">Host analytics info specifying Dynamo launching host related information.</param>
/// <returns></returns>
public static DynamoModel MakeModel(bool CLImode, string asmPath = "", HostAnalyticsInfo info = new HostAnalyticsInfo())
public static DynamoModel MakeModel(bool CLImode, bool noNetworkMode, string asmPath = "", HostAnalyticsInfo info = new HostAnalyticsInfo())
{
IPathResolver pathResolver = CreatePathResolver(false, string.Empty, string.Empty, string.Empty);
PathManager.Instance.AssignHostPathAndIPathResolver(string.Empty, pathResolver);
Expand All @@ -288,7 +301,8 @@ public static DynamoModel MakeModel(bool CLImode, string asmPath = "", string ho
// Preload ASM and display corresponding message on splash screen
DynamoModel.OnRequestUpdateLoadBarStatus(new SplashScreenLoadEventArgs(Resources.SplashScreenPreLoadingAsm, 10));
var isASMloaded = PreloadASM(asmPath, out string geometryFactoryPath, out string preloaderLocation);
var model = StartDynamoWithDefaultConfig(CLImode, string.Empty, string.Empty, geometryFactoryPath, preloaderLocation, info);
var model = StartDynamoWithDefaultConfig(CLImode, string.Empty, string.Empty, geometryFactoryPath,
preloaderLocation, noNetworkMode, info);
model.IsASMLoaded = isASMloaded;
return model;
}
Expand All @@ -306,33 +320,7 @@ private static IPathResolver CreatePathResolver(bool CLImode, string preloaderLo
IPathResolver pathResolver = CLImode ? new CLIPathResolver(preloaderLocation, userDataFolder, commonDataFolder) as IPathResolver : new SandboxPathResolver(preloaderLocation) as IPathResolver;
return pathResolver;
}

/// <summary>
/// TODO (DYN-2118) remove this method in 3.0 and unify this method with the overload above.
/// Use this overload to construct a DynamoModel when the location of ASM to use is known.
/// </summary>
/// <param name="CLImode">CLI mode starts the model in test mode and uses a seperate path resolver.</param>
/// <param name="asmPath">Path to directory containing geometry library binaries</param>
/// <returns></returns>
[Obsolete("This method will be removed in Dynamo 3.0 - please use the version with more parameters")]
public static DynamoModel MakeModel(bool CLImode, string asmPath)
{
var isASMloaded = PreloadASM(asmPath, out string geometryFactoryPath, out string preloaderLocation);
var model = StartDynamoWithDefaultConfig(CLImode, string.Empty, string.Empty, geometryFactoryPath, preloaderLocation);
model.IsASMLoaded = isASMloaded;
return model;
}

//TODO (DYN-2118) remove this method in 3.0 and unify this method with the overload above.
[Obsolete("This method will be removed in Dynamo 3.0 - please use the version with more parameters")]
public static DynamoModel MakeModel(bool CLImode)
{
var isASMloaded = PreloadASM(string.Empty, out string geometryFactoryPath, out string preloaderLocation);
var model = StartDynamoWithDefaultConfig(CLImode, string.Empty, string.Empty, geometryFactoryPath, preloaderLocation);
model.IsASMLoaded = isASMloaded;
return model;
}


private static bool PreloadASM(string asmPath, out string geometryFactoryPath, out string preloaderLocation )
{
if (string.IsNullOrEmpty(asmPath) && OSHelper.IsWindows())
Expand Down Expand Up @@ -391,6 +379,7 @@ private static DynamoModel StartDynamoWithDefaultConfig(bool CLImode,
string commonDataFolder,
string geometryFactoryPath,
string preloaderLocation,
bool noNetworkMode,
HostAnalyticsInfo info = new HostAnalyticsInfo(),
bool isServiceMode = false)
{
Expand All @@ -401,13 +390,13 @@ private static DynamoModel StartDynamoWithDefaultConfig(bool CLImode,
ProcessMode = CLImode ? TaskProcessMode.Synchronous : TaskProcessMode.Asynchronous,
HostAnalyticsInfo = info,
CLIMode = CLImode,
//TODO we currently use this like a no network comms flags - work on introducing a new flag or renaming this flag.
AuthProvider = CLImode || Dynamo.Logging.Analytics.DisableAnalytics ? null : new Core.IDSDKManager(),
AuthProvider = CLImode || noNetworkMode ? null : new Core.IDSDKManager(),
UpdateManager = CLImode ? null : OSHelper.IsWindows() ? InitializeUpdateManager() : null,
StartInTestMode = CLImode,
PathResolver = CreatePathResolver(CLImode, preloaderLocation, userDataFolder, commonDataFolder),
IsServiceMode = isServiceMode,
Preferences = PreferenceSettings.Instance
Preferences = PreferenceSettings.Instance,
NoNetworkMode = noNetworkMode
};
var model = DynamoModel.Start(config);
return model;
Expand Down
15 changes: 5 additions & 10 deletions src/DynamoCLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using System.Threading;
using Dynamo.Applications;
using Dynamo.Logging;
using Dynamo.Models;

namespace DynamoCLI
Expand All @@ -11,7 +12,7 @@ internal class Program
private static EventWaitHandle suspendEvent = new AutoResetEvent(false);

[STAThread]
static internal void Main(string[] args)
internal static void Main(string[] args)
{
bool useConsole = true;

Expand All @@ -20,10 +21,8 @@ static internal void Main(string[] args)
var cmdLineArgs = StartupUtils.CommandLineArguments.Parse(args);
useConsole = !cmdLineArgs.NoConsole;
var locale = StartupUtils.SetLocale(cmdLineArgs);
if (cmdLineArgs.DisableAnalytics)
{
Dynamo.Logging.Analytics.DisableAnalytics = true;
}

cmdLineArgs.SetDisableAnalytics();

if (cmdLineArgs.KeepAlive)
{
Expand Down Expand Up @@ -100,11 +99,7 @@ private static void RunKeepAlive(StartupUtils.CommandLineArguments cmdLineArgs)
private static DynamoModel StartupDynamo(StartupUtils.CommandLineArguments cmdLineArgs)
{
DynamoModel model;
model = Dynamo.Applications.StartupUtils.MakeCLIModel(String.IsNullOrEmpty(cmdLineArgs.ASMPath) ? string.Empty : cmdLineArgs.ASMPath,
cmdLineArgs.UserDataFolder,
cmdLineArgs.CommonDataFolder,
cmdLineArgs.AnalyticsInfo,
cmdLineArgs.ServiceMode);
model = StartupUtils.MakeCLIModel(cmdLineArgs);

if (!string.IsNullOrEmpty(cmdLineArgs.CERLocation))
{
Expand Down
12 changes: 0 additions & 12 deletions src/DynamoCore/Configuration/IPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ public interface IPreferences
/// </summary>
string NumberFormat { get; set; }

/// <summary>
/// Indicates whether usage reporting is approved or not.
/// </summary>
[Obsolete("Property will be deprecated in Dynamo 3.0")]
bool IsUsageReportingApproved { get; set; }

/// <summary>
/// Indicates whether Google analytics reporting is approved or not.
/// </summary>
[Obsolete("Property will be deprecated in Dynamo 3.0")]
bool IsAnalyticsReportingApproved { get; set; }

/// <summary>
/// Indicates whether ADP analytics reporting is approved or not.
/// </summary>
Expand Down
13 changes: 0 additions & 13 deletions src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,6 @@ internal readonly static Lazy<PreferenceSettings>
/// </summary>
public bool IsFirstRun { get; set; }

/// <summary>
/// Indicates whether usage reporting is approved or not.
/// </summary>
[Obsolete("Property will be deprecated in Dynamo 3.0")]
public bool IsUsageReportingApproved { get { return false; } set { } }

/// <summary>
/// Indicates whether Google analytics reporting is approved or not.
/// </summary>
[Obsolete("Property will be deprecated in Dynamo 3.0")]
public bool IsAnalyticsReportingApproved { get { return false; } set { } }

/// <summary>
/// This defines if the user export file path would include timestamp
/// </summary>
Expand Down Expand Up @@ -868,7 +856,6 @@ public PreferenceSettings()

// Default Settings
IsFirstRun = true;
IsAnalyticsReportingApproved = true;
Locale = Configurations.SupportedLocaleDic.FirstOrDefault().Value;
LibraryWidth = 304;
ConsoleHeight = 0;
Expand Down
Loading

0 comments on commit 8c0d9b9

Please sign in to comment.