-
Notifications
You must be signed in to change notification settings - Fork 23
Upgrade to Gradle 9.7.0 and GradleUp Shadow, convert build to Kotlin DSL #238
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
Open
lhotari
wants to merge
2
commits into
apache:main
Choose a base branch
from
lhotari:lh-improve-gradle-9-upgrade
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
build-logic/src/main/kotlin/pulsar-client-reactive.codestyle-conventions.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| plugins { | ||
| checkstyle | ||
| id("io.spring.javaformat") | ||
| id("com.diffplug.spotless") | ||
| } | ||
|
|
||
| // The version catalog has no type-safe accessors inside a precompiled script plugin, so it | ||
| // has to be looked up through the extension. | ||
| val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
|
||
| // `isolated` keeps this compatible with configuration caching and project isolation. | ||
| val checkstyleConfigDir = isolated.rootProject.projectDirectory.dir("checkstyle") | ||
| val licenseHeader = checkstyleConfigDir.file("HEADER.txt") | ||
|
|
||
| dependencies { | ||
| checkstyle(libs.findLibrary("spring-javaformat-checkstyle").get()) | ||
| } | ||
|
|
||
| checkstyle { | ||
| toolVersion = libs.findVersion("checkstyle").get().requiredVersion | ||
| // `configFile` defaults to `checkstyle.xml` inside `configDirectory` | ||
| configDirectory = checkstyleConfigDir | ||
| } | ||
|
|
||
| // Formatting of Java sources is owned by spring-javaformat; Spotless only enforces the ASF | ||
| // license header. Apache RAT is the repository-wide backstop for every other file type. | ||
| spotless { | ||
| kotlinGradle { | ||
| target("*.gradle.kts") | ||
| licenseHeaderFile(licenseHeader, "(plugins|import|rootProject|pluginManagement|dependencyResolutionManagement)") | ||
| } | ||
| } | ||
|
|
||
| // `java` has no sources to point Spotless at until the `java` plugin is applied, which | ||
| // happens after this convention plugin. Reacting to the plugin avoids `afterEvaluate`. | ||
| pluginManager.withPlugin("java") { | ||
| spotless { | ||
| java { | ||
| licenseHeaderFile(licenseHeader) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
build-logic/src/main/kotlin/pulsar-client-reactive.publish-conventions.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| plugins { | ||
| `maven-publish` | ||
| signing | ||
| } | ||
|
|
||
| val publishDebug = providers.gradleProperty("publishDebug") | ||
| val isSnapshot = provider { version.toString().endsWith("-SNAPSHOT") } | ||
|
|
||
| // `project.description` is assigned at the bottom of each module's build script, so it has | ||
| // to be read lazily rather than when this convention plugin is applied. | ||
| val projectDescription = objects.property<String>().value(provider { description }) | ||
|
|
||
| publishing { | ||
| repositories { | ||
| maven { | ||
| if (publishDebug.isPresent) { | ||
| url = uri(publishDebug.get()) | ||
| } | ||
| else { | ||
| name = "asf" | ||
| url = uri( | ||
| if (isSnapshot.get()) "https://repository.apache.org/content/repositories/snapshots/" | ||
| else "https://repository.apache.org/service/local/staging/deploy/maven2" | ||
| ) | ||
| credentials(PasswordCredentials::class) | ||
| } | ||
| } | ||
| } | ||
| publications { | ||
| create<MavenPublication>("mavenJava") { | ||
| pom { | ||
| name = project.name | ||
| description = projectDescription | ||
| url = "https://github.com/apache/pulsar-client-reactive" | ||
| licenses { | ||
| license { | ||
| name = "The Apache License, Version 2.0" | ||
| url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
| distribution = "repo" | ||
| } | ||
| } | ||
| developers { | ||
| developer { | ||
| organization = "Apache Pulsar developers" | ||
| organizationUrl = "https://pulsar.apache.org/" | ||
| } | ||
| } | ||
| scm { | ||
| connection = "scm:git:https://github.com/apache/pulsar-client-reactive.git" | ||
| developerConnection = "scm:git:https://github.com/apache/pulsar-client-reactive.git" | ||
| url = "https://github.com/apache/pulsar-client-reactive" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| signing { | ||
| setRequired(!publishDebug.isPresent) | ||
| sign(publishing.publications["mavenJava"]) | ||
| } |
69 changes: 69 additions & 0 deletions
69
build-logic/src/main/kotlin/pulsar-client-reactive.test-conventions.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| plugins { | ||
| `java-library` | ||
| id("com.adarshr.test-logger") | ||
| } | ||
|
|
||
| val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
|
||
| testlogger { | ||
| showStandardStreams = true | ||
| } | ||
|
|
||
| val main: SourceSet = sourceSets[SourceSet.MAIN_SOURCE_SET_NAME] | ||
| val intTest: SourceSet = sourceSets.create("intTest") { | ||
| compileClasspath += main.output | ||
| runtimeClasspath += main.output | ||
| } | ||
|
|
||
| configurations[intTest.implementationConfigurationName] | ||
| .extendsFrom(configurations[JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME]) | ||
| configurations[intTest.runtimeOnlyConfigurationName] | ||
| .extendsFrom(configurations[JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME]) | ||
|
|
||
| // `isolated` keeps this compatible with configuration caching and project isolation. | ||
| val sharedTestResources = files(isolated.rootProject.projectDirectory.dir("shared-test-resources")) | ||
|
|
||
| dependencies { | ||
| // add shared-test-resources directory to runtime classpath | ||
| intTest.runtimeOnlyConfigurationName(sharedTestResources) | ||
| JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME(sharedTestResources) | ||
| intTest.runtimeOnlyConfigurationName(libs.findLibrary("junit-platform-launcher").get()) | ||
| } | ||
|
|
||
| val integrationTest = tasks.register<Test>("integrationTest") { | ||
| description = "Runs integration tests." | ||
| group = LifecycleBasePlugin.VERIFICATION_GROUP | ||
|
|
||
| testClassesDirs = intTest.output.classesDirs | ||
| classpath = intTest.runtimeClasspath | ||
| shouldRunAfter(tasks.named(JavaPlugin.TEST_TASK_NAME)) | ||
| } | ||
|
|
||
| tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME) { | ||
| dependsOn(integrationTest) | ||
| } | ||
|
|
||
| tasks.withType<Test>().configureEach { | ||
| // reduces CPU usage in tests when JIT compiler doesn't spend time compiling code | ||
| // this could help reduce flakiness in CI where there's less CPU resources available | ||
| jvmArgs("-XX:TieredStopAtLevel=1") | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.