Skip to content

[tools] Add a tool to decompress XA-compressed assemblies - #5536

Merged
jonpryor merged 1 commit into
dotnet:masterfrom
grendello:assembly-uncompress
Feb 5, 2021
Merged

[tools] Add a tool to decompress XA-compressed assemblies#5536
jonpryor merged 1 commit into
dotnet:masterfrom
grendello:assembly-uncompress

Conversation

@grendello

Copy link
Copy Markdown
Contributor

The utility is named decompress-assemblies and takes as its
parameters a list of files to decompress. The files might be either
.apk archives or .dll files.

I case of .apk, managed assemblies stored in the assemblies/
directory inside the APK will be read and decompressed.

The uncompressed result is stored in the current directory with the
original assembly name modified to contain the uncompressed- prefix,
in order to prevent accidental overwriting of assemblies found in the
current directory.

<OutputPath>../../bin/$(Configuration)/bin</OutputPath>
<OutputType>Exe</OutputType>
<LibZipSharpBundleAllNativeLibraries>true</LibZipSharpBundleAllNativeLibraries>
<LangVersion>$(LangVersion)</LangVersion>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to set $(LangVersion) with $(LangVersion).

This imports Configuration.props, so I think it would get the value you want;

https://github.com/xamarin/xamarin-android/blob/1877dd5ebee90452c6ab2cc33a58498a83ea7c1f/Configuration.props#L38

continue;
}

if (String.Compare (".apk", ext, StringComparison.OrdinalIgnoreCase) == 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be handy to extend to handle .aab files as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support for AAB added :)

@jonpryor

Copy link
Copy Markdown
Contributor

Should we add this tool to the installer?

@jpobst

jpobst commented Jan 23, 2021

Copy link
Copy Markdown
Contributor

I would suggest the opposite: remove it from xamarin-android, put it in a separate repo, and make it available as a dotnet tool like we do for apk-diff. (https://github.com/radekdoulik/apkdiff)

I think the last thing we want to do it add another one-off tool to our maintenance burden.

@jonpryor

Copy link
Copy Markdown
Contributor

I think the last thing we want to do it add another one-off tool to our maintenance burden.

There's two related considerations, which also apply to PR #5541:

  1. These utilities are as much for our own use as for anyone else. We need them for diagnostic purposes.
  2. Where the utilities are located doesn't change the fact that we need to maintain them, as per (1).

I think the more important question is one of "tying": if "something internal" changes in this repo, will the tool need to be updated?

In the case of decompress-assemblies or tmt (PR #5541), the answer is "Yes!". If the compression format changes, the the tool needs an update. If the typemap format changes, then the tool needs an update.

In both cases, having the utility in the same tree makes it easier to review the changes and ensure that the tool continues to work.

Compare to apkdiff, which doesn't rely as much on xamarin-android internals.

Comment thread tools/decompress-assemblies/main.cs Outdated
@grendello
grendello force-pushed the assembly-uncompress branch from 95cef48 to 2312881 Compare January 29, 2021 11:15
The utility is named `decompress-assemblies` and takes as its
parameters a list of files to decompress.  The files might be either
`.apk` archives or `.dll` files.

I case of `.apk`, managed assemblies stored in the `assemblies/`
directory inside the APK will be read and decompressed.

The uncompressed result is stored in the current directory with the
original assembly name modified to contain the `uncompressed-` prefix,
in order to prevent accidental overwriting of assemblies found in the
current directory.
@grendello
grendello force-pushed the assembly-uncompress branch from 2312881 to 72083cd Compare February 3, 2021 21:14
@jonpryor
jonpryor merged commit 29a317f into dotnet:master Feb 5, 2021
@grendello
grendello deleted the assembly-uncompress branch February 5, 2021 07:18
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants