Permalink
Browse files

Hudson: build the Windows jar to work around the JNA/MediaInfo callin…

…g-convention bug that crashes the JVM
  • Loading branch information...
1 parent 576c912 commit 9c54893b269b0cfac9fd7733b5d3af0a61ea4d22 @chocolateboy chocolateboy committed May 25, 2013
Showing with 110 additions and 45 deletions.
  1. +107 −45 pom.xml
  2. +3 −0 src/main/java/net/pms/dlna/MediaInfo.java
View
152 pom.xml
@@ -77,12 +77,13 @@
<project.version.short>1.82.0</project.version.short>
<!--
- JNA 3.4.0 solves issue #1152, but causes a bug in Windows.
- The version is therefore overruled in the Windows profile.
- This property should be removed when Windows can use the
- same version.
+ XXX we currently need to use an old version of JNA
+ for Windows builds to work around a bug in
+ JNA > 3.2.5. See here for more details:
+ https://code.google.com/p/ps3mediaserver/issues/detail?id=1152
-->
- <default-jna-version>3.4.0</default-jna-version>
+ <jna-version-posix>3.4.0</jna-version-posix>
+ <jna-version-windows>3.2.5</jna-version-windows>
<cuelib-version>1.2.1-2008-06-13</cuelib-version>
<jgoodies-common-version>1.2.1</jgoodies-common-version>
@@ -108,6 +109,13 @@
<maven-javadoc-plugin-version>2.9</maven-javadoc-plugin-version>
<git-commit-id-plugin-version>2.1.4</git-commit-id-plugin-version>
+
+ <!--
+ use the Windows makensis.exe for Windows builds unless
+ the system makensis is explicitly selected via the
+ system-makensis profile
+ -->
+ <makensis-bin>${project.external-resources}/third-party/nsis/makensis.exe</makensis-bin>
</properties>
<pluginRepositories>
@@ -931,34 +939,14 @@
</build>
<profiles>
- <!-- settings for Windows build environments -->
- <profile>
- <id>build-platform-windows</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- <os>
- <family>windows</family>
- </os>
- </activation>
-
- <properties>
- <!-- use the bundled makensis.exe on Windows -->
- <makensis-bin>${project.external-resources}/third-party/nsis/makensis.exe</makensis-bin>
- </properties>
- </profile>
-
- <!-- settings for POSIX build environments -->
<profile>
- <id>build-platform-posix</id>
+ <id>system-makensis</id>
<activation>
- <activeByDefault>true</activeByDefault>
- <os>
- <family>!windows</family>
- </os>
+ <activeByDefault>false</activeByDefault>
</activation>
<properties>
- <!-- use the system makensis on Linux, Mac OS X &c. -->
+ <!-- if selected, use the system makensis on Linux, Mac OS X &c. -->
<makensis-bin>makensis</makensis-bin>
</properties>
</profile>
@@ -975,14 +963,6 @@
</os>
</activation>
- <properties>
- <!--
- Last known JNA version known not to cause a Java crash
- when browsing folders with files in them on Windows.
- -->
- <jna-version>3.2.5</jna-version>
- </properties>
-
<pluginRepositories>
<pluginRepository>
<id>Codehaus Snapshots</id>
@@ -1000,7 +980,7 @@
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
- <version>${jna-version}</version>
+ <version>${jna-version-windows}</version>
</dependency>
</dependencies>
@@ -1223,18 +1203,19 @@
-->
<profile>
<id>linux</id>
+ <!--
+ this setting does the right thing on Linux
+ and is needed for the Hudson profile to work
+ -->
<activation>
- <activeByDefault>false</activeByDefault>
- <os>
- <family>unix</family>
- </os>
+ <activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
- <version>${default-jna-version}</version>
+ <version>${jna-version-posix}</version>
</dependency>
</dependencies>
@@ -1335,7 +1316,6 @@
</build>
</profile>
-
<!--
Mac OSX profile: takes care of building the final package for Mac OSX
-->
@@ -1352,7 +1332,7 @@
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
- <version>${default-jna-version}</version>
+ <version>${jna-version-posix}</version>
</dependency>
</dependencies>
@@ -1521,6 +1501,89 @@
</profile>
<!--
+ Hudson (windows-jar): minimal profile that builds pms.jar with the
+ Windows JNA. The POSIX JNA causes snapshot builds to crash the JVM on
+ Windows, whereas the Windows JNA only disables MediaInfo for Ubuntu
+ users, who can still use ffmpeg.
+
+ Another difference from the other profiles is that we don't download the
+ binaries or build the tarball.
+ -->
+ <profile>
+ <id>windows-jar</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>env.HUDSON_URL</name>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>jna</artifactId>
+ <version>${jna-version-windows}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- Plugin to assemble a jar with dependencies -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <id>make-jar-with-dependencies-win</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>${project.basedir}/src/main/assembly/jar-with-dependencies.xml</descriptor>
+ </descriptors>
+ <archive>
+ <manifest>
+ <mainClass>net.pms.PMS</mainClass>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries> <!-- see above for documentation -->
+ </manifest>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ Use the antrun plugin to: copy the
+ pms-x.x.x-jar-with-dependencies.jar to pms.jar
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>copy-jar-with-dependencies-linux</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <copy file="${project.basedir}/target/${project.artifactId}-${project.version}-jar-with-dependencies.jar"
+ tofile="${project.basedir}/target/pms.jar" overwrite="true" />
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
This profile allows running PMS from inside Eclipse
(Requires a "mvn clean package" to download the binaries first)
-->
@@ -1551,4 +1614,3 @@
</profiles>
</project>
-
@@ -58,6 +58,9 @@
}
}
+ // XXX Note: none of JNA's 3 calling conventions
+ // (ALT_CONVENTION, C_CONVENTION, STDCALL_CONVENTION)
+ // work with MediaInfo.dll when JNA > 3.2.5.
// Internal stuff
interface MediaInfoDLL_Internal extends Library {
MediaInfoDLL_Internal INSTANCE = (MediaInfoDLL_Internal) Native.loadLibrary(

1 comment on commit 9c54893

@Raptor399
Member

Nice work on getting CI to build cross-platform jars! 👍

Please sign in to comment.