forked from ehcache/ehcache3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to Gradle 7.2 and add feature variants for Jakarta XML parsin…
…g support (Fixes ehcache#2946)
- Loading branch information
1 parent
43141f0
commit 499e486
Showing
1,565 changed files
with
6,145 additions
and
1,985 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,4 @@ | ||
*/target/ | ||
|
||
build/ | ||
*/src/generated/ | ||
# Gradle | ||
.gradle/ | ||
|
||
.project | ||
.classpath | ||
.settings/org.eclipse.m2e.core.prefs | ||
*/.classpath | ||
*.prefs | ||
|
||
*.iml | ||
.idea | ||
out/ | ||
|
||
.nb-gradle | ||
.nb-gradle-properties | ||
|
||
/classes | ||
|
||
**/*.*~ | ||
**/build/ | ||
!**/src/**/build/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
plugins { | ||
id 'java-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
internalModule { | ||
id = 'org.ehcache.build.internal-module' | ||
implementationClass = 'org.ehcache.build.InternalEhcacheModule' | ||
} | ||
publicModule { | ||
id = 'org.ehcache.build.public-module' | ||
implementationClass = 'org.ehcache.build.PublicEhcacheModule' | ||
} | ||
clusteredModule { | ||
id = 'org.ehcache.build.clustered-module' | ||
implementationClass = 'org.ehcache.build.ClusteredEhcacheModule' | ||
} | ||
serverModule { | ||
id = 'org.ehcache.build.clustered-server-module' | ||
implementationClass = 'org.ehcache.build.ClusteredServerModule' | ||
} | ||
distribution { | ||
id = 'org.ehcache.build.package' | ||
implementationClass = 'org.ehcache.build.EhcachePackage' | ||
} | ||
|
||
variant { | ||
id = 'org.ehcache.build.plugins.variant' | ||
implementationClass = 'org.ehcache.build.plugins.VariantPlugin' | ||
} | ||
|
||
base { | ||
id = 'org.ehcache.build.conventions.base' | ||
implementationClass = 'org.ehcache.build.conventions.BaseConvention' | ||
} | ||
java { | ||
id = 'org.ehcache.build.conventions.java' | ||
implementationClass = 'org.ehcache.build.conventions.JavaConvention' | ||
} | ||
javaLibrary { | ||
id = 'org.ehcache.build.conventions.java-library' | ||
implementationClass = 'org.ehcache.build.conventions.JavaLibraryConvention' | ||
} | ||
war { | ||
id = 'org.ehcache.build.conventions.war' | ||
implementationClass = 'org.ehcache.build.conventions.WarConvention' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
api gradleApi() | ||
api 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.0.0' | ||
api 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0' | ||
api 'org.unbroken-dome.gradle-plugins:gradle-xjc-plugin:2.0.0' | ||
api 'com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.9' | ||
implementation 'biz.aQute.bnd:biz.aQute.bndlib:6.0.0' | ||
implementation 'org.osgi:org.osgi.service.component.annotations:1.5.0' | ||
implementation 'org.apache.felix:org.apache.felix.scr.generator:1.18.4' | ||
implementation 'org.apache.felix:org.apache.felix.scr.ds-annotations:1.2.10' | ||
} |
12 changes: 12 additions & 0 deletions
12
build-logic/src/main/java/org/ehcache/build/ClusteredEhcacheModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.ehcache.build; | ||
|
||
import org.gradle.api.Project; | ||
|
||
public class ClusteredEhcacheModule extends EhcacheModule { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
project.setGroup("org.ehcache.modules.clustered"); | ||
super.apply(project); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
build-logic/src/main/java/org/ehcache/build/ClusteredServerModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.ehcache.build; | ||
|
||
import org.ehcache.build.conventions.DeployConvention; | ||
import org.ehcache.build.plugins.VoltronPlugin; | ||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
|
||
public class ClusteredServerModule implements Plugin<Project> { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
project.setGroup("org.ehcache.modules.clustered"); | ||
|
||
project.getPlugins().apply(DeployConvention.class); | ||
project.getPlugins().apply(VoltronPlugin.class); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
build-logic/src/main/java/org/ehcache/build/EhcacheModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.ehcache.build; | ||
|
||
import org.ehcache.build.conventions.BndConvention; | ||
import org.ehcache.build.conventions.JavaLibraryConvention; | ||
import org.ehcache.build.conventions.DeployConvention; | ||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
|
||
public abstract class EhcacheModule implements Plugin<Project> { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
project.getPlugins().apply(JavaLibraryConvention.class); | ||
project.getPlugins().apply(DeployConvention.class); | ||
project.getPlugins().apply(BndConvention.class); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
build-logic/src/main/java/org/ehcache/build/EhcachePackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.ehcache.build; | ||
|
||
import org.ehcache.build.conventions.DeployConvention; | ||
import org.ehcache.build.plugins.PackagePlugin; | ||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
|
||
public class EhcachePackage implements Plugin<Project> { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
project.setGroup("org.ehcache"); | ||
project.getPlugins().apply(PackagePlugin.class); | ||
project.getPlugins().apply(DeployConvention.class); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
build-logic/src/main/java/org/ehcache/build/InternalEhcacheModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.ehcache.build; | ||
|
||
import org.gradle.api.Project; | ||
|
||
public class InternalEhcacheModule extends EhcacheModule { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
project.setGroup("org.ehcache.modules"); | ||
super.apply(project); | ||
} | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
build-logic/src/main/java/org/ehcache/build/PublicEhcacheModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.ehcache.build; | ||
|
||
import org.gradle.api.Project; | ||
|
||
public class PublicEhcacheModule extends EhcacheModule { | ||
@Override | ||
public void apply(Project project) { | ||
project.setGroup("org.ehcache"); | ||
super.apply(project); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
build-logic/src/main/java/org/ehcache/build/conventions/BaseConvention.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.ehcache.build.conventions; | ||
|
||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.artifacts.ResolutionStrategy; | ||
import org.gradle.api.plugins.BasePlugin; | ||
|
||
import java.net.URI; | ||
|
||
public class BaseConvention implements Plugin<Project> { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
project.getPlugins().apply(BasePlugin.class); | ||
|
||
project.getRepositories().mavenCentral(); | ||
project.getRepositories().maven(repo -> repo.setUrl(URI.create("https://repo.terracotta.org/maven2"))); | ||
|
||
project.getConfigurations().configureEach( | ||
config -> config.resolutionStrategy(ResolutionStrategy::failOnVersionConflict) | ||
); | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
build-logic/src/main/java/org/ehcache/build/conventions/BndConvention.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package org.ehcache.build.conventions; | ||
|
||
import aQute.bnd.gradle.BndBuilderPlugin; | ||
import aQute.bnd.gradle.BundleTaskExtension; | ||
import aQute.bnd.osgi.Constants; | ||
import org.ehcache.build.plugins.osgids.OsgiDsPlugin; | ||
import org.gradle.api.Action; | ||
import org.gradle.api.GradleException; | ||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.artifacts.Dependency; | ||
import org.gradle.api.artifacts.ExternalDependency; | ||
import org.gradle.api.artifacts.ProjectDependency; | ||
import org.gradle.api.plugins.JavaPlugin; | ||
import org.gradle.api.provider.MapProperty; | ||
import org.gradle.api.publish.PublishingExtension; | ||
import org.gradle.api.publish.maven.MavenPublication; | ||
import org.gradle.api.publish.plugins.PublishingPlugin; | ||
import org.gradle.api.tasks.bundling.Jar; | ||
|
||
import static java.lang.System.lineSeparator; | ||
import static java.util.stream.Collectors.joining; | ||
|
||
public class BndConvention implements Plugin<Project> { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
project.getPlugins().apply(BndBuilderPlugin.class); | ||
project.getPlugins().apply(OsgiDsPlugin.class); | ||
project.getPlugins().apply(DeployConvention.class); | ||
|
||
project.getTasks().named(JavaPlugin.JAR_TASK_NAME, Jar.class, jar -> { | ||
jar.getExtensions().configure(BundleTaskExtension.class, bundle -> configureBundleDefaults(project, bundle)); | ||
}); | ||
|
||
project.getConfigurations().named("baseline", config -> { | ||
config.getResolutionStrategy().getComponentSelection().all(selection -> { | ||
if (!selection.getCandidate().getVersion().matches("^\\d+(?:\\.\\d+)*$")) { | ||
selection.reject("Only full releases can be used as OSGi baselines"); | ||
} | ||
}); | ||
}); | ||
|
||
String dependencyNotation = project.getGroup() + ":" + project.getName() + ":(," + project.getVersion() + "["; | ||
Dependency baseline = project.getDependencies().add("baseline", dependencyNotation); | ||
if (baseline instanceof ProjectDependency) { | ||
throw new GradleException("Baseline should not be a project dependency"); | ||
} else if (baseline instanceof ExternalDependency) { | ||
((ExternalDependency) baseline).setForce(true); | ||
((ExternalDependency) baseline).setTransitive(false); | ||
} else { | ||
throw new IllegalArgumentException("Unexpected dependency type: " + baseline); | ||
} | ||
} | ||
|
||
public static void configureBundleDefaults(Project project, BundleTaskExtension bundle) { | ||
MapProperty<String, String> defaultInstructions = project.getObjects().mapProperty(String.class, String.class); | ||
bundleDefaults(project).execute(defaultInstructions); | ||
bundle.bnd(defaultInstructions.map(kv -> kv.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(joining(lineSeparator())))); | ||
} | ||
|
||
public static Action<MapProperty<String, String>> bundleDefaults(Project project) { | ||
return properties -> { | ||
project.getPlugins().withType(PublishingPlugin.class, publishingPlugin -> { | ||
project.getExtensions().getByType(PublishingExtension.class).getPublications().withType(MavenPublication.class).stream().findAny().ifPresent(publication -> { | ||
properties.put(Constants.BUNDLE_NAME, publication.getPom().getName()); | ||
properties.put(Constants.BUNDLE_DESCRIPTION, publication.getPom().getDescription()); | ||
}); | ||
}); | ||
properties.put(Constants.BUNDLE_SYMBOLICNAME, project.getGroup() + "." + project.getName()); | ||
properties.put(Constants.BUNDLE_DOCURL, "http://ehcache.org"); | ||
properties.put(Constants.BUNDLE_LICENSE, "LICENSE"); | ||
properties.put(Constants.BUNDLE_VENDOR, "Terracotta Inc., a wholly-owned subsidiary of Software AG USA, Inc."); | ||
properties.put(Constants.BUNDLE_VERSION, osgiFixedVersion(project.getVersion().toString())); | ||
properties.put(Constants.SERVICE_COMPONENT, "OSGI-INF/*.xml"); | ||
}; | ||
} | ||
|
||
public static String osgiFixedVersion(String version) { | ||
/* | ||
* The bnd gradle plugin does not handle our 2-digit snapshot versioning scheme very well. It maps `x.y-SNAPSHOT` | ||
* to `x.y.0.SNAPSHOT`. This is bad since `x.y.0.SNAPSHOT` is considered to be less than *all* `x.y.z`. This means | ||
* the baseline version range expression `(,x.y.0.SNAPSHOT[` will always pick the last release from the previous | ||
* minor line. To fix this we manually map to a 3-digit snapshot version where the 3rd digit is a number chosen | ||
* to be higher than we would ever release ('All the worlds a VAX'). | ||
*/ | ||
return version.replaceAll("^(\\d+.\\d+)-SNAPSHOT$", "$1.999-SNAPSHOT"); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
build-logic/src/main/java/org/ehcache/build/conventions/CheckstyleConvention.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.ehcache.build.conventions; | ||
|
||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.plugins.quality.CheckstyleExtension; | ||
import org.gradle.api.plugins.quality.CheckstylePlugin; | ||
|
||
import java.util.Map; | ||
|
||
public class CheckstyleConvention implements Plugin<Project> { | ||
@Override | ||
public void apply(Project project) { | ||
project.getPlugins().apply(CheckstylePlugin.class); | ||
|
||
project.getExtensions().configure(CheckstyleExtension.class, checkstyle -> { | ||
checkstyle.setConfigFile(project.getRootProject().file("config/checkstyle.xml")); | ||
Map<String, Object> properties = checkstyle.getConfigProperties(); | ||
properties.put("projectDir", project.getProjectDir()); | ||
properties.put("rootDir", project.getRootDir()); | ||
}); | ||
} | ||
} |
Oops, something went wrong.