|
66 | 66 | </Target> |
67 | 67 |
|
68 | 68 | <!-- |
69 | | - _GenerateJavaStubs: lightweight — copies JCW files and generates stubs. |
70 | | - TypeMap generation already happened via _GenerateTrimmableTypeMap. |
| 69 | + _GenerateJavaStubs: overrides the legacy target from BuildOrder.targets. |
| 70 | + In the trimmable path, TypeMap generation already happened in _GenerateTrimmableTypeMap, |
| 71 | + so this target only handles JCW file copying, manifest, assembly store setup, and native config. |
| 72 | + We keep the name _GenerateJavaStubs because BuildOrder.targets references it. |
71 | 73 | --> |
72 | 74 | <Target Name="_GenerateJavaStubs" |
73 | | - DependsOnTargets="_SetLatestTargetFrameworkVersion;_CleanIntermediateIfNeeded;_PrepareAssemblies;_GetGenerateJavaStubsInputs;_PrepareNativeAssemblySources" |
| 75 | + DependsOnTargets="_SetLatestTargetFrameworkVersion;_CleanIntermediateIfNeeded;_PrepareAssemblies;_GetGenerateJavaStubsInputs;_DefineBuildTargetAbis;_PrepareNativeAssemblySources" |
74 | 76 | Inputs="@(_GenerateJavaStubsInputs)" |
75 | 77 | Outputs="$(_AndroidStampDirectory)_GenerateJavaStubs.stamp"> |
76 | 78 |
|
|
79 | 81 | </ItemGroup> |
80 | 82 | <Copy SourceFiles="@(_TypeMapJavaFiles)" DestinationFolder="$(IntermediateOutputPath)android\src\%(RecursiveDir)" /> |
81 | 83 |
|
82 | | - <!-- Add TRIMMED TypeMap DLLs (from ILLink output) to _ResolvedAssemblies so they're |
83 | | - counted by GenerateNativeApplicationConfigSources and included in the assembly store. |
84 | | - ILLink has already run in inner builds by the time _GenerateJavaStubs executes. --> |
| 84 | + <!-- TypeMap DLLs are already in _ResolvedAssemblies (added by the glob in _GenerateTrimmableTypeMap |
| 85 | + output flowing through the pipeline). They go through _RemoveRegisterAttribute → shrunk/. |
| 86 | + But they lack ABI metadata needed by CreateAssemblyStore. |
| 87 | + Add the metadata and ensure they're in _ShrunkUserAssemblies for the compression pipeline. --> |
| 88 | + <PropertyGroup> |
| 89 | + <_TypeMapFirstAbi Condition=" '$(AndroidSupportedAbis)' != '' ">$([System.String]::Copy('$(AndroidSupportedAbis)').Split(';')[0])</_TypeMapFirstAbi> |
| 90 | + <_TypeMapFirstAbi Condition=" '$(_TypeMapFirstAbi)' == '' ">arm64-v8a</_TypeMapFirstAbi> |
| 91 | + <_TypeMapFirstRid Condition=" '$(_TypeMapFirstAbi)' == 'arm64-v8a' ">android-arm64</_TypeMapFirstRid> |
| 92 | + <_TypeMapFirstRid Condition=" '$(_TypeMapFirstAbi)' == 'armeabi-v7a' ">android-arm</_TypeMapFirstRid> |
| 93 | + <_TypeMapFirstRid Condition=" '$(_TypeMapFirstAbi)' == 'x86_64' ">android-x64</_TypeMapFirstRid> |
| 94 | + <_TypeMapFirstRid Condition=" '$(_TypeMapFirstAbi)' == 'x86' ">android-x86</_TypeMapFirstRid> |
| 95 | + </PropertyGroup> |
85 | 96 | <ItemGroup> |
86 | | - <_LinkedTypeMapDlls Include="$(IntermediateOutputPath)android-arm64\linked\_*.TypeMap.dll;$(IntermediateOutputPath)android-arm64\linked\_Microsoft.Android.TypeMaps.dll" /> |
87 | | - <_ResolvedAssemblies Include="@(_LinkedTypeMapDlls)"> |
88 | | - <DestinationSubPath>%(Filename)%(Extension)</DestinationSubPath> |
| 97 | + <!-- Update existing _ResolvedAssemblies items to have ABI metadata --> |
| 98 | + <_ResolvedAssemblies Update="$(_TypeMapOutputDirectory)*.dll"> |
| 99 | + <Abi>$(_TypeMapFirstAbi)</Abi> |
| 100 | + <RuntimeIdentifier>$(_TypeMapFirstRid)</RuntimeIdentifier> |
| 101 | + <DestinationSubPath>$(_TypeMapFirstAbi)/%(Filename)%(Extension)</DestinationSubPath> |
| 102 | + <DestinationSubDirectory>$(_TypeMapFirstAbi)/</DestinationSubDirectory> |
89 | 103 | </_ResolvedAssemblies> |
90 | 104 | </ItemGroup> |
91 | 105 |
|
| 106 | + <!-- Generate native application config (assembly store hash table, environment, etc.). |
| 107 | + Must run AFTER TypeMap DLLs are added to _ResolvedAssemblies above. --> |
| 108 | + <GenerateNativeApplicationConfigSources |
| 109 | + ResolvedAssemblies="@(_ResolvedAssemblies)" |
| 110 | + SatelliteAssemblies="@(_AndroidResolvedSatellitePaths)" |
| 111 | + NativeLibraries="@(_AllNativeLibraries)" |
| 112 | + NativeLibrariesNoJniPreload="@(_AndroidNativeLibraryNeverJniPreload);@(AndroidNativeLibraryNoJniPreload)" |
| 113 | + NativeLibrariesAlwaysJniPreload="@(_AndroidNativeLibraryAlwaysJniPreload)" |
| 114 | + MonoComponents="@(_MonoComponent)" |
| 115 | + EnvironmentOutputDirectory="$(IntermediateOutputPath)android" |
| 116 | + Environments="@(_EnvironmentFiles)" |
| 117 | + AndroidAotMode="$(AndroidAotMode)" |
| 118 | + AndroidAotEnableLazyLoad="$(AndroidAotEnableLazyLoad)" |
| 119 | + EnableLLVM="$(EnableLLVM)" |
| 120 | + HttpClientHandlerType="$(AndroidHttpClientHandlerType)" |
| 121 | + TlsProvider="$(AndroidTlsProvider)" |
| 122 | + Debug="$(AndroidIncludeDebugSymbols)" |
| 123 | + AndroidSequencePointsMode="$(_SequencePointsMode)" |
| 124 | + EnableSGenConcurrent="$(AndroidEnableSGenConcurrent)" |
| 125 | + SupportedAbis="@(_BuildTargetAbis)" |
| 126 | + AndroidPackageName="$(_AndroidPackage)" |
| 127 | + EnablePreloadAssembliesDefault="$(_AndroidEnablePreloadAssembliesDefault)" |
| 128 | + PackageNamingPolicy="$(AndroidPackageNamingPolicy)" |
| 129 | + BoundExceptionType="$(AndroidBoundExceptionType)" |
| 130 | + RuntimeConfigBinFilePath="$(_BinaryRuntimeConfigPath)" |
| 131 | + UseAssemblyStore="$(_AndroidUseAssemblyStore)" |
| 132 | + EnableMarshalMethods="$(_AndroidUseMarshalMethods)" |
| 133 | + EnableManagedMarshalMethodsLookup="$(_AndroidUseManagedMarshalMethodsLookup)" |
| 134 | + CustomBundleConfigFile="$(AndroidBundleConfigurationFile)" |
| 135 | + TargetsCLR="$(_AndroidUseCLR)" |
| 136 | + AndroidRuntime="$(_AndroidRuntime)" |
| 137 | + ProjectRuntimeConfigFilePath="$(ProjectRuntimeConfigFilePath)" |
| 138 | + /> |
| 139 | + |
92 | 140 | <!-- HACK: Copy user's AndroidManifest.xml (TODO: #10807) --> |
93 | 141 | <Copy SourceFiles="$(_AndroidManifestAbs)" DestinationFiles="$(IntermediateOutputPath)AndroidManifest.xml" |
94 | 142 | SkipUnchangedFiles="true" |
|
0 commit comments