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


Java CompileContext.processMessage方法代码示例

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


在下文中一共展示了CompileContext.processMessage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: instrument

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的package包/类
@Override
@Nullable
protected BinaryContent instrument(CompileContext context,
                                   CompiledClass compiledClass,
                                   ClassReader reader,
                                   ClassWriter writer,
                                   InstrumentationClassFinder finder) {
  try {
    if (NotNullVerifyingInstrumenter.processClassFile(reader, writer)) {
      return new BinaryContent(writer.toByteArray());
    }
  }
  catch (Throwable e) {
    final StringBuilder msg = new StringBuilder();
    msg.append("@NotNull instrumentation failed ");
    final File sourceFile = compiledClass.getSourceFile();
    msg.append(" for ").append(sourceFile.getName());
    msg.append(": ").append(e.getMessage());
    context.processMessage(new CompilerMessage(getPresentableName(), BuildMessage.Kind.ERROR, msg.toString(), sourceFile.getPath()));
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:NotNullInstrumentingBuilder.java

示例2: copyFile

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的package包/类
public void copyFile(File file, Ref<File> targetFileRef, ResourceRootConfiguration rootConfiguration, CompileContext context,
                     FileFilter filteringFilter) throws IOException {
  boolean shouldFilter = rootConfiguration.isFiltered && !rootConfiguration.filters.isEmpty() && filteringFilter.accept(file);
  if (shouldFilter && file.length() > FILTERING_SIZE_LIMIT) {
    context.processMessage(new CompilerMessage(
      GradleResourcesBuilder.BUILDER_NAME, BuildMessage.Kind.WARNING,
      "File is too big to be filtered. Most likely it is a binary file and should be excluded from filtering", file.getPath())
    );
    shouldFilter = false;
  }
  if (shouldFilter) {
    copyWithFiltering(file, targetFileRef, rootConfiguration.filters, context);
  }
  else {
    FileUtil.copyContent(file, targetFileRef.get());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GradleResourceFileProcessor.java

示例3: copyFile

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的package包/类
public void copyFile(File file, File targetFile, ResourceRootConfiguration rootConfiguration, CompileContext context,
                     FileFilter filteringFilter) throws IOException {
  boolean shouldFilter = rootConfiguration.isFiltered && !myFilteringExcludedExtensions.contains(FileUtilRt.getExtension(file.getName()))
                         && filteringFilter.accept(file);
  if (shouldFilter && file.length() > FILTERING_SIZE_LIMIT) {
    context.processMessage(new CompilerMessage("MavenResources", BuildMessage.Kind.WARNING,
                                               "File is too big to be filtered. Most likely it is a binary file and should be excluded from filtering",
                                               file.getPath()));
    shouldFilter = false;
  }
  if (shouldFilter) {
    copyWithFiltering(file, targetFile);
  }
  else {
    FileUtil.copyContent(file, targetFile);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenResourceFileProcessor.java

示例4: instrument

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的package包/类
@Nullable
@Override
protected BinaryContent instrument(CompileContext context, CompiledClass compiled, ClassReader reader, ClassWriter writer, InstrumentationClassFinder finder) {
  final JpsIntelliLangConfiguration config =
    JpsIntelliLangExtensionService.getInstance().getConfiguration(context.getProjectDescriptor().getModel().getGlobal());
  final PatternInstrumenter instrumenter =
    new PatternInstrumenter(config.getPatternAnnotationClass(), writer, config.getInstrumentationType(), finder);
  try {
    reader.accept(instrumenter, 0);
    if (instrumenter.instrumented()) {
      return new BinaryContent(writer.toByteArray());
    }
  }
  catch (InstrumentationException e) {
    context.processMessage(new CompilerMessage(getPresentableName(), BuildMessage.Kind.ERROR, e.getMessage()));
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PatternValidatorBuilder.java

示例5: build

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的package包/类
@Override
public void build(CompileContext context) throws ProjectBuildException {
  final Set<JpsSdk<?>> sdks = context.getProjectDescriptor().getProjectJavaSdks();
  JpsSdk javaSdk = null;
  for (JpsSdk<?> sdk : sdks) {
    final JpsSdkType<? extends JpsElement> sdkType = sdk.getSdkType();
    if (sdkType instanceof JpsJavaSdkType) {
      javaSdk = sdk;
      break;
    }
  }
  if (javaSdk == null) {
    context.processMessage(new CompilerMessage(COMPILER_NAME, BuildMessage.Kind.ERROR, "Java version 7 or higher is required to build JavaFX package"));
    return;
  }
  new JpsJavaFxPackager(myProps, context, myArtifact).buildJavaFxArtifact(javaSdk.getHomePath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JpsJavaFxArtifactBuildTaskProvider.java

示例6: copyResource

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的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

示例7: checkUnsupportedModules

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的package包/类
private static void checkUnsupportedModules(JpsProject project, CompileContext context) {
  for (JpsTypedModule<JpsDummyElement> module : project.getModules(JpsJavaModuleType.INSTANCE)) {
    if (AndroidGradleJps.getGradleSystemExtension(module) == null) {
      context.processMessage(
        AndroidGradleJps.createCompilerMessage(BuildMessage.Kind.WARNING, "module '" + module.getName() + "' won't be compiled. " +
                                                                          "Unfortunately you can't have non-Gradle Java module and Android-Gradle module in one project."));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AndroidGradleTargetBuilder.java

示例8: getJavaExecutable

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的package包/类
@Nullable
private static String getJavaExecutable(@NotNull AndroidPlatform platform, @NotNull CompileContext context, @NotNull String builderName) {
  final JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> sdk = platform.getSdk();
  final String jdkName = sdk.getSdkProperties().getData().getJdkName();
  final JpsLibrary javaSdk = context.getProjectDescriptor().getModel().getGlobal().getLibraryCollection().findLibrary(jdkName);
  if (javaSdk == null || !javaSdk.getType().equals(JpsJavaSdkType.INSTANCE)) {
    context.processMessage(new CompilerMessage(builderName, BuildMessage.Kind.ERROR,
                                               AndroidJpsBundle.message("android.jps.errors.java.sdk.not.specified", jdkName)));
    return null;
  }
  return JpsJavaSdkType.getJavaExecutable((JpsSdk<?>)javaSdk.getProperties());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidDexBuilder.java

示例9: doBuild

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的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

示例10: doBuild

import org.jetbrains.jps.incremental.CompileContext; //导入方法依赖的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


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