Package org.jetbrains.jps.incremental.messages

Examples of org.jetbrains.jps.incremental.messages.CompilerMessage


    if (isDebugRunner ^ myDebugBuilder) {
      return false;
    }
    final JpsHaxeModuleSettings moduleSettings = JpsHaxeUtil.getModuleSettings(module);
    if (moduleSettings == null) {
      context.processMessage(new CompilerMessage(
        BUILDER_NAME, BuildMessage.Kind.ERROR, "can't find module settings for " + module.getName())
      );
      return false;
    }
    final JpsSdk<JpsHaxeSdkAdditionalData> jpsSdk = module.getSdk(JpsHaxeSdkType.INSTANCE);
    if (jpsSdk == null) {
      context.processMessage(new CompilerMessage(
        BUILDER_NAME, BuildMessage.Kind.ERROR, "can't find module sdk for " + module.getName())
      );
      return false;
    }

    context.processMessage(new ProgressMessage(HaxeCommonBundle.message("haxe.module.compilation.progress.message", module.getName())));

    boolean compiled = HaxeCommonCompilerUtil.compile(new HaxeCommonCompilerUtil.CompilationContext() {
      private String myErrorRoot;

      @NotNull
      @Override
      public HaxeModuleSettingsBase getModuleSettings() {
        return moduleSettings;
      }

      @Override
      public String getModuleName() {
        return module.getName();
      }

      @Override
      public void errorHandler(String message) {
        context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, message));
      }

      @Override
      public void log(String message) {
        LOG.debug(message);
      }

      @Override
      public boolean isDebug() {
        return isDebugRunner;
      }

      @Override
      public String getSdkHomePath() {
        return jpsSdk.getHomePath();
      }

      @Override
      public String getHaxelibPath() {
        return jpsSdk.getSdkProperties().getHaxelibPath();
      }

      @Override
      public String getSdkName() {
        return jpsSdk.getVersionString();
      }

      @Override
      public List<String> getSourceRoots() {
        return ContainerUtil.map(module.getSourceRoots(), new Function<JpsModuleSourceRoot, String>() {
          @Override
          public String fun(JpsModuleSourceRoot root) {
            return JpsPathUtil.urlToPath(root.getUrl());
          }
        });
      }

      @Override
      public String getCompileOutputPath() {
        final String outputRootUrl = JpsJavaExtensionService.getInstance().getOutputUrl(module, false);
        return JpsPathUtil.urlToPath(outputRootUrl);
      }

      @Override
      public void setErrorRoot(String root) {
        myErrorRoot = root;
      }

      @Override
      public String getErrorRoot() {
        return (myErrorRoot != null) ? myErrorRoot : getWorkingDirectoryPath();
      }

      @Override
      public void handleOutput(String[] lines) {
        /*for (String error : lines) {
          final HaxeCompilerError compilerError = HaxeCompilerError.create(StringUtil.notNullize(getErrorRoot()), error);
          context.processMessage(new CompilerMessage(
            BUILDER_NAME,
            BuildMessage.Kind.WARNING,
            compilerError != null ? compilerError.getErrorMessage() : error,
            compilerError != null ? compilerError.getPath() : null,
            -1L, -1L, -1L,
            compilerError != null ? (long)compilerError.getLine() : -1L,
            compilerError != null ? (long)compilerError.getColumn() : -1L
          ));
        }*/
      }

      @Override
      public String getModuleDirPath() {
        return getWorkingDirectoryPath();
      }

      @Nullable
      public String getWorkingDirectoryPath() {
        final File baseDirectory = JpsModelSerializationDataService.getBaseDirectory(module);
        return baseDirectory != null ? baseDirectory.getPath() : null;
      }
    });

    if (!compiled) {
      context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, "compilation failed"));
    }

    return compiled;
  }
View Full Code Here


  @Override
  public void warning(@NotNull String message, @Nullable Throwable t, @Nullable String sourcePath) {
    LOG.warn(message, t);
    if (sourcePath == null) sourcePath = mySourceToReport;
    myContext.processMessage(new CompilerMessage(OsmorcBuilder.ID, BuildMessage.Kind.WARNING, myMessagePrefix + message, sourcePath));
  }
View Full Code Here

  @Override
  public void error(@NotNull String message, @Nullable Throwable t, @Nullable String sourcePath) {
    LOG.warn(message, t);
    if (sourcePath == null) sourcePath = mySourceToReport;
    myContext.processMessage(new CompilerMessage(OsmorcBuilder.ID, BuildMessage.Kind.ERROR, myMessagePrefix + message, sourcePath));
  }
View Full Code Here

        else {
          writeToDisk(fileObject);
        }
      }
      catch (IOException e) {
        myContext.processMessage(new CompilerMessage(JAVAC_COMPILER_NAME, BuildMessage.Kind.ERROR, e.getMessage()));
      }
    }
View Full Code Here

      for (OutputFileObject file : myUnsavedFiles) {
        try {
          writeToDisk(file);
        }
        catch (IOException e) {
          myContext.processMessage(new CompilerMessage(JAVAC_COMPILER_NAME, BuildMessage.Kind.ERROR, e.getMessage()));
        }
      }
    }
View Full Code Here

    final Map<String, File> class2form = new HashMap<String, File>();

    for (File formFile : formsToInstrument) {
      final File outputDir = findOutputDir(formFile, outs);
      if (outputDir == null) {
        context.processMessage(new CompilerMessage(JavaBuilder.JAVAC_COMPILER_NAME, BuildMessage.Kind.ERROR, "No output directory found for the form", formFile.getAbsolutePath()));
        continue;
      }
      final LwRootContainer rootContainer;
      try {
        rootContainer = Utils.getRootContainer(formFile.toURI().toURL(), new CompiledClassPropertiesProvider(loader.getLoader()));
View Full Code Here

    public DiagnosticSink(CompileContext context) {
      myContext = context;
    }

    public void outputLineAvailable(String line) {
      myContext.processMessage(new CompilerMessage(JAVAC_COMPILER_NAME, BuildMessage.Kind.INFO, line));
    }
View Full Code Here

        srcPath = FileUtil.toSystemIndependentName(new File(source.toUri()).getPath());
      }
      else {
        srcPath = null;
      }
      myContext.processMessage(new CompilerMessage(
        JAVAC_COMPILER_NAME, kind, diagnostic.getMessage(Locale.US), srcPath,
        diagnostic.getStartPosition(), diagnostic.getEndPosition(), diagnostic.getPosition(),
        diagnostic.getLineNumber(), diagnostic.getColumnNumber()
      ));
    }
View Full Code Here

              try {
                context.processMessage(new ProgressMessage("Copying " + file.getPath()));
                copyResource(context, module, file, sourceRoot);
              }
              catch (IOException e) {
                context.processMessage(new CompilerMessage("Resource Compiler", BuildMessage.Kind.ERROR, e.getMessage(), FileUtil.toSystemIndependentName(file.getPath())));
                return false;
              }
              tsStorage.saveStamp(file);
            }
          }
View Full Code Here

  public void onTextAvailable(@NotNull ProcessEvent event, Key outputType) {
    ErlangCompilerError error = ErlangCompilerError.create(myCompileTargetRootPath, event.getText());
    if (error != null) {
      boolean isError = error.getCategory() == CompilerMessageCategory.ERROR;
      BuildMessage.Kind kind = isError ? BuildMessage.Kind.ERROR : BuildMessage.Kind.WARNING;
      CompilerMessage msg = new CompilerMessage(myBuilderName, kind, error.getErrorMessage(),
        VirtualFileManager.extractPath(error.getUrl()), -1, -1, -1, error.getLine(), -1);
      myContext.processMessage(msg);
    }
  }
View Full Code Here

TOP

Related Classes of org.jetbrains.jps.incremental.messages.CompilerMessage

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.