org.jetbrains.jps.incremental.messages.BuildMessage Java Examples
The following examples show how to use
org.jetbrains.jps.incremental.messages.BuildMessage.
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: CabalBuilder.java From intellij-haskforce with Apache License 2.0 | 6 votes |
/** * Runs cabal configure. */ private static boolean runConfigure(CompileContext context, JpsModule module, CabalJspInterface cabal) throws IOException, InterruptedException, ExecutionException { context.processMessage(new CompilerMessage("cabal", BuildMessage.Kind.INFO, "Start configure")); Process configureProcess = cabal.configure(); processOut(context, configureProcess, module); if (configureProcess.waitFor() != 0) { context.processMessage(new CompilerMessage( "cabal", BuildMessage.Kind.ERROR, "configure failed.")); return true; } return false; }
Example #2
Source File: CabalBuilder.java From intellij-haskforce with Apache License 2.0 | 6 votes |
/** * Runs cabal install --only-dependencies */ private static boolean runInstallDependencies(CompileContext context, JpsModule module, CabalJspInterface cabal) throws IOException, InterruptedException, ExecutionException { if (!installDependenciesRequired(cabal)) { return false; } context.processMessage(new CompilerMessage("cabal", BuildMessage.Kind.INFO, "Install dependencies")); Process installDependenciesProcess = cabal.installDependencies(); processOut(context, installDependenciesProcess, module, true); if (installDependenciesProcess.waitFor() != 0) { context.processMessage(new CompilerMessage( "cabal", BuildMessage.Kind.ERROR, "install dependencies failed.")); return true; } return false; }
Example #3
Source File: CabalBuilder.java From intellij-haskforce with Apache License 2.0 | 6 votes |
/** * Runs cabal sandbox init */ private static boolean runSandboxInit(CompileContext context, JpsModule module, CabalJspInterface cabal, File cabalFile) throws IOException, InterruptedException, ExecutionException { // If sandbox already exists, no need to run init - just bail out. if (new File(cabalFile.getParent(), "cabal.sandbox.config").isFile()) { return false; } context.processMessage(new CompilerMessage("cabal", BuildMessage.Kind.INFO, "Create sandbox")); Process sandboxProcess = cabal.sandboxInit(); if (sandboxProcess.waitFor() != 0) { context.processMessage(new CompilerMessage( "cabal", BuildMessage.Kind.ERROR, "sandbox init failed.")); return true; } return false; }
Example #4
Source File: CabalBuilder.java From intellij-haskforce with Apache License 2.0 | 5 votes |
/** * Runs cabal build. */ private static boolean runBuild(CompileContext context, JpsModule module, CabalJspInterface cabal) throws IOException, InterruptedException, ExecutionException { context.processMessage(new ProgressMessage("cabal build")); context.processMessage(new CompilerMessage("cabal", BuildMessage.Kind.INFO, "Start build")); Process buildProcess = cabal.build(); processOut(context, buildProcess, module); if (buildProcess.waitFor() != 0) { context.processMessage(new CompilerMessage("cabal", BuildMessage.Kind.ERROR, "build errors.")); return true; } return false; }
Example #5
Source File: ThriftBuilder.java From intellij-thrift with Apache License 2.0 | 5 votes |
private void compileFile(final CompileContext context, ModuleBuildTarget target, List<String> line, File source, File dir) throws StopBuildException { final JpsModule module = target.getModule(); List<String> cmdLine = new ArrayList<String>(line); cmdLine.add(source.getAbsolutePath()); StringBuilder cmdMessage = new StringBuilder(); for (String cmdPart : cmdLine) { cmdMessage.append(cmdPart).append(' '); } context.processMessage( new CompilerMessage(getPresentableName(), BuildMessage.Kind.INFO, cmdMessage.toString()) ); try { Process process = new ProcessBuilder() .command(cmdLine) .start(); BaseOSProcessHandler handler = new BaseOSProcessHandler(process, StringUtil.join(cmdLine, " "), CharsetToolkit.UTF8_CHARSET); final AtomicBoolean hasErrors = new AtomicBoolean(); handler.addProcessListener(new ThriftOutputConsumer(source.getAbsolutePath(), context, hasErrors, module, dir)); handler.startNotify(); handler.waitFor(); if (hasErrors.get()) { throw new StopBuildException(); } } catch (IOException e) { context.processMessage( new CompilerMessage(getPresentableName(), BuildMessage.Kind.ERROR, "Failed to translate files . Error: " + e.getMessage()) ); } }
Example #6
Source File: CabalBuilder.java From intellij-haskforce with Apache License 2.0 | 4 votes |
private static void processCabalError(final CompileContext context, final Exception e) { e.printStackTrace(); context.processMessage(new CompilerMessage("cabal", BuildMessage.Kind.ERROR, e.getMessage())); }
Example #7
Source File: ThriftBuilder.java From intellij-thrift with Apache License 2.0 | 4 votes |
@Override public ExitCode build(CompileContext context, ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, ModuleLevelBuilder.OutputConsumer outputConsumer) throws ProjectBuildException, IOException { ThriftConfig thriftConfig = ThriftConfig.getSettings(context.getProjectDescriptor().getProject()); final String compiler = thriftConfig.getCompilerPath(); final Map<ModuleBuildTarget, List<File>> toCompile = collectChangedFiles(dirtyFilesHolder); List<String> cmdLine = new ArrayList<String>(); cmdLine.add(compiler); if (thriftConfig.isNoWarn()) { cmdLine.add("-nowarn"); } if (thriftConfig.isStrict()) { cmdLine.add("-strict"); } if (thriftConfig.isVerbose()) { cmdLine.add("-verbose"); } if (thriftConfig.isRecurse()) { cmdLine.add("-recurse"); } if (thriftConfig.isDebug()) { cmdLine.add("-debug"); } if (thriftConfig.isAllowNegKeys()) { cmdLine.add("--allow-neg-keys"); } if (thriftConfig.isAllow64bitConsts()) { cmdLine.add("--allow-64bit-consts"); } for (Map.Entry<ModuleBuildTarget, List<File>> e : toCompile.entrySet()) { final ModuleBuildTarget target = e.getKey(); final JpsModule module = target.getModule(); ThriftCompilerOptions options = ThriftCompilerOptions.getSettings(module); final List<File> sourceFiles = e.getValue(); final List<Generator> generators = options.getGenerators(); if (generators.isEmpty()) { context.processMessage( new CompilerMessage( getPresentableName(), BuildMessage.Kind.WARNING, "No valid translators found for module " + module.getName() + ". Check facet configuration." ) ); continue; } List<String> moduleCmdLine = new ArrayList<String>(cmdLine); for (String include : options.getIncludes()) { moduleCmdLine.add("-I"); moduleCmdLine.add(include); } for (IGenerator g : generators) { List<String> genCmdLine = new ArrayList<String>(moduleCmdLine); genCmdLine.add("--gen"); genCmdLine.add(g.getOptionsString()); genCmdLine.add("-out"); final String path = new URL(g.getOutputDir()).getPath(); genCmdLine.add(path); final File targetDir = new File(path); if (options.isCleanOutput()) { try { FileUtils.cleanDirectory(targetDir); } catch (IOException ex) { context.processMessage( new CompilerMessage(getPresentableName(), BuildMessage.Kind.ERROR, "Failed to empty target directory: " + path + " . Error: " + ex.getMessage()) ); return ExitCode.ABORT; } } for (File source : sourceFiles) { compileFile(context, target, genCmdLine, source, targetDir); } } } return ExitCode.OK; }