Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
2fcee5e
[GEODE-10667] Remove unused Gradle plugin-publish plugin from build-t…
JinwooHwang Sep 25, 2026
2fd71cd
[GEODE-10667] Pin PMD tool version to match the custom rules
JinwooHwang Sep 25, 2026
6780d48
[GEODE-10667] Replace project APIs removed in Gradle 9
JinwooHwang Sep 25, 2026
f3351c2
[GEODE-10667] Create old version project directories during settings
JinwooHwang Sep 25, 2026
96e35da
[GEODE-10667] Replace nebula.facet with an in-repo facets plugin
JinwooHwang Sep 25, 2026
52d7a44
[GEODE-10667] Order combined test report after all test tasks
JinwooHwang Sep 25, 2026
49f3f32
[GEODE-10667] Upgrade JMH Gradle plugin to 0.7.3
JinwooHwang Sep 25, 2026
8312863
[GEODE-10667] Upgrade Spring dependency-management Gradle plugin to 1…
JinwooHwang Sep 25, 2026
616b27e
[GEODE-10667] Import XmlParser explicitly in check-pom
JinwooHwang Sep 25, 2026
c0cacd3
[GEODE-10667] Build the signing password dialog with Swing directly
JinwooHwang Sep 25, 2026
d380734
[GEODE-10667] Build jar manifest Class-Path without Configuration.files
JinwooHwang Sep 25, 2026
44fb9f0
[GEODE-10667] Use archiveFile for distribution checksums
JinwooHwang Sep 25, 2026
7cc72a7
[GEODE-10667] Skip the signatures configuration in resolveDependencies
JinwooHwang Sep 25, 2026
b57c44d
[GEODE-10667] Declare the JUnit Platform launcher on test runtime cla…
JinwooHwang Sep 25, 2026
0c4d6ec
[GEODE-10667] Package only the Pulse war in the distribution
JinwooHwang Sep 25, 2026
b11d3d0
[GEODE-10667] Leave old version project directories out of the source…
JinwooHwang Sep 25, 2026
bb6851b
[GEODE-10667] Set the repeatUnitTest classpath explicitly
JinwooHwang Sep 26, 2026
7451ddb
[GEODE-10667] Upgrade Gradle to 9.7.1
JinwooHwang Sep 26, 2026
4bc441e
[GEODE-10667] Upgrade Apache RAT Gradle plugin to 0.11.0
JinwooHwang Sep 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build-tools/geode-annotation-processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ plugins {
id 'java-gradle-plugin'
id 'groovy-gradle-plugin'
id 'maven-publish'
id 'com.gradle.plugin-publish' version '0.18.0'
}

repositories {
Expand Down
5 changes: 4 additions & 1 deletion build-tools/geode-build-tools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ plugins {
id 'java-gradle-plugin'
id 'groovy-gradle-plugin'
id 'maven-publish'
id 'com.gradle.plugin-publish' version '0.18.0'
}

repositories {
Expand All @@ -48,4 +47,8 @@ gradlePlugin {
id = 'org.apache.geode.gradle.geode-build-tools'
implementationClass = 'org.apache.geode.gradle.plugins.BuildToolsPlugin'
}
plugins.register('geode-facets') {
id = 'org.apache.geode.gradle.geode-facets'
implementationClass = 'org.apache.geode.gradle.plugins.FacetsPlugin'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* 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
*
* http://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.
*/

package org.apache.geode.gradle.plugins

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.testing.Test
import org.gradle.plugins.ide.eclipse.EclipsePlugin
import org.gradle.plugins.ide.eclipse.model.EclipseModel
import org.gradle.plugins.ide.idea.IdeaPlugin
import org.gradle.plugins.ide.idea.model.IdeaModel

/**
* Adds a {@code facets} block that declares additional source sets, each extending a parent
* source set (by default {@code main}). A facet whose name contains {@code Test} also gets a
* {@link Test} task that runs its tests.
*
* <pre>
* facets {
* integrationTest {
* includeInCheckLifecycle = false
* }
* }
* </pre>
*/
class FacetsPlugin implements Plugin<Project> {

@Override
void apply(Project project) {
project.extensions.add('facets', new FacetsExtension(project))
}
}

class FacetsExtension {
private final Project project

FacetsExtension(Project project) {
this.project = project
}

/**
* Declares a facet named after the method, configured by the closure argument.
*/
def methodMissing(String name, Object args) {
Object[] argArray = args as Object[]
if (argArray.length != 1 || !(argArray[0] instanceof Closure)) {
throw new MissingMethodException(name, getClass(), argArray)
}
FacetDefinition facet = new FacetDefinition(name)
Closure configuration = (argArray[0] as Closure).clone() as Closure
configuration.resolveStrategy = Closure.DELEGATE_FIRST
configuration.delegate = facet
configuration.call(facet)
addFacet(facet)
return facet
}

private void addFacet(FacetDefinition facet) {
project.plugins.withType(JavaBasePlugin) {
SourceSetContainer sourceSets = project.extensions.getByType(SourceSetContainer)
sourceSets.matching { it.name == facet.parentSourceSet }.all { SourceSet parent ->
SourceSet sourceSet = createSourceSet(sourceSets, parent, facet)

[
[parent.compileClasspathConfigurationName, sourceSet.compileClasspathConfigurationName],
[parent.runtimeClasspathConfigurationName, sourceSet.runtimeClasspathConfigurationName],
[parent.annotationProcessorConfigurationName, sourceSet.annotationProcessorConfigurationName]
].each { String parentName, String childName ->
project.configurations.getByName(childName)
.extendsFrom(project.configurations.getByName(parentName))
}

project.tasks.named('build').configure { it.dependsOn(sourceSet.classesTaskName) }

if (facet.isTestFacet()) {
def testTask = createTestTask(facet.testTaskName, sourceSet)
if (facet.includeInCheckLifecycle) {
project.tasks.named('check').configure { it.dependsOn(testTask) }
}
}

configureIde(sourceSet, facet.isTestFacet())
}
}
}

/**
* Creates the facet's source set. Its classpaths also include the output of its parent and,
* for a parent other than {@code main}, the output of {@code main}, which the parent sees.
*/
private SourceSet createSourceSet(SourceSetContainer sourceSets, SourceSet parent,
FacetDefinition facet) {
SourceSet main = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME)
List<Object> parentOutputs = parent == main ? [main.output] : [parent.output, main.output]
return sourceSets.create(facet.name) { SourceSet sourceSet ->
sourceSet.compileClasspath = project.objects.fileCollection()
.from([sourceSet.compileClasspath] + parentOutputs)
sourceSet.runtimeClasspath = project.objects.fileCollection()
.from([sourceSet.runtimeClasspath] + parentOutputs)
}
}

private def createTestTask(String testTaskName, SourceSet sourceSet) {
return project.tasks.register(testTaskName, Test) { Test test ->
test.group = JavaBasePlugin.VERIFICATION_GROUP
test.description = "Runs the ${sourceSet.name} tests"
test.reports.html.outputLocation.set(
project.layout.buildDirectory.dir("reports/${sourceSet.name}"))
test.reports.junitXml.outputLocation.set(
project.layout.buildDirectory.dir("${sourceSet.name}-results"))
test.testClassesDirs = sourceSet.output.classesDirs
test.classpath = sourceSet.runtimeClasspath
test.mustRunAfter(project.tasks.named('test'))
}
}

private void configureIde(SourceSet sourceSet, boolean isTest) {
def classpathConfigurations = [
project.configurations.getByName(sourceSet.compileClasspathConfigurationName),
project.configurations.getByName(sourceSet.runtimeClasspathConfigurationName)
]
project.plugins.withType(IdeaPlugin) {
def module = project.extensions.getByType(IdeaModel).module
if (isTest) {
module.testSources.from(sourceSet.allSource.srcDirs)
module.scopes.TEST.plus += classpathConfigurations
} else {
module.sourceDirs += sourceSet.allSource.srcDirs
module.scopes.COMPILE.plus += classpathConfigurations
}
}
project.plugins.withType(EclipsePlugin) {
project.extensions.getByType(EclipseModel).classpath.plusConfigurations +=
classpathConfigurations
}
}
}

class FacetDefinition {
final String name
String parentSourceSet = SourceSet.MAIN_SOURCE_SET_NAME
String testTaskName
boolean includeInCheckLifecycle = true

FacetDefinition(String name) {
this.name = name
}

String getTestTaskName() {
return testTaskName ?: name
}

boolean isTestFacet() {
return name.contains('Test')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,36 @@

package org.apache.geode.gradle.plugins

import groovy.swing.SwingBuilder
import java.awt.Frame
import javax.swing.Box
import javax.swing.JButton
import javax.swing.JDialog
import javax.swing.JLabel
import javax.swing.JPasswordField
import javax.swing.SwingUtilities

class PasswordDialog {
static String askPassword(String prompt) {
def password = ''
new SwingBuilder().edt {
dialog(modal: true,
title: 'Password',
alwaysOnTop: true,
locationRelativeTo: null,
pack: true,
show: true
) {
vbox {
label(text: prompt)
input = passwordField()
button(defaultButton: true, text: 'OK', actionPerformed: {
password = input.password.toString() // Set pass variable to value of input field
dispose() // Close dialog
})
}
SwingUtilities.invokeAndWait {
JDialog dialog = new JDialog((Frame) null, 'Password', true)
JPasswordField input = new JPasswordField()
JButton ok = new JButton('OK')
ok.addActionListener {
password = new String(input.password) // Set pass variable to value of input field
dialog.dispose() // Close dialog
}

Box box = Box.createVerticalBox()
box.add(new JLabel(prompt))
box.add(input)
box.add(ok)
dialog.contentPane.add(box)
dialog.rootPane.defaultButton = ok
dialog.alwaysOnTop = true
dialog.pack()
dialog.locationRelativeTo = null
dialog.visible = true
}
return password
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class DependencyConstraints {
// These versions are referenced in test.gradle, which is aggressively injected into all projects.
deps.put("junit.version", "4.13.2")
deps.put("junit-jupiter.version", "5.8.2")
deps.put("junit-platform.version", "1.8.2")
deps.put("cglib.version", "3.3.0")

// This old version is for geode-assembly:acceptanceTest for gradle-in-gradle tests. As noted there, do not let
Expand Down
1 change: 0 additions & 1 deletion build-tools/geode-repeat-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ plugins {
id 'java-gradle-plugin'
id 'groovy-gradle-plugin'
id 'maven-publish'
id 'com.gradle.plugin-publish' version '0.18.0'
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package org.apache.geode.gradle.testing.repeat

import org.gradle.StartParameter
import org.gradle.api.file.FileTree
import org.gradle.api.internal.DocumentationRegistry
import org.gradle.api.internal.tasks.testing.JvmTestExecutionSpec
import org.gradle.api.internal.tasks.testing.TestExecuter
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
Expand Down Expand Up @@ -56,7 +55,6 @@ public abstract class RepeatTest extends Test {
getServices().get(WorkerLeaseService.class),
getServices().get(StartParameter.class).getMaxWorkerCount(),
getServices().get(Clock.class),
getServices().get(DocumentationRegistry.class),
(DefaultTestFilter) getFilter(),
times)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@
*/
package org.apache.geode.gradle.testing.repeat;

import org.gradle.api.internal.tasks.testing.TestClassProcessor;
import org.gradle.api.internal.tasks.testing.TestClassRunInfo;
import org.gradle.api.internal.tasks.testing.TestDefinition;
import org.gradle.api.internal.tasks.testing.TestDefinitionProcessor;
import org.gradle.api.internal.tasks.testing.TestResultProcessor;

/**
* A test class processor that decorates its result processor to associate each test event with
* the test class execution that reported it.
* A test definition processor that decorates its result processor to associate each test event
* with the test class execution that reported it.
*/
public class ExecutionTrackingTestClassProcessor implements TestClassProcessor {
private final TestClassProcessor processor;
public class ExecutionTrackingTestDefinitionProcessor<D extends TestDefinition>
implements TestDefinitionProcessor<D> {
private final TestDefinitionProcessor<D> processor;
private final int iterationCount;

public ExecutionTrackingTestClassProcessor(TestClassProcessor processor,
public ExecutionTrackingTestDefinitionProcessor(TestDefinitionProcessor<D> processor,
int iterationCount) {
this.processor = processor;
this.iterationCount = iterationCount;
Expand All @@ -39,8 +40,8 @@ public void startProcessing(TestResultProcessor resultProcessor) {
}

@Override
public void processTestClass(TestClassRunInfo testClass) {
processor.processTestClass(testClass);
public void processTestDefinition(D testDefinition) {
processor.processTestDefinition(testDefinition);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
import org.gradle.api.internal.tasks.testing.TestDescriptorInternal;
import org.gradle.api.internal.tasks.testing.TestResultProcessor;
import org.gradle.api.internal.tasks.testing.TestStartEvent;
import org.gradle.api.internal.tasks.testing.worker.WorkerTestClassProcessor;
import org.gradle.api.internal.tasks.testing.worker.WorkerTestDefinitionProcessor;
import org.gradle.api.tasks.testing.TestFailure;
import org.gradle.api.tasks.testing.TestMetadataEvent;
import org.gradle.api.tasks.testing.TestOutputEvent;

/**
Expand Down Expand Up @@ -73,6 +74,11 @@ public void failure(Object testId, TestFailure result) {
processor.failure(testId, result);
}

@Override
public void published(Object testId, TestMetadataEvent event) {
processor.published(testId, event);
}

private TestDescriptorInternal executionTrackingDescriptor(TestDescriptorInternal original) {
if (original instanceof DefaultTestDescriptor) {
return executionTrackingTestDescriptor(original);
Expand All @@ -83,7 +89,7 @@ private TestDescriptorInternal executionTrackingDescriptor(TestDescriptorInterna
}
return executionTrackingClassDescriptor(original);
}
if (!(original instanceof WorkerTestClassProcessor.WorkerTestSuiteDescriptor)) {
if (!(original instanceof WorkerTestDefinitionProcessor.WorkerTestSuiteDescriptor)) {
warnUnrecognized(original);
} else {
workerName = original.getName();
Expand Down
Loading
Loading