Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ speed at which they compress/decompress/hash bytes.

Make sure you have a Java 7 installation in your [Maven toolchains.xml](https://maven.apache.org/guides/mini/guide-using-toolchains.html). You may also need a C compiler.

First run git submodule init and then git submodule update to initialize the lz4 submodule in src/lz4.

Then, run `./mvnw verify`.

Building a full artifact with native libraries for all supported platforms is more complex. We do this through github actions.
7 changes: 4 additions & 3 deletions lz4-java.bnd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Bundle-SymbolicName: lz4-java
Bundle-Name: LZ4 Java Compression
Bundle-Version:${ivy.revision}
Export-Package: net.jpountz.*;version:=${packages.version}

Bundle-Version: ${version_cleanup;${ivy.version}}
Export-Package: net.jpountz.*;version:=${version_cleanup;${packages.version}}
-noee: true
-removeheaders: Require-Capability
60 changes: 23 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
- Compile src/java, src/java-unsafe, and generated sources
- Include resources from src/resources
- Include native libraries by extracting them from the published 1.8.0 jar
- Wrap the jar with bnd 1.50.0 using lz4-java.bnd to match OSGi metadata
- Preserve Automatic-Module-Name: org.lz4.java

Note: We deliberately do the bnd wrapping after the regular jar build and overwrite the main artifact,
to keep the final jar identical in structure to the Ant "bundle" target output.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down Expand Up @@ -72,6 +68,11 @@
<native.cc>gcc</native.cc>
<native.cflags></native.cflags>
<native.ldflags></native.ldflags>

<!-- plugin versions -->
<bnd.maven.plugin.version>7.1.0</bnd.maven.plugin.version>
<packages.version>${project.version}</packages.version>
<ivy.version>${project.version}</ivy.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -214,13 +215,30 @@
<version>3.4.1</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>org.lz4.java</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>${bnd.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
<configuration>
<bndfile>lz4-java.bnd</bndfile>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
Expand All @@ -229,7 +247,7 @@
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bnd.ant</artifactId>
<version>7.1.0</version>
<version>${bnd.maven.plugin.version}</version>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
Expand Down Expand Up @@ -257,38 +275,6 @@
<goal>run</goal>
</goals>
</execution>
<!-- Use bndwrap for OSGi stuff that I don't understand. Could probably use maven-bundle-plugin here... -->
<execution>
<id>bnd-wrap-jar</id>
<phase>package</phase>
<configuration>
<target>
<!-- Set properties used by lz4-java.bnd -->
<property name="packages.version" value="${project.version}"/>
<property name="ivy.revision" value="${project.version}"/>
<property name="-noextraheaders" value="true"/>
<property name="-reproducible" value="true"/>

<!-- Define bnd ant task from plugin dependency -->
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpathref="maven.plugin.classpath"/>

<!-- Wrap the plain jar into the final OSGi bundle -->
<bndwrap definitions="${project.basedir}"
output="${project.build.directory}/${project.build.finalName}-wrapped.jar"
trace="true">
<fileset dir="${project.build.directory}" includes="${project.build.finalName}.jar"/>
</bndwrap>

<!-- Replace the original jar with the wrapped one (as in Ant: delete plain jar) -->
<delete file="${project.build.directory}/${project.build.finalName}.jar"/>
<move file="${project.build.directory}/${project.build.finalName}-wrapped.jar"
tofile="${project.build.directory}/${project.build.finalName}.jar"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
Expand Down