-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Rgen] Establish transformer tool setup (#21784)
Co-authored-by: GitHub Actions Autoformatter <[email protected]>
- Loading branch information
1 parent
2149632
commit b472b63
Showing
4 changed files
with
69 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.CommandLine; | ||
using System.CommandLine.Builder; | ||
using System.CommandLine.Parsing; | ||
using Microsoft.Macios.Transformer; | ||
|
||
|
||
//TODO: logging infra | ||
// add cli header stuff | ||
var parser = new CommandLineBuilder (new TransformCommand ()) | ||
.UseDefaults () | ||
.Build (); | ||
|
||
return await parser.InvokeAsync (args).ConfigureAwait (false); |
24 changes: 18 additions & 6 deletions
24
src/rgen/Microsoft.Macios.Transformer/Microsoft.Macios.Transformer.csproj
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 |
---|---|---|
@@ -1,10 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" /> | ||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Microsoft.Macios.Generator\Microsoft.Macios.Generator.csproj" PrivateAssets="all" /> | ||
<None Include="$(OutputPath)\*.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file was deleted.
Oops, something went wrong.
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,38 @@ | ||
using System.CommandLine; | ||
|
||
namespace Microsoft.Macios.Transformer; | ||
|
||
public class TransformCommand : Command { | ||
|
||
public TransformCommand () : base ("rgen-transform", "command to convert outdated bindings to be rgen compatible") | ||
{ | ||
var input = new Option<string> (["--input", "-i"], "input directory to search for bgen bindings") { | ||
//single file support? | ||
IsRequired = true | ||
}; | ||
AddOption (input); | ||
|
||
var output = new Option<string> (["--output", "-o"], "output directory to write rgen bindings") { | ||
IsRequired = true | ||
}; | ||
AddOption (output); | ||
|
||
AddValidator (result => { | ||
if (!Directory.Exists (result.GetValueForOption (input))) { | ||
result.ErrorMessage = "Input directory does not exist"; | ||
} | ||
if (!Directory.Exists (result.GetValueForOption (output))) { | ||
Directory.CreateDirectory (result.GetValueForOption (output)!); | ||
} | ||
}); | ||
// this.AddOption (new Option<bool> (new string [] { "--verbose", "-v" }, "verbose output")); | ||
|
||
this.SetHandler (Execute); | ||
} | ||
|
||
public async Task Execute () | ||
{ | ||
// placeholder for loading/parsing/transforming/writing components | ||
await Task.CompletedTask; | ||
} | ||
} |
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.