mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-22 20:45:38 +00:00
Merge pull request #627 from Nihlus/rewrite-new-1-better-options
Simplify option parsing for Generator.Rewrite
This commit is contained in:
commit
f3044c259a
|
@ -27,7 +27,7 @@
|
|||
<DocumentationFile>bin\Debug\Rewrite.xml</DocumentationFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Commandlineparameters>../../OpenTK/Debug/OpenTK.dll ../../../OpenTK.snk -debug</Commandlineparameters>
|
||||
<Commandlineparameters>--assembly ../../OpenTK/Debug/OpenTK.dll --signing-key ../../../OpenTK.snk --debug</Commandlineparameters>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -38,7 +38,7 @@
|
|||
<DocumentationFile>bin\Release\Rewrite.xml</DocumentationFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Commandlineparameters>../../OpenTK/Release/OpenTK.dll ../../../OpenTK.snk</Commandlineparameters>
|
||||
<Commandlineparameters>--assembly ../../OpenTK/Release/OpenTK.dll --signing-key ../../../OpenTK.snk</Commandlineparameters>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
|
@ -59,6 +59,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="CountAttribute.cs" />
|
||||
<Compile Include="GeneratedVariableIdentifier.cs" />
|
||||
<Compile Include="Options.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -98,6 +99,35 @@
|
|||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.0.3')">
|
||||
<ItemGroup>
|
||||
<Reference Include="CommandLine">
|
||||
<HintPath>..\..\packages\CommandLineParser\lib\net40\CommandLine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="CommandLine">
|
||||
<HintPath>..\..\packages\CommandLineParser\lib\net45\CommandLine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1')) Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.tvOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.watchOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac')">
|
||||
<ItemGroup>
|
||||
<Reference Include="CommandLine">
|
||||
<HintPath>..\..\packages\CommandLineParser\lib\netstandard1.5\CommandLine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v3.5'">
|
||||
<ItemGroup>
|
||||
|
@ -229,6 +259,29 @@
|
|||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib">
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
<Reference Include="System.Console">
|
||||
<HintPath>..\..\packages\System.Console\lib\net46\System.Console.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Console">
|
||||
<HintPath>..\..\packages\System.Console\ref\netstandard1.3\System.Console.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
|
||||
<ItemGroup>
|
||||
|
@ -310,9 +363,6 @@
|
|||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib">
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
<Reference Include="System.IO">
|
||||
<HintPath>..\..\packages\System.IO\lib\net462\System.IO.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
@ -417,6 +467,82 @@
|
|||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Linq.Expressions">
|
||||
<HintPath>..\..\packages\System.Linq.Expressions\lib\net463\System.Linq.Expressions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Linq.Expressions">
|
||||
<HintPath>..\..\packages\System.Linq.Expressions\ref\netstandard1.0\System.Linq.Expressions.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5')">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Linq.Expressions">
|
||||
<HintPath>..\..\packages\System.Linq.Expressions\ref\netstandard1.3\System.Linq.Expressions.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Linq.Expressions">
|
||||
<HintPath>..\..\packages\System.Linq.Expressions\lib\netstandard1.6\System.Linq.Expressions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Linq.Expressions">
|
||||
<HintPath>..\..\packages\System.Linq.Expressions\ref\netstandard1.6\System.Linq.Expressions.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.ObjectModel">
|
||||
<HintPath>..\..\packages\System.ObjectModel\ref\netstandard1.0\System.ObjectModel.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.ObjectModel">
|
||||
<HintPath>..\..\packages\System.ObjectModel\lib\netstandard1.3\System.ObjectModel.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.ObjectModel">
|
||||
<HintPath>..\..\packages\System.ObjectModel\ref\netstandard1.3\System.ObjectModel.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
|
@ -455,6 +581,77 @@
|
|||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.Emit">
|
||||
<HintPath>..\..\packages\System.Reflection.Emit\ref\netstandard1.1\System.Reflection.Emit.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.Emit">
|
||||
<HintPath>..\..\packages\System.Reflection.Emit\lib\netstandard1.3\System.Reflection.Emit.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.Emit.ILGeneration">
|
||||
<HintPath>..\..\packages\System.Reflection.Emit.ILGeneration\ref\netstandard1.0\System.Reflection.Emit.ILGeneration.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.Emit.ILGeneration">
|
||||
<HintPath>..\..\packages\System.Reflection.Emit.ILGeneration\lib\netstandard1.3\System.Reflection.Emit.ILGeneration.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.Emit.Lightweight">
|
||||
<HintPath>..\..\packages\System.Reflection.Emit.Lightweight\ref\netstandard1.0\System.Reflection.Emit.Lightweight.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.Emit.Lightweight">
|
||||
<HintPath>..\..\packages\System.Reflection.Emit.Lightweight\lib\netstandard1.3\System.Reflection.Emit.Lightweight.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2' Or $(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.Extensions">
|
||||
<HintPath>..\..\packages\System.Reflection.Extensions\ref\netstandard1.0\System.Reflection.Extensions.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2' Or $(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
|
@ -466,6 +663,35 @@
|
|||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.TypeExtensions">
|
||||
<HintPath>..\..\packages\System.Reflection.TypeExtensions\lib\net462\System.Reflection.TypeExtensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.TypeExtensions">
|
||||
<HintPath>..\..\packages\System.Reflection.TypeExtensions\lib\netstandard1.5\System.Reflection.TypeExtensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Reflection.TypeExtensions">
|
||||
<HintPath>..\..\packages\System.Reflection.TypeExtensions\ref\netstandard1.5\System.Reflection.TypeExtensions.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2' Or $(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
|
||||
<ItemGroup>
|
||||
|
|
24
src/Generator.Rewrite/Options.cs
Normal file
24
src/Generator.Rewrite/Options.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using CommandLine;
|
||||
using CommandLine.Text;
|
||||
|
||||
namespace OpenTK.Rewrite
|
||||
{
|
||||
public class Options
|
||||
{
|
||||
[Option('a', "assembly", Required = true,
|
||||
HelpText = "The path to the target assembly that should be rewritten.")]
|
||||
public string TargetAssembly { get; set; }
|
||||
|
||||
[Option('k', "signing-key",
|
||||
HelpText = "The path to the strong name key which should be used to sign or resign the assembly.")]
|
||||
public string StrongNameKey { get; set; }
|
||||
|
||||
[Option('d', "debug", Default = false,
|
||||
HelpText = "Enable calls to GL.GetError(), wrapped around each native call.")]
|
||||
public bool EnableDebugCalls { get; set; }
|
||||
|
||||
[Option("dllimport", Default = false,
|
||||
HelpText = "Force native calls to use DllImport instead of GetProcAddress.")]
|
||||
public bool UseDLLImport { get; set; }
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using CommandLine;
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
using Mono.Cecil.Rocks;
|
||||
|
@ -29,22 +29,29 @@ namespace OpenTK.Rewrite
|
|||
// with the s IL instructions.
|
||||
internal class Program
|
||||
{
|
||||
private static Options Options;
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
Parser.Default.ParseArguments<Options>(args)
|
||||
.WithParsed(result => Options = result)
|
||||
.WithNotParsed(error => Environment.Exit(-1));
|
||||
|
||||
// Argument error checking
|
||||
if (!File.Exists(Options.TargetAssembly))
|
||||
{
|
||||
Console.WriteLine("Usage: rewrite [file.dll] [file.snk] [options]");
|
||||
Console.WriteLine("[options] is:");
|
||||
Console.WriteLine(" -debug (enable calls to GL.GetError())");
|
||||
Console.WriteLine(" -dllimport (force calls to use DllImport instead of GetProcAddress)");
|
||||
return;
|
||||
Console.Error.WriteLine($"Target assembly not found. \n" +
|
||||
$"Please check the given path ({Options.TargetAssembly}).");
|
||||
}
|
||||
|
||||
if (!File.Exists(Path.ChangeExtension(Options.TargetAssembly, "pdb")))
|
||||
{
|
||||
Console.Error.WriteLine("Debugging symbols for target assembly not found. \n" +
|
||||
"Please make sure that debugging symbols are being generated.");
|
||||
}
|
||||
|
||||
var program = new Program();
|
||||
var file = args[0];
|
||||
var key = args[1];
|
||||
var options = args.Where(a => a.StartsWith("-") || a.StartsWith("/"));
|
||||
program.Rewrite(file, key, options);
|
||||
program.Rewrite();
|
||||
}
|
||||
|
||||
// mscorlib types
|
||||
|
@ -58,13 +65,8 @@ namespace OpenTK.Rewrite
|
|||
// OpenTK.BindingsBase
|
||||
private static TypeDefinition TypeBindingsBase;
|
||||
|
||||
private static bool dllimport;
|
||||
|
||||
private void Rewrite(string file, string keyfile, IEnumerable<string> options)
|
||||
private void Rewrite()
|
||||
{
|
||||
IEnumerable<string> optionsEnumerated = options as IList<string> ?? options.ToList();
|
||||
dllimport = optionsEnumerated.Contains("-dllimport");
|
||||
|
||||
// Specify assembly read and write parameters
|
||||
// We want to keep a valid symbols file (pdb or mdb)
|
||||
var read_params = new ReaderParameters();
|
||||
|
@ -74,11 +76,11 @@ namespace OpenTK.Rewrite
|
|||
read_params.ReadWrite = true;
|
||||
write_params.WriteSymbols = true;
|
||||
|
||||
if (!String.IsNullOrEmpty(keyfile) && File.Exists(keyfile))
|
||||
if (!String.IsNullOrEmpty(Options.StrongNameKey) && File.Exists(Options.StrongNameKey))
|
||||
{
|
||||
keyfile = Path.GetFullPath(keyfile);
|
||||
string absoluteKeyFilePath = Path.GetFullPath(Options.StrongNameKey);
|
||||
|
||||
using (var fs = new FileStream(keyfile, FileMode.Open, FileAccess.Read))
|
||||
using (var fs = new FileStream(absoluteKeyFilePath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
var keypair = new System.Reflection.StrongNameKeyPair(fs);
|
||||
write_params.StrongNameKeyPair = keypair;
|
||||
|
@ -92,7 +94,7 @@ namespace OpenTK.Rewrite
|
|||
// Load assembly and process all modules
|
||||
try
|
||||
{
|
||||
using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(file, read_params))
|
||||
using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(Options.TargetAssembly, read_params))
|
||||
{
|
||||
var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute");
|
||||
if (rewritten == null)
|
||||
|
@ -132,7 +134,7 @@ namespace OpenTK.Rewrite
|
|||
{
|
||||
foreach (var type in module.Types)
|
||||
{
|
||||
Rewrite(type, optionsEnumerated);
|
||||
Rewrite(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +154,7 @@ namespace OpenTK.Rewrite
|
|||
}
|
||||
}
|
||||
|
||||
private void Rewrite(TypeDefinition type, IEnumerable<string> options)
|
||||
private void Rewrite(TypeDefinition type)
|
||||
{
|
||||
var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints");
|
||||
if (entry_points != null)
|
||||
|
@ -162,7 +164,7 @@ namespace OpenTK.Rewrite
|
|||
entry_signatures.AddRange(type.Methods
|
||||
.Where(t => t.CustomAttributes.Any(a => a.AttributeType.Name == "SlotAttribute")));
|
||||
|
||||
Rewrite(type, entry_points, entry_signatures, options);
|
||||
Rewrite(type, entry_points, entry_signatures);
|
||||
|
||||
RemoveNativeSignatures(type, entry_signatures);
|
||||
}
|
||||
|
@ -180,7 +182,7 @@ namespace OpenTK.Rewrite
|
|||
private static int GetSlot(MethodDefinition signature)
|
||||
{
|
||||
// Pretend there is no slots if we want to force everything to work through DllImport (Android & iOS)
|
||||
if (dllimport)
|
||||
if (Options.UseDLLImport)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -196,14 +198,13 @@ namespace OpenTK.Rewrite
|
|||
}
|
||||
|
||||
private void Rewrite(TypeDefinition type, FieldDefinition entry_points,
|
||||
List<MethodDefinition> entry_signatures, IEnumerable<string> options)
|
||||
List<MethodDefinition> entry_signatures)
|
||||
{
|
||||
// Rewrite all wrapper methods
|
||||
var wrapper_signatures = new List<MethodDefinition>();
|
||||
wrapper_signatures.AddRange(type.Methods
|
||||
.Where(m => m.IsPublic && m.CustomAttributes.Any(a => a.AttributeType.Name == "AutoGeneratedAttribute")));
|
||||
|
||||
IEnumerable<string> optionsEnumerated = options as IList<string> ?? options.ToList();
|
||||
foreach (var wrapper in wrapper_signatures)
|
||||
{
|
||||
var autogenerated = wrapper.CustomAttributes
|
||||
|
@ -215,7 +216,7 @@ namespace OpenTK.Rewrite
|
|||
var signature = entry_signatures.FirstOrDefault(s => s.Name == signature_name);
|
||||
int slot = GetSlot(signature);
|
||||
|
||||
ProcessMethod(wrapper, signature, slot, entry_points, optionsEnumerated);
|
||||
ProcessMethod(wrapper, signature, slot, entry_points);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +226,7 @@ namespace OpenTK.Rewrite
|
|||
{
|
||||
foreach (var nested_type in type.NestedTypes)
|
||||
{
|
||||
Rewrite(nested_type, entry_points, entry_signatures, optionsEnumerated);
|
||||
Rewrite(nested_type, entry_points, entry_signatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,7 +273,7 @@ namespace OpenTK.Rewrite
|
|||
|
||||
// Create body for method
|
||||
private static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot,
|
||||
FieldDefinition entry_points, IEnumerable<string> options)
|
||||
FieldDefinition entry_points)
|
||||
{
|
||||
var body = wrapper.Body;
|
||||
var il = body.GetILProcessor();
|
||||
|
@ -283,8 +284,7 @@ namespace OpenTK.Rewrite
|
|||
// and push each parameter on the stack
|
||||
|
||||
DebugVariables vars = null;
|
||||
IEnumerable<string> optionsEnumerated = options as IList<string> ?? options.ToList();
|
||||
if (optionsEnumerated.Contains("-debug"))
|
||||
if (Options.EnableDebugCalls)
|
||||
{
|
||||
vars = EmitDebugPrologue(wrapper, il);
|
||||
}
|
||||
|
@ -301,7 +301,12 @@ namespace OpenTK.Rewrite
|
|||
generatedVariables = EmitConvenienceWrapper(wrapper, native, difference, body, il);
|
||||
}
|
||||
|
||||
if (slot != -1)
|
||||
if (slot == -1 || Options.UseDLLImport)
|
||||
{
|
||||
// issue DllImport call
|
||||
EmitCall(il, native);
|
||||
}
|
||||
else
|
||||
{
|
||||
// push the entry point address on the stack
|
||||
EmitEntryPoint(entry_points, il, slot);
|
||||
|
@ -309,11 +314,6 @@ namespace OpenTK.Rewrite
|
|||
// issue calli
|
||||
EmitCalli(il, native);
|
||||
}
|
||||
else
|
||||
{
|
||||
// issue DllImport call
|
||||
EmitCall(il, native);
|
||||
}
|
||||
|
||||
if (wrapper.ReturnType.Name != "Void")
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ namespace OpenTK.Rewrite
|
|||
|
||||
EmitParameterEpilogues(wrapper, native, body, il, generatedVariables);
|
||||
|
||||
if (optionsEnumerated.Contains("-debug"))
|
||||
if (Options.EnableDebugCalls)
|
||||
{
|
||||
EmitDebugEpilogue(wrapper, il, vars);
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
Mono.Cecil
|
||||
StyleCop.Analyzers
|
||||
StyleCop.Analyzers
|
||||
CommandLineParser
|
|
@ -798,10 +798,18 @@
|
|||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Target Name="AfterBuild">
|
||||
<Exec Command="$(OutputPath)..\..\..\Generator.Rewrite\bin\Debug\Rewrite.exe $(OutputPath)OpenTK.dll ..\..\OpenTK.snk -debug" Condition="$(OS) == 'Windows_NT' and $(Configuration) == 'Debug'" />
|
||||
<Exec Command="$(OutputPath)..\..\..\Generator.Rewrite\bin\Release\Rewrite.exe $(OutputPath)OpenTK.dll ..\..\OpenTK.snk" Condition="$(OS) == 'Windows_NT' and $(Configuration) == 'Release'" />
|
||||
<Exec Command="mono $(OutputPath)../../../Generator.Rewrite/bin/Debug/Rewrite.exe $(OutputPath)OpenTK.dll ../../OpenTK.snk -debug" Condition="$(OS) != 'Windows_NT' and $(Configuration) == 'Debug'" />
|
||||
<Exec Command="mono $(OutputPath)../../../Generator.Rewrite/bin/Release/Rewrite.exe $(OutputPath)OpenTK.dll ../../OpenTK.snk" Condition="$(OS) != 'Windows_NT' and $(Configuration) == 'Release'" />
|
||||
<Exec
|
||||
Condition="$(OS) == 'Windows_NT' and $(Configuration) == 'Debug'"
|
||||
Command="$(OutputPath)..\..\..\Generator.Rewrite\bin\Debug\Rewrite.exe --assembly $(OutputPath)OpenTK.dll --signing-key ..\..\OpenTK.snk --debug" />
|
||||
<Exec
|
||||
Condition="$(OS) == 'Windows_NT' and $(Configuration) == 'Release'"
|
||||
Command="$(OutputPath)..\..\..\Generator.Rewrite\bin\Release\Rewrite.exe --assembly $(OutputPath)OpenTK.dll --signing-key ..\..\OpenTK.snk" />
|
||||
<Exec
|
||||
Condition="$(OS) != 'Windows_NT' and $(Configuration) == 'Debug'"
|
||||
Command="mono $(OutputPath)../../../Generator.Rewrite/bin/Debug/Rewrite.exe --assembly $(OutputPath)OpenTK.dll --signing-key ../../OpenTK.snk --debug" />
|
||||
<Exec
|
||||
Condition="$(OS) != 'Windows_NT' and $(Configuration) == 'Release'"
|
||||
Command="mono $(OutputPath)../../../Generator.Rewrite/bin/Release/Rewrite.exe --assembly $(OutputPath)OpenTK.dll --signing-key ../../OpenTK.snk" />
|
||||
</Target>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
|
|
Loading…
Reference in a new issue