Skip to content

Commit

Permalink
Add rule for 'javax.inject:javax.inject'
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed May 6, 2022
1 parent 0efce9f commit 3d638db
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ Each Capability's GA coordinates correspond to the GA coordinates of the Compone
* [javax.el:el-api](https://mvnrepository.com/artifact/javax.el/el-api) ([JakartaElApiRule](plugin/src/main/java/de/jjohannes/gradle/javaecosystem/capabilities/rules/JakartaElApiRule.java))
* [jakarta.el:jakarta.el-api](https://mvnrepository.com/artifact/jakarta.el/jakarta.el-api)
* [javax.el:javax.el-api](https://mvnrepository.com/artifact/javax.el/javax.el-api)
* [javax.inject:javax.inject](https://mvnrepository.com/artifact/javax.inject/javax.inject) ([JakartaInjectApiRule](plugin/src/main/java/de/jjohannes/gradle/javaecosystem/capabilities/rules/JakartaInjectApiRule.java))
* [jakarta.inject:jakarta.inject-api](https://mvnrepository.com/artifact/jakarta.inject/jakarta.inject-api)
* [javax.jws:javax.jws-api](https://mvnrepository.com/artifact/javax.jws/javax.jws-api) ([JakartaJwsApisRule](plugin/src/main/java/de/jjohannes/gradle/javaecosystem/capabilities/rules/JakartaJwsApisRule.java))
* [jakarta.jws:jakarta.jws-api](https://mvnrepository.com/artifact/jakarta.jws/jakarta.jws-api)
* [javax.mail:mail](https://mvnrepository.com/artifact/javax.mail/mail) ([JakartaMailApiRule](plugin/src/main/java/de/jjohannes/gradle/javaecosystem/capabilities/rules/JakartaMailApiRule.java))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ private void registerRules(ComponentMetadataHandler components) {
for (String module : JakartaAnnotationApiRule.MODULES) { components.withModule(module, JakartaAnnotationApiRule.class); }
for (String module : JakartaEjbApiRule.MODULES) { components.withModule(module, JakartaEjbApiRule.class); }
for (String module : JakartaElApiRule.MODULES) { components.withModule(module, JakartaElApiRule.class); }
for (String module : JakartaInjectApiRule.MODULES) { components.withModule(module, JakartaInjectApiRule.class); }
for (String module : JakartaJwsApisRule.MODULES) { components.withModule(module, JakartaJwsApisRule.class); }
for (String module : JakartaMailApiRule.MODULES) { components.withModule(module, JakartaMailApiRule.class); }
for (String module : JakartaPersistenceApiRule.MODULES) { components.withModule(module, JakartaPersistenceApiRule.class); }
Expand All @@ -58,6 +59,7 @@ private void defineStrategies(CapabilitiesResolution resolution) {
selectHighestVersion(resolution, JakartaAnnotationApiRule.CAPABILITY_GROUP, JakartaAnnotationApiRule.CAPABILITY_NAME);
selectHighestVersion(resolution, JakartaEjbApiRule.CAPABILITY_GROUP, JakartaEjbApiRule.CAPABILITY_NAME);
selectHighestVersion(resolution, JakartaElApiRule.CAPABILITY_GROUP, JakartaElApiRule.CAPABILITY_NAME);
selectHighestVersion(resolution, JakartaInjectApiRule.CAPABILITY_GROUP, JakartaInjectApiRule.CAPABILITY_NAME);
selectHighestVersion(resolution, JakartaJwsApisRule.CAPABILITY_GROUP, JakartaJwsApisRule.CAPABILITY_NAME);
selectHighestVersion(resolution, JakartaMailApiRule.CAPABILITY_GROUP, JakartaMailApiRule.CAPABILITY_NAME);
selectHighestVersion(resolution, JakartaPersistenceApiRule.CAPABILITY_GROUP, JakartaPersistenceApiRule.CAPABILITY_NAME);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package de.jjohannes.gradle.javaecosystem.capabilities.rules;

import org.gradle.api.artifacts.CacheableRule;
import org.gradle.api.artifacts.ComponentMetadataContext;
import org.gradle.api.artifacts.ComponentMetadataRule;

@CacheableRule
public abstract class JakartaInjectApiRule implements ComponentMetadataRule {

public static final String CAPABILITY_GROUP = "javax.inject";
public static final String CAPABILITY_NAME = "javax.inject";

public static final String[] MODULES = {
"jakarta.inject:jakarta.inject-api"
};

@Override
public void execute(ComponentMetadataContext context) {
String version = context.getDetails().getId().getVersion();
context.getDetails().allVariants(variant -> variant.withCapabilities(capabilities -> capabilities.addCapability(
CAPABILITY_GROUP, CAPABILITY_NAME, version
)));
}
}
5 changes: 3 additions & 2 deletions samples/sample-all/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {
}

dependencies {
implementation("org.ow2.asm:asm:9.2")
implementation("asm:asm:3.3.1")
implementation("c3p0:c3p0:0.9.1.2")
implementation("cglib:cglib-nodep:3.2.12")
Expand All @@ -17,6 +16,7 @@ dependencies {
implementation("jakarta.annotation:jakarta.annotation-api:2.1.0")
implementation("jakarta.ejb:jakarta.ejb-api:4.0.0")
implementation("jakarta.el:jakarta.el-api:4.0.0")
implementation("jakarta.inject:jakarta.inject-api:1.0.5")
implementation("jakarta.jws:jakarta.jws-api:3.0.0")
implementation("jakarta.persistence:jakarta.persistence-api:3.0.0")
implementation("jakarta.servlet:jakarta.servlet-api:5.0.0")
Expand All @@ -33,6 +33,7 @@ dependencies {
implementation("javax.ejb:javax.ejb-api:3.2.2")
implementation("javax.el:el-api:2.2")
implementation("javax.el:javax.el-api:3.0.0")
implementation("javax.inject:javax.inject:1")
implementation("javax.jws:javax.jws-api:1.1")
implementation("javax.mail:mail:1.4.7")
implementation("javax.persistence:javax.persistence-api:2.2")
Expand Down Expand Up @@ -66,11 +67,11 @@ dependencies {
implementation("org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:1.0.1.Final")
implementation("org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:2.0.2.Final")
implementation("org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_3.0_spec:1.0.1.Final")
implementation("org.ow2.asm:asm:9.2")
implementation("stax:stax-api:1.0")
implementation("velocity:velocity:1.4")
implementation("woodstox:wstx-asl:2.9.3")
implementation("xml-apis:xml-apis:2.0.2")

// implementation("woodstox:wstx-lgpl:3.2.7") - has no POM file
}
repositories {
Expand Down
4 changes: 3 additions & 1 deletion samples/sample-all/build.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Root project 'sample-all_build.sample'
------------------------------------------------------------

compileClasspath - Compile classpath for source set 'main'.
+--- org.ow2.asm:asm:9.2
+--- asm:asm:3.3.1 -> org.ow2.asm:asm:9.2
+--- c3p0:c3p0:0.9.1.2 -> com.mchange:c3p0:0.9.5.5
| \--- com.mchange:mchange-commons-java:0.2.19
Expand All @@ -20,6 +19,7 @@ compileClasspath - Compile classpath for source set 'main'.
+--- jakarta.ejb:jakarta.ejb-api:4.0.0
| \--- jakarta.transaction:jakarta.transaction-api:2.0.0
+--- jakarta.el:jakarta.el-api:4.0.0
+--- jakarta.inject:jakarta.inject-api:1.0.5
+--- jakarta.jws:jakarta.jws-api:3.0.0
+--- jakarta.persistence:jakarta.persistence-api:3.0.0
+--- jakarta.servlet:jakarta.servlet-api:5.0.0 -> org.apache.tomcat:tomcat-servlet-api:9.0.1
Expand All @@ -41,6 +41,7 @@ compileClasspath - Compile classpath for source set 'main'.
+--- javax.ejb:javax.ejb-api:3.2.2 -> jakarta.ejb:jakarta.ejb-api:4.0.0 (*)
+--- javax.el:el-api:2.2 -> jakarta.el:jakarta.el-api:4.0.0
+--- javax.el:javax.el-api:3.0.0 -> jakarta.el:jakarta.el-api:4.0.0
+--- javax.inject:javax.inject:1 -> jakarta.inject:jakarta.inject-api:1.0.5
+--- javax.jws:javax.jws-api:1.1 -> jakarta.jws:jakarta.jws-api:3.0.0
+--- javax.mail:mail:1.4.7 -> com.sun.mail:jakarta.mail:2.0.1 (*)
+--- javax.persistence:javax.persistence-api:2.2 -> jakarta.persistence:jakarta.persistence-api:3.0.0
Expand Down Expand Up @@ -78,6 +79,7 @@ compileClasspath - Compile classpath for source set 'main'.
+--- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:1.0.1.Final -> org.jboss.resteasy:jaxrs-api:3.0.1.Final
+--- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:2.0.2.Final -> org.jboss.resteasy:jaxrs-api:3.0.1.Final
+--- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_3.0_spec:1.0.1.Final -> org.jboss.resteasy:jaxrs-api:3.0.1.Final
+--- org.ow2.asm:asm:9.2
+--- velocity:velocity:1.4 -> org.apache.velocity:velocity-engine-core:2.3 (*)
+--- woodstox:wstx-asl:2.9.3 -> org.codehaus.woodstox:woodstox-core-asl:4.4.1 (*)
\--- xml-apis:xml-apis:2.0.2 -> jakarta.xml.bind:jakarta.xml.bind-api:3.0.1 (*)
Expand Down

0 comments on commit 3d638db

Please sign in to comment.