コード例 #1
0
ファイル: BuilderHelper.java プロジェクト: sergeyzsg/erlide
  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;
    }
  }
コード例 #2
0
ファイル: BuilderHelper.java プロジェクト: sergeyzsg/erlide
  public IRpcFuture startCompileYrl(
      final IProject project,
      final IResource resource,
      final IBackend backend,
      final OtpErlangList compilerOptions) {
    // final IPath projectPath = project.getLocation();
    // final OldErlangProjectProperties prefs = new
    // OldErlangProjectProperties(project);

    MarkerUtils.deleteMarkers(resource);
    // try {
    // resource.deleteMarkers(PROBLEM_MARKER, true,
    // IResource.DEPTH_INFINITE);
    // } catch (final CoreException e1) {
    // }

    final IPath erl = getErlForYrl(resource);
    final IResource br = project.findMember(erl);

    // we should check timestamps, but yrl files are rare, so it doesn't
    // matter much

    try {
      if (br != null && br.exists()) {
        try {
          br.delete(true, null);
        } catch (final Exception e) {
          ErlLogger.warn(e);
        }
      }

      final String input = resource.getLocation().toString();
      final String output = resource.getLocation().removeFileExtension().toString();
      return InternalErlideBuilder.compileYrl(backend, input, output);
    } catch (final Exception e) {
      e.printStackTrace();
      return null;
    }
  }