forcefull check of version match when building

This commit is contained in:
Brian Matzon 2010-04-12 23:22:08 +00:00
parent d31d965aaf
commit ed4ff0e1dc
2 changed files with 82 additions and 0 deletions

View File

@ -315,6 +315,29 @@
</echo>
</target>
<macrodef name="version-check">
<attribute name="platform"/>
<sequential>
<java classname="org.lwjgl.test.NativeTest" logError="false" resultproperty="nativetest.res" outputproperty="nativetest.out" errorproperty="nativetest.err" fork="true">
<jvmarg value="-Djava.library.path=libs/@{platform}"/>
<classpath>
<pathelement path="${lwjgl.bin}"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<fail message="Unable to load native library: ${nativetest.err}">
<condition>
<not>
<equals arg1="OK" arg2="${nativetest.out}"/>
</not>
</condition>
</fail>
<echo message="Successfully executed NativeTest"/>
</sequential>
</macrodef>
<!-- Compiles the Java source code -->
<target name="compile" description="Compiles the java source code" depends="-initialize">
<javac debug="yes" destdir="${lwjgl.bin}" source="1.4" target="1.4" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
@ -359,6 +382,7 @@
<copy todir="${lwjgl.lib}/windows">
<fileset dir="${lwjgl.bin}/lwjgl" includes="lwjgl*.dll"/>
</copy>
<version-check platform="windows"/>
</target>
<!-- Compiles LWJGL on Linux platforms -->
@ -367,6 +391,7 @@
<copy todir="${lwjgl.lib}/linux">
<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
</copy>
<version-check platform="linux"/>
</target>
<!-- Compiles LWJGL on solaris platforms -->
@ -376,12 +401,14 @@
<copy todir="${lwjgl.lib}/solaris">
<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
</copy>
<version-check platform="solaris"/>
</target>
<!-- Compiles LWJGL on Mac platforms -->
<target name="-compile_native_macosx" if="lwjgl.platform.macosx">
<ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/lwjgl/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/>
<version-check platform="macosx"/>
</target>
<target name="repack200" description="Pack200-repack a jar file">

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2002-2010 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.lwjgl.test;
import org.lwjgl.Sys;
/**
* <br>
* Simple test that just checks that the native library loads
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision: 2983 $
* $Id: SysTest.java 2983 2008-04-07 18:36:09Z matzon $
*/
public class NativeTest {
/**
* Entry point for test
*
* @param args ignored
*/
public static void main(String[] args) {
Sys.getVersion();
System.out.println("OK");
}
}