Skip to content
  • Marek Habersack's avatar
    [tmt] Update to work with current `libxamarin-app.so` (#8694) · 71b6fcc9
    Marek Habersack authored
    Context: 46f10fe0
    Context? 68368189
    
    `tools/tmt` (46f10fe0) is a utility to print typemap entries contained
    within an application.
    
    `tools/tmt` no longer supports dumping typemap entries; it was
    possibly broken in 68368189:
    
    	% ./dotnet-local.sh build tools/tmt/*.csproj
    	% ./dotnet-local.sh build -c Release samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj
    	% bin/Debug/bin/tmt samples/HelloWorld/HelloWorld/bin/Release/net9.0-android/*-Signed.apk
    	No type maps found in 'samples/HelloWorld/HelloWorld/bin/Release/net9.0-android/com.xamarin.android.helloworld-Signed.apk'
    
    Update the `tools/tmt` utility to support the current format of
    typemaps within `libxamarin-app.so`, and update it to generate nicely
    formatted Markdown report files instead of the text file output:
    
    	% bin/Debug/bin/tmt samples/HelloWorld/HelloWorld/bin/Release/net9.0-android/*-Signed.apk
    	samples/HelloWorld/HelloWorld/bin/Release/net9.0-android/com.xamarin.android.helloworld-Signed.apk!lib/arm64-v8a/libxamarin-app.so:
    	  File Type: Xamarin App Release DSO
    	  Format version: 2
    	  Map kind: Release
    	  Map architecture: ARM64
    	  Managed to Java entries: 56
    	  Java to Managed entries: 46 (without duplicates)
    	…
    
    `typemap-v2-Release-ARM64.md` will be created (among other files)
    which contains the actual typemap data, in Markdown tabular form:
    
    > # Java to Managed
    
    > | Java type name                                     | Managed type name                                                | Type token ID         | Is Generic?      | MVID                                 |
    > | -------------------------------------------------- | ---------------------------------------------------------------- | --------------------- | ---------------- | ------------------------------------ |
    > | android/app/Activity                               | Android.App.Activity, Mono.Android                               | 0x02000042 (33554498) | no               | 33da2efb-61bb-4fd5-b529-2dee309a3d65 |
    > …
    > | java/lang/Object                                   | Java.Lang.Object, Mono.Android                                   | 0x0200008B (33554571) | no               | 33da2efb-61bb-4fd5-b529-2dee309a3d65 |
    > …
    
    > # Managed to Java
    
    > | Managed type name                                                       | Java type name                                     | Type token ID         | Is Generic? | Is Duplicate? | MVID                                 |
    > | ----------------------------------------------------------------------- | -------------------------------------------------- | --------------------- | ----------- | ------------- | ------------------------------------ |
    > | HelloLibrary.LibraryActivity, HelloLibrary.DotNet                       | mono/samples/hello/LibraryActivity                 | 0x02000002 (33554434) | no          | false         | ca140934-068f-47d0-a861-6179233e49aa |
    > …
    71b6fcc9