Skip to content

Commit fc23448

Browse files
authored
Add publishing of NuGet package with CLI version (#167)
1 parent 2646438 commit fc23448

File tree

4 files changed

+65
-6
lines changed

4 files changed

+65
-6
lines changed

MetadataProcessor.Console/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public static void Main(string[] args)
213213
{
214214
System.Console.WriteLine("");
215215
System.Console.WriteLine("-parse <path-to-assembly-file> Analyses .NET assembly.");
216-
System.Console.WriteLine("-compile <path-to-PE-file> Compiles an assembly into nanoCLR format. Optionally flags if this it's a core library.");
216+
System.Console.WriteLine("-compile <path-to-PE-file> <isCoreLibrary> Compiles an assembly into nanoCLR format and (true/false) if this it's a core library.");
217217
System.Console.WriteLine("-loadHints <assembly-name> <path-to-assembly-file> Loads one (or more) assembly file(s) as a dependency(ies).");
218218
System.Console.WriteLine("-excludeClassByName <class-name> Removes the class from an assembly.");
219219
System.Console.WriteLine("-generateskeleton Generate skeleton files with stubs to add native code for an assembly.");
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>nanoFramework.Tools.MetadataProcessor.CLI</id>
5+
<title>nanoFramework.Tools.MetadataProcessor.CLI</title>
6+
<version>$version$</version>
7+
<authors>nanoframework</authors>
8+
<description>Command line interface to the Metadata Processor that is used internally by nanoFramework tooling and VS extensions. It is not needed for regular nanoFramework projects, but there are a few use cases where this tool is required.</description>
9+
<releaseNotes>
10+
</releaseNotes>
11+
<readme>docs\README.md</readme>
12+
<projectUrl>https://github.com/nanoframework/metadata-processor</projectUrl>
13+
<icon>images\nf-logo.png</icon>
14+
<license type="file">LICENSE.md</license>
15+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
16+
<repository type="git" url="https://github.com/nanoframework/metadata-processor" commit="$commit$" />
17+
<copyright>Copyright (c) .NET Foundation and Contributors</copyright>
18+
<references></references>
19+
<tags>nanoFramework</tags>
20+
<contentFiles>
21+
<files include="any\any\MetadataProcessor\**" buildAction="None" copyToOutput="true"/>
22+
</contentFiles>
23+
</metadata>
24+
<files>
25+
<file src="..\assets\nf-logo.png" target="images\" />
26+
<file src="..\LICENSE.md" target="" />
27+
<file src="..\README.md" target="docs\" />
28+
<!-- Installation via packages.json -->
29+
<file src="bin\Release\*.dll" target="content/MetadataProcessor" />
30+
<file src="bin\Release\*.exe" target="content/MetadataProcessor" />
31+
<file src="bin\Release\*.exe.config" target="content/MetadataProcessor" />
32+
<!-- Installation via PackageReference -->
33+
<file src="bin\Release\*.dll" target="/contentFiles/any/any/MetadataProcessor" />
34+
<file src="bin\Release\*.exe" target="/contentFiles/any/any/MetadataProcessor" />
35+
<file src="bin\Release\*.exe.config" target="/contentFiles/any/any/MetadataProcessor" />
36+
</files>
37+
</package>

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ Is part of .NET **nanoFramework** toolbox, along with other various tools that a
1313
Version 2.0 is a C# application adapted from the original work of [Oleg Rakhmatulin](@OlegRa).
1414
Version 1.0 was a Visual C++ application adapted from .NETMF toolbox.
1515

16+
## Using the metadata processor
17+
18+
The metadata processor is available in two packages.
19+
20+
The main use of the metadata processor is packaged as a MSBuild task: [nanoFramework.Tools.MetadataProcessor.MsBuildTask](https://www.nuget.org/packages/nanoFramework.Tools.MetadataProcessor.MsBuildTask). The task is well integrated into the .NET **nanoFramework** build system and is distributed as part of the VS extensions. Almost all use cases can be addressed by the build system as it is, or by setting build variables for, e.g., additional logging.
21+
22+
There are few use cases where the build task cannot be used. E.g., in software that generates source code at runtime, compiles the code via Roslyn, executes it on the virtual device, and uses the output for further processing. The metadata processor is required as a companion to Roslyn to convert the generated .NET assemblies to .NET **nanoFramework** .pe assemblies. The second package, [nanoFramework.Tools.MetadataProcessor.CLI](https://www.nuget.org/packages/nanoFramework.Tools.MetadataProcessor.CLI), contains a CLI version of the tool for this purpose. It is packaged as content: if added to a project, the tool will be distributed with the results of that project. If the package is added to a non-SDK-style project (e.g., .NET Framework project), make sure to set the *Copy to Output Directory* property for the files, as the package manager does not automatically do that. The code in the project should run the CLI with arguments *-loadhints*, *-parse* and *-compile* (in that order!) to create the .pe assembly.
23+
1624
## Developers guide
1725

1826
### Cloning the repository

azure-pipelines.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,25 @@ jobs:
209209
TargetFolder: '$(Build.ArtifactStagingDirectory)'
210210
flattenFolders: true
211211

212+
# set cloud build vars again as they've been overriten by the tests run
213+
- script: nbgv cloud -a -c
214+
condition: succeeded()
215+
displayName: Set build number
216+
217+
- task: PowerShell@2
218+
condition: succeeded()
219+
displayName: Save cloud build number
220+
inputs:
221+
targetType: 'inline'
222+
script: Write-Host "$("##vso[build.updatebuildnumber]")$env:NBGV_NuGetPackageVersion"
223+
224+
- task: NuGetCommand@2
225+
condition: succeeded()
226+
displayName: Pack NuGet with MetadataProcessor Console
227+
inputs:
228+
command: 'custom'
229+
arguments: 'pack MetadataProcessor.Console\package.nuspec -Version $(NBGV_NuGetPackageVersion) -properties commit="$(Build.SourceVersion)" -properties NoWarn=NU5100'
230+
212231
- task: CopyFiles@1
213232
condition: succeeded()
214233
displayName: Collecting NuGet package artifact
@@ -255,11 +274,6 @@ jobs:
255274
targetPath: '$(Build.ArtifactStagingDirectory)'
256275
artifactName: deployables
257276

258-
# set cloud build vars again as they've been overriten by the tests run
259-
- script: nbgv cloud -a -c
260-
condition: succeeded()
261-
displayName: Set build number
262-
263277
# push NuGet packages to NuGet (always happens except on PR builds)
264278
- task: NuGetCommand@2
265279
displayName: Push NuGet packages to NuGet

0 commit comments

Comments
 (0)