private void generateHFile (FileDescriptor file) throws Exception { String className = getFullyQualifiedClassName(file); String command = "javah -classpath " + classpath + " -o " + jniDir.path() + "/" + className + ".h " + className; Process process = Runtime.getRuntime().exec(command); process.waitFor(); if (process.exitValue() != 0) { System.out.println(); System.out.println("Command: " + command); InputStream errorStream = process.getErrorStream(); int c = 0; while ((c = errorStream.read()) != -1) { System.out.print((char)c); } } }
private void generateHFile (FileDescriptor file) throws Exception { String className = getFullyQualifiedClassName(file); String command = "javah -classpath " + classpath + " -o " + jniDir.path() + "/" + className + ".h " + className; Process process = Runtime.getRuntime().exec(command); process.waitFor(); if (process.exitValue() != 0) { System.out.println(); System.out.println("Command: " + command); InputStream errorStream = process.getErrorStream(); int c = 0; while ((c = errorStream.read()) != -1) { System.out.print((char)c); } } }
private String getLibsDirectory (BuildConfig config, BuildTarget target) { String targetName = target.osFileName; if (targetName == null) targetName = target.os.toString().toLowerCase() + (target.is64Bit ? "64" : "32"); return config.libsDir.child(targetName).path().replace('\\', '/'); }
private String getLibsDirectory (BuildConfig config, BuildTarget target) { String targetName = target.osFileName; if (targetName == null) targetName = target.os.toString().toLowerCase() + (target.is64Bit ? "64" : "32"); return config.libsDir.child(targetName).path().replace('\\', '/'); }
private void gatherSourceFiles (FileDescriptor file, String[] includes, String[] excludes, ArrayList<FileDescriptor> files) { String fileName = file.path().replace('\\', '/'); if (file.isDirectory()) { if (match(fileName, excludes)) return; for (FileDescriptor child : file.list()) { gatherSourceFiles(child, includes, excludes, files); } } else { if (match(fileName, includes) && !match(fileName, excludes)) files.add(file); } }
private void gatherSourceFiles (FileDescriptor file, String[] includes, String[] excludes, ArrayList<FileDescriptor> files) { String fileName = file.path().replace('\\', '/'); if (file.isDirectory()) { if (match(fileName, excludes)) return; for (FileDescriptor child : file.list()) { gatherSourceFiles(child, includes, excludes, files); } } else { if (match(fileName, includes) && !match(fileName, excludes)) files.add(file); } }
for (FileDescriptor file : files) { if (file.isDirectory()) { if (file.path().contains(".svn")) continue; if (excludes != null && matcher.match(file.path(), excludes)) continue; processDirectory(file); } else { if (file.extension().equals("java")) { if (file.name().contains("NativeCodeGenerator")) continue; if (includes != null && !matcher.match(file.path(), includes)) continue; if (excludes != null && matcher.match(file.path(), excludes)) continue; String className = getFullyQualifiedClassName(file); FileDescriptor hFile = new FileDescriptor(jniDir.path() + "/" + className + ".h"); FileDescriptor cppFile = new FileDescriptor(jniDir + "/" + className + ".cpp"); if (file.lastModified() < cppFile.lastModified()) { System.out.println("C/C++ for '" + file.path() + "' up to date"); continue;
for (FileDescriptor file : files) { if (file.isDirectory()) { if (file.path().contains(".svn")) continue; if (excludes != null && matcher.match(file.path(), excludes)) continue; processDirectory(file); } else { if (file.extension().equals("java")) { if (file.name().contains("NativeCodeGenerator")) continue; if (includes != null && !matcher.match(file.path(), includes)) continue; if (excludes != null && matcher.match(file.path(), excludes)) continue; String className = getFullyQualifiedClassName(file); FileDescriptor hFile = new FileDescriptor(jniDir.path() + "/" + className + ".h"); FileDescriptor cppFile = new FileDescriptor(jniDir + "/" + className + ".cpp"); if (file.lastModified() < cppFile.lastModified()) { System.out.println("C/C++ for '" + file.path() + "' up to date"); continue;
template = template.replace("%buildDir%", config.buildDir.child(targetFolder).path().replace('\\', '/')); template = template.replace("%libsDir%", "../" + getLibsDirectory(config, target)); template = template.replace("%libName%", libName);
template = template.replace("%buildDir%", config.buildDir.child(targetFolder).path().replace('\\', '/')); template = template.replace("%libsDir%", "../" + getLibsDirectory(config, target)); template = template.replace("%libName%", libName);
for (int i = 0; i < files.size(); i++) { if (i > 0) srcFiles.append("\t"); srcFiles.append(files.get(i).path().replace('\\', '/').replace(config.jniDir.toString() + "/", "")); if (i < files.size() - 1) srcFiles.append("\\\n");
for (int i = 0; i < files.size(); i++) { if (i > 0) srcFiles.append("\t"); srcFiles.append(files.get(i).path().replace('\\', '/').replace(config.jniDir.toString() + "/", "")); if (i < files.size() - 1) srcFiles.append("\\\n");
copyJniHeaders(config.jniDir.path()); libsDirs.add("../" + libsDir.path().replace('\\', '/')); template = template.replace("<clean/>", clean.toString()); template = template.replace("<compile/>", compile.toString()); template = template.replace("%packFile%", "../" + config.libsDir.path().replace('\\', '/') + "/" + config.sharedLibName + "-natives.jar"); template = template.replace("<pack/>", pack);
copyJniHeaders(config.jniDir.path()); libsDirs.add("../" + libsDir.path().replace('\\', '/')); template = template.replace("<clean/>", clean.toString()); template = template.replace("<compile/>", compile.toString()); template = template.replace("%packFile%", "../" + config.libsDir.path().replace('\\', '/') + "/" + config.sharedLibName + "-natives.jar"); template = template.replace("<pack/>", pack);
private void generateHFile (FileDescriptor file) throws Exception { String className = getFullyQualifiedClassName(file); String command = "javah -classpath " + classpath + " -o " + jniDir.path() + "/" + className + ".h " + className; Process process = Runtime.getRuntime().exec(command); process.waitFor(); if (process.exitValue() != 0) { System.out.println(); System.out.println("Command: " + command); InputStream errorStream = process.getErrorStream(); int c = 0; while ((c = errorStream.read()) != -1) { System.out.print((char)c); } } }
private String getLibsDirectory (BuildConfig config, BuildTarget target) { String targetName = target.osFileName; if (targetName == null) targetName = target.os.toString().toLowerCase() + (target.is64Bit ? "64" : "32"); return config.libsDir.child(targetName).path().replace('\\', '/'); }
private void gatherSourceFiles (FileDescriptor file, String[] includes, String[] excludes, ArrayList<FileDescriptor> files) { String fileName = file.path().replace('\\', '/'); if (file.isDirectory()) { if (match(fileName, excludes)) return; for (FileDescriptor child : file.list()) { gatherSourceFiles(child, includes, excludes, files); } } else { if (match(fileName, includes) && !match(fileName, excludes)) files.add(file); } }