Skip to content

Commit 003f5d1

Browse files
authored
[Xamarin.Android.Build.Tasks] Remove ILRepack (#9226)
The historical reasons for needing to ILRepack assemblies should no longer be a concern in a .NET world without Visual Studio for Mac. The ILRepacker target has been removed, and the remaining external assembly=ies (`Newtonsoft.Json.dll`, `System.Reflection.Metadata.dll`) that were being repacked have been added to our workload SDK pack.
1 parent 3669ea5 commit 003f5d1

File tree

5 files changed

+5
-54
lines changed

5 files changed

+5
-54
lines changed

Documentation/guides/MSBuildBestPractices.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,7 @@ Waiting for debugger to attach (dotnet PID 13001). Press enter to continue...
1919

2020
You can then use VS or VSCode to attach to this process and debug you tasks.
2121

22-
In the case of .NET for Android we need to do a couple of thing first though. Firstly
23-
we need to disable the use of `ILRepacker` on the `Xamarin.Android.Build.Tasks`
24-
assembly. This is because `ILRepacker` does NOT handle debug symbols very well.
25-
Assemblies it generates seem to be JIT optimized so the debugger will not load
26-
the symbols. A new MSBuild property has been introduced to disable this feature
27-
while debugging. `_ILRepackEnabled` can be set as an environment variable which
28-
MSBuild will pickup. You will also need to build the `Debug` Configuration.
29-
30-
```dotnetcli
31-
export CONFIGURATION=Debug
32-
make prepare && _ILRepackEnabled=false make jenkins
33-
```
34-
35-
This will disable the `ILRepacker` for the build.
36-
37-
You can then start your test app with the `dotnet-local` script (so it uses your build)
22+
You can start your test app with the `dotnet-local` script (so it uses your build).
3823

3924
### [MacOS](#tab/macos)
4025

build-tools/create-packs/SignList.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<ItemGroup>
33
<!-- Do not sign files that already have a signature -->
44
<Skip Include="libZipSharp*" />
5+
<Skip Include="NuGet*" />
56
</ItemGroup>
67

78
<ItemGroup>
@@ -10,6 +11,7 @@
1011
<ThirdParty Include="Irony.dll" />
1112
<ThirdParty Include="K4os.Compression.LZ4.dll" />
1213
<ThirdParty Include="ELFSharp.dll" />
14+
<ThirdParty Include="Newtonsoft.Json.dll" />
1315
<ThirdParty Include="protobuf-net.dll" />
1416
<ThirdParty Include="SgmlReaderDll.dll" />
1517
<ThirdParty Include="aapt2.exe" />

build-tools/installers/create-installers.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Mono.Options.dll" />
120120
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Mono.Options.pdb" />
121121
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)MULTIDEX_JAR_LICENSE" />
122+
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Newtonsoft.Json.dll" />
122123
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)NuGet.Common.dll" />
123124
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)NuGet.Configuration.dll" />
124125
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)NuGet.DependencyResolver.Core.dll" />
@@ -142,6 +143,7 @@
142143
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)System.Collections.Immutable.dll" />
143144
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)System.Buffers.dll" />
144145
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)System.IO.Hashing.dll" />
146+
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)System.Reflection.Metadata.dll" />
145147
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Aapt2.targets" />
146148
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Analysis.targets" />
147149
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Application.targets" />

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
<ItemGroup>
2828
<PackageReference Include="Mono.Cecil" Version="$(MonoCecilVersion)" GeneratePathProperty="true" />
29-
<PackageReference Include="ILRepack" Version="2.0.28" />
3029
<PackageReference Include="Irony" />
3130
<PackageReference Include="NuGet.ProjectModel" Version="6.11.0" />
3231
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.targets

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<_MultiDexAarInAndroidSdk>extras\android\m2repository\com\android\support\multidex\1.0.1\multidex-1.0.1.aar</_MultiDexAarInAndroidSdk>
2929
<_SupportLicense Condition="Exists('$(_AndroidSdkLocation)\extras\android\m2repository\NOTICE.txt')">$(_AndroidSdkLocation)\extras\android\m2repository\NOTICE.txt</_SupportLicense>
3030
<_SupportLicense Condition="Exists('$(_AndroidSdkLocation)\extras\android\m2repository\m2repository\NOTICE.txt')">$(_AndroidSdkLocation)\extras\android\m2repository\m2repository\NOTICE.txt</_SupportLicense>
31-
<_ILRepackEnabled Condition=" '$(_ILRepackEnabled)' == '' ">true</_ILRepackEnabled>
3231
</PropertyGroup>
3332
<ItemGroup>
3433
<None
@@ -290,42 +289,6 @@
290289
<Exec Command="chmod +x @(_MonoScriptDestination->'%(Identity)', ' ')" />
291290
</Target>
292291

293-
<ItemGroup>
294-
<InputAssemblies Include="$(OutputPath)Newtonsoft.Json.dll" />
295-
<InputAssemblies Include="$(OutputPath)System.Collections.Immutable.dll" />
296-
<InputAssemblies Include="$(OutputPath)System.Reflection.Metadata.dll" />
297-
</ItemGroup>
298-
299-
<Target Name="ILRepacker"
300-
Condition=" '$(_ILRepackEnabled)' == 'true' "
301-
BeforeTargets="CopyFilesToOutputDirectory"
302-
Inputs="$(MSBuildAllProjects);@(IntermediateAssembly);@(InputAssemblies)"
303-
Outputs="$(IntermediateOutputPath)ILRepacker.stamp" >
304-
<ItemGroup>
305-
<_InputAssembliesThatExist Include="@(InputAssemblies)" Condition="Exists('%(Identity)')" />
306-
<_NetstandardPath Include="@(ReferencePath->'%(RootDir)%(Directory)')" Condition="'%(FileName)%(Extension)' == 'netstandard.dll'" />
307-
</ItemGroup>
308-
<PropertyGroup>
309-
<_NetstandardDir>@(_NetstandardPath)</_NetstandardDir>
310-
<_ILRepackArgs>/out:&quot;$(MSBuildThisFileDirectory)$(IntermediateOutputPath)$(AssemblyName).dll&quot; /internalize</_ILRepackArgs>
311-
<_ILRepackArgs>$(_ILRepackArgs) /keyfile:&quot;$(XamarinAndroidSourcePath)product.snk&quot;</_ILRepackArgs>
312-
<_ILRepackArgs>$(_ILRepackArgs) &quot;$(MSBuildThisFileDirectory)$(IntermediateOutputPath)$(AssemblyName).dll&quot;</_ILRepackArgs>
313-
<_ILRepackArgs>$(_ILRepackArgs) @(_InputAssembliesThatExist->'&quot;%(Identity)&quot;', ' ')</_ILRepackArgs>
314-
<_ILRepackArgs>$(_ILRepackArgs) /lib:&quot;$(_NetstandardDir.TrimEnd('\'))&quot;</_ILRepackArgs> <!-- Path to netstandard.dll -->
315-
</PropertyGroup>
316-
<Exec
317-
Command="$(ManagedRuntime) $(ManagedRuntimeArgs) &quot;$(ILRepack)&quot; $(_ILRepackArgs)"
318-
WorkingDirectory="$(OutputPath)"
319-
/>
320-
<Touch
321-
Files="$(IntermediateOutputPath)ILRepacker.stamp"
322-
AlwaysCreate="True"
323-
/>
324-
<ItemGroup>
325-
<FileWrites Include="$(IntermediateOutputPath)ILRepacker.stamp" />
326-
</ItemGroup>
327-
</Target>
328-
329292
<ItemGroup>
330293
<_ExtraPackageSource Include="$(PkgXamarin_LibZipSharp)\lib\$(TargetFrameworkNETStandard)\libZipSharp.pdb" />
331294
<_ExtraPackageTarget Include="$(OutputPath)\libZipSharp.pdb" />

0 commit comments

Comments
 (0)