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 a sub-project for the common sources. #1155

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

prbprbprb
Copy link
Collaborator

Puts the common sources in an explicit Gradle sub-project rather than just referring to them from multiple sourceSets.

Pro: Project now loads cleanly in Studio with no duplicate source root warnings and Studio can follow cross-refs between all sub-projects.

Pro: Also tidied up the dependencies to the constants build. Hopefully we can now tidy that build up further.

Con: Had to add a whole new set of stubs (platform-stub) for Platform.java due to circular dependency... All of the code in common/ expects to be compiled against the current platform's Platform.java but all of the Platform.java's also expect to be compiled against the common code.

Pro: Adding platform-stub allows us to remove the platformJar stuff from the OpenJDK build. Turns out this was just a hack to allow android-platform to build on OpenJDK so compiling against a stub is cleaner.

Con: the common build's processTestResources task seems to try and copy all the resources twice causing an error. Added a hacky workaround for now.

Major con: The AARs built by the Android build do not contain classes from the common sources. I've tried multiple ways of expressing the dependency and got nowhere so advice would be appreciated.

@prbprbprb prbprbprb requested a review from borisf August 7, 2023 15:48
@prbprbprb
Copy link
Collaborator Author

Oh yeah, also rationalised the JUnit suite classes. Dropped the OpenJDK 7 one and merged the remainder together as we only use suites on OpenJDK.

@prbprbprb
Copy link
Collaborator Author

Ugh, I forgot to test the source jar and Javadoc tasks, which are failing in CI... I'll convert this to a draft until I fix them, but if you feel like commenting on the general shape of the change, that would be great.

@prbprbprb prbprbprb marked this pull request as draft August 7, 2023 16:16
@kruton
Copy link
Contributor

kruton commented Aug 9, 2023

shadow might help here. It's already being used in testing/build.gradle and openjdk/build.gradle, but adding a few more configuration options can get the .jar created the way you want it.

@prbprbprb
Copy link
Collaborator Author

Thanks, will do!

prbprbprb added a commit to prbprbprb/conscrypt that referenced this pull request Oct 23, 2023
ConscryptJava7Suite is obsolete, and we no longer use
suites for anything but OpenJDK so merge ConscryptSuite into
ConscryptOpenJdkSuite. Ultimately I aim to stop using suites.

This is part of google#1155 but splitting it out here to simplify that
change.
prbprbprb added a commit that referenced this pull request Oct 24, 2023
ConscryptJava7Suite is obsolete, and we no longer use
suites for anything but OpenJDK so merge ConscryptSuite into
ConscryptOpenJdkSuite. Ultimately I aim to stop using suites.

This is part of #1155 but splitting it out here to simplify that
change.
Puts the common sources in an explicit Gradle sub-project rather
than just referring to them from multiple sourceSets.

Pro: Project now loads cleanly in Studio with no duplicate source
root warnings and Studio can follow cross-refs between all
sub-projects.

Pro: Also tidied up the dependencies to the constants build.
Hopefully we can now tidy that build up further.

Con: Had to add a whole new set of stubs (platform-stub) for
Platform.java due to circular dependency... All of the code in
common/ expects to be compiled against the current platform's
Platform.java but all of the Platform.java's also expect to be
compiled against the common code.

Pro: Adding platform-stub allows us to remove the platformJar
stuff from the OpenJDK build. Turns out this was just a hack to
allow android-platform to build on OpenJDK so compiling against a
stub is cleaner.

Con: the common build's processTestResources task seems to try
and copy all the resources twice causing an error.  Added a hacky
workaround for now.

Major con: The AARs built by the Android build do not contain
classes from the common sources. I've tried multiple ways of
expressing the dependency and got nowhere so advice would be
appreciated.
Still various Javadoc issues remain but they existed before this PR.
When specified in a defaultConfig block it ends
up setting the module version too.....
Was using a no-longer-needed 3P plugin which doesn't
work correctly with the latest AGP.  Now is at least
publishing an AAR even though it doesn't contain
the common classes.
1. Remove the implementation dependency from :conscrypt-android
to :conscrypt-common as that ends up exposing conscrypt-common
as a dependency in the POM file.

2. Just copy the actual class files from the :conscrypt-common
output into the :conscrypt-android build directory before the
AAR is built.
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