Exemple #1
0
 public void compileYrl(
     final IProject project,
     final BuildResource resource,
     final IBackend b,
     final OtpErlangList compilerOptions) {
   final IRpcFuture res = startCompileYrl(project, resource.getResource(), b, compilerOptions);
   if (res == null) {
     ErlLogger.warn(
         "error compiling yrl file: " + resource.getResource().getProjectRelativePath());
     return;
   }
   try {
     completeCompile(project, resource.getResource(), res.get(), b, compilerOptions);
   } catch (final RpcException e) {
     ErlLogger.warn(e);
   }
 }
Exemple #2
0
  public IRpcFuture startCompileErl(
      final IProject project,
      final BuildResource bres,
      final String outputDir0,
      final IBackend backend,
      final OtpErlangList compilerOptions,
      final boolean force) {
    final IPath projectPath = project.getLocation();
    final IResource res = bres.getResource();
    final String s = res.getFileExtension();
    if (!"erl".equals(s)) {
      ErlLogger.warn("trying to compile " + res.getName() + "?!?!");
    }

    MarkerUtils.deleteMarkers(res);

    String outputDir;
    outputDir = getRealOutputDir(bres, outputDir0, projectPath);

    final Collection<IPath> includeDirs = getAllIncludeDirs(project);

    // delete beam file
    final IPath beamPath = getBeamForErl(res);
    final IResource beam = project.findMember(beamPath);

    try {
      final boolean shouldCompile = force || shouldCompile(project, res, beam);

      if (shouldCompile) {
        if (beam != null) {
          try {
            beam.delete(true, null);
          } catch (final Exception e) {
            ErlLogger.warn(e);
          }
        }
        if (isDebugging()) {
          ErlLogger.debug("compiling %s", res.getName());
        }

        createTaskMarkers(project, res);
        return InternalErlideBuilder.compileErl(
            backend, res.getLocation(), outputDir, includeDirs, compilerOptions);

      } else {
        return null;
      }
    } catch (final Exception e) {
      ErlLogger.warn(e);
      return null;
    }
  }
Exemple #3
0
 private String getRealOutputDir(
     final BuildResource bres, final String outputDir0, final IPath projectPath) {
   String outputDir;
   final String bout = bres.getOutput();
   if (bout == null) {
     outputDir = projectPath.append(outputDir0).toString();
   } else {
     outputDir =
         bout.startsWith("/") || bout.charAt(1) == ':'
             ? bout
             : projectPath.append(bout).toString();
   }
   ensureDirExists(outputDir);
   return outputDir;
 }