diff --git a/boms/geode-all-bom/build.gradle b/boms/geode-all-bom/build.gradle index 32378332ec71..f94814b45f01 100644 --- a/boms/geode-all-bom/build.gradle +++ b/boms/geode-all-bom/build.gradle @@ -17,10 +17,11 @@ plugins { id 'java-platform' - id 'geode-dependency-constraints' + id 'org.apache.geode.gradle.geode-dependency-constraints' + id 'geode-publish-common' } -apply from: "${rootDir}/gradle/publish-common.gradle" +DependencyConstraints.apply(project) publishing { publications { diff --git a/boms/geode-client-bom/build.gradle b/boms/geode-client-bom/build.gradle index f012b47e8aa4..66b4ab5ad685 100644 --- a/boms/geode-client-bom/build.gradle +++ b/boms/geode-client-bom/build.gradle @@ -15,10 +15,12 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" +plugins { + id 'standard-subproject-configuration' + id 'io.spring.dependency-management' + id 'geode-publish-common' +} -apply plugin: "io.spring.dependency-management" -apply from: "${project.projectDir}/../../gradle/publish-common.gradle" jar.enabled = false diff --git a/buildSrc/build.gradle b/build-tools/geode-annotation-processor/build.gradle similarity index 74% rename from buildSrc/build.gradle rename to build-tools/geode-annotation-processor/build.gradle index 08be6c8dcb82..8dd0e9d4f3f3 100644 --- a/buildSrc/build.gradle +++ b/build-tools/geode-annotation-processor/build.gradle @@ -18,15 +18,14 @@ plugins { id 'java' + id 'java-gradle-plugin' + id 'groovy-gradle-plugin' + id 'maven-publish' + id 'com.gradle.plugin-publish' version '0.18.0' } repositories { mavenCentral() - gradlePluginPortal() { - content { - includeModule('me.champeau.gradle', 'japicmp-gradle-plugin') - } - } } dependencies { @@ -34,15 +33,17 @@ dependencies { transitive(false) } implementation(gradleApi()) - implementation('org.apache.commons:commons-lang3:3.12.0') - implementation('org.apache.maven:maven-artifact:3.8.5') - implementation('com.google.guava:guava:31.1-jre') - implementation('me.champeau.gradle:japicmp-gradle-plugin:0.3.0') - implementation('junit:junit:4.13.2') + + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' testAnnotationProcessor(this.project) } +test { + useJUnitPlatform() +} + sourceSets { main { java { diff --git a/build-tools/geode-annotation-processor/settings.gradle b/build-tools/geode-annotation-processor/settings.gradle new file mode 100644 index 000000000000..9d368eb9f66f --- /dev/null +++ b/build-tools/geode-annotation-processor/settings.gradle @@ -0,0 +1,18 @@ +/* + * 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. + */ + +rootProject.name = 'geode-annotation-processor' diff --git a/buildSrc/src/main/java/org/apache/geode/javac/EnsureCorrectRunsWithProcessor.java b/build-tools/geode-annotation-processor/src/main/java/org/apache/geode/javac/EnsureCorrectRunsWithProcessor.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/javac/EnsureCorrectRunsWithProcessor.java rename to build-tools/geode-annotation-processor/src/main/java/org/apache/geode/javac/EnsureCorrectRunsWithProcessor.java diff --git a/buildSrc/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/build-tools/geode-annotation-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor similarity index 100% rename from buildSrc/src/main/resources/META-INF/services/javax.annotation.processing.Processor rename to build-tools/geode-annotation-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor diff --git a/buildSrc/src/test/java/org/apache/geode/javac/CompilerException.java b/build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/CompilerException.java similarity index 100% rename from buildSrc/src/test/java/org/apache/geode/javac/CompilerException.java rename to build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/CompilerException.java diff --git a/buildSrc/src/test/java/org/apache/geode/javac/SimpleClassFile.java b/build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/SimpleClassFile.java similarity index 100% rename from buildSrc/src/test/java/org/apache/geode/javac/SimpleClassFile.java rename to build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/SimpleClassFile.java diff --git a/buildSrc/src/test/java/org/apache/geode/javac/SimpleFileManager.java b/build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/SimpleFileManager.java similarity index 100% rename from buildSrc/src/test/java/org/apache/geode/javac/SimpleFileManager.java rename to build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/SimpleFileManager.java diff --git a/buildSrc/src/test/java/org/apache/geode/javac/SimpleSourceFile.java b/build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/SimpleSourceFile.java similarity index 100% rename from buildSrc/src/test/java/org/apache/geode/javac/SimpleSourceFile.java rename to build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/SimpleSourceFile.java diff --git a/buildSrc/src/test/java/org/apache/geode/javac/TestAnnotationProcessor.java b/build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/TestAnnotationProcessor.java similarity index 100% rename from buildSrc/src/test/java/org/apache/geode/javac/TestAnnotationProcessor.java rename to build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/TestAnnotationProcessor.java diff --git a/buildSrc/src/test/java/org/apache/geode/javac/TestCompiler.java b/build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/TestCompiler.java similarity index 100% rename from buildSrc/src/test/java/org/apache/geode/javac/TestCompiler.java rename to build-tools/geode-annotation-processor/src/test/java/org/apache/geode/javac/TestCompiler.java diff --git a/build-tools/geode-build-tools/build.gradle b/build-tools/geode-build-tools/build.gradle new file mode 100644 index 000000000000..1aca60b5fbad --- /dev/null +++ b/build-tools/geode-build-tools/build.gradle @@ -0,0 +1,51 @@ +/* + * 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. + * + */ + +plugins { + id 'java' + id 'java-gradle-plugin' + id 'groovy-gradle-plugin' + id 'maven-publish' + id 'com.gradle.plugin-publish' version '0.18.0' +} + +repositories { + mavenCentral() + gradlePluginPortal() +} + +dependencies { + implementation(gradleApi()) + + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' +} + +test { + useJUnitPlatform() +} + +group = 'org.apache.geode.gradle' +version = 1.0 + +gradlePlugin { + plugins.register('geode-build-tools') { + id = 'org.apache.geode.gradle.geode-build-tools' + implementationClass = 'org.apache.geode.gradle.plugins.BuildToolsPlugin' + } +} diff --git a/build-tools/geode-build-tools/settings.gradle b/build-tools/geode-build-tools/settings.gradle new file mode 100644 index 000000000000..4956799b14af --- /dev/null +++ b/build-tools/geode-build-tools/settings.gradle @@ -0,0 +1,18 @@ +/* + * 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. + */ + +rootProject.name = 'geode-build-tools' diff --git a/build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/BuildToolsPlugin.groovy b/build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/BuildToolsPlugin.groovy new file mode 100644 index 000000000000..b5a1ed832f8a --- /dev/null +++ b/build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/BuildToolsPlugin.groovy @@ -0,0 +1,24 @@ +/* + * 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; + +public class BuildToolsPlugin implements Plugin { + public void apply(Project project) { + // this plugin doesn't create any task by default + } +} diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/PasswordDialog.groovy b/build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/PasswordDialog.groovy similarity index 97% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/PasswordDialog.groovy rename to build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/PasswordDialog.groovy index b54affbee90c..67072d3e044f 100644 --- a/buildSrc/src/main/groovy/org/apache/geode/gradle/PasswordDialog.groovy +++ b/build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/PasswordDialog.groovy @@ -14,7 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +package org.apache.geode.gradle.plugins + import groovy.swing.SwingBuilder + class PasswordDialog { static String askPassword(String prompt) { def password = '' diff --git a/build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/TestPropertiesWriter.groovy b/build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/TestPropertiesWriter.groovy new file mode 100644 index 000000000000..8e0a1cc804fd --- /dev/null +++ b/build-tools/geode-build-tools/src/main/groovy/org/apache/geode/gradle/plugins/TestPropertiesWriter.groovy @@ -0,0 +1,36 @@ +/* + * 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 java.io.BufferedWriter +import java.io.File +import java.util.Properties + +class TestPropertiesWriter { + static void writeTestProperties(File parent, String name) { + Properties props = new Properties() + props.setProperty('log-level', 'config') + File propsFile = new File(testResultsDir(parent, name), 'gemfire.properties') + BufferedWriter writer = propsFile.newWriter() + props.store(writer, 'Autogenerated Gemfire properties') + } + + static File testResultsDir(File parent, String name) { + return new File(parent, name) + } +} + + diff --git a/build-tools/geode-dependency-management/build.gradle b/build-tools/geode-dependency-management/build.gradle new file mode 100644 index 000000000000..46fb5adfda1f --- /dev/null +++ b/build-tools/geode-dependency-management/build.gradle @@ -0,0 +1,49 @@ +/* + * 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. + * + */ + +plugins { + id 'java' + id 'groovy-gradle-plugin' +} + +repositories { + mavenCentral() + gradlePluginPortal() +} + +dependencies { + implementation(gradleApi()) +} + +sourceSets { + main { + java { + srcDirs = [] + } + groovy { + srcDirs += ['src/main/java'] + } + } +} + +gradlePlugin { + plugins.register('geode-dependency-constraints') { + id = 'org.apache.geode.gradle.geode-dependency-constraints' + implementationClass = 'org.apache.geode.gradle.plugins.DependencyConstraintsPlugin' + } +} diff --git a/build-tools/geode-dependency-management/settings.gradle b/build-tools/geode-dependency-management/settings.gradle new file mode 100644 index 000000000000..035585842d85 --- /dev/null +++ b/build-tools/geode-dependency-management/settings.gradle @@ -0,0 +1,18 @@ +/* + * 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. + */ + +rootProject.name = 'geode-dependency-management' diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy similarity index 98% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy rename to build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy index f100fc91b242..9b097f2b7150 100644 --- a/buildSrc/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy +++ b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy @@ -15,12 +15,11 @@ package org.apache.geode.gradle.plugins -import org.gradle.api.Plugin import org.gradle.api.Project -class DependencyConstraints implements Plugin { - /** By necessity, the version of those plugins used in the build-scripts are defined in the - * buildscript {} configuration in the root project's build.gradle. */ +class DependencyConstraints { +/** By necessity, the version of those plugins used in the build-scripts are defined in the + * buildscript {} configuration in the root project's build.gradle. */ static Map disparateDependencies = initExternalDependencies() static String get(String name) { @@ -75,7 +74,6 @@ class DependencyConstraints implements Plugin { return deps } - @Override void apply(Project project) { def dependencySet = { Map group_and_version, Closure closure -> DependencySetHandler delegate = diff --git a/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraintsPlugin.groovy b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraintsPlugin.groovy new file mode 100644 index 000000000000..6c4c810b2272 --- /dev/null +++ b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraintsPlugin.groovy @@ -0,0 +1,27 @@ +/* + * 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 + +class DependencyConstraintsPlugin implements Plugin { + + @Override + void apply(Project project) { + project.extensions.create("DependencyConstraints", DependencyConstraints) + } +} diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/plugins/DependencySetHandler.groovy b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencySetHandler.groovy similarity index 100% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/plugins/DependencySetHandler.groovy rename to build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencySetHandler.groovy diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/TestPropertiesWriter.groovy b/build-tools/geode-japicmp/build.gradle similarity index 59% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/TestPropertiesWriter.groovy rename to build-tools/geode-japicmp/build.gradle index 4fb2cc4371c7..9136fd3ecc94 100644 --- a/buildSrc/src/main/groovy/org/apache/geode/gradle/TestPropertiesWriter.groovy +++ b/build-tools/geode-japicmp/build.gradle @@ -16,18 +16,36 @@ * */ -package org.apache.geode.gradle +plugins { + id 'groovy-gradle-plugin' +} + +repositories { + mavenCentral() + gradlePluginPortal() +} -class TestPropertiesWriter { - static void writeTestProperties(File parent, String name) { - Properties props = new Properties() - props.setProperty('log-level', 'config') - File propsFile = new File(testResultsDir(parent, name), 'gemfire.properties') - BufferedWriter writer = propsFile.newWriter() - props.store(writer, 'Autogenerated Gemfire properties') +dependencies { + implementation(gradleApi()) + implementation('me.champeau.gradle:japicmp-gradle-plugin:0.3.0') +} + +sourceSets { + main { + java { + srcDirs = [] + } + groovy { + srcDirs += ['src/main/java'] + } } +} - static File testResultsDir(File parent, String name) { - return new File(parent, name) +group = 'org.apache.geode.gradle' +version = 1.0 +gradlePlugin { + plugins.register('geode-japicmp') { + id = 'org.apache.geode.gradle.geode-japicmp' + implementationClass = 'org.apache.geode.gradle.japicmp.JapicmpPlugin' } } diff --git a/build-tools/geode-japicmp/settings.gradle b/build-tools/geode-japicmp/settings.gradle new file mode 100644 index 000000000000..3eda382cb407 --- /dev/null +++ b/build-tools/geode-japicmp/settings.gradle @@ -0,0 +1,18 @@ +/* + * 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. + */ + +rootProject.name = 'geode-japicmp' diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/japicmp/AllowMajorBreakingChanges.groovy b/build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/AllowMajorBreakingChanges.groovy similarity index 100% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/japicmp/AllowMajorBreakingChanges.groovy rename to build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/AllowMajorBreakingChanges.groovy diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/japicmp/GeodeApiRegressionRule.groovy b/build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/GeodeApiRegressionRule.groovy similarity index 100% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/japicmp/GeodeApiRegressionRule.groovy rename to build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/GeodeApiRegressionRule.groovy diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/japicmp/GeodeSpiRegressionRule.groovy b/build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/GeodeSpiRegressionRule.groovy similarity index 100% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/japicmp/GeodeSpiRegressionRule.groovy rename to build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/GeodeSpiRegressionRule.groovy diff --git a/build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/JapicmpPlugin.groovy b/build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/JapicmpPlugin.groovy new file mode 100644 index 000000000000..dd7a37169ff4 --- /dev/null +++ b/build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/JapicmpPlugin.groovy @@ -0,0 +1,29 @@ +/* + * 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.japicmp + +import org.gradle.api.Plugin +import org.gradle.api.Project + +class JapicmpPlugin implements Plugin { + + @Override + void apply(Project project) { + // Plugin loads no tasks. Only provided to load API comparison rule classes from this package. + } +} + + diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/japicmp/ParentIsExperimental.groovy b/build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/ParentIsExperimental.groovy similarity index 100% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/japicmp/ParentIsExperimental.groovy rename to build-tools/geode-japicmp/src/main/groovy/org/apache/geode/gradle/japicmp/ParentIsExperimental.groovy diff --git a/buildSrc/src/main/resources/japicmp_exceptions.json b/build-tools/geode-japicmp/src/main/resources/japicmp_exceptions.json similarity index 100% rename from buildSrc/src/main/resources/japicmp_exceptions.json rename to build-tools/geode-japicmp/src/main/resources/japicmp_exceptions.json diff --git a/build-tools/geode-repeat-test/build.gradle b/build-tools/geode-repeat-test/build.gradle new file mode 100644 index 000000000000..18a74e8d788c --- /dev/null +++ b/build-tools/geode-repeat-test/build.gradle @@ -0,0 +1,52 @@ +/* + * 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. + * + */ + +plugins { + id 'java' + id 'java-gradle-plugin' + id 'groovy-gradle-plugin' + id 'maven-publish' + id 'com.gradle.plugin-publish' version '0.18.0' +} + +repositories { + mavenCentral() + gradlePluginPortal() +} + +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' +} + +test { + useJUnitPlatform() +} + +group = 'org.apache.geode.gradle' +version = 1.0 + +gradlePlugin { + plugins.register('geodeRepeatTest') { + id = 'org.apache.geode.gradle.geode-repeat-test' + implementationClass = 'org.apache.geode.gradle.testing.repeat.RepeatTestPlugin' + } +} diff --git a/build-tools/geode-repeat-test/settings.gradle b/build-tools/geode-repeat-test/settings.gradle new file mode 100644 index 000000000000..6630310627f4 --- /dev/null +++ b/build-tools/geode-repeat-test/settings.gradle @@ -0,0 +1,18 @@ +/* + * 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. + */ + +rootProject.name = 'geode-repeat-test' diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTest.groovy b/build-tools/geode-repeat-test/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTest.groovy similarity index 51% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTest.groovy rename to build-tools/geode-repeat-test/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTest.groovy index 82fc4ba9157f..e2d4912fe71d 100644 --- a/buildSrc/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTest.groovy +++ b/build-tools/geode-repeat-test/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTest.groovy @@ -21,40 +21,51 @@ 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 import org.gradle.api.tasks.testing.Test +import org.gradle.api.tasks.Input import org.gradle.internal.time.Clock import org.gradle.internal.work.WorkerLeaseRegistry -class RepeatTest extends Test { - int times = 1 - - /** - * Submit each test class for processing multiple times. - */ - @Override - FileTree getCandidateClassFiles() { - FileTree candidates = super.getCandidateClassFiles() - int additionalRuns = times - 1 - for (int i = 0; i < additionalRuns; i++) { - candidates = candidates.plus(super.getCandidateClassFiles()) - } - - return candidates - } +public class RepeatTest extends Test { + + @Input + private int times = 5 - /** - * Use a custom {@link TestExecuter} that processes each test class as many times as submitted. - */ - @Override - protected TestExecuter createTestExecuter() { - return new RepeatTestExecuter( - super.createTestExecuter().workerFactory, - getActorFactory(), - getModuleRegistry(), - getServices().get(WorkerLeaseRegistry.class), - getServices().get(StartParameter.class).getMaxWorkerCount(), - getServices().get(Clock.class), - getServices().get(DocumentationRegistry.class), - (DefaultTestFilter) getFilter(), - times) + /** + * Submit each test class for processing multiple times. + */ + @Override + public FileTree getCandidateClassFiles() { + FileTree candidates = super.getCandidateClassFiles() + int additionalRuns = times - 1 + for (int i = 0; i < additionalRuns; i++) { + candidates = candidates.plus(super.getCandidateClassFiles()) } + + return candidates + } + + /** + * Use a custom {@link TestExecuter} that processes each test class as many times as submitted. + */ + @Override + protected TestExecuter createTestExecuter() { + return new RepeatTestExecuter( + super.createTestExecuter().workerFactory, + getActorFactory(), + getModuleRegistry(), + getServices().get(WorkerLeaseRegistry.class), + getServices().get(StartParameter.class).getMaxWorkerCount(), + getServices().get(Clock.class), + getServices().get(DocumentationRegistry.class), + (DefaultTestFilter) getFilter(), + times) + } + + int getTimes() { + return times + } + + void setTimes(int times) { + this.times = times + } } diff --git a/build-tools/geode-repeat-test/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTestPlugin.groovy b/build-tools/geode-repeat-test/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTestPlugin.groovy new file mode 100644 index 000000000000..2f1ddbe24565 --- /dev/null +++ b/build-tools/geode-repeat-test/src/main/groovy/org/apache/geode/gradle/testing/repeat/RepeatTestPlugin.groovy @@ -0,0 +1,27 @@ +/* + * 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.testing.repeat; + +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.tasks.testing.Test; + +public class RepeatTestPlugin implements Plugin { + public void apply(Project project) { + // this plugin doesn't create any task by default + // TODO: Look at how Dale did the test-isolation instrumentation to configure existing tasks on the project, and + // also any new tasks created on the project, and use that to create our repeat tasks + } +} diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/repeat/ExecutionTrackingTestClassProcessor.java b/build-tools/geode-repeat-test/src/main/java/org/apache/geode/gradle/testing/repeat/ExecutionTrackingTestClassProcessor.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/repeat/ExecutionTrackingTestClassProcessor.java rename to build-tools/geode-repeat-test/src/main/java/org/apache/geode/gradle/testing/repeat/ExecutionTrackingTestClassProcessor.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/repeat/ExecutionTrackingTestResultProcessor.java b/build-tools/geode-repeat-test/src/main/java/org/apache/geode/gradle/testing/repeat/ExecutionTrackingTestResultProcessor.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/repeat/ExecutionTrackingTestResultProcessor.java rename to build-tools/geode-repeat-test/src/main/java/org/apache/geode/gradle/testing/repeat/ExecutionTrackingTestResultProcessor.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/repeat/RepeatTestExecuter.java b/build-tools/geode-repeat-test/src/main/java/org/apache/geode/gradle/testing/repeat/RepeatTestExecuter.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/repeat/RepeatTestExecuter.java rename to build-tools/geode-repeat-test/src/main/java/org/apache/geode/gradle/testing/repeat/RepeatTestExecuter.java diff --git a/build-tools/geode-repeat-test/src/test/groovy/org/apache/geode/gradle/testing/repeat/RepeatTestTest.groovy b/build-tools/geode-repeat-test/src/test/groovy/org/apache/geode/gradle/testing/repeat/RepeatTestTest.groovy new file mode 100644 index 000000000000..be3af3de5098 --- /dev/null +++ b/build-tools/geode-repeat-test/src/test/groovy/org/apache/geode/gradle/testing/repeat/RepeatTestTest.groovy @@ -0,0 +1,30 @@ +/* + * 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.testing.repeat + +import org.gradle.testfixtures.ProjectBuilder +import org.gradle.api.Project +import org.junit.Test + +import static org.junit.Assert.assertTrue; + +class RepeatTestTest { + @Test + void canAddTaskToProject() { + Project project = ProjectBuilder.builder().build() + def task = project.task('repeatTest', type: RepeatTest) + assertTrue(task instanceof RepeatTest) + } +} diff --git a/build-tools/geode-testing-isolation/build.gradle b/build-tools/geode-testing-isolation/build.gradle new file mode 100644 index 000000000000..ad921325db47 --- /dev/null +++ b/build-tools/geode-testing-isolation/build.gradle @@ -0,0 +1,48 @@ +/* + * 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. + * + */ + +plugins { + id 'java' + id 'java-gradle-plugin' + id 'groovy-gradle-plugin' + id 'maven-publish' + id 'com.gradle.plugin-publish' version '0.18.0' +} + +group = 'org.apache.geode.gradle' +version = 1.0 + +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' +} + +test { + useJUnitPlatform() +} + +gradlePlugin { + plugins.register('geodeTestingIsolation') { + id = 'org.apache.geode.gradle.geode-testing-isolation' + implementationClass = 'org.apache.geode.gradle.testing.isolation.IsolatedTestPlugin' + } +} diff --git a/build-tools/geode-testing-isolation/settings.gradle b/build-tools/geode-testing-isolation/settings.gradle new file mode 100644 index 000000000000..caec879f193a --- /dev/null +++ b/build-tools/geode-testing-isolation/settings.gradle @@ -0,0 +1,18 @@ +/* + * 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. + */ + +rootProject.name = 'geode-testing-isolation' diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/testing/Executers.groovy b/build-tools/geode-testing-isolation/src/main/groovy/org/apache/geode/gradle/testing/Executers.groovy similarity index 100% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/testing/Executers.groovy rename to build-tools/geode-testing-isolation/src/main/groovy/org/apache/geode/gradle/testing/Executers.groovy diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/testing/Workers.groovy b/build-tools/geode-testing-isolation/src/main/groovy/org/apache/geode/gradle/testing/Workers.groovy similarity index 99% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/testing/Workers.groovy rename to build-tools/geode-testing-isolation/src/main/groovy/org/apache/geode/gradle/testing/Workers.groovy index 5d0b46fd2091..0402465dbea1 100644 --- a/buildSrc/src/main/groovy/org/apache/geode/gradle/testing/Workers.groovy +++ b/build-tools/geode-testing-isolation/src/main/groovy/org/apache/geode/gradle/testing/Workers.groovy @@ -18,6 +18,7 @@ package org.apache.geode.gradle.testing import org.apache.geode.gradle.testing.process.LauncherProxyWorkerProcessFactory import org.apache.geode.gradle.testing.process.ProcessLauncher + import org.gradle.internal.remote.MessagingServer import org.gradle.process.internal.worker.WorkerProcessFactory diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/testing/isolation/IsolatedTestPlugin.groovy b/build-tools/geode-testing-isolation/src/main/groovy/org/apache/geode/gradle/testing/isolation/IsolatedTestPlugin.groovy similarity index 93% rename from buildSrc/src/main/groovy/org/apache/geode/gradle/testing/isolation/IsolatedTestPlugin.groovy rename to build-tools/geode-testing-isolation/src/main/groovy/org/apache/geode/gradle/testing/isolation/IsolatedTestPlugin.groovy index 10769bc4eca3..f0032d0ff79b 100644 --- a/buildSrc/src/main/groovy/org/apache/geode/gradle/testing/isolation/IsolatedTestPlugin.groovy +++ b/build-tools/geode-testing-isolation/src/main/groovy/org/apache/geode/gradle/testing/isolation/IsolatedTestPlugin.groovy @@ -46,12 +46,11 @@ class IsolatedTestPlugin implements Plugin { initializePortRangeWorkerProcessFactory(project.gradle.startParameter.maxWorkerCount) def usePortRangeTestWorker = { - if (!it.hasProperty('isolatedTest')) { - return - } - it.doFirst { - testExecuter = Executers.withFactory(it, portRangeWorkerProcessFactory) + it.doFirst { + if (it.hasProperty('isolatedTest')) { + testExecuter = Executers.withFactory(it, portRangeWorkerProcessFactory) } + } } project.tasks.withType(Test).each(usePortRangeTestWorker) diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/CompletableProcess.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/CompletableProcess.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/CompletableProcess.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/CompletableProcess.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/PortRange.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/PortRange.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/PortRange.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/PortRange.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/PortRangeContext.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/PortRangeContext.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/PortRangeContext.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/PortRangeContext.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/PortRangeProcessLauncher.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/PortRangeProcessLauncher.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/PortRangeProcessLauncher.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/PortRangeProcessLauncher.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolator.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolator.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolator.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolator.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/process/AdjustableProcessLauncher.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/AdjustableProcessLauncher.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/process/AdjustableProcessLauncher.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/AdjustableProcessLauncher.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/process/LauncherProxyWorkerProcessBuilder.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/LauncherProxyWorkerProcessBuilder.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/process/LauncherProxyWorkerProcessBuilder.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/LauncherProxyWorkerProcessBuilder.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/process/LauncherProxyWorkerProcessFactory.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/LauncherProxyWorkerProcessFactory.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/process/LauncherProxyWorkerProcessFactory.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/LauncherProxyWorkerProcessFactory.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/process/ProcessLauncher.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/ProcessLauncher.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/process/ProcessLauncher.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/ProcessLauncher.java diff --git a/buildSrc/src/main/java/org/apache/geode/gradle/testing/process/Reflection.java b/build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/Reflection.java similarity index 100% rename from buildSrc/src/main/java/org/apache/geode/gradle/testing/process/Reflection.java rename to build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/process/Reflection.java diff --git a/buildSrc/src/test/java/org/apache/geode/gradle/test/isolation/PortRangeTest.java b/build-tools/geode-testing-isolation/src/test/java/org/apache/geode/gradle/test/isolation/PortRangeTest.java similarity index 87% rename from buildSrc/src/test/java/org/apache/geode/gradle/test/isolation/PortRangeTest.java rename to build-tools/geode-testing-isolation/src/test/java/org/apache/geode/gradle/test/isolation/PortRangeTest.java index 5bb126b8336d..617a8f53a5fa 100644 --- a/buildSrc/src/test/java/org/apache/geode/gradle/test/isolation/PortRangeTest.java +++ b/build-tools/geode-testing-isolation/src/test/java/org/apache/geode/gradle/test/isolation/PortRangeTest.java @@ -16,31 +16,28 @@ package org.apache.geode.gradle.test.isolation; import static java.util.stream.Collectors.toList; -import static org.junit.Assert.assertTrue; import java.util.List; import java.util.stream.IntStream; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import org.apache.geode.gradle.testing.isolation.PortRange; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class PortRangeTest { @Test public void firstPartitionHasSameLowerBoundAsFullRange() { PortRange fullRange = new PortRange(11111, 19994); // Arbitrary PortRange firstPartition = fullRange.partition(0, 24); - assertEquals(fullRange.lowerBound(), firstPartition.lowerBound()); + Assertions.assertEquals(fullRange.lowerBound(), firstPartition.lowerBound()); + } @Test public void lastPartitionHasSameUpperBoundAsSourceRange() { PortRange fullRange = new PortRange(3333, 20002); // Arbitrary PortRange lastPartition = fullRange.partition(23, 24); - assertEquals(fullRange.upperBound(), lastPartition.upperBound()); + Assertions.assertEquals(fullRange.upperBound(), lastPartition.upperBound()); } @Test @@ -59,7 +56,7 @@ public void adjacentPartitionsHaveAdjacentBounds() { String description = String.format( "partition %d upper bound (%d) is adjacent to partition %d lower bound (%d)", i - 1, lowerPartitionUpperBound, i, upperPartitionLowerBound); - assertTrue(description, areAdjacent); + Assertions.assertTrue(areAdjacent, description); } } @@ -80,6 +77,6 @@ public void partitionSizesDifferByNoMoreThan1() { String description = String.format( "minimum (%d) and maximum (%d) partition sizes differ by no more than 1", minPartitionSize, maxPartitionSize); - assertTrue(description, maxPartitionSize - minPartitionSize <= 1); + Assertions.assertTrue(maxPartitionSize - minPartitionSize <= 1, description); } } diff --git a/buildSrc/src/test/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolatorTest.java b/build-tools/geode-testing-isolation/src/test/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolatorTest.java similarity index 78% rename from buildSrc/src/test/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolatorTest.java rename to build-tools/geode-testing-isolation/src/test/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolatorTest.java index b19b11597bba..c4b794e436d1 100644 --- a/buildSrc/src/test/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolatorTest.java +++ b/build-tools/geode-testing-isolation/src/test/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolatorTest.java @@ -15,12 +15,11 @@ */ package org.apache.geode.gradle.testing.isolation; -import static org.junit.Assert.assertEquals; - import java.io.File; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class WorkingDirectoryIsolatorTest { @@ -31,7 +30,7 @@ public void updatesRelativeUnixPaths() { processBuilder.command("/bin/java", "-javaagent:../some/jacocoagent.jar=destfile=../jacoco/integrationTest.exec", "GradleWorkerMain"); new WorkingDirectoryIsolator().accept(processBuilder); - assertEquals(Arrays.asList("/bin/java", "-javaagent:../../some/jacocoagent.jar=destfile=../../jacoco/integrationTest.exec", "GradleWorkerMain"), processBuilder.command()); + Assertions.assertEquals(Arrays.asList("/bin/java", "-javaagent:../../some/jacocoagent.jar=destfile=../../jacoco/integrationTest.exec", "GradleWorkerMain"), processBuilder.command()); } @Test @@ -41,7 +40,7 @@ public void updatesRelativeWindowsPaths() { processBuilder.command("/bin/java", "-javaagent:..\\some\\jacocoagent.jar=destfile=..\\jacoco\\integrationTest.exec", "GradleWorkerMain"); new WorkingDirectoryIsolator().accept(processBuilder); - assertEquals(Arrays.asList("/bin/java", "-javaagent:..\\..\\some\\jacocoagent.jar=destfile=..\\..\\jacoco\\integrationTest.exec", "GradleWorkerMain"), processBuilder.command()); + Assertions.assertEquals(Arrays.asList("/bin/java", "-javaagent:..\\..\\some\\jacocoagent.jar=destfile=..\\..\\jacoco\\integrationTest.exec", "GradleWorkerMain"), processBuilder.command()); } } diff --git a/build-tools/scripts/build.gradle b/build-tools/scripts/build.gradle new file mode 100644 index 000000000000..25b542d1a011 --- /dev/null +++ b/build-tools/scripts/build.gradle @@ -0,0 +1,37 @@ +/* + * 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. + */ + +plugins { + id 'groovy-gradle-plugin' +} + +repositories { + mavenCentral() + gradlePluginPortal() +} + +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('org.apache.geode.gradle:org.apache.geode.gradle.geode-repeat-test:1.0') + implementation('org.apache.geode.gradle:geode-japicmp:1.0') + implementation('org.apache.geode.gradle:org.apache.geode.gradle.geode-build-tools:1.0') + implementation('org.apache.geode.gradle:org.apache.geode.gradle.geode-testing-isolation:1.0') +} diff --git a/build-tools/scripts/settings.gradle b/build-tools/scripts/settings.gradle new file mode 100644 index 000000000000..357290e402fe --- /dev/null +++ b/build-tools/scripts/settings.gradle @@ -0,0 +1,39 @@ +/* + * 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. + */ + +includeBuild("${rootDir}/../geode-dependency-management") + +includeBuild("${rootDir}/../geode-japicmp") { + dependencySubstitution { + substitute module('org.apache.geode.gradle:geode-japicmp') using project(':') + } +} +includeBuild("${rootDir}/../geode-repeat-test") { + dependencySubstitution { + substitute module('org.apache.geode.gradle:org.apache.geode.gradle.geode-repeat-test') using project(':') + } +} +includeBuild("${rootDir}/../geode-build-tools") { + dependencySubstitution { + substitute module('org.apache.geode.gradle:org.apache.geode.gradle.geode-build-tools') using project(':') + } +} +includeBuild("${rootDir}/../geode-testing-isolation") { + dependencySubstitution { + substitute module('org.apache.geode.gradle:org.apache.geode.gradle.geode-testing-isolation') using project(':') + } +} diff --git a/gradle/check-pom.gradle b/build-tools/scripts/src/main/groovy/check-pom.gradle similarity index 95% rename from gradle/check-pom.gradle rename to build-tools/scripts/src/main/groovy/check-pom.gradle index 7cfe73ede242..d73492f3a805 100644 --- a/gradle/check-pom.gradle +++ b/build-tools/scripts/src/main/groovy/check-pom.gradle @@ -19,11 +19,13 @@ import java.nio.file.Paths def expectedPomFile = Paths.get(projectDir.toString(), 'src', 'test', 'resources', 'expected-pom.xml') -task('checkPom') { +tasks.register('checkPom') { // The XmlParser used below has a strange tendency to return lists of fields rather than the field // you actually want. Be careful with that, future developer. group 'verification' - dependsOn('generatePomFileForMavenPublication') + inputs.files { + tasks.named('generatePomFileForMavenPublication') + } description 'Checks the generated POM against an expected POM for dependency changes.' + ' Ignores versions of Apache Geode dependencies.' @@ -78,7 +80,6 @@ task('checkPom') { } doLast { - if (tasks.getByName("generatePomFileForMavenPublication").enabled) { if (null == expectedPomFile) { throw new RuntimeException("expected-pom.xml not found.") } @@ -131,17 +132,17 @@ Alternatively, run './gradlew ${project.path}:updateExpectedPom' to replace the """ thisOutput.write(message) throw new RuntimeException(message) - } } } } check.dependsOn('checkPom') -task updateExpectedPom(dependsOn: generatePomFileForMavenPublication, type: Copy) { +tasks.register('updateExpectedPom', Copy) { + dependsOn tasks.named('generatePomFileForMavenPublication') description 'After having verified changes with checkPom, this task will perform the copy.' def expectedPomDir = expectedPomFile.parent - def actualPomFile = generatePomFileForMavenPublication.outputs.files.first() + def actualPomFile = tasks.named('generatePomFileForMavenPublication').get().outputs.files.first() inputs.files { [actualPomFile, expectedPomFile] @@ -149,7 +150,7 @@ task updateExpectedPom(dependsOn: generatePomFileForMavenPublication, type: Copy outputs.files { expectedPomFile } - if (tasks.getByName("generatePomFileForMavenPublication").enabled) { + if (tasks.named("generatePomFileForMavenPublication").get().enabled) { from actualPomFile into expectedPomDir rename '.*.xml', "expected-pom.xml" diff --git a/gradle/code-analysis.gradle b/build-tools/scripts/src/main/groovy/code-analysis.gradle similarity index 64% rename from gradle/code-analysis.gradle rename to build-tools/scripts/src/main/groovy/code-analysis.gradle index 7ec757013141..2f35e8430172 100644 --- a/gradle/code-analysis.gradle +++ b/build-tools/scripts/src/main/groovy/code-analysis.gradle @@ -15,50 +15,46 @@ * limitations under the License. */ -if (project.hasProperty("staticAnalysis")) { - apply plugin: 'checkstyle' +plugins { + // Findbugs has been removed as of Gradle 6. Spotbugs is an alternative, if anyone wants to enable it. +// id 'com.github.spotbugs' + id 'jacoco' +} - //Checkstyle configuration - configurations.checkstyle { - dependencies.all { dep -> - dep.transitive = true +// JaCoCo configuration +def jacocoOff = { + it.configure { + jacoco { + enabled = false } } - - //Findbugs configuration - apply plugin: 'findbugs' - - // Switch default Findbugs report to HTML for developers - def findbugsXmlEnabled = false - def findbugsHtmlEnabled = true - - // Provide ability to change report type to XML for ingesting into other ap - if (project.hasProperty("findbugsXmlReport")) { - findbugsXmlEnabled = true - findbugsHtmlEnabled = false - } - - configurations.findbugs { - dependencies.all { dep -> - dep.transitive = true +} +def jacocoOn = { + it.configure { + jacoco { + enabled = true } - findbugs.effort = 'max' - findbugs.reportLevel = 'low' - } + } +} - tasks.withType(FindBugs) { - reports { - xml.enabled = findbugsXmlEnabled - html.enabled = findbugsHtmlEnabled - } +// Default is off +project.tasks.withType(Test).each(jacocoOff) +project.tasks.whenTaskAdded() { + if (it instanceof Test) { + it.configure(jacocoOff) } } -// JaCoCo configuration if (project.hasProperty("codeCoverage")) { - apply plugin: 'jacoco' + // Enable if provided + project.tasks.withType(Test).each(jacocoOn) + project.tasks.whenTaskAdded() { + if (it instanceof Test) { + it.configure(jacocoOn) + } + } - task mergeIntegrationTestCoverage(type: JacocoMerge) { + tasks.register('mergeIntegrationTestCoverage', JacocoMerge) { description 'Merges Distributed and Integration test coverage results' destinationFile = file("${buildDir}/jacoco/mergedIntegrationTestCoverage.exec") @@ -66,10 +62,9 @@ if (project.hasProperty("codeCoverage")) { '**/distributedTest.exec', '**/integrationTest.exec' ]) - } - task jacocoIntegrationTestReport(type: JacocoReport) { + tasks.register('jacocoIntegrationTestReport', JacocoReport) { reports { csv.enabled false sourceSets project.sourceSets.main @@ -78,7 +73,7 @@ if (project.hasProperty("codeCoverage")) { } } - task jacocoDistributedTestReport(type: JacocoReport) { + tasks.register('jacocoDistributedTestReport', JacocoReport) { reports { csv.enabled false sourceSets project.sourceSets.main @@ -87,7 +82,7 @@ if (project.hasProperty("codeCoverage")) { } } - task jacocoOverallTestReport(type: JacocoReport) { + tasks.register('jacocoOverallTestReport', JacocoReport) { reports { csv.enabled false sourceSets project.sourceSets.main diff --git a/gradle/dependency-resolution.gradle b/build-tools/scripts/src/main/groovy/dependency-resolution.gradle similarity index 100% rename from gradle/dependency-resolution.gradle rename to build-tools/scripts/src/main/groovy/dependency-resolution.gradle diff --git a/gradle/japicmp.gradle b/build-tools/scripts/src/main/groovy/geode-japicmp-task.gradle similarity index 97% rename from gradle/japicmp.gradle rename to build-tools/scripts/src/main/groovy/geode-japicmp-task.gradle index e83349311795..c3cdff2735f5 100644 --- a/gradle/japicmp.gradle +++ b/build-tools/scripts/src/main/groovy/geode-japicmp-task.gradle @@ -18,17 +18,16 @@ import japicmp.model.JApiChangeStatus import org.apache.maven.artifact.versioning.ComparableVersion import org.apache.maven.artifact.versioning.DefaultArtifactVersion - -import org.apache.geode.gradle.japicmp.AllowMajorBreakingChanges +import me.champeau.gradle.japicmp.JapicmpTask import org.apache.geode.gradle.japicmp.ParentIsExperimental import org.apache.geode.gradle.japicmp.GeodeApiRegressionRule import org.apache.geode.gradle.japicmp.GeodeSpiRegressionRule - +import org.apache.geode.gradle.japicmp.AllowMajorBreakingChanges def mostRecentReleaseProj = project(':geode-old-versions').subprojects.max(){ v -> new ComparableVersion(v.name)} def newest = mostRecentReleaseProj.name -tasks.register('japicmp', me.champeau.gradle.japicmp.JapicmpTask) { +tasks.register('japicmp', JapicmpTask) { inputs.files { configurations.runtimeClasspath} def ourUnpackTaskProvider = project(":geode-old-versions:${newest}").tasks.named('downloadAndUnzipFile') inputs.files { ourUnpackTaskProvider } diff --git a/gradle/java.gradle b/build-tools/scripts/src/main/groovy/geode-java.gradle similarity index 93% rename from gradle/java.gradle rename to build-tools/scripts/src/main/groovy/geode-java.gradle index 64e19de1ee7e..7379995c1d02 100644 --- a/gradle/java.gradle +++ b/build-tools/scripts/src/main/groovy/geode-java.gradle @@ -14,15 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import org.apache.geode.gradle.plugins.DependencyConstraints -if (project.name.endsWith("geode-all-bom")) { - // This anti-pattern is a workaround -- java-platform must be applied before java or java-library - // to avoid conflicts over redefining certain configurations. - // Evaluation as to whether java-platform should be applied at all is left to GEODE-6611. - apply plugin: 'java-platform' +plugins { + id 'java-library' + id 'org.apache.geode.gradle.geode-dependency-constraints' } -apply plugin: 'java-library' sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -174,7 +170,8 @@ tasks.all { task -> } } -task jarTest(type: Jar, dependsOn: testClasses) { +tasks.register('jarTest', Jar) { + dependsOn testClasses description 'Assembles a jar archive of test classes.' from sourceSets.test.output classifier 'test' diff --git a/gradle/pmd.gradle b/build-tools/scripts/src/main/groovy/geode-pmd.gradle similarity index 97% rename from gradle/pmd.gradle rename to build-tools/scripts/src/main/groovy/geode-pmd.gradle index c37a5ffdef4a..dd55223a8d8e 100644 --- a/gradle/pmd.gradle +++ b/build-tools/scripts/src/main/groovy/geode-pmd.gradle @@ -14,7 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -apply plugin: 'pmd' + +plugins { + id 'pmd' +} + pmd { sourceSets = [] ruleSetFiles = files("${project.projectDir}/../static-analysis/pmd-rules/src/main/resources/geodepmd.xml") diff --git a/gradle/publish-artifacts.gradle b/build-tools/scripts/src/main/groovy/geode-publish-artifacts.gradle similarity index 100% rename from gradle/publish-artifacts.gradle rename to build-tools/scripts/src/main/groovy/geode-publish-artifacts.gradle diff --git a/gradle/publish-common.gradle b/build-tools/scripts/src/main/groovy/geode-publish-common.gradle similarity index 96% rename from gradle/publish-common.gradle rename to build-tools/scripts/src/main/groovy/geode-publish-common.gradle index 26a169fa17c2..fc78d2acc7c8 100644 --- a/gradle/publish-common.gradle +++ b/build-tools/scripts/src/main/groovy/geode-publish-common.gradle @@ -15,8 +15,10 @@ * limitations under the License. */ -apply plugin: 'maven-publish' -apply plugin: 'signing' +plugins { + id 'maven-publish' + id 'signing' +} // The published bom will constrain versions within geode of any subproject with this property set. project.ext.set('constrainVersionInBom', true) @@ -102,9 +104,10 @@ signing { sign publishing.publications.maven } -task install(dependsOn: publishToMavenLocal) {} +tasks.register('install') { + dependsOn tasks.named('publishToMavenLocal') +} -apply from: "${rootDir}/${scriptDir}/check-pom.gradle" tasks.withType(GenerateModuleMetadata) { enabled = false diff --git a/gradle/publish-java.gradle b/build-tools/scripts/src/main/groovy/geode-publish-java.gradle similarity index 90% rename from gradle/publish-java.gradle rename to build-tools/scripts/src/main/groovy/geode-publish-java.gradle index 3a47b6a5323d..64f544235945 100644 --- a/gradle/publish-java.gradle +++ b/build-tools/scripts/src/main/groovy/geode-publish-java.gradle @@ -15,8 +15,11 @@ * limitations under the License. */ -apply from: "${rootDir}/gradle/publish-common.gradle" -apply from: "${rootDir}/gradle/publish-artifacts.gradle" +plugins { + id 'geode-publish-common' + id 'geode-publish-artifacts' + id 'check-pom' +} publishing { publications { diff --git a/gradle/publish-war.gradle b/build-tools/scripts/src/main/groovy/geode-publish-war.gradle similarity index 90% rename from gradle/publish-war.gradle rename to build-tools/scripts/src/main/groovy/geode-publish-war.gradle index 4710062d70ca..e2331ac6b546 100644 --- a/gradle/publish-war.gradle +++ b/build-tools/scripts/src/main/groovy/geode-publish-war.gradle @@ -15,8 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/gradle/publish-common.gradle" -apply from: "${rootDir}/gradle/publish-artifacts.gradle" +plugins { + id 'geode-publish-common' + id 'geode-publish-artifacts' +} publishing { publications { diff --git a/gradle/rat.gradle b/build-tools/scripts/src/main/groovy/geode-rat.gradle similarity index 99% rename from gradle/rat.gradle rename to build-tools/scripts/src/main/groovy/geode-rat.gradle index b380bfcf1e98..dca43213de10 100644 --- a/gradle/rat.gradle +++ b/build-tools/scripts/src/main/groovy/geode-rat.gradle @@ -15,7 +15,10 @@ * limitations under the License. */ -apply plugin: "org.nosphere.apache.rat" +plugins { + id 'base' + id "org.nosphere.apache.rat" +} rat { inputDir = rootDir diff --git a/gradle/sonar.gradle b/build-tools/scripts/src/main/groovy/geode-sonar.gradle similarity index 97% rename from gradle/sonar.gradle rename to build-tools/scripts/src/main/groovy/geode-sonar.gradle index 72625952b1c2..121b44fb3458 100644 --- a/gradle/sonar.gradle +++ b/build-tools/scripts/src/main/groovy/geode-sonar.gradle @@ -15,7 +15,9 @@ * limitations under the License. */ -apply plugin: 'org.sonarqube' +plugins { + id 'org.sonarqube' +} sonarqube { properties { diff --git a/gradle/test.gradle b/build-tools/scripts/src/main/groovy/geode-test.gradle similarity index 96% rename from gradle/test.gradle rename to build-tools/scripts/src/main/groovy/geode-test.gradle index 2f36ac19cc58..93488986e512 100644 --- a/gradle/test.gradle +++ b/build-tools/scripts/src/main/groovy/geode-test.gradle @@ -1,7 +1,3 @@ -import org.apache.geode.gradle.TestPropertiesWriter -import org.apache.geode.gradle.plugins.DependencyConstraints -import org.apache.geode.gradle.testing.repeat.RepeatTest - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -19,6 +15,15 @@ import org.apache.geode.gradle.testing.repeat.RepeatTest * limitations under the License. */ + +plugins { + id 'nebula.facet' + id 'org.apache.geode.gradle.geode-build-tools' +} + +import org.apache.geode.gradle.testing.repeat.RepeatTest +import org.apache.geode.gradle.plugins.TestPropertiesWriter + // This configuration might be safely removed once the CategoryWithParameterizedRunnerFactory // and associated classes are themselves removed, per GEODE-5606 configurations { @@ -41,7 +46,6 @@ test { } -apply plugin: 'nebula.facet' facets { integrationTest { includeInCheckLifecycle = false @@ -96,37 +100,38 @@ if (project.hasProperty("forceTest")) { } } -task repeatDistributedTest(type: RepeatTest) { +tasks.register('repeatDistributedTest', RepeatTest) { dependsOn { distributedTest.taskDependencies } classpath = project.sourceSets.distributedTest.runtimeClasspath testClassesDirs = project.sourceSets.distributedTest.output.classesDirs } -task repeatIntegrationTest(type: RepeatTest) { +tasks.register('repeatIntegrationTest', RepeatTest) { dependsOn { integrationTest.taskDependencies } classpath = project.sourceSets.integrationTest.runtimeClasspath testClassesDirs = project.sourceSets.integrationTest.output.classesDirs } -task repeatAcceptanceTest(type: RepeatTest) { +tasks.register('repeatAcceptanceTest', RepeatTest) { dependsOn { acceptanceTest.taskDependencies } classpath = project.sourceSets.acceptanceTest.runtimeClasspath testClassesDirs = project.sourceSets.acceptanceTest.output.classesDirs } -task repeatUpgradeTest(type: RepeatTest) { +tasks.register('repeatUpgradeTest', RepeatTest) { dependsOn { upgradeTest.taskDependencies } classpath = project.sourceSets.upgradeTest.runtimeClasspath testClassesDirs = project.sourceSets.upgradeTest.output.classesDirs } -task repeatUnitTest(type: RepeatTest) { +tasks.register('repeatUnitTest', RepeatTest) { dependsOn { test.taskDependencies } // default classpath works for this one. } configure([test, integrationTest, distributedTest, performanceTest, acceptanceTest, uiTest, upgradeTest, - repeatDistributedTest, repeatIntegrationTest, repeatUpgradeTest, repeatUnitTest, repeatAcceptanceTest]) { + repeatDistributedTest, repeatIntegrationTest, repeatUpgradeTest, repeatUnitTest, repeatAcceptanceTest +]) { useJUnitPlatform() } diff --git a/gradle/ide.gradle b/build-tools/scripts/src/main/groovy/ide.gradle similarity index 98% rename from gradle/ide.gradle rename to build-tools/scripts/src/main/groovy/ide.gradle index 5ee5ccf0f3bd..f5229e4aa09c 100644 --- a/gradle/ide.gradle +++ b/build-tools/scripts/src/main/groovy/ide.gradle @@ -16,8 +16,10 @@ */ import org.gradle.plugins.ide.eclipse.model.Container -apply plugin: 'idea' -apply plugin: 'eclipse' +plugins { + id 'idea' + id 'eclipse' +} eclipse { classpath { diff --git a/gradle/javaVersions.gradle b/build-tools/scripts/src/main/groovy/javaVersions.gradle similarity index 98% rename from gradle/javaVersions.gradle rename to build-tools/scripts/src/main/groovy/javaVersions.gradle index 9129dbd37bf5..06f59ed2c2a3 100644 --- a/gradle/javaVersions.gradle +++ b/build-tools/scripts/src/main/groovy/javaVersions.gradle @@ -15,9 +15,11 @@ * limitations under the License. */ -import org.apache.tools.ant.taskdefs.condition.Os +plugins { + id 'de.undercouch.download' +} -apply plugin: 'de.undercouch.download' +import org.apache.tools.ant.taskdefs.condition.Os static def getPlatformInfo() { if (Os.isFamily(Os.FAMILY_MAC)) { diff --git a/gradle/jmh.gradle b/build-tools/scripts/src/main/groovy/jmh.gradle similarity index 97% rename from gradle/jmh.gradle rename to build-tools/scripts/src/main/groovy/jmh.gradle index 682705aa39ae..c470e08befbe 100644 --- a/gradle/jmh.gradle +++ b/build-tools/scripts/src/main/groovy/jmh.gradle @@ -15,7 +15,10 @@ * limitations under the License. */ -apply plugin: 'me.champeau.gradle.jmh' +plugins { + id 'me.champeau.gradle.jmh' + id 'nebula.facet' +} configurations { javaagent { @@ -51,7 +54,6 @@ jmhJar { exclude('*.jar') } -apply plugin: 'nebula.facet' facets { jmhTest { parentSourceSet = 'jmh' diff --git a/gradle/lint.gradle b/build-tools/scripts/src/main/groovy/lint.gradle similarity index 96% rename from gradle/lint.gradle rename to build-tools/scripts/src/main/groovy/lint.gradle index 9d91f5ad2ca2..38ca5b957d71 100644 --- a/gradle/lint.gradle +++ b/build-tools/scripts/src/main/groovy/lint.gradle @@ -16,7 +16,9 @@ */ allprojects { - apply plugin: 'nebula.lint' + plugins { + id 'nebula.lint' + } gradleLint.rules = [] gradleLint.rules += 'overridden-dependency-version' gradleLint.rules += 'unused-dependency' diff --git a/gradle/multi-process-test.gradle b/build-tools/scripts/src/main/groovy/multi-process-test.gradle similarity index 97% rename from gradle/multi-process-test.gradle rename to build-tools/scripts/src/main/groovy/multi-process-test.gradle index ee61a28fad7a..3c606b23ed9a 100644 --- a/gradle/multi-process-test.gradle +++ b/build-tools/scripts/src/main/groovy/multi-process-test.gradle @@ -33,6 +33,9 @@ * also applies this property to unit test tasks, with different defaults.) */ +plugins { + id 'org.apache.geode.gradle.geode-testing-isolation' +} import org.apache.geode.gradle.testing.Executers import org.apache.geode.gradle.testing.isolation.WorkingDirectoryIsolator @@ -58,7 +61,6 @@ if (project.hasProperty('parallelDunit')) { isolatedTest = true } } - apply plugin: 'geode-isolated-test' } else { for (task in multiProcessTestTasks) { if (project.hasProperty('testMaxParallelForks')) { diff --git a/build-tools/scripts/src/main/groovy/platform-subproject-configuration.gradle b/build-tools/scripts/src/main/groovy/platform-subproject-configuration.gradle new file mode 100644 index 000000000000..c7cb20e8864d --- /dev/null +++ b/build-tools/scripts/src/main/groovy/platform-subproject-configuration.gradle @@ -0,0 +1,21 @@ +/* + * 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. + */ + +plugins { + id 'java-platform' + id 'standard-subproject-configuration' +} diff --git a/gradle/resolve-dependencies.gradle b/build-tools/scripts/src/main/groovy/resolve-dependencies.gradle similarity index 100% rename from gradle/resolve-dependencies.gradle rename to build-tools/scripts/src/main/groovy/resolve-dependencies.gradle diff --git a/gradle/spotless.gradle b/build-tools/scripts/src/main/groovy/spotless.gradle similarity index 98% rename from gradle/spotless.gradle rename to build-tools/scripts/src/main/groovy/spotless.gradle index c3fbb65ff46c..eaa527899ddf 100644 --- a/gradle/spotless.gradle +++ b/build-tools/scripts/src/main/groovy/spotless.gradle @@ -15,12 +15,15 @@ * limitations under the License. */ +plugins { + id 'com.diffplug.spotless' +} // When a custom step changes, we need to bump the value passed to the method // bumpThisNumberIfACustomStepChanges // This has been historically easy to forget, however, and can cause failures in some rare cases. // To safeguard against this, we instead use the (partial) md5 of this file as that method input. -def thisFile = file("${rootDir}/${scriptDir}/spotless.gradle") +def thisFile = file("${rootDir}/build-tools/scripts/src/main/groovy/spotless.gradle") def thisFileMd5 = thisFile.text.md5() as String def thisFileMd5Piece = thisFileMd5.substring(0, 8) def thisFileIntegerHash = Integer.parseUnsignedInt(thisFileMd5Piece, 16) @@ -29,7 +32,6 @@ logger.debug("Using partial md5 (${thisFileIntegerHash}) of file ${thisFile} as project.ext.set("spotless-file-hash", thisFileIntegerHash) -apply plugin: "com.diffplug.spotless" spotless { lineEndings = 'unix' java { diff --git a/gradle/standard-subproject-configuration.gradle b/build-tools/scripts/src/main/groovy/standard-subproject-configuration.gradle similarity index 71% rename from gradle/standard-subproject-configuration.gradle rename to build-tools/scripts/src/main/groovy/standard-subproject-configuration.gradle index e3e944a87ca8..ef1e9756662e 100644 --- a/gradle/standard-subproject-configuration.gradle +++ b/build-tools/scripts/src/main/groovy/standard-subproject-configuration.gradle @@ -15,14 +15,16 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/java.gradle" -apply from: "${rootDir}/${scriptDir}/dependency-resolution.gradle" -apply from: "${rootDir}/${scriptDir}/test.gradle" -apply from: "${rootDir}/${scriptDir}/code-analysis.gradle" -apply from: "${rootDir}/${scriptDir}/multi-process-test.gradle" -apply from: "${rootDir}/${scriptDir}/spotless.gradle" -apply from: "${rootDir}/${scriptDir}/ide.gradle" -apply plugin: 'com.github.ben-manes.versions' +plugins { + id 'geode-java' + id 'dependency-resolution' + id 'geode-test' + id 'code-analysis' + id 'multi-process-test' + id 'spotless' + id 'ide' + id "com.github.ben-manes.versions" +} // Within the configure block, 'project' refers to the task-owning project, in this case rootProject def thisProjectScoped = project diff --git a/gradle/warnings.gradle b/build-tools/scripts/src/main/groovy/warnings.gradle similarity index 100% rename from gradle/warnings.gradle rename to build-tools/scripts/src/main/groovy/warnings.gradle diff --git a/build.gradle b/build.gradle index ccf150ca343a..41fe9616b984 100755 --- a/build.gradle +++ b/build.gradle @@ -29,16 +29,21 @@ plugins { id "org.ajoberstar.grgit" version "4.1.1" apply false id "org.nosphere.apache.rat" version "0.7.1" apply false id "org.sonarqube" version "3.3" apply false - id "me.champeau.gradle.japicmp" apply false // Version defined in buildSrc/build.gradle id 'me.champeau.gradle.jmh' version '0.5.3' apply false id "de.undercouch.download" version "5.0.1" apply false + id 'org.apache.geode.gradle.geode-dependency-constraints' apply false + id 'geode-publish-artifacts' apply false + id 'geode-publish-common' apply false + id 'geode-publish-java' apply false + id 'geode-publish-war' apply false +// id 'lint' + id 'resolve-dependencies' + id 'geode-sonar' + id 'geode-rat' } +import org.apache.geode.gradle.plugins.PasswordDialog -apply from: "${scriptDir}/lint.gradle" -apply from: "${scriptDir}/resolve-dependencies.gradle" -apply from: "${scriptDir}/sonar.gradle" -apply from: "${scriptDir}/rat.gradle" wrapper { gradleVersion = minimumGradleVersion diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/geode-dependency-constraints.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/geode-dependency-constraints.properties deleted file mode 100644 index d5cefb65a27c..000000000000 --- a/buildSrc/src/main/resources/META-INF/gradle-plugins/geode-dependency-constraints.properties +++ /dev/null @@ -1 +0,0 @@ -implementation-class = org.apache.geode.gradle.plugins.DependencyConstraints \ No newline at end of file diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/geode-isolated-test.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/geode-isolated-test.properties deleted file mode 100644 index b5c844ccb7c6..000000000000 --- a/buildSrc/src/main/resources/META-INF/gradle-plugins/geode-isolated-test.properties +++ /dev/null @@ -1 +0,0 @@ -implementation-class = org.apache.geode.gradle.testing.isolation.IsolatedTestPlugin diff --git a/ci/pipelines/shared/utilities.sh b/ci/pipelines/shared/utilities.sh index 56a3261ca0a2..8bae9ee1f1be 100644 --- a/ci/pipelines/shared/utilities.sh +++ b/ci/pipelines/shared/utilities.sh @@ -31,4 +31,4 @@ getSanitizedFork () { shortenJobName () { echo $(sanitizeName ${1}) | sed -e 's/windows/win/' -e 's/distributed/dst/' -e 's/acceptance/acc/' -e 's/openjdk/oj/' | cut -c 1-18 -} \ No newline at end of file +} diff --git a/extensions/geode-modules-assembly/build.gradle b/extensions/geode-modules-assembly/build.gradle index 53532d9643be..9a21957aa887 100644 --- a/extensions/geode-modules-assembly/build.gradle +++ b/extensions/geode-modules-assembly/build.gradle @@ -15,6 +15,10 @@ * limitations under the License. */ +plugins { + id 'standard-subproject-configuration' + id 'maven-publish' +} evaluationDependsOn(':extensions:geode-modules') evaluationDependsOn(':extensions:geode-modules-tomcat7') evaluationDependsOn(':extensions:geode-modules-tomcat8') @@ -22,11 +26,9 @@ evaluationDependsOn(':extensions:geode-modules-tomcat9') evaluationDependsOn(':extensions:geode-modules-session') evaluationDependsOn(':extensions:geode-modules-session-internal') -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" import org.apache.geode.gradle.plugins.DependencyConstraints import org.apache.tools.ant.filters.ReplaceTokens -apply plugin: 'maven-publish' configurations { slf4jDeps diff --git a/extensions/geode-modules-session-internal/build.gradle b/extensions/geode-modules-session-internal/build.gradle index f34e32639263..b60562a6e746 100644 --- a/extensions/geode-modules-session-internal/build.gradle +++ b/extensions/geode-modules-session-internal/build.gradle @@ -15,7 +15,9 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" +plugins { + id 'standard-subproject-configuration' +} dependencies { // main diff --git a/extensions/geode-modules-session/build.gradle b/extensions/geode-modules-session/build.gradle index 830a8fdec769..36ec77f3ece7 100644 --- a/extensions/geode-modules-session/build.gradle +++ b/extensions/geode-modules-session/build.gradle @@ -17,7 +17,9 @@ import org.apache.geode.gradle.plugins.DependencyConstraints * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" +plugins { + id 'standard-subproject-configuration' +} evaluationDependsOn(":geode-core") diff --git a/extensions/geode-modules-test/build.gradle b/extensions/geode-modules-test/build.gradle index c7b40e079c90..58154fc30466 100644 --- a/extensions/geode-modules-test/build.gradle +++ b/extensions/geode-modules-test/build.gradle @@ -17,7 +17,9 @@ import org.apache.geode.gradle.plugins.DependencyConstraints -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" +plugins { + id 'standard-subproject-configuration' +} dependencies { // main diff --git a/extensions/geode-modules-tomcat7/build.gradle b/extensions/geode-modules-tomcat7/build.gradle index 31a841c71a62..e1e75b52a10f 100644 --- a/extensions/geode-modules-tomcat7/build.gradle +++ b/extensions/geode-modules-tomcat7/build.gradle @@ -17,8 +17,10 @@ import org.apache.geode.gradle.plugins.DependencyConstraints -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${rootDir}/${scriptDir}/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'warnings' +} evaluationDependsOn(":geode-core") diff --git a/extensions/geode-modules-tomcat8/build.gradle b/extensions/geode-modules-tomcat8/build.gradle index 70788ed595f8..a24651dd4469 100644 --- a/extensions/geode-modules-tomcat8/build.gradle +++ b/extensions/geode-modules-tomcat8/build.gradle @@ -17,9 +17,11 @@ import org.apache.geode.gradle.plugins.DependencyConstraints -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${rootDir}/${scriptDir}/warnings.gradle" -apply from: "${rootDir}/${scriptDir}/publish-java.gradle" +plugins { + id 'standard-subproject-configuration' + id 'warnings' + id 'geode-publish-java' +} evaluationDependsOn(":geode-core") diff --git a/extensions/geode-modules-tomcat9/build.gradle b/extensions/geode-modules-tomcat9/build.gradle index 54fda60a24e6..542ba93137a4 100644 --- a/extensions/geode-modules-tomcat9/build.gradle +++ b/extensions/geode-modules-tomcat9/build.gradle @@ -17,9 +17,11 @@ import org.apache.geode.gradle.plugins.DependencyConstraints -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${rootDir}/${scriptDir}/warnings.gradle" -apply from: "${rootDir}/${scriptDir}/publish-java.gradle" +plugins { + id 'standard-subproject-configuration' + id 'warnings' + id 'geode-publish-java' +} evaluationDependsOn(":geode-core") diff --git a/extensions/geode-modules/build.gradle b/extensions/geode-modules/build.gradle index d35dd544d425..d32ad3315341 100644 --- a/extensions/geode-modules/build.gradle +++ b/extensions/geode-modules/build.gradle @@ -17,8 +17,10 @@ import org.apache.geode.gradle.plugins.DependencyConstraints -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${rootDir}/${scriptDir}/publish-java.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} evaluationDependsOn(":geode-core") diff --git a/extensions/session-testing-war/build.gradle b/extensions/session-testing-war/build.gradle index e8e2d91dedd1..fddf0a5e77f5 100644 --- a/extensions/session-testing-war/build.gradle +++ b/extensions/session-testing-war/build.gradle @@ -15,9 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply plugin: 'war' +plugins { + id 'standard-subproject-configuration' + id 'war' +} diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle index 5a280012f7b9..78f1f5e37740 100755 --- a/geode-assembly/build.gradle +++ b/geode-assembly/build.gradle @@ -15,12 +15,15 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${rootDir}/${scriptDir}/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'warnings' + id 'distribution' + id 'com.palantir.docker' + id 'geode-publish-common' +} -import org.apache.geode.gradle.plugins.DependencyConstraints import org.apache.tools.ant.taskdefs.condition.Os - import java.nio.file.Paths // This project aggressively reaches into many other projects and must wait for those configurations @@ -32,10 +35,6 @@ rootProject.subprojects.each {neighborProject -> } } -apply plugin: 'distribution' -apply plugin: 'com.palantir.docker' -apply from: "${rootDir}/${scriptDir}/publish-common.gradle" - // This subproject's 'publication' is not a jar and should not be constrained to match versions // in the geode-all-bom. diff --git a/geode-assembly/geode-assembly-test/build.gradle b/geode-assembly/geode-assembly-test/build.gradle index bd6559bf14e0..02e4138ed5ba 100755 --- a/geode-assembly/geode-assembly-test/build.gradle +++ b/geode-assembly/geode-assembly-test/build.gradle @@ -15,7 +15,9 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" +plugins { + id 'standard-subproject-configuration' +} diff --git a/geode-common/build.gradle b/geode-common/build.gradle index b6fedec29a6b..1ec66dbcd752 100755 --- a/geode-common/build.gradle +++ b/geode-common/build.gradle @@ -15,11 +15,12 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" -apply from: "${project.projectDir}/../gradle/jmh.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' + id 'jmh' +} dependencies { // main diff --git a/geode-concurrency-test/build.gradle b/geode-concurrency-test/build.gradle index f257baeed472..daaba942e78d 100644 --- a/geode-concurrency-test/build.gradle +++ b/geode-concurrency-test/build.gradle @@ -15,10 +15,11 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-connectors/build.gradle b/geode-connectors/build.gradle index 2cb354d27d2a..b1cb44fa8e33 100644 --- a/geode-connectors/build.gradle +++ b/geode-connectors/build.gradle @@ -15,12 +15,14 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} evaluationDependsOn(":geode-core") -apply from: "${project.projectDir}/../gradle/publish-java.gradle" configurations { //Configuration used to download mysql jar diff --git a/geode-core/build.gradle b/geode-core/build.gradle index 28d690ca081a..a63aefa0ae9f 100755 --- a/geode-core/build.gradle +++ b/geode-core/build.gradle @@ -15,14 +15,14 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply plugin: 'antlr' - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/pmd.gradle" -apply from: "${project.projectDir}/../gradle/jmh.gradle" -apply from: "${project.projectDir}/../gradle/javaVersions.gradle" +plugins { + id 'standard-subproject-configuration' + id 'antlr' + id 'geode-publish-java' + id 'geode-pmd' + id 'jmh' + id 'javaVersions' +} sourceSets { jca { @@ -63,7 +63,8 @@ sourceSets { // Creates the version properties file and writes it to the classes dir -task createVersionPropertiesFile(dependsOn: ':writeBuildInfo') { +tasks.register('createVersionPropertiesFile') { + dependsOn rootProject.tasks.named('writeBuildInfo') def propertiesFile = file(generatedResources + "/org/apache/geode/internal/GemFireVersion.properties") def scmInfoFile = rootProject.tasks.writeBuildInfo.outputs.files @@ -119,14 +120,16 @@ jar { jar.dependsOn(createVersionPropertiesFile) -task raJar(type: Jar, dependsOn: classes) { +tasks.register('raJar', Jar) { + dependsOn tasks.named('classes') description 'Assembles the jar archive that contains the JCA classes' from sourceSets.jca.output exclude 'org/apache/geode/ra/**' archiveFileName='ra.jar' } -task jcaJar(type: Jar, dependsOn: raJar) { +tasks.register('jcaJar', Jar) { + dependsOn tasks.named('raJar') description 'Assembles the jar archive that contains the JCA bundle' archiveBaseName='geode-jca' archiveExtension='rar' diff --git a/geode-cq/build.gradle b/geode-cq/build.gradle index 0096ee98aff6..68b4493f4c52 100644 --- a/geode-cq/build.gradle +++ b/geode-cq/build.gradle @@ -15,9 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} dependencies { diff --git a/geode-deployment/geode-deployment-legacy/build.gradle b/geode-deployment/geode-deployment-legacy/build.gradle index 79f1ce2813f4..4a64dcc8e97c 100644 --- a/geode-deployment/geode-deployment-legacy/build.gradle +++ b/geode-deployment/geode-deployment-legacy/build.gradle @@ -15,10 +15,11 @@ * limitations under the License. */ -apply from: "${project.projectDir}/../../gradle/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { implementation(platform(project(':boms:geode-all-bom'))) diff --git a/geode-dunit/build.gradle b/geode-dunit/build.gradle index 23a543bf1fd2..50ddbfc59d90 100755 --- a/geode-dunit/build.gradle +++ b/geode-dunit/build.gradle @@ -15,10 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" - +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-gfsh/build.gradle b/geode-gfsh/build.gradle index ce694acf4a1c..985dbe46db14 100644 --- a/geode-gfsh/build.gradle +++ b/geode-gfsh/build.gradle @@ -15,10 +15,11 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-http-service/build.gradle b/geode-http-service/build.gradle index 556df12ea14e..7d06518c25ee 100755 --- a/geode-http-service/build.gradle +++ b/geode-http-service/build.gradle @@ -15,10 +15,11 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-jmh/build.gradle b/geode-jmh/build.gradle index 9715792ff381..b760b1ea417f 100644 --- a/geode-jmh/build.gradle +++ b/geode-jmh/build.gradle @@ -15,12 +15,13 @@ * limitations under the License. */ -apply plugin: 'java-library' -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'java-library' ; //TODO + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-junit/build.gradle b/geode-junit/build.gradle index 13836e45deb8..010e30a4f87e 100755 --- a/geode-junit/build.gradle +++ b/geode-junit/build.gradle @@ -15,9 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} compileJava { options.compilerArgs << '-Xlint:-sunapi' diff --git a/geode-junit/src/main/java/org/apache/geode/util/FilterSerializables.java b/geode-junit/src/main/java/org/apache/geode/util/FilterSerializables.java new file mode 100644 index 000000000000..031cea707596 --- /dev/null +++ b/geode-junit/src/main/java/org/apache/geode/util/FilterSerializables.java @@ -0,0 +1,35 @@ +/* + * 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.util; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collection; + + +public class FilterSerializables { + + // Filter on class fields. This was added to support the jacoco plugin + // and its addition of synthetic fields to Java classes + public static Collection getNonSyntheticFields(Field[] inputFields) { + ArrayList genuineFields = new ArrayList(); + for (Field f : inputFields) { + if (!f.isSynthetic()) { + genuineFields.add(f); + } + } + return genuineFields; + } +} diff --git a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableExternalResourceTest.java b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableExternalResourceTest.java index fb722faa81cd..991c2f4b1e56 100755 --- a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableExternalResourceTest.java +++ b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableExternalResourceTest.java @@ -18,12 +18,14 @@ import java.io.Serializable; import java.lang.reflect.Field; -import java.util.Arrays; +import java.util.Collection; import org.apache.commons.lang3.SerializationUtils; import org.junit.Test; import org.junit.rules.ExternalResource; +import org.apache.geode.util.FilterSerializables; + /** * Unit tests for {@link SerializableExternalResource}. @@ -33,7 +35,9 @@ public class SerializableExternalResourceTest { @Test public void hasZeroFields() throws Exception { Field[] fields = ExternalResource.class.getDeclaredFields(); - assertThat(fields.length).as("Fields: " + Arrays.asList(fields)).isEqualTo(0); + Collection genuineFields = FilterSerializables.getNonSyntheticFields(fields); + assertThat(genuineFields.size()).as("Fields: " + genuineFields).isEqualTo(0); + assertThat(genuineFields).hasSize(0); } @Test diff --git a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTestNameTest.java b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTestNameTest.java index a134177668ce..de49bc677365 100755 --- a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTestNameTest.java +++ b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTestNameTest.java @@ -21,13 +21,15 @@ import java.io.Serializable; import java.lang.reflect.Field; -import java.util.Arrays; +import java.util.Collection; import org.apache.commons.lang3.SerializationUtils; import org.junit.Test; import org.junit.rules.TestName; import org.junit.runner.Description; +import org.apache.geode.util.FilterSerializables; + /** * Unit tests for {@link SerializableTestName}. @@ -37,7 +39,9 @@ public class SerializableTestNameTest { @Test public void hasOneFields() throws Exception { Field[] fields = TestName.class.getDeclaredFields(); - assertThat(fields.length).as("Fields: " + Arrays.asList(fields)).isEqualTo(1); + Collection genuineFields = FilterSerializables.getNonSyntheticFields(fields); + assertThat(genuineFields.size()).as("Fields: " + genuineFields).isEqualTo(1); + assertThat(genuineFields).hasSize(1); } @Test diff --git a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTestWatcherTest.java b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTestWatcherTest.java index 85d4f0d823fe..478d71322a62 100755 --- a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTestWatcherTest.java +++ b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTestWatcherTest.java @@ -18,12 +18,14 @@ import java.io.Serializable; import java.lang.reflect.Field; -import java.util.Arrays; +import java.util.Collection; import org.apache.commons.lang3.SerializationUtils; import org.junit.Test; import org.junit.rules.TestWatcher; +import org.apache.geode.util.FilterSerializables; + /** * Unit tests for {@link SerializableTestWatcher}. @@ -33,7 +35,9 @@ public class SerializableTestWatcherTest { @Test public void hasZeroFields() throws Exception { Field[] fields = TestWatcher.class.getDeclaredFields(); - assertThat(fields.length).as("Fields: " + Arrays.asList(fields)).isEqualTo(0); + Collection genuineFields = FilterSerializables.getNonSyntheticFields(fields); + assertThat(genuineFields.size()).as("Fields: " + genuineFields).isEqualTo(0); + assertThat(genuineFields).hasSize(0); } @Test diff --git a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTimeoutTest.java b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTimeoutTest.java index 9933c0fe61f8..180c37e5f4d2 100755 --- a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTimeoutTest.java +++ b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/serializable/SerializableTimeoutTest.java @@ -23,13 +23,15 @@ import java.io.Serializable; import java.lang.reflect.Field; -import java.util.Arrays; +import java.util.Collection; import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.SerializationUtils; import org.junit.Test; import org.junit.rules.Timeout; +import org.apache.geode.util.FilterSerializables; + /** * Unit tests for {@link SerializableTimeout}. @@ -39,7 +41,9 @@ public class SerializableTimeoutTest { @Test public void hasThreeFields() { Field[] fields = Timeout.class.getDeclaredFields(); - assertThat(fields.length).as("Fields: " + Arrays.asList(fields)).isEqualTo(3); + Collection genuineFields = FilterSerializables.getNonSyntheticFields(fields); + assertThat(genuineFields.size()).as("Fields: " + genuineFields).isEqualTo(3); + assertThat(genuineFields).hasSize(3); } @Test diff --git a/geode-log4j/build.gradle b/geode-log4j/build.gradle index 9eedad02ce81..d2501c2a7a7e 100644 --- a/geode-log4j/build.gradle +++ b/geode-log4j/build.gradle @@ -14,12 +14,12 @@ */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" -apply from: "${project.projectDir}/../gradle/jmh.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' + id 'jmh' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-logging/build.gradle b/geode-logging/build.gradle index 6a321779cd91..0a450578bcc2 100644 --- a/geode-logging/build.gradle +++ b/geode-logging/build.gradle @@ -15,10 +15,11 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-lucene/build.gradle b/geode-lucene/build.gradle index d256d12d0ff0..bf55a9dd56c8 100644 --- a/geode-lucene/build.gradle +++ b/geode-lucene/build.gradle @@ -15,10 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" - +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-lucene/geode-lucene-test/build.gradle b/geode-lucene/geode-lucene-test/build.gradle index 4282886a2dc4..feade4a0511f 100644 --- a/geode-lucene/geode-lucene-test/build.gradle +++ b/geode-lucene/geode-lucene-test/build.gradle @@ -15,7 +15,9 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" +plugins { + id 'standard-subproject-configuration' +} diff --git a/geode-management/build.gradle b/geode-management/build.gradle index 083c7447702e..32f94873a9ac 100755 --- a/geode-management/build.gradle +++ b/geode-management/build.gradle @@ -15,10 +15,11 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-membership/build.gradle b/geode-membership/build.gradle index 67a8f5e74c53..46506c0d80cb 100644 --- a/geode-membership/build.gradle +++ b/geode-membership/build.gradle @@ -15,9 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-memcached/build.gradle b/geode-memcached/build.gradle index cc1a11cb52aa..def2c9dea4d9 100644 --- a/geode-memcached/build.gradle +++ b/geode-memcached/build.gradle @@ -15,9 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} dependencies { compileOnly(platform(project(':boms:geode-all-bom'))) diff --git a/geode-old-client-support/build.gradle b/geode-old-client-support/build.gradle index ee47e2a14e17..c55f853a4d4a 100644 --- a/geode-old-client-support/build.gradle +++ b/geode-old-client-support/build.gradle @@ -15,10 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" - +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} dependencies { implementation(platform(project(':boms:geode-all-bom'))) diff --git a/geode-old-versions/build.gradle b/geode-old-versions/build.gradle index d112b7916afe..71309b66d725 100644 --- a/geode-old-versions/build.gradle +++ b/geode-old-versions/build.gradle @@ -17,12 +17,14 @@ import java.nio.file.Paths * limitations under the License. */ -apply from: "${rootProject.rootDir}/gradle/java.gradle" +plugins { + id 'geode-java' +} project.ext.installs = new Properties() subprojects { - apply plugin: 'base' + it.apply plugin: 'base' def oldGeodeVersion = project.name diff --git a/geode-pulse/build.gradle b/geode-pulse/build.gradle index 2ae1a5712420..33d679b92228 100644 --- a/geode-pulse/build.gradle +++ b/geode-pulse/build.gradle @@ -15,13 +15,15 @@ * limitations under the License. */ -evaluationDependsOn(':geode-core') -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply plugin: 'war' +plugins { + id 'standard-subproject-configuration' + id 'war' + id 'geode-publish-war' + id 'warnings' +} -apply from: "${project.projectDir}/../gradle/publish-war.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +evaluationDependsOn(':geode-core') jar.enabled = true diff --git a/geode-pulse/geode-pulse-test/build.gradle b/geode-pulse/geode-pulse-test/build.gradle index 21b38db82e2c..f4993bffc057 100644 --- a/geode-pulse/geode-pulse-test/build.gradle +++ b/geode-pulse/geode-pulse-test/build.gradle @@ -15,8 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${rootDir}/${scriptDir}/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-rebalancer/build.gradle b/geode-rebalancer/build.gradle index 96911f1b0c34..59d66636a340 100644 --- a/geode-rebalancer/build.gradle +++ b/geode-rebalancer/build.gradle @@ -15,11 +15,11 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" - +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-serialization/build.gradle b/geode-serialization/build.gradle index e3e1f81a9b85..9aa3866e46f1 100755 --- a/geode-serialization/build.gradle +++ b/geode-serialization/build.gradle @@ -15,10 +15,11 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { implementation(platform(project(':boms:geode-all-bom'))) diff --git a/geode-server-all/build.gradle b/geode-server-all/build.gradle index 2e09c7ae862b..94b525f3ae6e 100644 --- a/geode-server-all/build.gradle +++ b/geode-server-all/build.gradle @@ -17,12 +17,11 @@ plugins { id 'java-library' + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'geode-japicmp-task' } -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${rootDir}/${scriptDir}/publish-java.gradle" -apply from: "${rootDir}/${scriptDir}/japicmp.gradle" - configurations { constrainedByBom api.extendsFrom(constrainedByBom) @@ -63,8 +62,10 @@ dependencies { // Override some things from java.gradle jar { - manifest { - attributes.put("Class-Path", configurations.runtimeClasspath.files.collect {it.name}.join(' ')) + doFirst { + manifest { + attributes.put("Class-Path", configurations.runtimeClasspath.files.collect { it.name }.join(' ')) + } } } diff --git a/geode-tcp-server/build.gradle b/geode-tcp-server/build.gradle index 6c1d03c8fa99..ce13b47306ec 100644 --- a/geode-tcp-server/build.gradle +++ b/geode-tcp-server/build.gradle @@ -13,10 +13,11 @@ * the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${rootDir}/${scriptDir}/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' +} dependencies { api(platform(project(':boms:geode-all-bom'))) diff --git a/geode-unsafe/build.gradle b/geode-unsafe/build.gradle index 9737604a324b..1452cc189428 100755 --- a/geode-unsafe/build.gradle +++ b/geode-unsafe/build.gradle @@ -17,12 +17,11 @@ plugins { id 'java-library' + id 'standard-subproject-configuration' + id 'geode-publish-java' + id 'warnings' } -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${project.projectDir}/../gradle/publish-java.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" - dependencies { implementation(platform(project(':boms:geode-all-bom'))) diff --git a/geode-wan/build.gradle b/geode-wan/build.gradle index a776629dd747..4e500ddcac4f 100644 --- a/geode-wan/build.gradle +++ b/geode-wan/build.gradle @@ -15,9 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply from: "${project.projectDir}/../gradle/publish-java.gradle" +plugins { + id 'standard-subproject-configuration' + id 'geode-publish-java' +} dependencies { diff --git a/geode-web-api/build.gradle b/geode-web-api/build.gradle index c464e243fdb0..dcb46bd7ec5b 100644 --- a/geode-web-api/build.gradle +++ b/geode-web-api/build.gradle @@ -15,12 +15,12 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply plugin: 'war' - -apply from: "${project.projectDir}/../gradle/publish-war.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'war' + id 'geode-publish-war' + id 'warnings' +} jar.enabled = false diff --git a/geode-web-management/build.gradle b/geode-web-management/build.gradle index 9f3174ee1f0f..feeae3ea093a 100644 --- a/geode-web-management/build.gradle +++ b/geode-web-management/build.gradle @@ -13,16 +13,16 @@ * the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply plugin: 'war' - -apply from: "${project.projectDir}/../gradle/publish-war.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'war' + id 'geode-publish-war' + id 'warnings' + id 'nebula.facet' +} jar.enabled = false -apply plugin: 'nebula.facet' facets { commonTest { testTaskName = 'commonTest' diff --git a/geode-web/build.gradle b/geode-web/build.gradle index 5302b6ecd79a..3ba81e4b84df 100644 --- a/geode-web/build.gradle +++ b/geode-web/build.gradle @@ -15,12 +15,12 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" - -apply plugin: 'war' - -apply from: "${project.projectDir}/../gradle/publish-war.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'war' + id 'geode-publish-war' + id 'warnings' +} jar.enabled = false diff --git a/settings.gradle b/settings.gradle index 5c2ac26e8f96..74b2578816ef 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,6 +17,27 @@ import org.gradle.util.GradleVersion +pluginManagement { + includeBuild('build-tools/geode-dependency-management') + includeBuild('build-tools/geode-repeat-test') { + dependencySubstitution { + substitute module('org.apache.geode.gradle:org.apache.geode.gradle.geode-repeat-test') using project(':') + } + } + includeBuild('build-tools/geode-build-tools') { + dependencySubstitution { + substitute module('org.apache.geode.gradle:org.apache.geode.gradle.geode-build-tools') using project(':') + } + } + includeBuild('build-tools/geode-testing-isolation') { + dependencySubstitution { + substitute module('org.apache.geode.gradle:org.apache.geode.gradle.geode-testing-isolation') using project(':') + } + } + includeBuild('build-tools/geode-annotation-processor') + includeBuild('build-tools/scripts') +} + rootProject.name = 'geode' // We want to see all test results. This is equivalent to setting --continue on the command line. diff --git a/static-analysis/build.gradle b/static-analysis/build.gradle index 951c8cfe2a09..9a3eb4d15234 100644 --- a/static-analysis/build.gradle +++ b/static-analysis/build.gradle @@ -15,5 +15,7 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${project.projectDir}/../gradle/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'warnings' +} diff --git a/static-analysis/pmd-rules/build.gradle b/static-analysis/pmd-rules/build.gradle index 60f24fcb2eb8..69ee57edd104 100644 --- a/static-analysis/pmd-rules/build.gradle +++ b/static-analysis/pmd-rules/build.gradle @@ -15,8 +15,10 @@ * limitations under the License. */ -apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle" -apply from: "${rootDir}/${scriptDir}/warnings.gradle" +plugins { + id 'standard-subproject-configuration' + id 'warnings' +} dependencies { implementation(platform(project(':boms:geode-all-bom')))