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 flag to disable output library.ap_ #11253

Conversation

jongerrish
Copy link
Contributor

android_library ResourceLinkAction exports generated library.ap_ files. These files grow exponentially in size as their contents are merged in to depending libraries, but library.ap_ files are in the format consumable by devices only. Since android_binary generated the final library.ap_ file these intermediates are not needed as outputs.

For a build the size of ours this saves around 2GB of unnecessary outputs.

defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.UNKNOWN},
help = "If disabled, does not provide library.ap_ outputs for library targets")
Copy link
Member

Choose a reason for hiding this comment

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

Could you also include the PR description here? The PR description has great context, e.g. reducing download overhead and devices not requiring these files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done - thanks for the review!

@jin jin removed the request for review from lberki April 30, 2020 07:39
@jin jin added the team-Android Issues for Android team label Apr 30, 2020
@jin
Copy link
Member

jin commented May 1, 2020

Update: looking into failing tests internally with blaze.

@jongerrish
Copy link
Contributor Author

jongerrish commented May 1, 2020 via email

@jongerrish
Copy link
Contributor Author

I think bazelbuild/rules_android#10 is a better solution

@artem-zinnatullin
Copy link
Contributor

I think bazelbuild/rules_android#10 is a better solution

But do you think there is any use case in library.ap_ files in general?

I agree that disabling R class merging is generally what we should aim for but wouldn't it still be producing useless library.ap_ files, just smaller?

@jongerrish jongerrish changed the title Add flag to desiable output library.ap_ Add flag to disable output library.ap_ May 12, 2020
@jongerrish
Copy link
Contributor Author

I can't see a usecase for library.ap_ - I think it was just a side affect (-o is a mandatory parameter) from calling aapt2 link which is used to generate the R.java + R.txt. However, AndroidResourceMerge now generates an R.class + R.txt directly from the intermediate compilation outputs, so really linking is no longer necessary at all. That's why I prefer bazelbuild/rules_android#10 Also both is behind a flag, just in case there is a strange usecase I haven't thought of.

bazel-io pushed a commit that referenced this pull request May 13, 2020
transitive_static_lib should be removed in coordination with #11253

PiperOrigin-RevId: 311406837
@ulfjack
Copy link
Contributor

ulfjack commented May 20, 2020

@jin, can you provide an update here, please? This is part of a batch of changes that are necessary to get Bazel's Android builds on par with Buck wrt. build performance. This is a blocker for some people for migrating from Buck to Bazel.

@jin
Copy link
Member

jin commented May 21, 2020

I'm currently adding tests to add coverage for our decoupled @android_tools infra, which the resource processing pipeline is part of, so @jongerrish's PRs can be properly tested on our Buildkite CI and not run into failures internally.

@ulfjack
Copy link
Contributor

ulfjack commented May 27, 2020

Cool, glad to hear it. Have you been able to make progress? Anything we can help with?

@jin
Copy link
Member

jin commented May 27, 2020

Blocking on internal review.

@jin
Copy link
Member

jin commented May 28, 2020

Could you rebase your PRs onto f3d1683 please?

@jongerrish
Copy link
Contributor Author

@jin Just resolved conflicts is that enough?


boolean outputLibraryLinkedResources() {
return outputLibraryLinkedResources;

Copy link
Member

Choose a reason for hiding this comment

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

You have a missing closing brace here

@aiuto
Copy link
Contributor

aiuto commented Jan 6, 2021

Friendly ping. The tests are failing. Are you going to fix or drop this.

@Bencodes
Copy link
Contributor

@jin any updates on getting this merged?

@nkoroste
Copy link
Contributor

Any updates on this?

@oquenchil
Copy link
Contributor

@jin It looks like this PR was approved and it doesn't need any more changes. Can it be merged? Or does it not make sense any more and it should be closed?

@ajanuar
Copy link

ajanuar commented Jul 28, 2021

Any update on this?

@Bencodes
Copy link
Contributor

This is still something that would be really nice to merge so I opened the PR back up with the merge conflicts resolved. Mind taking another quick look @jin @aiuto?

#14786

@aiuto
Copy link
Contributor

aiuto commented Feb 10, 2022 via email

@Bencodes
Copy link
Contributor

Awesome thanks @aiuto!

@jongerrish jongerrish requested a review from ted-xie as a code owner April 22, 2022 11:45
@sgowroji sgowroji added the awaiting-user-response Awaiting a response from the author label May 13, 2022
@sgowroji sgowroji added awaiting-review PR is awaiting review from an assigned reviewer awaiting-user-response Awaiting a response from the author and removed awaiting-user-response Awaiting a response from the author awaiting-review PR is awaiting review from an assigned reviewer labels Aug 11, 2022
@sgowroji
Copy link
Member

Hello @jongerrish, Can you please check build failures and code conflicts Thanks!

luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this pull request Sep 4, 2022
    transitive_static_lib should be removed in coordination with bazelbuild/bazel#11253

    PiperOrigin-RevId: 311406837
@keertk
Copy link
Member

keertk commented Dec 7, 2022

Hi there! Thank you for contributing to the Bazel repository. We appreciate your time and effort. We're doing a clean up of old PRs and will be closing this one since it seems to have stalled. Please feel free to reopen if you’re still interested in pursuing this or if you'd like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

@keertk keertk closed this Dec 7, 2022
@ted-xie ted-xie reopened this Dec 8, 2022
@ted-xie
Copy link
Contributor

ted-xie commented Dec 8, 2022

This PR is still in our backlog, sorry for the confusion. I'll mark this as "P3" so it doesn't get closed again.

@ted-xie ted-xie added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed awaiting-user-response Awaiting a response from the author labels Dec 8, 2022
@Bencodes
Copy link
Contributor

Bencodes commented Dec 8, 2022

This PR was reopened over here with the conflicts resolved.

#14786

@ted-xie
Copy link
Contributor

ted-xie commented Dec 8, 2022

Oh, thanks Ben! Closing this PR then.

@ted-xie ted-xie closed this Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Android Issues for Android team
Projects
None yet
Development

Successfully merging this pull request may close these issues.