当前位置: 首页>>代码示例>>Java>>正文


Java ProgressMessage类代码示例

本文整理汇总了Java中org.jetbrains.jps.incremental.messages.ProgressMessage的典型用法代码示例。如果您正苦于以下问题:Java ProgressMessage类的具体用法?Java ProgressMessage怎么用?Java ProgressMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProgressMessage类属于org.jetbrains.jps.incremental.messages包,在下文中一共展示了ProgressMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildJars

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
public boolean buildJars() throws IOException, ProjectBuildException {
  myContext.processMessage(new ProgressMessage("Building archives..."));

  final JarInfo[] sortedJars = sortJars();
  if (sortedJars == null) {
    return false;
  }

  myBuiltJars = new HashMap<JarInfo, File>();
  try {
    for (JarInfo jar : sortedJars) {
      myContext.checkCanceled();
      buildJar(jar);
    }

    myContext.processMessage(new ProgressMessage("Copying archives..."));
    copyJars();
  }
  finally {
    deleteTemporaryJars();
  }


  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JarsBuilder.java

示例2: writeToDisk

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private void writeToDisk(@NotNull OutputFileObject fileObject, boolean isTemp) throws IOException {
  myContext.processMessage(new ProgressMessage("Writing classes... " + myChunkName));

  final File file = fileObject.getFile();
  final BinaryContent content = fileObject.getContent();
  if (content == null) {
    throw new IOException("Missing content for file " + file);
  }

  content.saveToFile(file);

  final File source = fileObject.getSourceFile();
  if (!isTemp && source != null) {
    mySuccessfullyCompiled.add(source);
    //final String className = fileObject.getClassName();
    //if (className != null) {
    //  myContext.processMessage(new ProgressMessage("Compiled " + className));
    //}
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:OutputFilesSink.java

示例3: createProgressListener

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private TeaVMProgressListener createProgressListener(CompileContext context) {
    return new TeaVMProgressListener() {
        private TeaVMPhase currentPhase;
        int expectedCount;

        @Override
        public TeaVMProgressFeedback phaseStarted(TeaVMPhase phase, int count) {
            expectedCount = count;
            context.processMessage(new ProgressMessage(phaseName(phase), 0));
            currentPhase = phase;
            return context.getCancelStatus().isCanceled() ? TeaVMProgressFeedback.CANCEL
                    : TeaVMProgressFeedback.CONTINUE;
        }

        @Override
        public TeaVMProgressFeedback progressReached(int progress) {
            context.processMessage(new ProgressMessage(phaseName(currentPhase), (float) progress / expectedCount));
            return context.getCancelStatus().isCanceled() ? TeaVMProgressFeedback.CANCEL
                    : TeaVMProgressFeedback.CONTINUE;
        }
    };
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:23,代码来源:TeaVMBuild.java

示例4: copyResource

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private static void copyResource(CompileContext context, ResourceRootDescriptor rd, File file, BuildOutputConsumer outputConsumer) throws IOException {
  final File outputRoot = rd.getTarget().getOutputDir();
  if (outputRoot == null) {
    return;
  }
  final String sourceRootPath = FileUtil.toSystemIndependentName(rd.getRootFile().getAbsolutePath());
  final String relativePath = FileUtil.getRelativePath(sourceRootPath, FileUtil.toSystemIndependentName(file.getPath()), '/');
  final String prefix = rd.getPackagePrefix();

  final StringBuilder targetPath = new StringBuilder();
  targetPath.append(FileUtil.toSystemIndependentName(outputRoot.getPath()));
  if (prefix.length() > 0) {
    targetPath.append('/').append(prefix.replace('.', '/'));
  }
  targetPath.append('/').append(relativePath);

  context.processMessage(new ProgressMessage("Copying resources... [" + rd.getTarget().getModule().getName() + "]"));

  final String outputPath = targetPath.toString();
  final File targetFile = new File(outputPath);
  FileUtil.copyContent(file, targetFile);
  try {
    outputConsumer.registerOutputFile(targetFile, Collections.singletonList(file.getPath()));
  }
  catch (Exception e) {
    context.processMessage(new CompilerMessage(BUILDER_NAME, e));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ResourcesBuilder.java

示例5: runArtifactTasks

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private static void runArtifactTasks(CompileContext context, JpsArtifact artifact, ArtifactBuildTaskProvider.ArtifactBuildPhase phase)
  throws ProjectBuildException {
  for (ArtifactBuildTaskProvider provider : JpsServiceManager.getInstance().getExtensions(ArtifactBuildTaskProvider.class)) {
    List<? extends BuildTask> tasks = provider.createArtifactBuildTasks(artifact, phase);
    if (!tasks.isEmpty()) {
      context.processMessage(new ProgressMessage("Running " + phase.getPresentableName() + " tasks for '" + artifact.getName() + "' artifact..."));
      for (BuildTask task : tasks) {
        task.build(context);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:IncArtifactBuilder.java

示例6: build

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
@Override
public final ExitCode build(CompileContext context, ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, OutputConsumer outputConsumer) throws ProjectBuildException, IOException {
  if (outputConsumer.getCompiledClasses().isEmpty() || !isEnabled(context, chunk)) {
    return ExitCode.NOTHING_DONE;
  }

  final String progress = getProgressMessage();
  final boolean shouldShowProgress = !StringUtil.isEmptyOrSpaces(progress);
  if (shouldShowProgress) {
    context.processMessage(new ProgressMessage(progress + " [" + chunk.getPresentableShortName() + "]"));
  }

  ExitCode exitCode = ExitCode.NOTHING_DONE;
  try {
    InstrumentationClassFinder finder = CLASS_FINDER.get(context); // try using shared finder
    if (finder == null) {
      final Collection<File> platformCp = ProjectPaths.getPlatformCompilationClasspath(chunk, false);
      final Collection<File> classpath = new ArrayList<File>();
      classpath.addAll(ProjectPaths.getCompilationClasspath(chunk, false));
      classpath.addAll(ProjectPaths.getSourceRootsWithDependents(chunk).keySet());

      finder = createInstrumentationClassFinder(platformCp, classpath, outputConsumer);
      CLASS_FINDER.set(context, finder);
    }

    exitCode = performBuild(context, chunk, finder, outputConsumer);
  }
  finally {
    if (shouldShowProgress) {
      context.processMessage(new ProgressMessage("")); // cleanup progress
    }
  }
  return exitCode;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:ClassProcessingBuilder.java

示例7: runBuild

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:carymrobbins,项目名称:intellij-haskforce,代码行数:17,代码来源:CabalBuilder.java

示例8: build

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
@Override
public final ExitCode build(CompileContext context, ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, OutputConsumer outputConsumer) throws ProjectBuildException, IOException {
  if (outputConsumer.getCompiledClasses().isEmpty() || !isEnabled(context, chunk)) {
    return ExitCode.NOTHING_DONE;
  }

  final String progress = getProgressMessage();
  final boolean shouldShowProgress = !StringUtil.isEmptyOrSpaces(progress);
  if (shouldShowProgress) {
    context.processMessage(new ProgressMessage(progress + " [" + chunk.getName() + "]"));
  }

  ExitCode exitCode = ExitCode.NOTHING_DONE;
  try {
    InstrumentationClassFinder finder = CLASS_FINDER.get(context); // try using shared finder
    if (finder == null) {
      final Collection<File> platformCp = ProjectPaths.getPlatformCompilationClasspath(chunk, false);
      final Collection<File> classpath = new ArrayList<File>();
      classpath.addAll(ProjectPaths.getCompilationClasspath(chunk, false));
      classpath.addAll(ProjectPaths.getSourceRootsWithDependents(chunk).keySet());

      finder = createInstrumentationClassFinder(platformCp, classpath, outputConsumer);
      CLASS_FINDER.set(context, finder);
    }

    exitCode = performBuild(context, chunk, finder, outputConsumer);
  }
  finally {
    if (shouldShowProgress) {
      context.processMessage(new ProgressMessage("")); // cleanup progress
    }
  }
  return exitCode;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:ClassProcessingBuilder.java

示例9: buildJar

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private void buildJar(final JarInfo jar) throws IOException {
  final String emptyArchiveMessage = "Archive '" + jar.getPresentableDestination() + "' doesn't contain files so it won't be created";
  if (jar.getContent().isEmpty()) {
    myContext.processMessage(new CompilerMessage(IncArtifactBuilder.BUILDER_NAME, BuildMessage.Kind.WARNING, emptyArchiveMessage));
    return;
  }

  myContext.processMessage(new ProgressMessage("Building " + jar.getPresentableDestination() + "..."));
  File jarFile = FileUtil.createTempFile("artifactCompiler", "tmp");
  myBuiltJars.put(jar, jarFile);

  FileUtil.createParentDirs(jarFile);
  final String targetJarPath = jar.getDestination().getOutputFilePath();
  List<String> packedFilePaths = new ArrayList<String>();
  Manifest manifest = loadManifest(jar, packedFilePaths);
  final JarOutputStream jarOutputStream = createJarOutputStream(jarFile, manifest);

  final THashSet<String> writtenPaths = new THashSet<String>();
  try {
    if (manifest != null) {
      writtenPaths.add(JarFile.MANIFEST_NAME);
    }

    for (Pair<String, Object> pair : jar.getContent()) {
      final String relativePath = pair.getFirst();
      if (pair.getSecond() instanceof ArtifactRootDescriptor) {
        final ArtifactRootDescriptor descriptor = (ArtifactRootDescriptor)pair.getSecond();
        final int rootIndex = descriptor.getRootIndex();
        if (descriptor instanceof FileBasedArtifactRootDescriptor) {
          addFileToJar(jarOutputStream, jarFile, descriptor.getRootFile(), descriptor.getFilter(), relativePath, targetJarPath, writtenPaths,
                       packedFilePaths, rootIndex);
        }
        else {
          final String filePath = FileUtil.toSystemIndependentName(descriptor.getRootFile().getAbsolutePath());
          packedFilePaths.add(filePath);
          myOutSrcMapping.appendData(targetJarPath, rootIndex, filePath);
          extractFileAndAddToJar(jarOutputStream, (JarBasedArtifactRootDescriptor)descriptor, relativePath, writtenPaths);
        }
      }
      else {
        JarInfo nestedJar = (JarInfo)pair.getSecond();
        File nestedJarFile = myBuiltJars.get(nestedJar);
        if (nestedJarFile != null) {
          addFileToJar(jarOutputStream, jarFile, nestedJarFile, SourceFileFilter.ALL, relativePath, targetJarPath, writtenPaths,
                       packedFilePaths, -1);
        }
        else {
          LOG.debug("nested JAR file " + relativePath + " for " + jar.getPresentableDestination() + " not found");
        }
      }
    }

    if (writtenPaths.isEmpty()) {
      myContext.processMessage(new CompilerMessage(IncArtifactBuilder.BUILDER_NAME, BuildMessage.Kind.WARNING, emptyArchiveMessage));
      return;
    }

    final ProjectBuilderLogger logger = myContext.getLoggingManager().getProjectBuilderLogger();
    if (logger.isEnabled()) {
      logger.logCompiledPaths(packedFilePaths, IncArtifactBuilder.BUILDER_NAME, "Packing files:");
    }
    myOutputConsumer.registerOutputFile(new File(targetJarPath), packedFilePaths);

  }
  finally {
    if (writtenPaths.isEmpty()) {
      try {
        jarOutputStream.close();
      }
      catch (IOException ignored) {
      }
      FileUtil.delete(jarFile);
      myBuiltJars.remove(jar);
    }
    else {
      jarOutputStream.close();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:80,代码来源:JarsBuilder.java

示例10: deleteOutdatedFiles

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private static void deleteOutdatedFiles(MultiMap<String, String> filesToDelete, CompileContext context,
                                        SourceToOutputMapping srcOutMapping,
                                        ArtifactOutputToSourceMapping outSrcMapping) throws IOException {
  if (filesToDelete.isEmpty()) return;

  context.processMessage(new ProgressMessage("Deleting outdated files..."));
  int notDeletedFilesCount = 0;
  final THashSet<String> notDeletedPaths = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
  final THashSet<String> deletedPaths = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);

  for (String filePath : filesToDelete.keySet()) {
    if (notDeletedPaths.contains(filePath)) {
      continue;
    }

    boolean deleted = deletedPaths.contains(filePath);
    if (!deleted) {
      deleted = FileUtil.delete(new File(filePath));
    }

    if (deleted) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Outdated output file deleted: " + filePath);
      }
      outSrcMapping.remove(filePath);
      deletedPaths.add(filePath);
      for (String sourcePath : filesToDelete.get(filePath)) {
        srcOutMapping.removeOutput(sourcePath, filePath);
      }
    }
    else {
      notDeletedPaths.add(filePath);
      if (notDeletedFilesCount++ > 50) {
        context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.WARNING, "Deletion of outdated files stopped because too many files cannot be deleted"));
        break;
      }
      context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.WARNING, "Cannot delete file '" + filePath + "'"));
    }
  }
  ProjectBuilderLogger logger = context.getLoggingManager().getProjectBuilderLogger();
  if (logger.isEnabled()) {
    logger.logDeletedFiles(deletedPaths);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:IncArtifactBuilder.java

示例11: doBuild

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private static boolean doBuild(CompileContext context, JpsModule module, BuildOutputConsumer outputConsumer) throws IOException {
  final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
  if (extension == null || !extension.isLibrary()) {
    return true;
  }

  File outputDir = AndroidJpsUtil.getDirectoryForIntermediateArtifacts(context, module);
  outputDir = AndroidJpsUtil.createDirIfNotExist(outputDir, context, BUILDER_NAME);
  if (outputDir == null) {
    return false;
  }

  final File classesDir = ProjectPaths.getModuleOutputDir(module, false);
  if (classesDir == null || !classesDir.isDirectory()) {
    return true;
  }
  final Set<String> subdirs = new HashSet<String>();
  AndroidJpsUtil.addSubdirectories(classesDir, subdirs);

  if (subdirs.size() > 0) {
    context.processMessage(new ProgressMessage(AndroidJpsBundle.message("android.jps.progress.library.packaging", module.getName())));
    final File outputJarFile = new File(outputDir, AndroidCommonUtils.CLASSES_JAR_FILE_NAME);
    final List<String> srcFiles;

    try {
      srcFiles = AndroidCommonUtils.packClassFilesIntoJar(ArrayUtil.EMPTY_STRING_ARRAY, ArrayUtil.toStringArray(subdirs), outputJarFile);
    }
    catch (IOException e) {
      AndroidJpsUtil.reportExceptionError(context, null, e, BUILDER_NAME);
      return false;
    }
    final AndroidBuildTestingManager testingManager = AndroidBuildTestingManager.getTestingManager();

    if (testingManager != null && outputJarFile.isFile()) {
      testingManager.getCommandExecutor().checkJarContent("library_package_jar", outputJarFile.getPath());
    }

    if (srcFiles.size() > 0) {
      outputConsumer.registerOutputFile(outputJarFile, srcFiles);
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:AndroidLibraryPackagingBuilder.java

示例12: runBuildConfigGeneration

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private static MyExitStatus runBuildConfigGeneration(@NotNull CompileContext context,
                                                     @NotNull Map<JpsModule, MyModuleData> moduleDataMap) throws IOException {
  boolean success = true;
  boolean didSomething = false;

  for (Map.Entry<JpsModule, MyModuleData> entry : moduleDataMap.entrySet()) {
    final JpsModule module = entry.getKey();
    final ModuleBuildTarget moduleTarget = new ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION);
    final AndroidBuildConfigStateStorage storage =
      context.getProjectDescriptor().dataManager.getStorage(
        moduleTarget, AndroidBuildConfigStateStorage.PROVIDER);

    final MyModuleData moduleData = entry.getValue();
    final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);

    final File generatedSourcesDir = AndroidJpsUtil.getGeneratedSourcesStorage(module, context.getProjectDescriptor().dataManager);
    final File outputDirectory = new File(generatedSourcesDir, AndroidJpsUtil.BUILD_CONFIG_GENERATED_SOURCE_ROOT_NAME);

    try {
      if (extension == null || isLibraryWithBadCircularDependency(extension)) {
        if (!clearDirectoryIfNotEmpty(outputDirectory, context, ANDROID_BUILD_CONFIG_GENERATOR)) {
          success = false;
        }
        continue;
      }
      final String packageName = moduleData.getPackage();
      final boolean debug = !AndroidJpsUtil.isReleaseBuild(context);
      final Set<String> libPackages = new HashSet<String>(getDepLibPackages(module).values());
      libPackages.remove(packageName);

      final AndroidBuildConfigState newState = new AndroidBuildConfigState(packageName, libPackages, debug);

      final AndroidBuildConfigState oldState = storage.getState(module.getName());
      if (newState.equalsTo(oldState)) {
        continue;
      }
      didSomething = true;
      context.processMessage(new ProgressMessage(AndroidJpsBundle.message("android.jps.progress.build.config", module.getName())));

      // clear directory, because it may contain obsolete files (ex. if package name was changed)
      if (!clearDirectory(outputDirectory, context, ANDROID_BUILD_CONFIG_GENERATOR)) {
        success = false;
        continue;
      }

      if (doBuildConfigGeneration(packageName, libPackages, debug, outputDirectory, context)) {
        storage.update(module.getName(), newState);
        markDirtyRecursively(outputDirectory, context, ANDROID_BUILD_CONFIG_GENERATOR, true);
      }
      else {
        storage.update(module.getName(), null);
        success = false;
      }
    }
    catch (IOException e) {
      AndroidJpsUtil.reportExceptionError(context, null, e, ANDROID_BUILD_CONFIG_GENERATOR);
      success = false;
    }
  }

  if (!success) {
    return MyExitStatus.FAIL;
  }
  else if (didSomething) {
    return MyExitStatus.OK;
  }
  return MyExitStatus.NOTHING_CHANGED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:69,代码来源:AndroidSourceGeneratingBuilder.java

示例13: runAidlCompiler

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private static boolean runAidlCompiler(@NotNull final CompileContext context,
                                       @NotNull Map<File, ModuleBuildTarget> files,
                                       @NotNull Map<JpsModule, MyModuleData> moduleDataMap) {
  if (files.size() > 0) {
    context.processMessage(new ProgressMessage(AndroidJpsBundle.message("android.jps.progress.aidl")));
  }

  boolean success = true;

  for (Map.Entry<File, ModuleBuildTarget> entry : files.entrySet()) {
    final File file = entry.getKey();
    final ModuleBuildTarget buildTarget = entry.getValue();
    final String filePath = file.getPath();

    final MyModuleData moduleData = moduleDataMap.get(buildTarget.getModule());

    if (!LOG.assertTrue(moduleData != null)) {
      context.processMessage(
        new CompilerMessage(ANDROID_IDL_COMPILER, BuildMessage.Kind.ERROR, AndroidJpsBundle.message("android.jps.internal.error")));
      success = false;
      continue;
    }
    final File generatedSourcesDir =
      AndroidJpsUtil.getGeneratedSourcesStorage(buildTarget.getModule(), context.getProjectDescriptor().dataManager);
    final File aidlOutputDirectory = new File(generatedSourcesDir, AndroidJpsUtil.AIDL_GENERATED_SOURCE_ROOT_NAME);

    if (!aidlOutputDirectory.exists() && !aidlOutputDirectory.mkdirs()) {
      context.processMessage(
        new CompilerMessage(ANDROID_IDL_COMPILER, BuildMessage.Kind.ERROR,
                            AndroidJpsBundle.message("android.jps.cannot.create.directory", aidlOutputDirectory.getPath())));
      success = false;
      continue;
    }

    final IAndroidTarget target = moduleData.getPlatform().getTarget();

    try {
      final File[] sourceRoots = AndroidJpsUtil.getSourceRootsForModuleAndDependencies(buildTarget.getModule());
      final String[] sourceRootPaths = AndroidJpsUtil.toPaths(sourceRoots);
      final String packageName = computePackageForFile(context, file);

      if (packageName == null) {
        context.processMessage(new CompilerMessage(ANDROID_IDL_COMPILER, BuildMessage.Kind.ERROR,
                                                   AndroidJpsBundle.message("android.jps.errors.cannot.compute.package", filePath)));
        success = false;
        continue;
      }

      final File outputFile = new File(aidlOutputDirectory, packageName.replace('.', File.separatorChar) +
                                                            File.separator + FileUtil.getNameWithoutExtension(file) + ".java");
      final String outputFilePath = outputFile.getPath();
      final Map<AndroidCompilerMessageKind, List<String>> messages =
        AndroidIdl.execute(target, filePath, outputFilePath, sourceRootPaths);

      addMessages(context, messages, filePath, ANDROID_IDL_COMPILER);

      if (messages.get(AndroidCompilerMessageKind.ERROR).size() > 0) {
        success = false;
      }
      else if (outputFile.exists()) {
        final SourceToOutputMapping sourceToOutputMap = context.getProjectDescriptor().dataManager.getSourceToOutputMap(buildTarget);
        sourceToOutputMap.setOutput(filePath, outputFilePath);
        FSOperations.markDirty(context, CompilationRound.CURRENT, outputFile);
      }
    }
    catch (final IOException e) {
      AndroidJpsUtil.reportExceptionError(context, filePath, e, ANDROID_IDL_COMPILER);
      success = false;
    }
  }
  return success;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:73,代码来源:AndroidSourceGeneratingBuilder.java

示例14: doBuild

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
private static boolean doBuild(final CompileContext context,
                               AndroidAarDepsBuildTarget target,
                               BuildOutputConsumer outputConsumer) {
  final JpsModule module = target.getModule();
  final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
  if (extension == null || extension.isLibrary()) {
    return true;
  }

  File outputDir = AndroidJpsUtil.getDirectoryForIntermediateArtifacts(context, module);
  outputDir = AndroidJpsUtil.createDirIfNotExist(outputDir, context, BUILDER_NAME);
  if (outputDir == null) {
    return false;
  }
  final List<String> srcJarFiles = new ArrayList<String>();

  for (BuildRootDescriptor descriptor : context.getProjectDescriptor().getBuildRootIndex().getTargetRoots(target, context)) {
    final File file = descriptor.getRootFile();

    if (file.exists()) {
      srcJarFiles.add(file.getPath());
    }
  }
  if (srcJarFiles.size() == 0) {
    return true;
  }
  context.processMessage(new ProgressMessage(AndroidJpsBundle.message(
    "android.jps.progress.aar.dependencies.packaging", module.getName())));

  File tempDir = null;

  try {
    tempDir = FileUtil.createTempDirectory("extracted_aar_deps", "tmp");

    for (int i = srcJarFiles.size() - 1; i >= 0; i--) {
      ZipUtil.extract(new File(srcJarFiles.get(i)), tempDir, null, true);
    }
    final File outputJarFile = new File(outputDir, AndroidCommonUtils.AAR_DEPS_JAR_FILE_NAME);

    if (!packDirectoryIntoJar(tempDir, outputJarFile, context)) {
      return false;
    }
    final AndroidBuildTestingManager testingManager = AndroidBuildTestingManager.getTestingManager();

    if (testingManager != null && outputJarFile.isFile()) {
      testingManager.getCommandExecutor().checkJarContent("aar_dependencies_package_jar", outputJarFile.getPath());
    }
    outputConsumer.registerOutputFile(outputJarFile, srcJarFiles);
    return true;
  }
  catch (IOException e) {
    AndroidJpsUtil.reportExceptionError(context, null, e, BUILDER_NAME);
    return false;
  }
  finally {
    if (tempDir != null) {
      FileUtil.delete(tempDir);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:AndroidAarDepsBuilder.java

示例15: build

import org.jetbrains.jps.incremental.messages.ProgressMessage; //导入依赖的package包/类
@Override
public ExitCode build(CompileContext context, ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, OutputConsumer outputConsumer) throws ProjectBuildException, IOException {
  final JpsProject project = context.getProjectDescriptor().getProject();
  final JpsUiDesignerConfiguration config = JpsUiDesignerExtensionService.getInstance().getOrCreateUiDesignerConfiguration(project);
  if (!config.isInstrumentClasses()) {
    return ExitCode.NOTHING_DONE;
  }

  final Map<File, Collection<File>> srcToForms = FORMS_TO_COMPILE.get(context);
  FORMS_TO_COMPILE.set(context, null);

  if (srcToForms == null || srcToForms.isEmpty()) {
    return ExitCode.NOTHING_DONE;
  }

  final Set<File> formsToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
  for (Collection<File> files : srcToForms.values()) {
    formsToCompile.addAll(files);
  }

  if (JavaBuilderUtil.isCompileJavaIncrementally(context)) {
    final ProjectBuilderLogger logger = context.getLoggingManager().getProjectBuilderLogger();
    if (logger.isEnabled()) {
      logger.logCompiledFiles(formsToCompile, getPresentableName(), "Compiling forms:");
    }
  }

  try {
    final Collection<File> platformCp = ProjectPaths.getPlatformCompilationClasspath(chunk, false);

    final List<File> classpath = new ArrayList<File>();
    classpath.addAll(ProjectPaths.getCompilationClasspath(chunk, false));
    classpath.add(getResourcePath(GridConstraints.class)); // forms_rt.jar
    final Map<File, String> chunkSourcePath = ProjectPaths.getSourceRootsWithDependents(chunk);
    classpath.addAll(chunkSourcePath.keySet()); // sourcepath for loading forms resources

    final InstrumentationClassFinder finder = ClassProcessingBuilder.createInstrumentationClassFinder(platformCp, classpath, outputConsumer);

    try {
      final Map<File, Collection<File>> processed = instrumentForms(context, chunk, chunkSourcePath, finder, formsToCompile, outputConsumer);

      final OneToManyPathsMapping sourceToFormMap = context.getProjectDescriptor().dataManager.getSourceToFormMap();

      for (Map.Entry<File, Collection<File>> entry : processed.entrySet()) {
        final File src = entry.getKey();
        final Collection<File> forms = entry.getValue();

        final Collection<String> formPaths = new ArrayList<String>(forms.size());
        for (File form : forms) {
          formPaths.add(form.getPath());
        }
        sourceToFormMap.update(src.getPath(), formPaths);
        srcToForms.remove(src);
      }
      // clean mapping
      for (File srcFile : srcToForms.keySet()) {
        sourceToFormMap.remove(srcFile.getPath());
      }
    }
    finally {
      finder.releaseResources();
    }
  }
  finally {
    context.processMessage(new ProgressMessage("Finished instrumenting forms [" + chunk.getPresentableShortName() + "]"));
  }

  return ExitCode.OK;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:70,代码来源:FormsInstrumenter.java


注:本文中的org.jetbrains.jps.incremental.messages.ProgressMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。