Skip to content

Commit

Permalink
Merge branch 'release/4.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Dec 22, 2020
2 parents bb49f8c + 40104ab commit 0e4527c
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 42 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/deploy-jdk8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Deploy New Version

on: workflow_dispatch
# push:
# branches: [ support/4.x-jdk8 ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: GPG Setup
env:
GPG_KEY_BASE64: ${{ secrets.GPG_KEY_BASE64 }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./gpg-setup.sh
- name: Deploy to OSS Sonatype
env:
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
# mvn -Prelease source:jar javadoc:jar deploy -Dgpg.passphrase=thephrase
run: mvn -B -Prelease source:jar javadoc:jar deploy --file pom.xml -s settings-template.xml -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}

26 changes: 26 additions & 0 deletions .github/workflows/deploy-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Maven Package

on:
push:
branches:
- develop

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 9
uses: actions/setup-java@v1
with:
java-version: 9

- name: Build with Maven
env:
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: mvn -B deploy --file pom.xml -s settings-template.xml
8 changes: 5 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
name: Deploy New Version

on: workflow_dispatch
#on:
# push:
# branches: [ support/4.x-jdk8 ]
# tags:
# - 'v*'

jobs:
build:
Expand All @@ -14,10 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 9
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 9
- name: GPG Setup
env:
GPG_KEY_BASE64: ${{ secrets.GPG_KEY_BASE64 }}
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ This plugin was born as the 'alter ego' of maven apt plugin [apt-maven-plugin](h

Date | Version | Info
--- | --- | ---
**Dec 22, 2020** | [Release 4.5](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.5) | fix issue [#90](https://github.com/bsorrentino/maven-annotation-plugin/issues/90)
**Dec 22, 2020** | [Release 4.5-jdk8](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.5-jdk8) | ---
**Oct 01, 2020** | [Release 4.4](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.4) | merge PR #87. Thanks to [Martijn Dashorst](https://github.com/dashorst)
**Oct 01, 2020** | [Release 4.4-jdk8](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.4-jdk8) | ---
**Sep 25, 2020** | [Release 4.3](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.3) | merge PR #85. Thanks to [Martijn Dashorst](https://github.com/dashorst)
**Aug 03, 2020** | [Release 4.2](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.2) | merge PR #84. Thanks to [DemonicTutor](https://github.com/DemonicTutor)
**Aug 03, 2020** | [Release 4.2-jdk8](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.2-jdk8) | merge PR #84. Thanks to [DemonicTutor](https://github.com/DemonicTutor)
**Aug 03, 2020** | [Release 4.2-jdk8](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.2-jdk8) | ---
**Jul 30, 2020** | [Release 4.1](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.1) | Release based on JDK9 and above
**Jul 30, 2020** | [Release 4.1-jdk8](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.1-jdk8) | Maintenance release compatible with JDK8
**Jul 21, 2020** | [Release 4.0-jdk8](https://github.com/bsorrentino/maven-annotation-plugin/releases/tag/v4.0-jdk8) | Maintenance release compatible with JDK8
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin-parent</artifactId>
<packaging>pom</packaging>
<version>4.4</version>
<version>4.5</version>
<name>MAVEN PROCESSOR PLUGIN PARENT</name>
<description>A maven plugin to process annotation for jdk6 at compile time

Expand Down Expand Up @@ -91,7 +91,7 @@ This plugin could be considered the 'alter ego' of maven apt plugin http://mojo.
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This plugin could be considered the 'alter ego' of maven apt plugin http://mojo.
<parent>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin-parent</artifactId>
<version>4.4</version>
<version>4.5</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,26 @@ public abstract class AbstractAnnotationProcessorMojo extends AbstractMojo
*/
public abstract File getDefaultOutputDirectory();

/**
*
* @return
*/
private Charset getCharsetFromEncoding() {

return ofNullable(encoding).map( enc -> {
try {
return Charset.forName(encoding);
}
catch( IllegalCharsetNameException ex1 ) {
getLog().warn( format("the given charset name [%s] is illegal!. default is used", encoding ));
}
catch( UnsupportedCharsetException ex2 ) {
getLog().warn( format("the given charset name [%s] is unsupported!. default is used", encoding ));
}
return Charset.defaultCharset();
}).orElseGet( () -> Charset.defaultCharset() );

}

private String buildProcessor()
{
Expand Down Expand Up @@ -565,6 +585,11 @@ private List<String> prepareOptions( JavaCompiler compiler ) {
});
});

ofNullable(encoding).ifPresent( enc -> {
options.add("-encoding");
options.add( getCharsetFromEncoding().name() );
});

if( getLog().isDebugEnabled() ) {
for (String option : options) {
getLog().debug(format("javac option: %s", option));
Expand Down Expand Up @@ -803,28 +828,10 @@ private void executeWithExceptionsHandled() throws Exception
return;
}


Charset charset = null; ;

if( encoding != null ) {
try {
charset = Charset.forName(encoding);
}
catch( IllegalCharsetNameException ex1 ) {
getLog().warn( format("the given charset name [%s] is illegal!. default is used", encoding ));
charset = null;
}
catch( UnsupportedCharsetException ex2 ) {
getLog().warn( format("the given charset name [%s] is unsupported!. default is used", encoding ));
charset = null;
}
}

final StandardJavaFileManager fileManager =
compiler.getStandardFileManager(null, null,
(charset==null) ?
Charset.defaultCharset() :
charset);
final StandardJavaFileManager fileManager =
compiler.getStandardFileManager(null,
null,
getCharsetFromEncoding());

if( files!=null && !files.isEmpty() ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ else if( "-s".equals(option) ) {
else if( "--release".equals(option) ) {
javacConf.setReleaseVersion(ii.next());
}
else if("-encoding".equals(option)) {
javacConf.setSourceEncoding(ii.next());
}
else /*if( option.startsWith("-A") ) */ { // view pull #70
// Just pass through any other arguments
javacConf.addCompilerCustomArgument(option, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
*/
package org.bsc.maven.plugin.processor;

import java.io.File;
import org.junit.Assert;
import org.junit.Test;
import org.hamcrest.core.*;

import java.nio.charset.Charset;

import static org.junit.Assert.*;

/**
*
* @author softphone
Expand All @@ -20,11 +22,11 @@ public void compareFile() {
final java.io.File f = new java.io.File( "target/test-classes");
final java.io.File f2 = new java.io.File( "target/classes");

Assert.assertThat( f.equals(f2), Is.is(false));
assertFalse( f.equals(f2));

final java.io.File f3 = new java.io.File( "target/classes");

Assert.assertThat( f3.equals(f2), Is.is(true));
assertTrue( f3.equals(f2));

}

Expand All @@ -46,12 +48,25 @@ public void testDuplicatePath() {
fileSet.add( f2 );


Assert.assertThat( fileSet.size(), IsEqual.equalTo(1) );
assertEquals( 1, fileSet.size() );

fileSet.add( f2 );
fileSet.add(f3);

Assert.assertThat( fileSet.size(), IsEqual.equalTo(2) );
assertEquals( 2, fileSet.size() );

}

@Test
public void testEncoding() {

Charset.availableCharsets().entrySet().forEach( e -> {
System.out.printf( "encoding { key:%s, name:%s, aliases:%s }\n", e.getKey(), e.getValue().name(), e.getValue().aliases());
});

final Charset utf8 = Charset.forName("utf8");
assertEquals( "UTF-8", utf8.name() );
}


}
1 change: 1 addition & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.maven-processor-source-files.txt
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin-parent</artifactId>
<version>4.4</version>
<version>4.5</version>
</parent>

<dependencies>
Expand Down
4 changes: 0 additions & 4 deletions test/src/site/.maven-processor-source-files.txt

This file was deleted.

2 changes: 1 addition & 1 deletion utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin-parent</artifactId>
<version>4.4</version>
<version>4.5</version>
</parent>

<properties>
Expand Down

0 comments on commit 0e4527c

Please sign in to comment.