Skip to content

Commit 752a040

Browse files
committed
Convert to SmallRye project
1 parent f2959f0 commit 752a040

35 files changed

Lines changed: 807 additions & 528 deletions

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "maven"
4+
directory: "/" # Location of package manifests
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"

.github/project.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: SmallRye Modules
2+
# for this project, always set next-version to the next *minor* unless it's on a stable branch!
3+
release:
4+
current-version: 1.0.alpha1-SNAPSHOT
5+
next-version: 1.0.alpha2-SNAPSHOT

.github/workflows/build.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: SmallRye Build
2+
env:
3+
MAVEN_VERSION: 3.9.12
4+
IO_TAKARI_MAVEN_WRAPPER_VERSION: 0.7.7
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- jakarta
11+
paths-ignore:
12+
- '.gitattributes'
13+
- '.gitignore'
14+
- 'LICENSE'
15+
- 'NOTICE'
16+
- 'README*'
17+
pull_request:
18+
paths-ignore:
19+
- '.gitattributes'
20+
- '.gitignore'
21+
- 'LICENSE'
22+
- 'NOTICE'
23+
- 'README*'
24+
25+
jobs:
26+
build:
27+
strategy:
28+
matrix:
29+
os: [ ubuntu-latest, windows-latest, macos-latest ]
30+
fail-fast: false
31+
runs-on: ${{ matrix.os }}
32+
name: build
33+
34+
steps:
35+
- uses: actions/checkout@v6
36+
name: checkout
37+
38+
- uses: actions/setup-java@v5
39+
name: set up JDKs
40+
with:
41+
distribution: temurin
42+
java-version: |
43+
25
44+
cache: 'maven'
45+
cache-dependency-path: '**/pom.xml'
46+
47+
- name: build with maven
48+
run: |
49+
mvn -q -N "io.takari:maven:${{env.IO_TAKARI_MAVEN_WRAPPER_VERSION}}:wrapper" "-Dmaven=${{env.MAVEN_VERSION}}"
50+
./mvnw -B -ntp formatter:validate verify javadoc:javadoc --file pom.xml "-Djava25.home=${{env.JAVA_HOME_25_X64}}${{env.JAVA_HOME_25_ARM64}}"
51+
52+
quality:
53+
needs: [ build ]
54+
if: false && github.event_name == 'push' && github.repository_owner == 'smallrye'
55+
runs-on: ubuntu-latest
56+
name: quality
57+
58+
steps:
59+
- uses: actions/checkout@v6
60+
61+
- uses: actions/setup-java@v5
62+
with:
63+
distribution: temurin
64+
java-version: 25
65+
cache: 'maven'
66+
cache-dependency-path: '**/pom.xml'
67+
68+
- name: build with coverage
69+
run: |
70+
mvn -q -N "io.takari:maven:${{env.IO_TAKARI_MAVEN_WRAPPER_VERSION}}:wrapper" "-Dmaven=${{env.MAVEN_VERSION}}"
71+
./mvnw -B -ntp verify -Pcoverage
72+
73+
- uses: actions/setup-java@v5
74+
with:
75+
distribution: 'temurin'
76+
java-version: 25
77+
78+
- name: sonar
79+
run: ./mvnw -B -ntp sonar:sonar -Dsonar.projectKey=smallrye_smallrye-modules -Dsonar.token=${{secrets.SONAR_TOKEN}}

.github/workflows/pre-release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: SmallRye Pre Release
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/project.yml'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
name: pre release
12+
13+
steps:
14+
- uses: radcortez/project-metadata-action@main
15+
name: retrieve project metadata
16+
id: metadata
17+
with:
18+
github-token: ${{secrets.GITHUB_TOKEN}}
19+
metadata-file-path: '.github/project.yml'
20+
21+
- name: Validate version
22+
if: contains(steps.metadata.outputs.current-version, 'SNAPSHOT')
23+
run: |
24+
echo '::error::Cannot release a SNAPSHOT version.'
25+
exit 1
26+
27+
- uses: radcortez/milestone-review-action@main
28+
name: milestone review
29+
with:
30+
github-token: ${{secrets.GITHUB_TOKEN}}
31+
milestone-title: ${{steps.metadata.outputs.current-version}}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: SmallRye Release
2+
run-name: Perform ${{github.event.inputs.tag || github.ref_name}} Release
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to release'
11+
required: true
12+
13+
permissions:
14+
attestations: write
15+
id-token: write
16+
contents: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
perform-release:
24+
name: Perform Release
25+
uses: smallrye/.github/.github/workflows/perform-release.yml@main
26+
secrets: inherit
27+
with:
28+
version: ${{github.event.inputs.tag || github.ref_name}}
29+
java_version: 25
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: SmallRye Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [ closed ]
7+
paths:
8+
- '.github/project.yml'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
prepare-release:
16+
name: Prepare Release
17+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true}}
18+
uses: smallrye/.github/.github/workflows/prepare-release.yml@main
19+
secrets: inherit
20+
with:
21+
java_version: 25
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Update Milestone
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
name: update-milestone
11+
if: ${{github.event.pull_request.merged == true}}
12+
13+
steps:
14+
- uses: radcortez/milestone-set-action@main
15+
name: milestone set
16+
with:
17+
github-token: ${{secrets.GITHUB_TOKEN}}

pom.xml

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>io.github.dmlloyd.modules</groupId>
8-
<artifactId>modules3</artifactId>
9-
<version>1.0-SNAPSHOT</version>
7+
<groupId>io.smallrye.modules</groupId>
8+
<artifactId>smallrye-modules</artifactId>
9+
<version>1.0-alpha1-SNAPSHOT</version>
1010

1111
<parent>
12-
<groupId>org.jboss</groupId>
13-
<artifactId>jboss-parent</artifactId>
14-
<version>51</version>
12+
<groupId>io.smallrye</groupId>
13+
<artifactId>smallrye-parent</artifactId>
14+
<version>45</version>
1515
</parent>
1616

1717
<properties>
@@ -56,7 +56,7 @@
5656
</dependency>
5757
<dependency>
5858
<groupId>org.junit.jupiter</groupId>
59-
<artifactId>junit-jupiter-api</artifactId>
59+
<artifactId>junit-jupiter</artifactId>
6060
<version>5.11.1</version>
6161
<scope>test</scope>
6262
</dependency>
@@ -67,19 +67,64 @@
6767
<plugin>
6868
<artifactId>maven-surefire-plugin</artifactId>
6969
<configuration>
70-
<argLine>--add-exports java.base/jdk.internal.module=io.github.dmlloyd.modules</argLine>
70+
<argLine>--add-exports java.base/jdk.internal.module=io.smallrye.modules</argLine>
7171
</configuration>
7272
</plugin>
7373
<plugin>
7474
<artifactId>maven-jar-plugin</artifactId>
7575
<configuration>
7676
<archive>
7777
<manifest>
78-
<mainClass>io.github.dmlloyd.modules.Launcher</mainClass>
78+
<mainClass>io.smallrye.modules.Launcher</mainClass>
7979
</manifest>
8080
</archive>
8181
</configuration>
8282
</plugin>
83+
<plugin>
84+
<groupId>net.revelc.code</groupId>
85+
<artifactId>impsort-maven-plugin</artifactId>
86+
<version>1.13.0</version>
87+
<dependencies>
88+
<dependency>
89+
<groupId>com.github.javaparser</groupId>
90+
<artifactId>javaparser-core</artifactId>
91+
<version>3.28.0</version>
92+
</dependency>
93+
</dependencies>
94+
<executions>
95+
<execution>
96+
<id>sort-imports</id>
97+
<goals>
98+
<goal>sort</goal>
99+
</goals>
100+
<configuration>
101+
<compliance>17</compliance>
102+
</configuration>
103+
</execution>
104+
</executions>
105+
</plugin>
106+
<plugin>
107+
<groupId>net.revelc.code.formatter</groupId>
108+
<artifactId>formatter-maven-plugin</artifactId>
109+
<executions>
110+
<execution>
111+
<id>format-sources</id>
112+
<phase>process-sources</phase>
113+
<goals>
114+
<goal>format</goal>
115+
</goals>
116+
<configuration>
117+
<compilerCompliance>17</compilerCompliance>
118+
</configuration>
119+
</execution>
120+
</executions>
121+
</plugin>
122+
<plugin>
123+
<artifactId>maven-javadoc-plugin</artifactId>
124+
<configuration>
125+
<source>17</source>
126+
</configuration>
127+
</plugin>
83128
</plugins>
84129
</build>
85130
</project>

src/main/java/io/github/dmlloyd/modules/DefinedModule.java renamed to src/main/java/io/smallrye/modules/DefinedModule.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package io.github.dmlloyd.modules;
1+
package io.smallrye.modules;
22

33
import java.util.List;
44
import java.util.concurrent.locks.ReentrantLock;
55

6-
import io.github.dmlloyd.modules.desc.ModuleDescriptor;
76
import io.smallrye.common.constraint.Assert;
87
import io.smallrye.common.resource.ResourceLoader;
8+
import io.smallrye.modules.desc.ModuleDescriptor;
99

1010
/**
1111
* A defined module.
@@ -18,7 +18,8 @@ static final class New extends DefinedModule {
1818
private final ReentrantLock loadLock = new ReentrantLock();
1919
private volatile DefinedModule result;
2020

21-
New(final String moduleName, final List<ResourceLoaderOpener> resourceLoaderOpeners, final ModuleDescriptorLoader descriptorLoader) {
21+
New(final String moduleName, final List<ResourceLoaderOpener> resourceLoaderOpeners,
22+
final ModuleDescriptorLoader descriptorLoader) {
2223
this.moduleName = moduleName;
2324
this.resourceLoaderOpeners = List.copyOf(resourceLoaderOpeners);
2425
this.descriptorLoader = descriptorLoader;
@@ -42,9 +43,11 @@ ModuleClassLoader moduleClassLoader(final ModuleLoader moduleLoader) {
4243
for (int i = 0; i < cnt; i++) {
4344
ResourceLoaderOpener opener = openers.get(i);
4445
try {
45-
loaderArray[i] = Assert.checkNotNullArrayParam("returned loader from openers", i, opener.open());
46+
loaderArray[i] = Assert.checkNotNullArrayParam("returned loader from openers", i,
47+
opener.open());
4648
} catch (Throwable t) {
47-
ModuleLoadException mle = new ModuleLoadException("Failed to open a resource loader for `" + moduleName + "`", t);
49+
ModuleLoadException mle = new ModuleLoadException(
50+
"Failed to open a resource loader for `" + moduleName + "`", t);
4851
for (int j = i - 1; j >= 0; j--) {
4952
try {
5053
loaderArray[j].close();
@@ -58,14 +61,14 @@ ModuleClassLoader moduleClassLoader(final ModuleLoader moduleLoader) {
5861
List<ResourceLoader> loaders = List.of(loaderArray);
5962
try {
6063
ModuleDescriptor desc = descriptorLoader.loadDescriptor(moduleName, loaders);
61-
if (! desc.name().equals(moduleName)) {
62-
throw new ModuleLoadException("Module descriptor for `" + moduleName + "` has unexpected name `" + desc.name() + "`");
64+
if (!desc.name().equals(moduleName)) {
65+
throw new ModuleLoadException(
66+
"Module descriptor for `" + moduleName + "` has unexpected name `" + desc.name() + "`");
6367
}
6468
ModuleClassLoader.ClassLoaderConfiguration config = new ModuleClassLoader.ClassLoaderConfiguration(
65-
moduleLoader,
66-
loaders,
67-
desc
68-
);
69+
moduleLoader,
70+
loaders,
71+
desc);
6972
ModuleClassLoader mcl;
7073
try {
7174
mcl = moduleLoader.createClassLoader(config);
@@ -76,7 +79,8 @@ ModuleClassLoader moduleClassLoader(final ModuleLoader moduleLoader) {
7679
this.result = result;
7780
moduleLoader.replace(this, result);
7881
} catch (Throwable t) {
79-
ModuleLoadException mle = new ModuleLoadException("Failed to load module descriptor for for " + moduleName, t);
82+
ModuleLoadException mle = new ModuleLoadException(
83+
"Failed to load module descriptor for for " + moduleName, t);
8084
for (int j = cnt - 1; j >= 0; j--) {
8185
try {
8286
loaders.get(j).close();

src/main/java/io/github/dmlloyd/modules/DelegatingModuleLoader.java renamed to src/main/java/io/smallrye/modules/DelegatingModuleLoader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.dmlloyd.modules;
1+
package io.smallrye.modules;
22

33
import java.util.function.Function;
44

@@ -17,7 +17,8 @@ public final class DelegatingModuleLoader extends ModuleLoader {
1717
* @param moduleFinder the module finder (must not be {@code null})
1818
* @param delegateFn the function which yields the delegate to use when the module is not found (must not be {@code null})
1919
*/
20-
public DelegatingModuleLoader(final String name, final ModuleFinder moduleFinder, final Function<String, ModuleLoader> delegateFn) {
20+
public DelegatingModuleLoader(final String name, final ModuleFinder moduleFinder,
21+
final Function<String, ModuleLoader> delegateFn) {
2122
super(name, moduleFinder);
2223
this.delegateFn = Assert.checkNotNullParam("delegateFn", delegateFn);
2324
}

0 commit comments

Comments
 (0)