Java Code Examples for com.sun.tools.javac.main.Main#EXIT_OK
The following examples show how to use
com.sun.tools.javac.main.Main#EXIT_OK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompileHelper.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Nullable public static File buildJarAchieve(Context context, JavaProjectFolder projectFile, DiagnosticListener listener) throws IOException { int status = compileJava(context, projectFile, listener); if (status != Main.EXIT_OK) { throw new RuntimeException("Compile time error... Exit code(" + status + ")"); } //now create normal jar file Jar.createJarArchive(projectFile); return projectFile.getOutJarArchive(); }
Example 2
Source File: AndroidBuilder.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
public static void build(Context context, AndroidProjectFolder projectFile, @NonNull DiagnosticCollector diagnosticCollector) throws Exception { AndroidBuilder.extractLibrary(projectFile); //create R.java System.out.println("Run aidl"); AndroidBuilder.runAidl(projectFile); System.out.println("Run aapt"); AndroidBuilder.runAapt(context, projectFile); //compile java System.out.println("Compile Java file"); int status = CompileHelper.compileJava(context, projectFile, diagnosticCollector); System.gc(); if (status != Main.EXIT_OK) { System.out.println("Compile error"); throw new RuntimeException("Compile time error!"); } //classes to dex System.out.println("Convert classes to dex"); CompileHelper.convertToDexFormat(context, projectFile); //zip apk System.out.println("Build apk"); AndroidBuilder.buildApk(projectFile); System.out.println("Zip sign"); AndroidBuilder.zipSign(projectFile); System.out.println("Zip align"); AndroidBuilder.zipAlign(); System.out.println("Publish apk"); AndroidBuilder.publishApk(); }
Example 3
Source File: CompileJavaTask.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Override protected Integer doInBackground(JavaProjectFolder... params) { if (params[0] == null) return null; this.projectFile = params[0]; DiagnosticListener listener = new DiagnosticListener() { @Override public void report(Diagnostic diagnostic) { mDiagnostics.add(diagnostic); } }; //clean task projectFile.clean(); projectFile.createBuildDir(); int status = CompileHelper.compileJava(context, projectFile, listener); if (status == Main.EXIT_OK) { try { CompileHelper.convertToDexFormat(context, projectFile); } catch (Throwable e) { this.error = e; Log.e(TAG, "doInBackground: ", e); publishProgress(e.getMessage().toCharArray(), 0, e.getMessage().length()); status = Main.EXIT_ERROR; } } return status; }
Example 4
Source File: CompileJavaTask.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Override protected void onPostExecute(final Integer result) { super.onPostExecute(result); if (result != Main.EXIT_OK) { if (compileListener != null) compileListener.onError(error, mDiagnostics); } else { if (compileListener != null) compileListener.onComplete(projectFile, mDiagnostics); } }