-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW-FEATURE] Implements package metadata retrieval from ix project (#80
) * [ixc] adds retrieveal of metadata from nuget package * [ixc] adds documentation on packaging --------- Co-authored-by: PTKu <[email protected]>
- Loading branch information
Showing
23 changed files
with
234 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Creating NuGet package from Twin library | ||
|
||
NuGet is the preferred way to manage dependencies in an ix project. For creating NuGet packages you would follow the same procedure as with ordinary NuGet packages. | ||
|
||
## Additional configuration | ||
|
||
To properly create and consume a package you'd need to add the PLC project's metadata to your NuGet package. | ||
|
||
You can do it by adding the following in the respective `csproj` file of your twin project. | ||
|
||
~~~ XML | ||
<ItemGroup> | ||
<Folder Include=".meta\" /> | ||
<Content Include=".meta\**"/> | ||
</ItemGroup> | ||
~~~ | ||
|
||
or | ||
|
||
Set the files in the `.meta` folder to build action to `Content`. | ||
|
||
![](2023-02-18-09-32-22.png) | ||
|
||
|
||
## Versioning | ||
|
||
> **Important** | ||
> The APAX package and respective Twin NuGet package must be released with the same version number. APAX package and NuGet package with the same version number are considered aligned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/ix.compiler/src/IX.Cs.Compiler/Exceptions/FailedToDeterminePackageVersion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Ix.Compiler; | ||
|
||
public class FailedToDeterminePackageVersion : Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/ix.compiler/tests/Ix.Compiler.CsTests/PackageReferenceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit.Abstractions; | ||
using YamlDotNet.Core; | ||
|
||
namespace Ix.Compiler.CsTests | ||
{ | ||
public class PackageReferenceTests | ||
{ | ||
private readonly string testFolder; | ||
|
||
private ITestOutputHelper output; | ||
|
||
protected IEnumerable<Type> builders; | ||
|
||
protected string OutputSubFolder; | ||
|
||
public PackageReferenceTests(ITestOutputHelper output) | ||
{ | ||
this.output = output; | ||
|
||
#pragma warning disable CS8604 // Possible null reference argument. | ||
var executingAssemblyFileInfo | ||
= new FileInfo(Assembly.GetExecutingAssembly().FullName); | ||
#pragma warning restore CS8604 // Possible null reference argument. | ||
|
||
testFolder = executingAssemblyFileInfo.Directory!.FullName; | ||
} | ||
|
||
[Fact] | ||
public void retrieve_metadata_from_package_success() | ||
{ | ||
var packageFolder = Path.Combine(testFolder, $@"samples\packaging\"); | ||
var packageReference = new PackageReference(packageFolder, "ix.framework.core", "0.0.0"); | ||
|
||
Assert.True(File.Exists(packageReference.MetadataPath)); | ||
Assert.True(packageReference.IsIxDependency); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/ix.compiler/tests/Ix.Compiler.CsTests/samples/packaging/[Content_Types].xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> | ||
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /> | ||
<Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /> | ||
<Default Extension="dll" ContentType="application/octet" /> | ||
<Default Extension="json" ContentType="application/octet" /> | ||
<Default Extension="nuspec" ContentType="application/octet" /> | ||
</Types> |
5 changes: 5 additions & 0 deletions
5
src/ix.compiler/tests/Ix.Compiler.CsTests/samples/packaging/_rels/.rels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> | ||
<Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/ix.framework.core.nuspec" Id="RD93A6E0D5F092AD4" /> | ||
<Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/package/services/metadata/core-properties/4c98e6798bcd4b0ebb9e869bf1e81990.psmdcp" Id="RC47489BFB7BC9D85" /> | ||
</Relationships> |
1 change: 1 addition & 0 deletions
1
src/ix.compiler/tests/Ix.Compiler.CsTests/samples/packaging/content/.meta/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["NAMESPACE ix.framework.core\nCLASS IxContext END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS _NULL_CONTEXT END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxObject END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxContext END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxObject END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxComponent END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nTYPE eIxTaskState : INT (item0 := 0); END_TYPEEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxTask END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxComponent END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxServiceable END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxCoordinator END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nTYPE CoordinatorStates : INT (item0 := 0); END_TYPEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxTask END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxTaskState END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nTYPE eIxSequenceMode : INT (item0 := 0); END_TYPEEND_NAMESPACE","NAMESPACE ix.framework.core\nTYPE eIxSteppingMode : INT (item0 := 0); END_TYPEEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxSequencer END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxStep END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nEND_NAMESPACE","NAMESPACE ix.framework.core\nEND_NAMESPACE","NAMESPACE ix.framework.core\nEND_NAMESPACE","NAMESPACE ix.framework.core\nEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxStep END_INTERFACEEND_NAMESPACE"] |
1 change: 1 addition & 0 deletions
1
src/ix.compiler/tests/Ix.Compiler.CsTests/samples/packaging/content/.meta/sourceinfo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"ax-source":"../ctrl"} |
1 change: 1 addition & 0 deletions
1
...piler/tests/Ix.Compiler.CsTests/samples/packaging/contentFiles/any/net6.0/.meta/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["NAMESPACE ix.framework.core\nCLASS IxContext END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS _NULL_CONTEXT END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxObject END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxContext END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxObject END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxComponent END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nTYPE eIxTaskState : INT (item0 := 0); END_TYPEEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxTask END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxComponent END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxServiceable END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxCoordinator END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nTYPE CoordinatorStates : INT (item0 := 0); END_TYPEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxTask END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxTaskState END_INTERFACEEND_NAMESPACE","NAMESPACE ix.framework.core\nTYPE eIxSequenceMode : INT (item0 := 0); END_TYPEEND_NAMESPACE","NAMESPACE ix.framework.core\nTYPE eIxSteppingMode : INT (item0 := 0); END_TYPEEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxSequencer END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nCLASS IxStep END_CLASSEND_NAMESPACE","NAMESPACE ix.framework.core\nEND_NAMESPACE","NAMESPACE ix.framework.core\nEND_NAMESPACE","NAMESPACE ix.framework.core\nEND_NAMESPACE","NAMESPACE ix.framework.core\nEND_NAMESPACE","NAMESPACE ix.framework.core\nINTERFACE IIxStep END_INTERFACEEND_NAMESPACE"] |
1 change: 1 addition & 0 deletions
1
...tests/Ix.Compiler.CsTests/samples/packaging/contentFiles/any/net6.0/.meta/sourceinfo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"ax-source":"../ctrl"} |
18 changes: 18 additions & 0 deletions
18
src/ix.compiler/tests/Ix.Compiler.CsTests/samples/packaging/ix.framework.core.nuspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> | ||
<metadata> | ||
<id>ix.framework.core</id> | ||
<version>0.1.1-19-desing-component-base-class.38</version> | ||
<authors>ix.framework.core</authors> | ||
<description>Package Description</description> | ||
<dependencies> | ||
<group targetFramework="net6.0"> | ||
<dependency id="Ix.Connector" version="0.13.3-alpha.56" exclude="Build,Analyzers" /> | ||
</group> | ||
</dependencies> | ||
<contentFiles> | ||
<files include="any/net6.0/.meta/meta.json" buildAction="Content" /> | ||
<files include="any/net6.0/.meta/sourceinfo.json" buildAction="Content" /> | ||
</contentFiles> | ||
</metadata> | ||
</package> |
Binary file added
BIN
+51.5 KB
src/ix.compiler/tests/Ix.Compiler.CsTests/samples/packaging/lib/net6.0/ix.framework.core.dll
Binary file not shown.
Oops, something went wrong.