Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial draft of automatic modules support. #3134

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build-logic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ gradlePlugin {

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 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.3.1'
api 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
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'
api 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.12'
implementation 'biz.aQute.bnd:biz.aQute.bndlib:6.3.1'
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'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package org.ehcache.build;

import org.gradle.api.Project;
import org.gradle.api.tasks.bundling.Jar;

public class ClusteredEhcacheModule extends EhcacheModule {

@Override
public void apply(Project project) {
project.setGroup("org.ehcache.modules.clustered");
super.apply(project);

project.getTasks().withType(Jar.class).configureEach(jar -> {
jar.manifest(manifest -> {
manifest.getAttributes().put("Automatic-Module-Name", "org.ehcache.clustered." + project.getName().replaceAll("^ehcache-", ""));
});
});
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package org.ehcache.build;

import org.gradle.api.Project;
import org.gradle.api.tasks.bundling.Jar;

public class InternalEhcacheModule extends EhcacheModule {

@Override
public void apply(Project project) {
project.setGroup("org.ehcache.modules");
super.apply(project);

project.getTasks().withType(Jar.class).configureEach(jar -> {
jar.manifest(manifest -> {
manifest.getAttributes().put("Automatic-Module-Name", "org.ehcache." + project.getName()
.replaceAll("^ehcache-", "").replace("-", ".").replace("107", "jcache"));
});
});
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public void apply(Project project) {

project.getConfigurations().all(config -> {
config.getResolutionStrategy().dependencySubstitution(subs -> {
subs.substitute(subs.module("org.hamcrest:hamcrest-core:1.3")).with(subs.module("org.hamcrest:hamcrest-core:" + project.property("hamcrestVersion")));
subs.substitute(subs.module("org.hamcrest:hamcrest-library:1.3")).with(subs.module("org.hamcrest:hamcrest-library:" + project.property("hamcrestVersion")));
subs.substitute(subs.module("org.hamcrest:hamcrest-core:1.3")).using(subs.module("org.hamcrest:hamcrest-core:" + project.property("hamcrestVersion")));
subs.substitute(subs.module("org.hamcrest:hamcrest-library:1.3")).using(subs.module("org.hamcrest:hamcrest-library:" + project.property("hamcrestVersion")));
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.ehcache.clustered.client.internal.config.SharedClusteredResourcePoolImpl;
import org.ehcache.config.ResourcePool;
import org.ehcache.config.units.MemoryUnit;
import org.ehcache.xml.CacheResourceConfigurationParser;
import org.ehcache.xml.spi.CacheResourceConfigurationParser;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.osgi.service.component.annotations.Component;
import org.w3c.dom.Attr;
Expand All @@ -34,8 +34,8 @@
import java.util.HashSet;
import java.util.Set;

import static org.ehcache.xml.ParsingUtil.parsePropertyOrPositiveInteger;
import static org.ehcache.xml.ParsingUtil.parsePropertyOrString;
import static org.ehcache.xml.spi.ParsingUtil.parsePropertyOrPositiveInteger;
import static org.ehcache.xml.spi.ParsingUtil.parsePropertyOrString;

/**
* Provides a parser for the {@code /config/cache/resources} extension elements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.ehcache.clustered.common.ServerSideConfiguration;
import org.ehcache.config.Builder;
import org.ehcache.config.units.MemoryUnit;
import org.ehcache.xml.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.spi.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.osgi.service.component.annotations.Component;
import org.w3c.dom.Attr;
Expand All @@ -50,9 +50,9 @@
import java.util.function.UnaryOperator;

import static java.lang.String.format;
import static org.ehcache.xml.ParsingUtil.parsePropertyOrPositiveInteger;
import static org.ehcache.xml.ParsingUtil.parsePropertyOrString;
import static org.ehcache.xml.ParsingUtil.parseStringWithProperties;
import static org.ehcache.xml.spi.ParsingUtil.parsePropertyOrPositiveInteger;
import static org.ehcache.xml.spi.ParsingUtil.parsePropertyOrString;
import static org.ehcache.xml.spi.ParsingUtil.parseStringWithProperties;

/**
* Provides parsing support for the {@code <service>} elements representing a {@link ClusteringService ClusteringService}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.ehcache.clustered.client.config.builders.ClusteredStoreConfigurationBuilder;
import org.ehcache.clustered.client.internal.store.ClusteredStore;
import org.ehcache.clustered.common.Consistency;
import org.ehcache.xml.CacheServiceConfigurationParser;
import org.ehcache.xml.spi.CacheServiceConfigurationParser;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.osgi.service.component.annotations.Component;
import org.w3c.dom.Attr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.ehcache.clustered.client.internal.config.xml;

import org.ehcache.xml.BaseConfigParser;
import org.ehcache.xml.spi.BaseConfigParser;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.ehcache.config.Configuration;
import org.ehcache.config.units.MemoryUnit;
import org.ehcache.spi.service.ServiceCreationConfiguration;
import org.ehcache.xml.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.spi.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.XmlConfiguration;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.ehcache.xml.model.TimeTypeWithPropSubst;
Expand Down
4 changes: 2 additions & 2 deletions ehcache-107/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ task unpackTckTests(type: Sync) {
from {
configurations.tckTestClasses.collect {zipTree(it)}
}
into sourceSets.tckTest.java.outputDir
into sourceSets.tckTest.java.classesDirectory
}

task tckTest(type: Test, dependsOn: unpackTckTests) {
testClassesDirs = sourceSets.tckTest.output.classesDirs
classpath += sourceSets.tckTest.runtimeClasspath

binResultsDir file("$buildDir/tck-tests-results/binary/$name")
binaryResultsDirectory = file("$buildDir/tck-tests-results/binary/$name")
reports.junitXml.destination = file("$buildDir/tck-tests-results")
reports.html.destination = file("$buildDir/reports/tck-tests")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.ehcache.jsr107.config.ConfigurationElementState;
import org.ehcache.jsr107.config.Jsr107CacheConfiguration;
import org.ehcache.jsr107.Jsr107Service;
import org.ehcache.xml.CacheServiceConfigurationParser;
import org.ehcache.xml.spi.CacheServiceConfigurationParser;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.osgi.service.component.annotations.Component;
import org.w3c.dom.Document;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.ehcache.jsr107.internal;

import org.ehcache.xml.BaseConfigParser;
import org.ehcache.xml.spi.BaseConfigParser;

import java.net.URI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.ehcache.jsr107.config.ConfigurationElementState;
import org.ehcache.jsr107.config.Jsr107Configuration;
import org.ehcache.xml.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.spi.CacheManagerServiceConfigurationParser;
import org.ehcache.jsr107.Jsr107Service;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.osgi.service.component.annotations.Component;
Expand Down
2 changes: 1 addition & 1 deletion ehcache-api/config/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<property name="scope" value="public"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="accessModifiers" value="public"/>
</module>
<module name="JavadocVariable">
<property name="scope" value="public"/>
Expand Down
2 changes: 1 addition & 1 deletion ehcache-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ task slowTest(type: Test) {
testClassesDirs = sourceSets.slowTest.output.classesDirs
classpath += sourceSets.slowTest.runtimeClasspath

binResultsDir file("$buildDir/slow-tests-results/binary/$name")
binaryResultsDirectory = file("$buildDir/slow-tests-results/binary/$name")
reports.junitXml.destination = file("$buildDir/slow-tests-results")
reports.html.destination = file("$buildDir/reports/slow-tests")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
package org.ehcache.management.registry;

import org.ehcache.management.ManagementRegistryService;
import org.ehcache.xml.BaseConfigParser;
import org.ehcache.xml.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.spi.BaseConfigParser;
import org.ehcache.xml.spi.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import java.net.URI;

import static java.util.Collections.singletonMap;
import static org.ehcache.xml.ParsingUtil.parsePropertyOrString;
import static org.ehcache.xml.spi.ParsingUtil.parsePropertyOrString;

public class ManagementRegistryServiceConfigurationParser extends BaseConfigParser<DefaultManagementRegistryConfiguration>
implements CacheManagerServiceConfigurationParser<ManagementRegistryService, DefaultManagementRegistryConfiguration> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import org.ehcache.transactions.xa.txmgr.provider.LookupTransactionManagerProviderConfiguration;
import org.ehcache.transactions.xa.txmgr.provider.TransactionManagerLookup;
import org.ehcache.transactions.xa.txmgr.provider.TransactionManagerProvider;
import org.ehcache.xml.BaseConfigParser;
import org.ehcache.xml.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.ehcache.xml.spi.BaseConfigParser;
import org.ehcache.xml.spi.CacheManagerServiceConfigurationParser;
import org.osgi.service.component.annotations.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Expand All @@ -32,7 +32,7 @@
import static java.util.Collections.singletonMap;
import static org.ehcache.core.util.ClassLoading.delegationChain;
import static org.ehcache.transactions.xa.internal.TypeUtil.uncheckedCast;
import static org.ehcache.xml.ParsingUtil.parsePropertyOrString;
import static org.ehcache.xml.spi.ParsingUtil.parsePropertyOrString;

/**
* @author Ludovic Orban
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package org.ehcache.transactions.xa.internal.xml;

import org.ehcache.xml.BaseConfigParser;
import org.ehcache.xml.CacheServiceConfigurationParser;
import org.ehcache.transactions.xa.internal.XAStore;
import org.ehcache.transactions.xa.configuration.XAStoreConfiguration;
import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.ehcache.xml.spi.BaseConfigParser;
import org.ehcache.xml.spi.CacheServiceConfigurationParser;
import org.osgi.service.component.annotations.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Expand All @@ -29,7 +29,7 @@

import static java.util.Collections.singletonMap;
import static org.ehcache.transactions.xa.internal.xml.TxCacheManagerServiceConfigurationParser.TRANSACTION_NAMESPACE_PREFIX;
import static org.ehcache.xml.ParsingUtil.parsePropertyOrString;
import static org.ehcache.xml.spi.ParsingUtil.parsePropertyOrString;

/**
* @author Ludovic Orban
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ehcache.xml;
package org.ehcache.xml.spi;

import org.ehcache.javadoc.PublicApi;
import org.ehcache.xml.exceptions.XmlConfigurationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.ehcache.xml;
package org.ehcache.xml.spi;

import org.ehcache.javadoc.PublicApi;
import org.ehcache.spi.service.Service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.ehcache.xml;
package org.ehcache.xml.spi;

import org.ehcache.config.ResourcePool;
import org.ehcache.javadoc.PublicApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.ehcache.xml;
package org.ehcache.xml.spi;

import org.ehcache.javadoc.PublicApi;
import org.ehcache.spi.service.Service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.ehcache.xml;
package org.ehcache.xml.spi;

import org.ehcache.javadoc.PublicApi;
import org.w3c.dom.Document;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.ehcache.xml;
package org.ehcache.xml.spi;

import org.ehcache.javadoc.PublicApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.ehcache.xml;

import org.ehcache.xml.spi.ParsingUtil;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
Expand Down
1 change: 1 addition & 0 deletions ehcache-xml/src/common/java/org/ehcache/xml/XmlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.ehcache.xml;

import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.ehcache.xml.spi.Parser;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
Expand Down
8 changes: 4 additions & 4 deletions ehcache-xml/src/common/schema/ehcache-core.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
<xs:simpleType name="propertyOrString">
<xs:annotation>
<xs:appinfo>
<jaxb:javaType name="java.lang.String" parseMethod="org.ehcache.xml.ParsingUtil.parsePropertyOrString"/>
<jaxb:javaType name="java.lang.String" parseMethod="org.ehcache.xml.spi.ParsingUtil.parsePropertyOrString"/>
</xs:appinfo>
</xs:annotation>
<xs:union memberTypes="ehcache:propertyReference">
Expand All @@ -656,7 +656,7 @@
<xs:simpleType name="propertyOrPositiveInteger">
<xs:annotation>
<xs:appinfo>
<jaxb:javaType name="java.math.BigInteger" parseMethod="org.ehcache.xml.ParsingUtil.parsePropertyOrPositiveInteger"/>
<jaxb:javaType name="java.math.BigInteger" parseMethod="org.ehcache.xml.spi.ParsingUtil.parsePropertyOrPositiveInteger"/>
</xs:appinfo>
</xs:annotation>
<xs:union memberTypes="ehcache:propertyReference xs:positiveInteger"/>
Expand All @@ -665,7 +665,7 @@
<xs:simpleType name="propertyOrNonNegativeInteger">
<xs:annotation>
<xs:appinfo>
<jaxb:javaType name="java.math.BigInteger" parseMethod="org.ehcache.xml.ParsingUtil.parsePropertyOrNonNegativeInteger"/>
<jaxb:javaType name="java.math.BigInteger" parseMethod="org.ehcache.xml.spi.ParsingUtil.parsePropertyOrNonNegativeInteger"/>
</xs:appinfo>
</xs:annotation>
<xs:union memberTypes="ehcache:propertyReference xs:nonNegativeInteger"/>
Expand All @@ -674,7 +674,7 @@
<xs:simpleType name="stringWithProperties">
<xs:annotation>
<xs:appinfo>
<jaxb:javaType name="java.lang.String" parseMethod="org.ehcache.xml.ParsingUtil.parseStringWithProperties"/>
<jaxb:javaType name="java.lang.String" parseMethod="org.ehcache.xml.spi.ParsingUtil.parseStringWithProperties"/>
</xs:appinfo>
</xs:annotation>
<xs:restriction base="xs:string"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
import org.ehcache.xml.model.CacheType;
import org.ehcache.xml.model.ConfigType;
import org.ehcache.xml.model.ObjectFactory;
import org.ehcache.xml.spi.CacheManagerServiceConfigurationParser;
import org.ehcache.xml.spi.CacheResourceConfigurationParser;
import org.ehcache.xml.spi.CacheServiceConfigurationParser;
import org.ehcache.xml.spi.Parser;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.ehcache.xml.model.PersistableMemoryTypeWithPropSubst;
import org.ehcache.xml.model.ResourceTypeWithPropSubst;
import org.ehcache.xml.model.ResourcesType;
import org.ehcache.xml.spi.CacheResourceConfigurationParser;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.ehcache.xml.service.DefaultSerializerConfigurationParser;
import org.ehcache.xml.service.DefaultWriteBehindConfigurationParser;
import org.ehcache.xml.service.OffHeapDiskStoreConfigurationParser;
import org.ehcache.xml.spi.CacheServiceConfigurationParser;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

Expand Down
Loading