Skip to content

Commit

Permalink
Merge pull request #635 from bjhargrave/1.0-release
Browse files Browse the repository at this point in the history
Prepare for 1.0 release
  • Loading branch information
bjhargrave authored Aug 22, 2024
2 parents 8fbd88f + 3ce649a commit 7ccaeca
Show file tree
Hide file tree
Showing 53 changed files with 473 additions and 657 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:
os:
- 'ubuntu-latest'
java:
- '8'
- '11'
- '21'
include:
- os: 'ubuntu-latest'
java: '17'
Expand Down
Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
8 changes: 5 additions & 3 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
wrapperVersion=3.3.2
distributionType=bin
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand Down Expand Up @@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
Expand Down Expand Up @@ -150,7 +150,7 @@ org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,NORMAL
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
@ExternalPlugin(name = "Transformer", objectClass = AnalyzerPlugin.class)
public class TransformerAnalyzerPlugin extends BaseTransformerPlugin implements AnalyzerPlugin {
public TransformerAnalyzerPlugin() {
/**
* We want to run before other AnalyzerPlugins so they will operate on
* the transformed classes and resources.
/*
We want to run before other AnalyzerPlugins so they will operate on
the transformed classes and resources.
*/
super(-10_000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
@ExternalPlugin(name = "Transformer", objectClass = VerifierPlugin.class)
public class TransformerVerifierPlugin extends BaseTransformerPlugin implements VerifierPlugin {
public TransformerVerifierPlugin() {
/**
* We want to run after other VerifierPlugins so we will operate on the
* final classes and resources.
/*
We want to run after other VerifierPlugins so we will operate on the
final classes and resources.
*/
super(10_000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand Down Expand Up @@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
Expand Down Expand Up @@ -150,7 +150,7 @@ org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,NORMAL
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME
Expand Down
16 changes: 0 additions & 16 deletions maven-plugins/transformer-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ This plugin contains the following goals:
- [`transform`](#transform-goal)
- [`help`](#help-goal)

__Note__: if you are using Java 21 or later see [Using Java 21 or later](#java-21-or-later).

## `jar` Goal

The `jar` goal operates at the JAR file level and transforms the specified input artifact into a project artifact.
Expand Down Expand Up @@ -253,17 +251,3 @@ It is therefore necessary to configure the `maven-jar-plugin` as follows:

The `help` goal displays help about the goals of the plugin.
Call `mvn transformer:help -Ddetail=true -Dgoal=<goal-name>` to display configuration details for the specified goal.

## Java 21 or later

If you are using Java 21 or later you will need to configure the Maven plugin to use a specific version of the `biz.aQute.bndlib` dependency.

For example:

```xml
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>7.0.0</version>
</dependency>
```
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public boolean skip() {
// Exit without generating anything if this project is not a known
// packaging type. Probably it's just a parent project.
if (!getPackagingTypes().contains(getProject().getPackaging())) {
getLogger().debug("skip project with packaging=" + getProject().getPackaging());
getLogger().debug("skip project with packaging={}", getProject().getPackaging());
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,16 @@ private TransformerArtifact prepareArtifactDescription(TransformerArtifact artif
List<Dependency> firstPass = dependencies.stream()
.filter(dependency -> Objects.equals(artifactDescription.getGroupId(), dependency.getGroupId())
&& Objects.equals(artifactDescription.getArtifactId(), dependency.getArtifactId()))
.collect(toList());
.toList();

Optional<Dependency> matchingDependency = firstPass.stream()
.filter(dependency -> Objects.equals(artifactDescription.getClassifier(), dependency.getClassifier())
&& Objects.equals(artifactDescription.getType(), dependency.getType()))
.findFirst();
if (!matchingDependency.isPresent()) {
if (matchingDependency.isEmpty()) {
matchingDependency = firstPass.stream()
.findFirst();
if (!matchingDependency.isPresent()) {
if (matchingDependency.isEmpty()) {
throw new MojoExecutionException(String.format(
"No version found for artifact %s:%s in project, dependencies, or dependency management",
artifactDescription.getGroupId(), artifactDescription.getArtifactId()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ public static String extractClassifier(PluginExecution execution) {
Optional<Xpp3Dom> rootConfiguration = Optional.ofNullable((Xpp3Dom) execution.getConfiguration());
Optional<Xpp3Dom> classifierConfiguration = rootConfiguration
.map(configuration -> configuration.getChild("classifier"));
if (!classifierConfiguration.isPresent()) {
if (classifierConfiguration.isEmpty()) {
classifierConfiguration = rootConfiguration.map(configuration -> configuration.getChild("artifact"))
.map(configuration -> configuration.getChild("classifier"));
}
if (!classifierConfiguration.isPresent()) {
if (classifierConfiguration.isEmpty()) {
return defaultClassifier(execution);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,59 +63,29 @@ private static List<String> condition(List<String> values) {

@Override
public List<String> getOptionValues(AppOption option) {
List<String> values;
switch (option) {
case RULES_BUNDLES :
values = rules.getBundles();
break;
case RULES_DIRECT :
values = rules.getDirects();
break;
case RULES_IMMEDIATE_DATA :
values = rules.getImmediates();
break;
case RULES_MASTER_TEXT :
values = rules.getTexts();
break;
case RULES_PER_CLASS_CONSTANT :
values = rules.getPerClassConstants();
break;
case RULES_RENAMES :
values = rules.getRenames();
break;
case RULES_SELECTIONS :
values = rules.getSelections();
break;
case RULES_VERSIONS :
values = rules.getVersions();
break;
default :
values = null;
break;
}
List<String> values = switch (option) {
case RULES_BUNDLES -> rules.getBundles();
case RULES_DIRECT -> rules.getDirects();
case RULES_IMMEDIATE_DATA -> rules.getImmediates();
case RULES_MASTER_TEXT -> rules.getTexts();
case RULES_PER_CLASS_CONSTANT -> rules.getPerClassConstants();
case RULES_RENAMES -> rules.getRenames();
case RULES_SELECTIONS -> rules.getSelections();
case RULES_VERSIONS -> rules.getVersions();
default -> null;
};
return condition(values);
}

@Override
public boolean hasOption(AppOption option) {
boolean has;
switch (option) {
case OVERWRITE :
has = rules.isOverwrite();
break;
case INVERT :
has = rules.isInvert();
break;
case WIDEN_ARCHIVE_NESTING :
has = rules.isWiden();
break;
case STRIP_SIGNATURES :
has = rules.isStripSignatures();
break;
default :
has = TransformOptions.super.hasOption(option);
break;
}
boolean has = switch (option) {
case OVERWRITE -> rules.isOverwrite();
case INVERT -> rules.isInvert();
case WIDEN_ARCHIVE_NESTING -> rules.isWiden();
case STRIP_SIGNATURES -> rules.isStripSignatures();
default -> TransformOptions.super.hasOption(option);
};
return has;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void execute() throws MojoFailureException, MojoExecutionException {
*/
public void transform(final Artifact sourceArtifact) throws MojoFailureException, MojoExecutionException {
final String sourceClassifier = sourceArtifact.getClassifier();
final String targetClassifier = (sourceClassifier == null || sourceClassifier.length() == 0) ? this.classifier
final String targetClassifier = (sourceClassifier == null || sourceClassifier.isEmpty()) ? this.classifier
: sourceClassifier + "-" + this.classifier;

final File targetFile = new File(outputDirectory, sourceArtifact.getArtifactId() + "-" + targetClassifier + "-"
Expand All @@ -129,36 +129,25 @@ public void transform(final Artifact sourceArtifact) throws MojoFailureException
final Function<String, URL> ruleLoader = JakartaTransform.getRuleLoader();
@Override
public boolean hasOption(AppOption option) {
switch (option) {
case OVERWRITE :
return overwrite;
case INVERT :
return invert;
case STRIP_SIGNATURES:
return stripSignatures;
default :
return TransformOptions.super.hasOption(option);
}
return switch (option) {
case OVERWRITE -> overwrite;
case INVERT -> invert;
case STRIP_SIGNATURES -> stripSignatures;
default -> TransformOptions.super.hasOption(option);
};
}

@Override
public String getOptionValue(AppOption option) {
switch (option) {
case RULES_RENAMES :
return emptyAsNull(rulesRenamesUri);
case RULES_VERSIONS :
return emptyAsNull(rulesVersionUri);
case RULES_BUNDLES :
return emptyAsNull(rulesBundlesUri);
case RULES_DIRECT :
return emptyAsNull(rulesDirectUri);
case RULES_MASTER_TEXT :
return emptyAsNull(rulesXmlsUri);
case RULES_PER_CLASS_CONSTANT :
return emptyAsNull(rulesPerClassConstantUri);
default :
return null;
}
return switch (option) {
case RULES_RENAMES -> emptyAsNull(rulesRenamesUri);
case RULES_VERSIONS -> emptyAsNull(rulesVersionUri);
case RULES_BUNDLES -> emptyAsNull(rulesBundlesUri);
case RULES_DIRECT -> emptyAsNull(rulesDirectUri);
case RULES_MASTER_TEXT -> emptyAsNull(rulesXmlsUri);
case RULES_PER_CLASS_CONSTANT -> emptyAsNull(rulesPerClassConstantUri);
default -> null;
};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void testMultipleArtifactTransformerPlugin() throws Exception {
.equals("zip")
&& a.getArtifactId()
.equals("simple-service")))
.map(a -> a.getClassifier())
.map(Artifact::getClassifier)
.collect(Collectors.toSet());

assertEquals(6, mavenProject.getAttachedArtifacts()
Expand Down Expand Up @@ -260,7 +260,7 @@ private static File createService(String packaging, File targetDirectory) throws
final File tempFile = File.createTempFile("service", "." + packaging);
tempFile.delete();

final Archive archive;
final Archive<?> archive;
if (packaging.equals("jar")) {
archive = ShrinkWrap.create(JavaArchive.class, "service." + packaging)
.addClass(EchoService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
Expand Down Expand Up @@ -57,9 +56,6 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Loading

0 comments on commit 7ccaeca

Please sign in to comment.