Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add extra files in nugets #14774

Merged
merged 13 commits into from
Jan 11, 2024
21 changes: 18 additions & 3 deletions test/Libraries/SystemTestServices/SystemTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ protected virtual void StartDynamo(TestSessionConfiguration testConfig)
StartInTestMode = true,
PathResolver = pathResolver,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = TaskProcessMode.Synchronous
ProcessMode = TaskProcessMode.Synchronous,
DynamoCorePath = testConfig.DynamoCorePath
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
});

ViewModel = DynamoViewModel.Start(
Expand Down Expand Up @@ -305,15 +306,29 @@ public void AssertPreviewCount(string guid, int count)
Assert.AreEqual(count, data.GetElements().ToList().Count);
}

public NodeModel GetNode<T>(string guid) where T : NodeModel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the type constraint "NodeModel" because the nunit discovery process needed to resolve it.
I does not seem to matter if the method is private or public. The type constraint will still need to be resolved along with the containing type "SystemTestBase"

/// <summary>
/// Returns the NodeModel corresponding to the input guid
/// </summary>
/// <typeparam name="T">A NodeModel (or derived) type</typeparam>
/// <param name="guid">The node Guid</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
[Obsolete("This method will be removed in a future version of Dynamo")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it be replaced with some other method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I just did not want to overcomplicate de PR now. I can change the text of the obsolete method wen the new one is implemented

public NodeModel GetNode<T>(string guid) where T : class
{
bool isNodeModel = typeof(T) == typeof(NodeModel);
bool isDerivedFromNodeModel = typeof(T).IsSubclassOf(typeof(NodeModel));
if ( !isNodeModel && !isDerivedFromNodeModel)
{
throw new Exception($"{typeof(T)} is not of type NodeModel");
}
var allNodes = ViewModel.Model.CurrentWorkspace.Nodes;
var nodes = allNodes.Where(x => string.CompareOrdinal(x.GUID.ToString(), guid) == 0);
if (nodes.Count() < 1)
return null;
else if (nodes.Count() > 1)
throw new Exception("There are more than one nodes with the same GUID!");
return nodes.ElementAt(0) as T;
return nodes.ElementAt(0);
}

public object GetPreviewValue(string guid)
Expand Down
9 changes: 9 additions & 0 deletions tools/NuGet/build_props/DynamoVisualProgramming.Tests.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)TestServices.dll.config">
Copy link
Member

@mjkkirschner mjkkirschner Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when does this props file get used? When packing? When unpacking? At build time in the code that references this package?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just curious, is there a simpler way to get this config file to be copied - putting it in the lib subfolder folder does not work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Props files (from nugets) are consumed by the project that references the nuget when running restore.
This is a pretty standard way to have both assemblies and generic files in a nuget pacakge. There is another way to add generic files (as contentFIles) but those seem to be readonly (and we need write access).
https://learn.microsoft.com/en-us/nuget/concepts/msbuild-props-and-targets#packagereference-projects

<Link>TestServices.dll.config</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Visible>True</Visible>
</Content>
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions tools/NuGet/build_props/TestServices.dll.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="DynamoBasePath" value=""/>
<add key="RequestedLibraryVersion2" value=""/>
</appSettings>
</configuration>
18 changes: 3 additions & 15 deletions tools/NuGet/template-nuget/DynamoVisualProgramming.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,15 @@
<icon>content\images\logo.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Assemblies required to start a DynamoModel and execute DesignScript code. Contains the following files:
1) DynamoApplications.dll
2) DynamoCore.dll
3) DynamoInstallDetective.dll
4) DynamoShapeManager.dll
5) DynamoUtilities.dll
6) ProtoCore.dll
7) DesignScriptBuiltin.dll
8) VMDataBridge.dll
9) DSCPython.dll
10) DynamoPackages.dll
Assemblies required to reference core APIs from Dynamo.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</description>
<summary>This package contains the core assemblies for Dynamo.</summary>
<copyright>Copyright Autodesk 2023</copyright>
<dependencies>
<!--TODO - why do we reference nunit from dynamo core? This is an odd partial collection of dependencies to mark.-->
<group targetFramework="$TargetFramework$">
<dependency id="NUnit" version="3.13.3"/>
<dependency id="DynamoVisualProgramming.ZeroTouchLibrary" version="$Version$"/>
<!--NewtonSoft types are exposed in Dynamo public APIs-->
<dependency id="Newtonsoft.Json" version="13.0.1"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think this will cause problems?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, removing it would probably cause build issues for some consumers.
NewtonSoft types still seem to be publicly exposed "near" core Dynamo APIs. I will add a task to mark those as obsolete...or move them somewhere more hidden.

Copy link
Member

@mjkkirschner mjkkirschner Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it's going to be a big lift to get rid of these types as we require users to use those attributes, perhaps if those attributes are also now facaded by system.text.json we can switch it out without breaking previous builds - but needs to be determined. It was something I was hopeful we could do for 3.0, but no dice.

<dependency id="System.Collections.Immutable" version="5.0.0"/>
</group>
</dependencies>
</metadata>
Expand All @@ -57,4 +45,4 @@
<file src="DynamoPackages.xml" target="lib\$TargetFramework$" />
<file src="..\..\..\doc\distrib\Images\logo_square_32x32.png" target="content\images\logo.png" />
</files>
</package>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@
<icon>content\images\logo.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Reference the core node types for Dynamo. It contains the following files:
1) Analysis.dll
2) GeometryColor.dll
3) DSCoreNodes.dll
4) CoreNodeModels.dll
5) Watch3DNodeModels.dll
6) UnitNodeModels.dll
Reference the core node types for Dynamo.
</description>
<copyright>Copyright Autodesk 2023</copyright>
<dependencies>
Expand Down
17 changes: 12 additions & 5 deletions tools/NuGet/template-nuget/DynamoVisualProgramming.Tests.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,30 @@
<projectUrl>https://github.com/DynamoDS/Dynamo</projectUrl>
<icon>content\images\logo.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Unit and system test infrastructure for Dynamo. It contains the following files:
1) DynamoCoreTests.dll
2) SystemTestServices.dll
3) TestServices.dll</description>
<description>Unit and system test infrastructure for Dynamo.</description>
<summary>This package contains all that is required to get up and running creating tests for Dynamo libraries.</summary>
<copyright>Copyright Autodesk 2023</copyright>
<dependencies>
<group targetFramework="$TargetFramework$">
<dependency id="DynamoVisualProgramming.Core" version="$Version$"/>
<dependency id="DynamoVisualProgramming.Core" version="$Version$" exclude="runtime" />
<dependency id="DynamoVisualProgramming.DynamoServices" version="$Version$" />
<dependency id="Microsoft.NET.Test.Sdk" version="17.3.2" />
<dependency id="NUnit" version="3.13.3" />
<dependency id="NUnit3TestAdapter" version="4.2.1" />
</group>
</dependencies>
<contentFiles>
</contentFiles>
</metadata>
<files>
<!--These assemblies are referenced from the bin directory since they are not harvested for the installer-->
<file src="..\..\..\bin\AnyCPU\Release\DynamoCoreTests.dll" target="lib\$TargetFramework$" />
<file src="..\..\..\bin\AnyCPU\Release\SystemTestServices.dll" target="lib\$TargetFramework$" />
<file src="..\..\..\bin\AnyCPU\Release\TestServices.dll" target="lib\$TargetFramework$" />

<file src="..\..\..\tools\Nuget\build_props\TestServices.dll.config" target="build" />
<file src="..\..\..\tools\Nuget\build_props\DynamoVisualProgramming.Tests.props" target="build" />

<file src="..\..\..\doc\distrib\Images\logo_square_32x32.png" target="content\images\logo.png" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,10 @@
<icon>content\images\logo.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Build node libraries for Dynamo with custom UI in WPF. It contains the following files:
1) DynamoCoreWpf.dll
2) CoreNodeModelsWpf.dll
Build node libraries for Dynamo with custom UI in WPF.
</description>
<summary>This package contains all that is required to get up and running building nodes for the Dynamo Visual Programming language with custom UI in WPF.</summary>
<copyright>Copyright Autodesk 2023</copyright>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Xaml" targetFramework="net48"/>
<frameworkAssembly assemblyName="WindowsBase" targetFramework="net48"/>
<frameworkAssembly assemblyName="PresentationCore" targetFramework="net48"/>
<frameworkAssembly assemblyName="PresentationFramework" targetFramework="net48"/>
</frameworkAssemblies>
<dependencies>
<group targetFramework="$TargetFramework$">
<dependency id="DynamoVisualProgramming.Core" version="$Version$"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
<projectUrl>https://github.com/DynamoDS/Dynamo</projectUrl>
<icon>content\images\logo.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Build zero touch node libraries for Dynamo. It contains the following files:
1) DynamoUnits.dll
2) ProtoGeometry.dll</description>
<description>Build zero touch node libraries for Dynamo.</description>
<summary>This package contains all that is required to get up and running building zero touch libraries for the Dynamo Visual Programming language.</summary>
<copyright>Copyright Autodesk 2023</copyright>
<dependencies>
Expand All @@ -29,4 +27,4 @@

<file src="..\..\..\doc\distrib\Images\logo_square_32x32.png" target="content\images\logo.png" />
</files>
</package>
</package>
Loading