/** Writes the specified string to the file using the default charset. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throw RuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * FileType#Internal file, or if it could not be written. */ public void writeString (String string, boolean append) { writeString(string, append, null); }
/** Writes the specified string to the file using the default charset. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throw RuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * FileType#Internal file, or if it could not be written. */ public void writeString (String string, boolean append) { writeString(string, append, null); }
application.writeString(new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/Application.mk.template", FileType.Classpath).readString(), false); template = template.replace("%srcFiles%", srcFiles); config.jniDir.child("Android.mk").writeString(template, false);
application.writeString(new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/Application.mk.template", FileType.Classpath).readString(), false); template = template.replace("%srcFiles%", srcFiles); config.jniDir.child("Android.mk").writeString(template, false);
config.jniDir.child(buildFileName).writeString(buildFile, false); System.out.println("Wrote target '" + target.os + (target.is64Bit ? "64" : "") + "' build script '" + config.jniDir.child(buildFileName) + "'"); template = template.replace("<pack/>", pack); config.jniDir.child("build.xml").writeString(template, false); System.out.println("Wrote master build script '" + config.jniDir.child("build.xml") + "'");
config.jniDir.child(buildFileName).writeString(buildFile, false); System.out.println("Wrote target '" + target.os + (target.is64Bit ? "64" : "") + "' build script '" + config.jniDir.child(buildFileName) + "'"); template = template.replace("<pack/>", pack); config.jniDir.child("build.xml").writeString(template, false); System.out.println("Wrote master build script '" + config.jniDir.child("build.xml") + "'");
private void generateCppFile (ArrayList<JavaSegment> javaSegments, FileDescriptor hFile, FileDescriptor cppFile) throws Exception { String headerFileContent = hFile.readString(); ArrayList<CMethod> cMethods = cMethodParser.parse(headerFileContent).getMethods(); StringBuffer buffer = new StringBuffer(); emitHeaderInclude(buffer, hFile.name()); for (JavaSegment segment : javaSegments) { if (segment instanceof JniSection) { emitJniSection(buffer, (JniSection)segment); } if (segment instanceof JavaMethod) { JavaMethod javaMethod = (JavaMethod)segment; if (javaMethod.getNativeCode() == null) { throw new RuntimeException("Method '" + javaMethod.getName() + "' has no body"); } CMethod cMethod = findCMethod(javaMethod, cMethods); if (cMethod == null) throw new RuntimeException("Couldn't find C method for Java method '" + javaMethod.getClassName() + "#" + javaMethod.getName() + "'"); emitJavaMethod(buffer, javaMethod, cMethod); } } cppFile.writeString(buffer.toString(), false, "UTF-8"); }
private void generateCppFile (ArrayList<JavaSegment> javaSegments, FileDescriptor hFile, FileDescriptor cppFile) throws Exception { String headerFileContent = hFile.readString(); ArrayList<CMethod> cMethods = cMethodParser.parse(headerFileContent).getMethods(); StringBuffer buffer = new StringBuffer(); emitHeaderInclude(buffer, hFile.name()); for (JavaSegment segment : javaSegments) { if (segment instanceof JniSection) { emitJniSection(buffer, (JniSection)segment); } if (segment instanceof JavaMethod) { JavaMethod javaMethod = (JavaMethod)segment; if (javaMethod.getNativeCode() == null) { throw new RuntimeException("Method '" + javaMethod.getName() + "' has no body"); } CMethod cMethod = findCMethod(javaMethod, cMethods); if (cMethod == null) throw new RuntimeException("Couldn't find C method for Java method '" + javaMethod.getClassName() + "#" + javaMethod.getName() + "'"); emitJavaMethod(buffer, javaMethod, cMethod); } } cppFile.writeString(buffer.toString(), false, "UTF-8"); }
/** Writes the specified string to the file using the default charset. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throw RuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * FileType#Internal file, or if it could not be written. */ public void writeString (String string, boolean append) { writeString(string, append, null); }
application.writeString(new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/Application.mk.template", FileType.Classpath).readString(), false); template = template.replace("%srcFiles%", srcFiles); config.jniDir.child("Android.mk").writeString(template, false);
config.jniDir.child(buildFileName).writeString(buildFile, false); System.out.println("Wrote target '" + target.os + (target.is64Bit ? "64" : "") + "' build script '" + config.jniDir.child(buildFileName) + "'"); template = template.replace("<pack/>", pack); config.jniDir.child("build.xml").writeString(template, false); System.out.println("Wrote master build script '" + config.jniDir.child("build.xml") + "'");
private void generateCppFile (ArrayList<JavaSegment> javaSegments, FileDescriptor hFile, FileDescriptor cppFile) throws Exception { String headerFileContent = hFile.readString(); ArrayList<CMethod> cMethods = cMethodParser.parse(headerFileContent).getMethods(); StringBuffer buffer = new StringBuffer(); emitHeaderInclude(buffer, hFile.name()); for (JavaSegment segment : javaSegments) { if (segment instanceof JniSection) { emitJniSection(buffer, (JniSection)segment); } if (segment instanceof JavaMethod) { JavaMethod javaMethod = (JavaMethod)segment; if (javaMethod.getNativeCode() == null) { throw new RuntimeException("Method '" + javaMethod.getName() + "' has no body"); } CMethod cMethod = findCMethod(javaMethod, cMethods); if (cMethod == null) throw new RuntimeException("Couldn't find C method for Java method '" + javaMethod.getClassName() + "#" + javaMethod.getName() + "'"); emitJavaMethod(buffer, javaMethod, cMethod); } } cppFile.writeString(buffer.toString(), false, "UTF-8"); }