Package com.google.gxp.compiler.fs

Examples of com.google.gxp.compiler.fs.JavaFileManagerImpl


    // compile java
    DiagnosticCollector<JavaFileObject> diagnosticCollector
        = new DiagnosticCollector<JavaFileObject>();

    JavaFileManager javaFileManager
        = new JavaFileManagerImpl(javaCompiler.getStandardFileManager(diagnosticCollector,
                                                                      Locale.US,
                                                                      Charsets.US_ASCII),
                                  outFs);
    String className = classBase + compilationVersion;

    try {
      JavaFileObject compilationUnit = javaFileManager.getJavaFileForInput(
          StandardLocation.SOURCE_PATH, className, JavaFileObject.Kind.SOURCE);

      Iterable<JavaFileObject> compilationUnits = ImmutableList.of(compilationUnit);

      javaCompiler.getTask(null, javaFileManager, diagnosticCollector,
                           null, null, compilationUnits).call();

      List<Diagnostic<? extends JavaFileObject>> diagnostics =
          filterErrors(diagnosticCollector.getDiagnostics());

      if (!diagnostics.isEmpty()) {
        throw new GxpCompilationException.Java(diagnostics);
      }

      List<byte[]> classFiles = Lists.newArrayList();
      for (FileRef fileRef : outFs.getManifest()) {
        if (fileRef.getKind().equals(JavaFileObject.Kind.CLASS)) {
          String outputClassName = javaFileManager.inferBinaryName(StandardLocation.CLASS_OUTPUT,
                                                                   new JavaFileRef(fileRef));
          if (outputClassName.equals(className) || outputClassName.startsWith(className + "$")) {
            classFiles.add(ByteStreams.toByteArray(fileRef.openInputStream()));
          }
        }
View Full Code Here


    // compile java
    DiagnosticCollector<JavaFileObject> diagnosticCollector
        = new DiagnosticCollector<JavaFileObject>();

    JavaFileManager javaFileManager
        = new JavaFileManagerImpl(SYSTEM_JAVA_COMPILER.getStandardFileManager(diagnosticCollector,
                                                                              Locale.US,
                                                                              Charsets.US_ASCII),
                                  fs);

    JavaFileObject compilationUnit = javaFileManager.getJavaFileForInput(
        StandardLocation.SOURCE_PATH, className, Kind.SOURCE);

    Iterable<JavaFileObject> compilationUnits = Collections.singleton(compilationUnit);

    SYSTEM_JAVA_COMPILER.getTask(null, javaFileManager, diagnosticCollector,
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.fs.JavaFileManagerImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.