forked from dotnet/java-interop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJava.Base.targets
More file actions
95 lines (87 loc) · 4.31 KB
/
Java.Base.targets
File metadata and controls
95 lines (87 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<Project>
<PropertyGroup>
<GeneratorPath>$(UtilityOutputFullPath)generator.dll</GeneratorPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.GenAPI" GeneratePathProperty="true" IncludeAssets="none" />
</ItemGroup>
<Target Name="_GetJavaBaseJmodPath">
<PropertyGroup Condition=" '$(Java11SdkDirectory)' != '' ">
<_JavaBaseJmod>$(Java11SdkDirectory)/jmods/java.base.jmod</_JavaBaseJmod>
</PropertyGroup>
</Target>
<Target Name="_GenerateApiDescription"
DependsOnTargets="_GetJavaBaseJmodPath"
BeforeTargets="_GenerateBinding"
Inputs="$(_JavaBaseJmod)"
Outputs="$(IntermediateOutputPath)\mcw\api.xml">
<MakeDir Directories="$(IntermediateOutputPath)mcw" />
<PropertyGroup>
<_ClassParse>"$(UtilityOutputFullPath)class-parse.dll"</_ClassParse>
<_Input>"$(_JavaBaseJmod)"</_Input>
<_Output>"-o=$(IntermediateOutputPath)/mcw/api.xml"</_Output>
</PropertyGroup>
<Error
Condition=" !Exists($(_JavaBaseJmod)) "
Text="Could not find a JDK-11 installation directory"
/>
<Exec
Command="$(DotnetToolPath) $(_ClassParse) $(_Input) $(_Output)"
/>
</Target>
<ItemGroup>
<_GenerateBindingInputs Include="$(GeneratorPath)" />
<_GenerateBindingInputs Include="$(MSBuildThisFileFullPath)" />
<_GenerateBindingInputs Include="Transforms\**" />
<_GenerateBindingInputs Include="$(IntermediateOutputPath)mcw\api.xml" />
</ItemGroup>
<Target Name="_GenerateBinding"
BeforeTargets="CoreCompile"
Inputs="@(_GenerateBindingInputs)"
Outputs="$(IntermediateOutputPath)mcw\Java.Base.projitems">
<MakeDir Directories="$(IntermediateOutputPath)mcw" />
<PropertyGroup>
<Generator>"$(GeneratorPath)"</Generator>
<_GenFlags>--public --global</_GenFlags>
<_Out>-o "$(IntermediateOutputPath)mcw"</_Out>
<_Codegen>--codegen-target=JavaInterop1</_Codegen>
<_Fixup>--fixup=Transforms/Metadata.xml</_Fixup>
<_Enums1>--preserve-enums --enumflags=Transforms/enumflags --enumfields=Transforms/map.csv --enummethods=Transforms/methodmap.csv</_Enums1>
<_Enums2>--enummetadata=$(IntermediateOutputPath)mcw/enummetadata</_Enums2>
<_Assembly>"--assembly=Java.Base"</_Assembly>
<_TypeMap>--type-map-report=$(IntermediateOutputPath)mcw/type-mapping.txt</_TypeMap>
<_Api>$(IntermediateOutputPath)mcw/api.xml</_Api>
<_Dirs>--enumdir=$(IntermediateOutputPath)mcw</_Dirs>
<_FullIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)'))</_FullIntermediateOutputPath>
<_LangFeatures>--lang-features=nullable-reference-types,default-interface-methods,nested-interface-types,interface-constants</_LangFeatures>
</PropertyGroup>
<Exec
Command="$(DotnetToolPath) $(Generator) $(_GenFlags) $(_ApiLevel) $(_Out) $(_Codegen) $(_Fixup) $(_Enums1) $(_Enums2) $(_Versions) $(_Annotations) $(_Assembly) $(_TypeMap) $(_LangFeatures) $(_Dirs) $(_Api) $(_WithJavadocXml)"
IgnoreStandardErrorWarningFormat="True"
/>
<ItemGroup>
<Compile Include="$(_FullIntermediateOutputPath)\mcw\**\*.cs" KeepDuplicates="False" />
</ItemGroup>
<XmlPeek
Namespaces="<Namespace Prefix='msbuild' Uri='http://schemas.microsoft.com/developer/msbuild/2003' />"
XmlInputPath="$(IntermediateOutputPath)mcw\Java.Base.projitems"
Query="/msbuild:Project/msbuild:PropertyGroup/msbuild:DefineConstants/text()" >
<Output TaskParameter="Result" PropertyName="_GeneratedDefineConstants" />
</XmlPeek>
<PropertyGroup>
<DefineConstants>$(DefineConstants);$([System.String]::Copy('$(_GeneratedDefineConstants)').Replace ('%24(DefineConstants);', ''))</DefineConstants>
</PropertyGroup>
</Target>
<Target Name="_GenerateRefApi"
Condition=" '$(PkgMicrosoft_DotNet_GenAPI)' != '' And '$(TargetPath)' != '' "
AfterTargets="Build"
Inputs="$(TargetPath)"
Outputs="..\Java.Base-ref.cs">
<PropertyGroup>
<_GenApi>$(PkgMicrosoft_DotNet_GenAPI)/tools/netcoreapp3.1/Microsoft.DotNet.GenAPI.dll</_GenApi>
<_Output>-o "../Java.Base-ref.cs"</_Output>
<_Libpath>--lib-path "$(OutputPath.TrimEnd('\'))"</_Libpath>
</PropertyGroup>
<Exec Command="$(DotnetToolPath) $(_GenApi) "$(TargetPath)" $(_Libpath) $(_Output)" />
</Target>
</Project>