-
Notifications
You must be signed in to change notification settings - Fork 60
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
Consolidate build #87
Conversation
This commit introduces a parent build which is responsible for coordinating the build of every subproject, independently of what they are using (Maven or Gradle). It's a Gradle composite build, which takes the responsibility of publishing subprojects artifacts into a "common" local repository, which can be used to verify by hand what is produced by the builds easily. On the root project, you can now run `./gradlew publishAllPublicationsToCommonRepository` which will trigger the dependent builds and publish all artifacts to: ./build/common-repo
It was difficult to integrate with the Maven build of the plugin in a consistent way. Therefore, this plugin rewrites the Maven plugin build so that it is using Gradle instead. The advantages are that now: - versions can be shared for all projects using a single file, which is now the `gradle/libs.versions.toml` file on the root project - all modules can be consistently built and published using a single command (`publishAllPublicationsToCommonRepository`) - there's no need to publish anything to Maven Local to get started - every project of the composite can also be built independently if needed
Before this commit, both the Maven and Gradle plugins had an identical VersionInfo class. Instead of this, we now introduce a `utils` project which generates this class statically at build time. This project will be used to share common code between the Gradle and Maven plugins, even if today it only contains a single class.
Publish all artifacts, clean build, no build cache: https://scans.gradle.com/s/7nwhko7377va6 |
It was possible that the `utils` project dependency wasn't published to the common repository before we compute the plugin descriptors.
so that the examples can be executed properly.
Testing the Maven plugin was complicated. Not because we build it with Gradle, but because running any build with Maven can accidentally pass because of the presence of stale files in the local Maven repository. In this case, we avoid the problem by completely isolating the Maven plugin tests by running them in containers, using test containers. Because spawning an image and re-downloading all dependencies can be pretty slow, we proceed in multiple steps: 1. we build the plugin, and all its dependencies, and publish the result in the local "common repository" 2. we create a docker image which base is the GraalVM image for the version we want to test 3. we inject a "bootstrapping" Maven project in that image, which is going to be responsible for triggering the download of the dependencies required at test execution time, so that all dependencies are present in the image when we want to run the tests 4. because the project needs the plugin to be built, we also inject a fake Maven repository, the one we built at step 1, into the image 5. we use a custom settings file for Maven so that the repository is injected in the build 6. now we can build the Docker image 7. integration tests spawn the test image and perform some verifications It's worth noting that at this stage, there's a *single* functional test for Maven. This test is very similar to the one done in Gradle, so, instead of providing examples in the examples directory, we will refactor the build so that the samples used for integration testing are also samples that can be shown to users.
This commit consolidates the samples so that they are used for both testing purposes, in functional testing, and for documentation.
This commit adds a task, `releaseZip` which will build all artifacts and create a zip in `build/distributions`. This task makes sure that the repository is pruned before building, so that it only contains what we want to release. The task will _not_ update the version, which needs to be done separately if needed.
This is mostly for CI, since locally we'd get test reports.
and move the checkstyle configuration to top level, so that we can consistently verify code.
a84a0c9
to
1770df9
Compare
1770df9
to
b6ca784
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, I'm glad we are getting rid of hacky shell scripts :)
build-logic/src/main/kotlin/org.graalvm.build.common.settings.gradle.kts
Outdated
Show resolved
Hide resolved
build-logic/src/main/kotlin/org.graalvm.build.common.settings.gradle.kts
Outdated
Show resolved
Hide resolved
...lugin/src/testFixtures/groovy/org/graalvm/buildtools/maven/GraalVMContainerController.groovy
Show resolved
Hide resolved
In order to try to reduce the memory pressure for Maven tests execution.
Since logs contains lots of garbage we don't care about. The full log is still captured so that we can make assertions on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maven build fails due to CI runner using Java 8 as default.
This can be fixed by adding
- uses: actions/setup-java@v1
with:
java-version: '11'
to the CI config file. You can then merge this PR when ready.
bf1232a
to
17237e9
Compare
When running the `updateSamples` task, Gradle will now process the `samples` directory and update the versions in those samples. This should typically be done before a release, to make sure that what we display in samples match what we release.
17237e9
to
046a3f3
Compare
046a3f3
to
5437a9e
Compare
This pull request consolidates the build in order to avoid tedious build stages. In particular:
gradle/libs.versions.toml
filework in progress
Fixes #82