DroidFish, CuckooChessEngine: Don't fork when building book files.

This makes the build work even if "java" is not in the path.
This commit is contained in:
Peter Osterlund 2016-11-12 16:41:41 +01:00
parent 1b35f9590e
commit 6996bead09
3 changed files with 14 additions and 11 deletions

View File

@ -2,8 +2,9 @@
<project default="build_binbook" name="Build assets/eco.dat"> <project default="build_binbook" name="Build assets/eco.dat">
<target name="build_binbook"> <target name="build_binbook">
<java classpath="bin" <java classpath="bin"
classname="chess.Book" classname="chess.Book">
fork="yes"> <arg value="${basedir}/src/book.txt"/>
<arg value="${basedir}/src/book.bin"/>
</java> </java>
</target> </target>
</project> </project>

View File

@ -19,6 +19,7 @@
package chess; package chess;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -188,8 +189,10 @@ public class Book {
/** Creates the book.bin file. */ /** Creates the book.bin file. */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
List<Byte> binBook = createBinBook(); String inFile = args[0];
FileOutputStream out = new FileOutputStream("src/book.bin"); String outFile = args[1];
List<Byte> binBook = createBinBook(inFile);
FileOutputStream out = new FileOutputStream(outFile);
int bookLen = binBook.size(); int bookLen = binBook.size();
byte[] binBookA = new byte[bookLen]; byte[] binBookA = new byte[bookLen];
for (int i = 0; i < bookLen; i++) for (int i = 0; i < bookLen; i++)
@ -197,11 +200,11 @@ public class Book {
out.write(binBookA); out.write(binBookA);
out.close(); out.close();
} }
public static List<Byte> createBinBook() { public static List<Byte> createBinBook(String inFileName) {
List<Byte> binBook = new ArrayList<Byte>(0); List<Byte> binBook = new ArrayList<Byte>(0);
try { try {
InputStream inStream = new Object().getClass().getResourceAsStream("/book.txt"); InputStream inStream = new FileInputStream(inFileName);
InputStreamReader inFile = new InputStreamReader(inStream); InputStreamReader inFile = new InputStreamReader(inStream);
BufferedReader inBuf = new BufferedReader(inFile); BufferedReader inBuf = new BufferedReader(inFile);
LineNumberReader lnr = new LineNumberReader(inBuf); LineNumberReader lnr = new LineNumberReader(inBuf);

View File

@ -2,10 +2,9 @@
<project default="build_eco" name="Build assets/eco.dat"> <project default="build_eco" name="Build assets/eco.dat">
<target name="build_eco"> <target name="build_eco">
<java classpath="bin/classes" <java classpath="bin/classes"
classname="org.petero.droidfish.buildtools.EcoBuilder" classname="org.petero.droidfish.buildtools.EcoBuilder">
fork="yes"> <arg value="${basedir}/src/org/petero/droidfish/buildtools/eco.pgn"/>
<arg value="src/org/petero/droidfish/buildtools/eco.pgn"/> <arg value="${basedir}/assets/eco.dat"/>
<arg value="assets/eco.dat"/>
</java> </java>
</target> </target>
</project> </project>