Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion build-tools/geode-japicmp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repositories {

dependencies {
implementation(gradleApi())
implementation('me.champeau.gradle:japicmp-gradle-plugin:0.3.0')
implementation('me.champeau.gradle:japicmp-gradle-plugin:0.4.6')
}

sourceSets {
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 @@ -31,7 +31,6 @@ repositories {

dependencies {
implementation(gradleApi())
implementation('com.google.guava:guava:31.1-jre')

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.gradle.api.tasks.Input
import org.gradle.internal.time.Clock
import org.gradle.internal.work.WorkerLeaseService

public class RepeatTest extends Test {
public abstract class RepeatTest extends Test {

@Input
private int times = 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
*/
package org.apache.geode.gradle.testing.repeat;

import java.io.File;
import java.util.List;
import java.util.Set;
import java.util.ArrayList;

import com.google.common.collect.ImmutableSet;
import org.gradle.api.file.FileTree;
import org.gradle.api.internal.DocumentationRegistry;
import org.gradle.api.internal.classpath.ModuleRegistry;
Expand All @@ -30,13 +27,15 @@
import org.gradle.api.internal.tasks.testing.WorkerTestClassProcessorFactory;
import org.gradle.api.internal.tasks.testing.detection.DefaultTestClassScanner;
import org.gradle.api.internal.tasks.testing.detection.DefaultTestExecuter;
import org.gradle.api.internal.tasks.testing.detection.ForkedTestClasspathFactory;
import org.gradle.api.internal.tasks.testing.detection.TestFrameworkDetector;
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter;
import org.gradle.api.internal.tasks.testing.processors.MaxNParallelTestClassProcessor;
import org.gradle.api.internal.tasks.testing.processors.PatternMatchTestClassProcessor;
import org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor;
import org.gradle.api.internal.tasks.testing.processors.RunPreviousFailedFirstTestClassProcessor;
import org.gradle.api.internal.tasks.testing.processors.TestMainAction;
import org.gradle.api.internal.tasks.testing.worker.ForkedTestClasspath;
import org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
Expand All @@ -47,7 +46,7 @@
import org.gradle.process.internal.worker.WorkerProcessFactory;

/**
* A copy of {@link DefaultTestExecuter} from Gradle v7.6.6, modified to process each test class
* A copy of {@link DefaultTestExecuter} from Gradle v8.14.5, modified to process each test class
* as many times as it was submitted. This is required by our {@link RepeatTest} task, because:
* <ul>
* <li>Geode's {@code RepeatTest} task operates by submitting each test class for processing
Expand All @@ -70,7 +69,7 @@ public class RepeatTestExecuter implements TestExecuter<JvmTestExecutionSpec> {

private final WorkerProcessFactory workerFactory;
private final ActorFactory actorFactory;
private final ModuleRegistry moduleRegistry;
private final ForkedTestClasspathFactory testClasspathFactory;
private final WorkerLeaseService workerLeaseService;
private final int maxWorkerCount;
private final Clock clock;
Expand All @@ -85,7 +84,7 @@ public RepeatTestExecuter(WorkerProcessFactory workerFactory, ActorFactory actor
int iterationCount) {
this.workerFactory = workerFactory;
this.actorFactory = actorFactory;
this.moduleRegistry = moduleRegistry;
this.testClasspathFactory = new ForkedTestClasspathFactory(moduleRegistry);
this.workerLeaseService = workerLeaseService;
this.maxWorkerCount = maxWorkerCount;
this.clock = clock;
Expand All @@ -99,17 +98,14 @@ public void execute(final JvmTestExecutionSpec testExecutionSpec,
TestResultProcessor testResultProcessor) {
final TestFramework testFramework = testExecutionSpec.getTestFramework();
final WorkerTestClassProcessorFactory testInstanceFactory = testFramework.getProcessorFactory();
final Set<File> classpath = ImmutableSet.copyOf(testExecutionSpec.getClasspath());
final Set<File> modulePath = ImmutableSet.copyOf(testExecutionSpec.getModulePath());
final List<String>
testWorkerImplementationModules =
testFramework.getTestWorkerImplementationModules();
final ForkedTestClasspath classpath = testClasspathFactory.create(
testExecutionSpec.getClasspath(), testExecutionSpec.getModulePath(), testFramework,
testExecutionSpec.getTestIsModule());
final Factory<TestClassProcessor> forkingProcessorFactory = () -> {
TestClassProcessor forkingTestClassProcessor =
new ForkingTestClassProcessor(workerLeaseService, workerFactory, testInstanceFactory,
testExecutionSpec.getJavaForkOptions(), classpath, modulePath,
testWorkerImplementationModules, testFramework.getWorkerConfigurationAction(),
moduleRegistry, documentationRegistry);
testExecutionSpec.getJavaForkOptions(), classpath,
testFramework.getWorkerConfigurationAction(), documentationRegistry);
// Wrap the forking processor to make it distinguish different executions of a test class
return new ExecutionTrackingTestClassProcessor(forkingTestClassProcessor, iterationCount);
};
Expand All @@ -129,8 +125,9 @@ public void execute(final JvmTestExecutionSpec testExecutionSpec,
Runnable detector;
if (testExecutionSpec.isScanForTestClasses() && testFramework.getDetector() != null) {
TestFrameworkDetector testFrameworkDetector = testFramework.getDetector();
testFrameworkDetector.setTestClasses(testExecutionSpec.getTestClassesDirs().getFiles());
testFrameworkDetector.setTestClasspath(classpath);
testFrameworkDetector
.setTestClasses(new ArrayList<>(testExecutionSpec.getTestClassesDirs().getFiles()));
testFrameworkDetector.setTestClasspath(classpath.getApplicationClasspath());
detector = new DefaultTestClassScanner(testClassFiles, testFrameworkDetector, processor);
} else {
detector = new DefaultTestClassScanner(testClassFiles, null, processor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import org.gradle.api.Action;
import org.gradle.api.logging.LogLevel;
import org.gradle.internal.nativeintegration.services.NativeServices.NativeServicesMode;
import org.gradle.process.internal.JavaExecHandleBuilder;
import org.gradle.process.internal.worker.WorkerProcess;
import org.gradle.process.internal.worker.WorkerProcessBuilder;
Expand Down Expand Up @@ -134,14 +135,23 @@ public void enableJvmMemoryInfoPublishing(boolean shouldPublish) {
delegate.enableJvmMemoryInfoPublishing(shouldPublish);
}

@Override
public void setNativeServicesMode(NativeServicesMode mode) {
delegate.setNativeServicesMode(mode);
}

@Override
public NativeServicesMode getNativeServicesMode() {
return delegate.getNativeServicesMode();
}

/**
* Returns this builder rather than the delegate's return value, because callers chain from this
* method and must continue to hold the wrapper that installs the process launcher.
*/
@SuppressWarnings("deprecation")
@Override
public WorkerProcessBuilder setUseLegacyAddOpens(boolean useLegacyAddOpens) {
delegate.setUseLegacyAddOpens(useLegacyAddOpens);
public WorkerProcessBuilder setAddJpmsCompatibilityFlags(boolean addJpmsCompatibilityFlags) {
delegate.setAddJpmsCompatibilityFlags(addJpmsCompatibilityFlags);
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion build-tools/scripts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
implementation('org.nosphere.apache:creadur-rat-gradle:0.7.1')
implementation('com.github.ben-manes:gradle-versions-plugin:0.42.0')
implementation("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3")
implementation('me.champeau.gradle:japicmp-gradle-plugin:0.3.0')
implementation('me.champeau.gradle:japicmp-gradle-plugin:0.4.6')

implementation('org.apache.geode.gradle:org.apache.geode.gradle.geode-repeat-test:1.0')
implementation('org.apache.geode.gradle:geode-japicmp:1.0')
Expand Down
19 changes: 6 additions & 13 deletions build-tools/scripts/src/main/groovy/code-analysis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,37 +54,30 @@ if (project.hasProperty("codeCoverage")) {
}
}

tasks.register('mergeIntegrationTestCoverage', JacocoMerge) {
description 'Merges Distributed and Integration test coverage results'

destinationFile = file("${buildDir}/jacoco/mergedIntegrationTestCoverage.exec")
executionData = fileTree(dir: 'build/jacoco', include: [
'**/distributedTest.exec',
'**/integrationTest.exec'
])
}

tasks.register('jacocoIntegrationTestReport', JacocoReport) {
mustRunAfter tasks.withType(Test)
reports {
csv.enabled false
csv.required = false
sourceSets project.sourceSets.main
html.outputLocation = project.file("${buildDir}/reports/jacoco/integrationTest")
executionData fileTree(dir: 'build/jacoco', include: '**/integrationTest.exec')
}
}

tasks.register('jacocoDistributedTestReport', JacocoReport) {
mustRunAfter tasks.withType(Test)
reports {
csv.enabled false
csv.required = false
sourceSets project.sourceSets.main
html.outputLocation = project.file("${buildDir}/reports/jacoco/distributedTest")
executionData fileTree(dir: 'build/jacoco', include: '**/distributedTest.exec')
}
}

tasks.register('jacocoOverallTestReport', JacocoReport) {
mustRunAfter tasks.withType(Test)
reports {
csv.enabled false
csv.required = false
sourceSets project.sourceSets.main
html.outputLocation = project.file("${buildDir}/reports/jacoco/all")
executionData fileTree(dir: 'build/jacoco', include: '**/*.exec')
Expand Down
49 changes: 22 additions & 27 deletions build-tools/scripts/src/main/groovy/geode-japicmp-task.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,24 @@ tasks.register('japicmp', JapicmpTask) {
inputs.files { ourUnpackTaskProvider }

def d = java.nio.file.Paths.get(project(":geode-old-versions:${newest}").buildDir.path.toString(), "apache-geode-${newest}", 'lib')
// Dirty hack, to set the value as requied in configuration,
// but then reset to the acutal unpacked jars on runtime.
oldClasspath = files()
oldArchives = files()
doFirst {
oldClasspath = files(file(d).listFiles())
oldArchives = files(file(d).listFiles(new FilenameFilter() {
// The unpacked jars are listed when the task runs, after the download has completed.
oldClasspath.setFrom(files({ file(d).listFiles() }))
oldArchives.setFrom(files({
file(d).listFiles(new FilenameFilter() {
boolean accept(File dir, String name) {
return name.toLowerCase().startsWith("geode-") && name.toLowerCase().endsWith(".jar")
};
}))
}
})
}))

newClasspath = configurations.runtimeClasspath
newArchives = configurations.runtimeClasspath.filter { File f ->
newClasspath.setFrom(configurations.runtimeClasspath)
newArchives.setFrom(configurations.runtimeClasspath.filter { File f ->
f.toString().contains("geode-") && f.toString().endsWith(".jar")
}
})

ignoreMissingClasses = true
onlyModified = true
accessModifier = "protected"
ignoreMissingClasses.set(true)
onlyModified.set(true)
accessModifier.set("protected")

def allowMajorBreaking = false
if (new DefaultArtifactVersion(version).majorVersion > new DefaultArtifactVersion(newest).majorVersion) {
Expand All @@ -67,19 +64,17 @@ tasks.register('japicmp', JapicmpTask) {
// includeSynthetic = true

def reportFileName = "japi-v${newest}-${version}"
txtOutputFile = file("$buildDir/reports/${reportFileName}.txt")
htmlOutputFile = file("$buildDir/reports/${reportFileName}.html")
packageExcludes = ['*internal*']
packageIncludes = ['org.apache.geode.*']
annotationExcludes = ['@org.apache.geode.annotations.Experimental']
txtOutputFile.set(file("$buildDir/reports/${reportFileName}.txt"))
htmlOutputFile.set(file("$buildDir/reports/${reportFileName}.html"))
packageExcludes.set(['*internal*'])
packageIncludes.set(['org.apache.geode.*'])
annotationExcludes.set(['@org.apache.geode.annotations.Experimental'])

richReport {
title = "Geode API Compatibility Report"
description = "Comparing current ${version} against downloaded v${newest}."
reportName = "rich-report-${reportFileName}.html"
outputs.files {
reportName
}
title.set("Geode API Compatibility Report")
description.set("Comparing current ${version} against downloaded v${newest}.".toString())
destinationDir.set(file("$buildDir/reports"))
reportName.set("rich-report-${reportFileName}.html".toString())

if (allowMajorBreaking) {
addRule(AllowMajorBreakingChanges)
Expand All @@ -89,6 +84,6 @@ tasks.register('japicmp', JapicmpTask) {
addRule(GeodeApiRegressionRule)
addRule(GeodeSpiRegressionRule)
}
addDefaultRules = true
addDefaultRules.set(true)
}
}
2 changes: 1 addition & 1 deletion build-tools/scripts/src/main/groovy/geode-java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ tasks.register('jarTest', Jar) {
dependsOn testClasses
description 'Assembles a jar archive of test classes.'
from sourceSets.test.output
classifier 'test'
archiveClassifier = 'test'
}

artifacts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ task sourcesJar(type: Jar) {
from {
sourceSets.main.allJava
}
classifier = 'sources'
archiveClassifier = 'sources'
}

task javadocJar(type: Jar) {
from {
javadoc
}
classifier = 'javadoc'
archiveClassifier = 'javadoc'
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion build-tools/scripts/src/main/groovy/geode-test.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ gradle.taskGraph.whenReady({ graph ->
def resultsDir = TestPropertiesWriter.testResultsDir(buildDir, test.name)
test.workingDir = resultsDir

reports.html.destination = file "$buildDir/reports/$name"
reports.html.outputLocation = file "$buildDir/reports/$name"
testLogging {
exceptionFormat = 'full'
}
Expand Down
16 changes: 10 additions & 6 deletions build-tools/scripts/src/main/groovy/resolve-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,25 @@
* limitations under the License.
*/

task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->
subProject.buildscript.configurations.each { configuration ->
// Each project resolves its own configurations, so running resolveDependencies from the root
// resolves the configurations of every project.
allprojects {
tasks.register('resolveDependencies') {
doLast {
project.buildscript.configurations.each { configuration ->
resolveConfiguration(configuration)
}
subProject.configurations.each { configuration ->
project.configurations.each { configuration ->
resolveConfiguration(configuration)
}
}
}
}

// The default and archives configurations are not meant to be resolved; the classpath
// configurations resolved alongside them cover the same dependencies.
void resolveConfiguration(configuration) {
if (configuration.canBeResolved) {
if (configuration.canBeResolved && !(configuration.name in ['default', 'archives'])) {
configuration.resolve()
}
}
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ plugins {
id "com.diffplug.spotless" version "6.4.1" apply false
id "com.github.ben-manes.versions" version "0.42.0" apply false
id "nebula.lint" version "17.7.0" apply false
id "com.palantir.docker" version "0.32.0" apply false
id "com.palantir.docker" version "0.40.0" apply false
id "io.spring.dependency-management" version "1.0.11.RELEASE" apply false
id "org.ajoberstar.grgit" version "4.1.1" apply false
id "org.nosphere.apache.rat" version "0.7.1" apply false
Expand Down Expand Up @@ -95,15 +95,15 @@ allprojects {

task combineReports(type: TestReport) {
description 'Combines the test reports.'
destinationDir = file "${rootProject.buildDir}/reports/combined"
destinationDirectory = file "${rootProject.buildDir}/reports/combined"
// Collect all Test tasks in subprojects
def allTests = subprojects.collect { it.tasks.withType(Test) }.flatten()

// Explicitly add geode-old-versions:test if it’s being missed
allTests += tasks.getByPath(":geode-old-versions:test")

// Tell TestReport to use their results
reportOn allTests
testResults.from(allTests.collect { it.binaryResultsDirectory })

// Explicitly depend on them so results exist before combining
dependsOn allTests
Expand Down Expand Up @@ -243,7 +243,7 @@ if (project.hasProperty('askpass')) {
}

gradle.taskGraph.whenReady({ graph ->
tasks.getByName('combineReports').reportOn rootProject.subprojects.collect {
tasks.getByName('combineReports').testResults.from(rootProject.subprojects.collect {
it.tasks.withType(Test)
}.flatten()
}.flatten().collect { it.binaryResultsDirectory })
})
Loading
Loading