Skip to content

Commit 5df15bc

Browse files
committed
Convert to SmallRye project
1 parent f2959f0 commit 5df15bc

36 files changed

Lines changed: 827 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}}

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
![Build Status](https://github.com/smallrye/smallrye-modules/actions/workflows/build.yml/badge.svg)
2+
![License](https://img.shields.io/github/license/smallrye/smallrye-modules.svg)
3+
![Maven Central](https://img.shields.io/maven-central/v/io.smallrye.modules/modules?color=green)
4+
5+
# SmallRye Modules
6+
7+
## Overview
8+
9+
SmallRye Modules provides an isolated, dynamic modular class loading environment that integrates with
10+
the Java platform module system.
11+
12+
13+
(todo)
14+
15+
## History
16+
17+
This project is loosely based on its predecessor, [JBoss Modules](https://github.com/jboss/jboss-modules).

pom.xml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
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

17+
<name>SmallRye Modules</name>
18+
<description>A dynamic modular class loading environment</description>
19+
1720
<properties>
1821
<maven.compiler.release>17</maven.compiler.release>
1922
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -56,7 +59,7 @@
5659
</dependency>
5760
<dependency>
5861
<groupId>org.junit.jupiter</groupId>
59-
<artifactId>junit-jupiter-api</artifactId>
62+
<artifactId>junit-jupiter</artifactId>
6063
<version>5.11.1</version>
6164
<scope>test</scope>
6265
</dependency>
@@ -67,19 +70,64 @@
6770
<plugin>
6871
<artifactId>maven-surefire-plugin</artifactId>
6972
<configuration>
70-
<argLine>--add-exports java.base/jdk.internal.module=io.github.dmlloyd.modules</argLine>
73+
<argLine>--add-exports java.base/jdk.internal.module=io.smallrye.modules</argLine>
7174
</configuration>
7275
</plugin>
7376
<plugin>
7477
<artifactId>maven-jar-plugin</artifactId>
7578
<configuration>
7679
<archive>
7780
<manifest>
78-
<mainClass>io.github.dmlloyd.modules.Launcher</mainClass>
81+
<mainClass>io.smallrye.modules.Launcher</mainClass>
7982
</manifest>
8083
</archive>
8184
</configuration>
8285
</plugin>
86+
<plugin>
87+
<groupId>net.revelc.code</groupId>
88+
<artifactId>impsort-maven-plugin</artifactId>
89+
<version>1.13.0</version>
90+
<dependencies>
91+
<dependency>
92+
<groupId>com.github.javaparser</groupId>
93+
<artifactId>javaparser-core</artifactId>
94+
<version>3.28.0</version>
95+
</dependency>
96+
</dependencies>
97+
<executions>
98+
<execution>
99+
<id>sort-imports</id>
100+
<goals>
101+
<goal>sort</goal>
102+
</goals>
103+
<configuration>
104+
<compliance>17</compliance>
105+
</configuration>
106+
</execution>
107+
</executions>
108+
</plugin>
109+
<plugin>
110+
<groupId>net.revelc.code.formatter</groupId>
111+
<artifactId>formatter-maven-plugin</artifactId>
112+
<executions>
113+
<execution>
114+
<id>format-sources</id>
115+
<phase>process-sources</phase>
116+
<goals>
117+
<goal>format</goal>
118+
</goals>
119+
<configuration>
120+
<compilerCompliance>17</compilerCompliance>
121+
</configuration>
122+
</execution>
123+
</executions>
124+
</plugin>
125+
<plugin>
126+
<artifactId>maven-javadoc-plugin</artifactId>
127+
<configuration>
128+
<source>17</source>
129+
</configuration>
130+
</plugin>
83131
</plugins>
84132
</build>
85133
</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();

0 commit comments

Comments
 (0)