protected void writeLibraryInterface(Result result, SourceFiles sourceFiles, DeclarationsHolder interf, String library, Identifier javaPackage) throws IOException { Identifier fullLibraryClassName = interf.getResolvedJavaIdentifier(); Signatures signatures = result.getSignaturesForOutputClass(fullLibraryClassName); if (interf instanceof Struct) { interf = result.notifyBeforeWritingClass(fullLibraryClassName, (Struct) interf, signatures, library); if (interf != null) { final PrintWriter out = result.classOutputter.getClassSourceWriter(fullLibraryClassName.toString()); //out.println("///\n/// This file was autogenerated by JNAerator (http://jnaerator.googlecode.com/), \n/// a tool written by Olivier Chafik (http://ochafik.com/).\n///"); result.printJavaClass(javaPackage, (Struct) interf, out); out.close(); } } else if (interf instanceof SourceFile) { SourceFile sourceFile = (SourceFile) interf; String sourcePath = sourceFile.getElementFile(); assert sourcePath != null; final PrintWriter out = result.classOutputter.getSourceWriter(sourcePath); //out.println("///\n/// This file was autogenerated by JNAerator (http://jnaerator.googlecode.com/), \n/// a tool written by Olivier Chafik (http://ochafik.com/).\n///"); out.print(sourceFile); out.close(); } } }
protected void writeLibraryInterface(Result result, SourceFiles sourceFiles, DeclarationsHolder interf, String library, Identifier javaPackage) throws IOException { Identifier fullLibraryClassName = interf.getResolvedJavaIdentifier(); Signatures signatures = result.getSignaturesForOutputClass(fullLibraryClassName); if (interf instanceof Struct) { interf = result.notifyBeforeWritingClass(fullLibraryClassName, (Struct) interf, signatures, library); if (interf != null) { final PrintWriter out = result.classOutputter.getClassSourceWriter(fullLibraryClassName.toString()); //out.println("///\n/// This file was autogenerated by JNAerator (http://jnaerator.googlecode.com/), \n/// a tool written by Olivier Chafik (http://ochafik.com/).\n///"); result.printJavaClass(javaPackage, (Struct) interf, out); out.close(); } } else if (interf instanceof SourceFile) { SourceFile sourceFile = (SourceFile) interf; String sourcePath = sourceFile.getElementFile(); assert sourcePath != null; final PrintWriter out = result.classOutputter.getSourceWriter(sourcePath); //out.println("///\n/// This file was autogenerated by JNAerator (http://jnaerator.googlecode.com/), \n/// a tool written by Olivier Chafik (http://ochafik.com/).\n///"); out.print(sourceFile); out.close(); } } }
String rawSrcFilePath = new File(sourceFile.getElementFile()).getCanonicalPath(); String srcFilePath = result.config.relativizeFileForSourceComments(rawSrcFilePath); File srcFile = new File(srcFilePath);
if (sourceFile.getElementFile() == null) sourceFile.setElementFile(getFile());