Skip to content

Conversation

@melix
Copy link
Contributor

@melix melix commented Sep 29, 2020

This is a PR which refactors the build in order to:

  • cleanup bad practices
  • introduce configuration avoidance
  • remove deprecations
  • add support for the maven-publish plugin instead of the old one

Initially I only wanted to focus on the last point but I realized there's a LOT of hackery in the build which makes it complicated to migrate without doing the cleanup first.

Gradle itself deprecates HTTP repositories, so the check is redundant.
This commit introduces a convention plugin for libraries
produced by this build. This is the first step in the build
cleanup.
The 'target' directory is a relic of the Ant era. With Gradle
the default output directory is named "build" and it's easier
to follow the best practice.
This commit makes the `groovy-all` and `groovy-bom` components
proper subprojects. This will allow us to publish them properly
using standard Gradle mechanisms.

The dependencies of the `groovy-bom` and `groovy-all` projects
are defined dynamically thanks to the application of a plugin.
Using features, it's not necessary to tweak the generated
POM files.

See https://blog.gradle.org/optional-dependencies
This commit introduces more cleanup of the Gradle build,
in particular how the jars are built. It simplifies how
the jar manifests are created, while keeping the separation
between the main groovy module and libraries.

This commit makes also use of configuration avoidance
whenever possible.
This commit reworks how publications are built. Before,
the publishing mechanism used a bunch of internal APIs,
as well as code to determine how to generate the POM
files based on whether a module belonged to groovy-all
or not, etc...

Now, the fact of being part of Groovy all is part of
the model. As such groovy-all is considered a platform,
which with Gradle Module Metadata adds the advantage
of providing native dependency version alignement.

Because the Groovy modules published on external
repositories are not the main "jars", but the "jarjar",
we need to create custom components for publication,
but this is all done using _public_ Gradle APIs, and
much cleaner.

The fact of repackaging dependencies determines whether
the dependencies should be part of the module metadata
or not.
This module should basically do what remains in `assemble.gradle`:
it's about the end deliverables, which are the distribution zips,
sources, ...

It's modeled as a proper module so that we can publish it without
hacking into internal APIs.
@melix melix changed the title Cc/gradle/update publishing Make the Gradle build more idiomatic Sep 29, 2020
Make use of a distribution extension to configure things.
Instead of hardcoding projects which generate grooid jars,
we now have an extension on the library to configure the
grooid version.
Lots of the tests were actually reaching out to other project
directories directly, making the relationships between projects
hard to track, and possibly buggy.

This commit reworks how tests are setup to use proper dependency
management, and introduces the use of test fixtures in case
a project needs a test fixture class from another project:
instead of adding the test runtime classpath of the other project
on its own test runtime classpath, we just add the required
classes.
Again instead of blindly applying the plugin to all projects,
it's now applied only where it makes sense and the aggregation
is done on demand.
The backports modules are a bit special. If we want to keep them they
would have to be reintroduced with a cleaner way of building.
This allows more task configuration avoidance, while making
things cleaner!
@melix melix force-pushed the cc/gradle/update-publishing branch from 82bb958 to bc95eb1 Compare September 30, 2020 18:50
@melix melix force-pushed the cc/gradle/update-publishing branch from 45feb2b to c018a78 Compare September 30, 2020 21:58
melix added 4 commits October 1, 2020 19:28
The `dist` task should actually trigger the creation of all the
"distribution" artifacts, instead of being the task which builds
the SDK archive.
The setup was completely broken. There's a single test file being compiled,
we should probably add way more to get significant numbers.
@melix melix force-pushed the cc/gradle/update-publishing branch from 9a0aaa3 to bf9ed22 Compare October 1, 2020 17:29
melix added 4 commits October 1, 2020 21:36
And move stress tests out of the main test suite
Now the jacoco plugin is applied conditionally, but more importantly
it relies on standard Gradle configuration even for the aggregation.
@melix
Copy link
Contributor Author

melix commented Oct 1, 2020

PR looks fine from my POV. Let me know how we can make progress on merging this.

@paulk-asert
Copy link
Contributor

I will look at it soon. Might be a few days. Nice work! Thanks so much.

melix added 10 commits October 2, 2020 09:57
Most of the build logic has moved to a precompiled script plugin
which allows focusing on the configuration of the module instead.
Build services are configuration cache safe and have built-in
resource limitation.
While we only read them, they are not declared so not compatible
with the configuration cache.
and make the checkstyle report task cacheable.
This commit introduces dependency verification to the Groovy build.
This is a security focused feature, in order to make sure no
compromised library is introduced in the distribution.
@asfgit asfgit closed this in 27249d5 Oct 9, 2020
@paulk-asert
Copy link
Contributor

Merged, Thanks!! Still a few glitches to unravel but with master continually updating, I think merging and some post amendments will be quickest path to get this in.

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.

3 participants