Skip to content

Commit

Permalink
Use maven-shade-plugin instead of custom source-unpack/recompile
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Dec 21, 2023
1 parent 3a9ff8c commit fb35df1
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 512 deletions.
198 changes: 32 additions & 166 deletions jansi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,198 +20,39 @@
</parent>

<artifactId>jansi</artifactId>
<name>Jansi bundle</name>
<name>Jansi Bundle</name>

<properties>
<automatic.module.name>org.jansi</automatic.module.name>
<javadocOptions>--enable-preview --release 21</javadocOptions>
<automatic.module.name>org.jline.jansi</automatic.module.name>
</properties>

<dependencies>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jansi-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-terminal</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-jni</artifactId>
<optional>true</optional>
<artifactId>jline-native</artifactId>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-ffm</artifactId>
<scope>test</scope>
<artifactId>jline-terminal-jni</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>unpack</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<artifactItems>
<!-- sources -->
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jline-native</artifactId>
<classifier>sources</classifier>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jline-terminal</artifactId>
<classifier>sources</classifier>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-jni</artifactId>
<classifier>sources</classifier>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jansi-core</artifactId>
<classifier>sources</classifier>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
</artifactItem>

<!-- resources -->
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jline-native</artifactId>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<excludes>**/*.class</excludes>
</artifactItem>
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jline-terminal</artifactId>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<excludes>**/*.class</excludes>
</artifactItem>
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-jni</artifactId>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<excludes>**/*.class</excludes>
</artifactItem>
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-ffm</artifactId>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<excludes>**/*.class</excludes>
</artifactItem>
<artifactItem>
<groupId>org.jline</groupId>
<artifactId>jansi-core</artifactId>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<excludes>**/*.class</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<goals>
<goal>add-source</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<goals>
<goal>add-resource</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<resources>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<showWarnings>true</showWarnings>
<fork>true</fork>
<skipSource>true</skipSource>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<excludes>
<exclude>**/ffm/*.java</exclude>
</excludes>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>jdk21</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<includes>
<include>**/ffm/*.java</include>
</includes>
<release>21</release>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
Expand All @@ -220,10 +61,35 @@
<instructions>
<Main-Class>org.jline.jansi.AnsiMain</Main-Class>
<Automatic-Module-Name>${automatic.module.name}</Automatic-Module-Name>
<Export-Package>*;-noimport:=true</Export-Package>
<Import-Package>sun.misc;resolution:=optional,*</Import-Package>
<Export-Package>org.jline*;-noimport:=true</Export-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
<createSourcesJar>true</createSourcesJar>
<createDependencyReducedPom>true</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Loading

0 comments on commit fb35df1

Please sign in to comment.