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">
<target name="build_binbook">
<java classpath="bin"
classname="chess.Book"
fork="yes">
classname="chess.Book">
<arg value="${basedir}/src/book.txt"/>
<arg value="${basedir}/src/book.bin"/>
</java>
</target>
</project>

View File

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

View File

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