Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dexes to AAB #19

Merged
merged 2 commits into from
Dec 6, 2024
Merged

Add dexes to AAB #19

merged 2 commits into from
Dec 6, 2024

Conversation

maxded
Copy link

@maxded maxded commented Dec 6, 2024

Adds precompiled dex files to the AAB by adding the directories containing the precompiled dex files to the input of the mergeDexRelease gradle task. The mergeDexRelease gradle task takes a file collection called dexDirs as input. The files in that file collection will all be merged together into a single dex file which is then packaged into the AAB.

@maxded maxded merged commit fcef13f into for-traverse Dec 6, 2024
3 of 4 checks passed
format!(
r#"
afterEvaluate {{
tasks.named("mergeDexRelease").configure {{ task ->
Copy link
Member

Choose a reason for hiding this comment

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

Sounds like this breaks if we build debug. As discussed and shown in-person yesterday, why not use tasks.withType(TheTypeThatMergeDex{}Uses)?

Copy link
Author

Choose a reason for hiding this comment

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

Sounds like this breaks if we build debug.

Potentially but not sure yet. In evolve we're not building AAB in debug ever so I decided to stick with this solution for now. That being said, I do agree that it should also work on debug at some point!

As discussed and shown in-person yesterday, why not use tasks.withType(TheTypeThatMergeDex{}Uses)?

That is incorrect also as you could potentially add the directory to multiple tasks and you don't even really know which tasks. I prefer to be explicit and specify one task.

Copy link
Member

Choose a reason for hiding this comment

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

By that logic there could be multiple mergeDexRelease/Debug tasks in the chain, making this equally incorrect 🙃

Copy link
Author

Choose a reason for hiding this comment

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

By that logic there could be multiple mergeDexRelease/Debug tasks in the chain, making this equally incorrect 🙃

There are multiple dex merging tasks all with different names, most have "debug" and "release" somewhere in their task name making it quite confusing. I inspected all these dex merging tasks to see what input directories they process and where the task would place its output. Based on that info I made the decision to add our precompiled dex directory to mergeDexRelease. Is this objectively the best task to add it to, no clue.. it works and we should look at this again some other time.

Comment on lines +74 to +77
// Pop the filename and use the directory.
//
// This is needed as we must provide a directory to `DexMergingTask::dexDirs`
path.pop();
Copy link
Member

Choose a reason for hiding this comment

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

Quite unfortunate: how do we control that there are no accidental/stale dex files in the directories? How did you deal with the "gradle does not know who produced this file, and cannot build a dependency graph" sort-of warning/error?

Copy link
Author

Choose a reason for hiding this comment

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

Quite unfortunate: how do we control that there are no accidental/stale dex files in the directories?

Right now, I don't. If there is a way to provide only files we should change to that but I haven't found it yet. If that doesn't exist, perhaps we should change the xbuild API to point to a directory in the manifest yaml instead of individual dex files.

How did you deal with the "gradle does not know who produced this file, and cannot build a dependency graph" sort-of warning/error?

By using a completely different task from yesterday. DexMergingTask not DexArchiveBuilderTask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants