-
Notifications
You must be signed in to change notification settings - Fork 5k
Clean up subproject grouping in gradle build #12805
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
Conversation
import org.owasp.dependencycheck.gradle.extension.DependencyCheckExtension | ||
|
||
|
||
open class DependencyVulnerabilitiesPlugin : Plugin<Project> { |
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.
Can we remove this completely? It is not used, out of date (selected plugin version of 'org.owasp.dependencycheck' does not work with current wrapper anymore) and not included in any CI pipeline.
@Suppress("unchecked_cast") | ||
val Project.libraries | ||
get() = rootProject.extra["libraries"] as Map<String, Map<String, String>> | ||
get() = if (rootProject.extra.has("libraries")) rootProject.extra["libraries"] as Map<String, Map<String, String>> else mapOf() |
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.
Need this has
check for pre-compiled script plugin compilation. (In a next step we shall get rid of using extra
altogether.)
gradleRuntimeSource(project(":apiMetadata")) | ||
gradleDocumentation(project(":docs")) | ||
gradleScripts(project(":launcher")) | ||
gradleRuntimeSource.withDependencies { |
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.
This config code is now also executed as part of pre-compiled script compilation. There the projects we try to find here (e.g. project(":apiMetadata")
) do not exist. We now only apply the dependencies once the configuration is resolved (withDependencies
hook).
|
||
|
||
tasks { | ||
validatePlugins { |
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.
This was a duplication. This is configured for all "java/kotlin" projects already by UnitTestAndCompilePlugin
.
} | ||
|
||
private | ||
fun Project.sharedDependencyAndQualityConfigs() { |
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.
I moved this here to make sure this is done as the first thing and is available for all other plugins/scripts afterwards. Then we do not have to be careful of order in the root build script (apart from applying the lifecycle plugin first).
A follow up should be to get rid of storing dependencies in "extra" altogether.
moduleType = ModuleType.INTERNAL | ||
// so that all Gradle features are available | ||
configurations.performanceTestRuntimeOnly.get().withDependencies { | ||
addAll(rootProject.configurations.testRuntime.get().allDependencies) |
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.
I made this change in some places to get rid of the "extra" properties set in the root build script.
In the next step I want to clean up the distribution building and improve this part further so that we do not need to reach into the root project anymore.
319a0b9
to
e6cfe48
Compare
Full ready-for-release build, before rebase: https://builds.gradle.org/buildConfiguration/Gradle_Check_Stage_ReadyforRelease_Trigger/33575502 |
e6cfe48
to
9f562dc
Compare
@bot-gradle test this |
OK, I've already triggered ReadyForMerge build for you. |
c729b19
to
20cb240
Compare
...ion-testing/src/main/kotlin/org/gradle/gradlebuild/test/fixtures/GradleDistributionPlugin.kt
Outdated
Show resolved
Hide resolved
4350d3f
to
89275e4
Compare
- Get rid of usages of "extra" - Use Kotlin DSL APIs - Adress or remove outdated TODOs
install task now lives in 'distributions'
89275e4
to
51857e4
Compare
Removed this by mistake as it had a misleading comment attached.
51857e4
to
1416e7b
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.
Nice clean, thanks for taking the time! 👍
1416e7b
to
32aa2d7
Compare
This commit improves the grouping of subprojects in the Gradle build by basically getting rid of two things:
ProjectGroups.kt
ModuleType
property each project had to setInstead, each project now applies one uber plugin indicating it's purpose:
gradlebuild.distribution
- part of the distribution. Subcategories determine if the project is in the core of the distribution or if it is a packaged plugin; if it is part of the api or only an implementation detail; if it is written in Java or Kotlingradlebuild.distribution.core-implementation-java
gradlebuild.distribution.core-implementation-kotlin
gradlebuild.distribution.core-api-java
gradlebuild.distribution.core-api-kotlin
gradlebuild.distribution.plugins-api-java
gradlebuild.distribution.plugins-implementation-java
gradlebuild.distribution.plugins-implementation-kotlin
gradlebuild.portalplugin
- subproject is not part of distribution but separately published to the plugin portal.gradlebuild.portalplugin.kotlin
gradlebuild.internal
- internal projectgradlebuild.internal.java
gradlebuild.internal.kotlin
gradlebuild.internal.kotlin-js
Other concerns that cross-cut these categories are realized by additional plugins (e.g. subproject is also published separately) or as a configuration property of the
UnitTestAndCompilePlugin
extension (e.g. is used in workers). This can be further refined in the future.This change also removes some configuration time ordering issues.
Following this improvement, I want to get rid of the "grouping" that is done by creating a bunch of configurations in the root build which is then used to assemble the distribution. This should all move into the "distribution" project and the "IntTestImage" plugin. Which both can be simplified now that we have the cleaner structuring that comes with this improvement.