Skip to content

Commit

Permalink
Bit changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed May 19, 2019
1 parent 50e0b4a commit b21bdb4
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 66 deletions.
6 changes: 0 additions & 6 deletions ArtifactCollector/ArtifactCollector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
<ItemGroup>
<EmbeddedResource Include="Arduino.properties" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.151">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<Target Name="CopyArtifactCollector" AfterTargets="Build">
<Copy SourceFiles="$(ProjectDir)\bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).exe" DestinationFolder="$(ProjectDir)" />
</Target>
Expand Down
43 changes: 27 additions & 16 deletions ArtifactCollector/Collectors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ namespace IL2C.ArtifactCollector
{
internal static class Collectors
{
public static async Task<string> GetVersionStringAsync(string solutionDir)
{
var result = await Executor.ExecuteAsync(
solutionDir,
new string[0],
"nbgv",
"get-version",
"-v", "NuGetPackageVersion");
return result.Item2.Trim('\r', '\n', ' ', '\t');
}

public static Task RecreateDirectoryAsync(string path)
{
return Task.Run(() =>
Expand Down Expand Up @@ -49,16 +60,21 @@ private static Task CopyFileAsync(string from, string to)
});
}

private static async Task CopyArtifactsAsync(string artifactsDir, string targetDirectoryPath)
private static async Task CopyArtifactsAsync(string artifactsDir, string targetDirectoryPath, string versionString)
{
// 0.4.70-beta+e458a2c794 --> 0.4.70-beta-e458a2c794
var semver2Ids = ThisAssembly.AssemblyInformationalVersion.Split('+');
var semver2Ids = versionString.Split('+');
var semver2Id = string.Join("-", semver2Ids);

var nupkgPaths = Directory.GetFiles(targetDirectoryPath, "*.nupkg", SearchOption.AllDirectories).
Where(p => p.Contains(semver2Id)). // HACK: Check contains current semver2 id
Where(p =>
p.EndsWith(semver2Id + ".nupkg") ||
p.EndsWith(semver2Id + ".symbols.nupkg")). // HACK: Check contains current semver2 id
GroupBy(p => p.Replace(".symbols", string.Empty)).
Select(g => Tuple.Create(g.Key, g.OrderByDescending(p => p.Length).ToArray())).
Select(g => Tuple.Create(
g.Key, g.
OrderByDescending(p => p.Contains(".symbols") ? 1 : 0).
ThenByDescending(p => p.Length).ToArray())).
ToDictionary(entry => entry.Item1, entry => entry.Item2);

foreach (var nupkgPath in nupkgPaths.Select(entry => entry.Value.First()))
Expand All @@ -85,7 +101,7 @@ private static async Task CopyArtifactsAsync(string artifactsDir, string targetD
}
}

public static async Task BuildCsprojAndCollectArtifactsAsync(string solutionDir, string artifactsDir, IEnumerable<string> csprojPaths)
public static async Task BuildCsprojAndCollectArtifactsAsync(string solutionDir, string artifactsDir, IEnumerable<string> csprojPaths, string versionString)
{
foreach (var path in csprojPaths)
{
Expand All @@ -110,17 +126,13 @@ public static async Task BuildCsprojAndCollectArtifactsAsync(string solutionDir,
await Task.WhenAll(csprojPaths.
Select(path => Path.GetDirectoryName(Path.GetFullPath(path))).
Distinct().
Select(path => CopyArtifactsAsync(artifactsDir, path)));
Select(path => CopyArtifactsAsync(artifactsDir, path, versionString)));
}

public static async Task BuildNuspecAndCollectArtifactsAsync(string solutionDir, string artifactsDir, IEnumerable<string> nuspecPaths)
public static async Task BuildNuspecAndCollectArtifactsAsync(string solutionDir, string artifactsDir, IEnumerable<string> nuspecPaths, string versionString)
{
var nugetPath = Path.Combine(solutionDir, ".nuget", "nuget.exe");

// 0.4.70-beta+e458a2c794 --> 0.4.70-beta-e458a2c794
var semver2Ids = ThisAssembly.AssemblyInformationalVersion.Split('+');
var semver2Id = string.Join("-", semver2Ids);

foreach (var path in nuspecPaths)
{
var outputDirectory = Path.Combine(Path.GetDirectoryName(path), "bin", "Release");
Expand All @@ -130,7 +142,7 @@ public static async Task BuildNuspecAndCollectArtifactsAsync(string solutionDir,
new string[0],
nugetPath,
"pack",
"-Version", semver2Id,
"-Version", versionString,
"-NoPackageAnalysis",
"-Prop", $"Configuration=Release",
"-OutputDirectory", $"\"{outputDirectory}\"",
Expand All @@ -145,7 +157,7 @@ public static async Task BuildNuspecAndCollectArtifactsAsync(string solutionDir,
await Task.WhenAll(nuspecPaths.
Select(path => Path.GetDirectoryName(Path.GetFullPath(path))).
Distinct().
Select(path => CopyArtifactsAsync(artifactsDir, path)));
Select(path => CopyArtifactsAsync(artifactsDir, path, versionString)));
}

private static async Task CopyResourceWithReplacementsAsync(string resourceName, string path, IReadOnlyDictionary<string, string> replacements)
Expand All @@ -163,7 +175,7 @@ private static async Task CopyResourceWithReplacementsAsync(string resourceName,
}
}

public static async Task CollectArduinoArtifactsAsync(string solutionDir, string artifactsDir)
public static async Task CollectArduinoArtifactsAsync(string solutionDir, string artifactsDir, string versionString)
{
var arduinoBasePath = Path.Combine(artifactsDir, "Arduino");
await RecreateDirectoryAsync(arduinoBasePath);
Expand All @@ -173,8 +185,7 @@ await CopyResourceWithReplacementsAsync(
Path.Combine(arduinoBasePath, "library.properties"),
new Dictionary<string, string>
{
{ "{version}", ThisAssembly.AssemblyFileVersion },
{ "{semver2}", ThisAssembly.AssemblyInformationalVersion }
{ "{version}", versionString }
});

var fromIncludeDir = Path.Combine(solutionDir, "IL2C.Runtime", "include");
Expand Down
12 changes: 7 additions & 5 deletions ArtifactCollector/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ private static async Task<int> MainAsync(string[] args)
var artifactsDir = Path.GetFullPath(args[1]);
var dirNames = args.Skip(2).ToArray();

WriteLine("/////////////////////////////////////////////////////\r\nIL2C artifact collector");
var versionString = await Collectors.GetVersionStringAsync(solutionDir);

WriteLine("\r\n/////////////////////////////////////////////////////\r\nIL2C artifact collector\r\n");
WriteLine("SolutionDir={0}",
solutionDir);
WriteLine("ArtifactsDir={0}",
artifactsDir);
WriteLine("Target version={0}",
ThisAssembly.AssemblyInformationalVersion);
versionString);

await Collectors.RecreateDirectoryAsync(artifactsDir);

Expand All @@ -46,7 +48,7 @@ private static async Task<int> MainAsync(string[] args)
WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
string.Join(", ", csprojPaths.Select(p => Path.GetFileName(p))));

await Collectors.BuildCsprojAndCollectArtifactsAsync(solutionDir, artifactsDir, csprojPaths);
await Collectors.BuildCsprojAndCollectArtifactsAsync(solutionDir, artifactsDir, csprojPaths, versionString);

var nuspecPaths = dirNames.
SelectMany(p => Directory.GetFiles(Path.Combine(solutionDir, p), "*.nuspec")).
Expand All @@ -55,12 +57,12 @@ private static async Task<int> MainAsync(string[] args)
WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
string.Join(", ", nuspecPaths.Select(p => Path.GetFileName(p))));

await Collectors.BuildNuspecAndCollectArtifactsAsync(solutionDir, artifactsDir, nuspecPaths);
await Collectors.BuildNuspecAndCollectArtifactsAsync(solutionDir, artifactsDir, nuspecPaths, versionString);

WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
"Arduino library");

await Collectors.CollectArduinoArtifactsAsync(solutionDir, artifactsDir);
await Collectors.CollectArduinoArtifactsAsync(solutionDir, artifactsDir, versionString);
}
catch (Exception ex)
{
Expand Down
2 changes: 1 addition & 1 deletion ArtifactCollector/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"ArtifactCollector": {
"commandName": "Project",
"commandLineArgs": "D:\\PROJECT\\IL2C IL2C.Interop IL2C.Core IL2C.Tasks IL2C.Runtime"
"commandLineArgs": "D:\\PROJECT\\IL2C artifacts IL2C.Interop IL2C.Core IL2C.Tasks IL2C.Runtime"
}
}
}
66 changes: 28 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,6 @@

![Intermediate language everywhere!](images/banner.png)

## Packages

| Packages | master |
|:---|:---|
| IL2C.Build | [![NuGet IL2C.Build](https://img.shields.io/nuget/v/IL2C.Build.svg?style=flat)](https://www.nuget.org/packages/IL2C.Build) |
| IL2C.Interop | [![NuGet IL2C.Interop](https://img.shields.io/nuget/v/IL2C.Interop.svg?style=flat)](https://www.nuget.org/packages/IL2C.Interop) |
| IL2C.Core | [![NuGet IL2C.Core](https://img.shields.io/nuget/v/IL2C.Core.svg?style=flat)](https://www.nuget.org/packages/IL2C.Core) |
| IL2C.Runtime | [![NuGet IL2C.Runtime](https://img.shields.io/nuget/v/IL2C.Runtime.svg?style=flat)](https://www.nuget.org/packages/IL2C.Runtime) |
| IL2C.Runtime.msvc | [![NuGet IL2C.Runtime.msvc](https://img.shields.io/nuget/v/IL2C.Runtime.msvc.svg?style=flat)](https://www.nuget.org/packages/IL2C.Runtime.msvc) |

| Packages | devel |
|:---|:---|
| IL2C.Build | [![MyGet IL2C.Build](https://img.shields.io/myget/il2c/v/IL2C.Core.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Build) |
| IL2C.Interop | [![MyGet IL2C.Interop](https://img.shields.io/myget/il2c/v/IL2C.Interop.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Interop) |
| IL2C.Core | [![MyGet IL2C.Core](https://img.shields.io/myget/il2c/v/IL2C.Core.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Core) |
| IL2C.Runtime | [![MyGet IL2C.Runtime](https://img.shields.io/myget/il2c/v/IL2C.Runtime.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Runtime) |
| IL2C.Runtime.msvc | [![MyGet IL2C.Runtime.msvc](https://img.shields.io/myget/il2c/v/IL2C.Runtime.msvc.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Runtime.msvc) |

## Status

|Configuration|master|
|:--|:--|
|Publish|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-publish-master)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=6)
|Debug|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-master-Debug) ![Azure pipelines tests](https://img.shields.io/azure-devops/tests/kekyo/IL2C/2.svg)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=2)
|Release|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-master-Release) ![Azure pipelines tests](https://img.shields.io/azure-devops/tests/kekyo/IL2C/3.svg)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=3)


|Configuration|devel|
|:--|:--|
|Publish|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-publish-devel)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=6)
|Debug|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-devel-Debug) ![Azure pipelines tests](https://img.shields.io/azure-devops/tests/kekyo/IL2C/4.svg)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=4)<br>![Build Stats](https://buildstats.info/azurepipelines/chart/kekyo/IL2C/4?includeBuildsFromPullRequest=false)|
|Release|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-devel-Release) ![Azure pipelines tests](https://img.shields.io/azure-devops/tests/kekyo/IL2C/5.svg)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=5)<br>![Build Stats](https://buildstats.info/azurepipelines/chart/kekyo/IL2C/5?includeBuildsFromPullRequest=false)|

## What's this?

* IL2C is a translator (transpiler) of ECMA-335 CIL/MSIL to C language.
Expand Down Expand Up @@ -94,21 +61,44 @@ void HelloWorld_Main()
IL2C current status is **experimental**, read a simple ["Getting started"](docs/getting-started.md) for first step.
### Inside IL2C
If you need understanding deep knowledge for IL2C, see ["Inside IL2C"](docs/inside-il2c.md) .
## Overall status
## Project status
### Following lists are auto-generated by unit test.
Following lists are auto-generated by unit test.
* [Supported IL opcodes list](docs/supported-opcodes.md)
* [Supported basic types](docs/supported-basic-types.md)
* [Supported runtime system features](docs/supported-runtime-system-features.md)
* [Supported features (old)](docs/supported-features.md)
[Supported features (old)](docs/supported-features.md)
## Packages
| Packages | master | devel |
|:---|:---|:---|
| IL2C.Build | [![NuGet IL2C.Build](https://img.shields.io/nuget/v/IL2C.Build.svg?style=flat)](https://www.nuget.org/packages/IL2C.Build) | [![MyGet IL2C.Build](https://img.shields.io/myget/il2c/v/IL2C.Core.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Build) |
| IL2C.Interop | [![NuGet IL2C.Interop](https://img.shields.io/nuget/v/IL2C.Interop.svg?style=flat)](https://www.nuget.org/packages/IL2C.Interop) | [![MyGet IL2C.Interop](https://img.shields.io/myget/il2c/v/IL2C.Interop.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Interop) |
| IL2C.Core | [![NuGet IL2C.Core](https://img.shields.io/nuget/v/IL2C.Core.svg?style=flat)](https://www.nuget.org/packages/IL2C.Core) | [![MyGet IL2C.Core](https://img.shields.io/myget/il2c/v/IL2C.Core.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Core) |
| IL2C.Runtime | [![NuGet IL2C.Runtime](https://img.shields.io/nuget/v/IL2C.Runtime.svg?style=flat)](https://www.nuget.org/packages/IL2C.Runtime) | [![MyGet IL2C.Runtime](https://img.shields.io/myget/il2c/v/IL2C.Runtime.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Runtime) |
| IL2C.Runtime.msvc | [![NuGet IL2C.Runtime.msvc](https://img.shields.io/nuget/v/IL2C.Runtime.msvc.svg?style=flat)](https://www.nuget.org/packages/IL2C.Runtime.msvc) | [![MyGet IL2C.Runtime.msvc](https://img.shields.io/myget/il2c/v/IL2C.Runtime.msvc.svg?style=flat&label=myget)](https://www.myget.org/feed/il2c/package/nuget/IL2C.Runtime.msvc) |
| IL2C.Runtime.Arduino | [(Constructing)](https://github.com/kekyo/IL2C.Runtime.Arduino) | [(Constructing)](https://github.com/kekyo/IL2C.Runtime.Arduino) |
## Build status
|Configuration|master|
|:--|:--|
|Publish|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-publish-master)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=6)
|Debug|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-master-Debug) ![Azure pipelines tests](https://img.shields.io/azure-devops/tests/kekyo/IL2C/2.svg)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=2)
|Release|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-master-Release) ![Azure pipelines tests](https://img.shields.io/azure-devops/tests/kekyo/IL2C/3.svg)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=3)
|Configuration|devel|
|:--|:--|
|Publish|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-publish-devel)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=6)
|Debug|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-devel-Debug) ![Azure pipelines tests](https://img.shields.io/azure-devops/tests/kekyo/IL2C/4.svg)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=4)<br>![Build Stats](https://buildstats.info/azurepipelines/chart/kekyo/IL2C/4?includeBuildsFromPullRequest=false)|
|Release|[![Azure pipelines (.NET 4.5 / .NET Core 2.0)](https://kekyo.visualstudio.com/IL2C/_apis/build/status/IL2C-devel-Release) ![Azure pipelines tests](https://img.shields.io/azure-devops/tests/kekyo/IL2C/5.svg)](https://kekyo.visualstudio.com/IL2C/_build?definitionId=5)<br>![Build Stats](https://buildstats.info/azurepipelines/chart/kekyo/IL2C/5?includeBuildsFromPullRequest=false)|
## License
Expand Down
3 changes: 3 additions & 0 deletions init-tools.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@echo off
echo "Setup nbgv ..."
dotnet tool install -g nbgv

echo "Setup native binary toolchain (IL2C-toolchain-gcc4-mingw32) ..."

rmdir /s /q toolchain
Expand Down
3 changes: 3 additions & 0 deletions init-tools.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

echo "Setup nbgv ..."
dotnet tool install -g nbgv

echo "Setup native binary toolchain ..."

apt-get update -y
Expand Down

0 comments on commit b21bdb4

Please sign in to comment.