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


Java CompileScope.getAffectedModules方法代码示例

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


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

示例1: getBuildTargetScopes

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
@NotNull
@Override
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter,
                                                       @NotNull Project project, boolean forceBuild) {
  List<String> pluginArtifactTargetIds = new ArrayList<String>();
  for (Module module : baseScope.getAffectedModules()) {
    if (PluginModuleType.isOfType(module)) {
      pluginArtifactTargetIds.add(module.getName()+":plugin");
    }
  }

  if (pluginArtifactTargetIds.isEmpty()) {
    return Collections.emptyList();
  }
  return Collections.singletonList(CmdlineProtoUtil.createTargetsScope(ArtifactBuildTargetType.INSTANCE.getTypeId(), pluginArtifactTargetIds, forceBuild));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PluginModuleBuildScopeProvider.java

示例2: isProGuardUsed

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
private static boolean isProGuardUsed(@NotNull Project project, @NotNull CompileScope scope) {
  for (Module module : scope.getAffectedModules()) {
    final AndroidFacet facet = AndroidFacet.getInstance(module);

    if (facet != null && facet.getProperties().RUN_PROGUARD) {
      return true;
    }
  }
  final String proguardCfgPathsStr = scope.getUserData(AndroidCompileUtil.PROGUARD_CFG_PATHS_KEY);
  if (proguardCfgPathsStr != null && proguardCfgPathsStr.length() > 0) {
    return true;
  }
  final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, scope, false);

  for (Artifact artifact : artifacts) {
    if (artifact.getArtifactType() instanceof AndroidApplicationArtifactType) {
      final ArtifactProperties<?> properties = artifact.getProperties(AndroidArtifactPropertiesProvider.getInstance());

      if (properties instanceof AndroidApplicationArtifactProperties) {
        final AndroidApplicationArtifactProperties p = (AndroidApplicationArtifactProperties)properties;

        if (p.isRunProGuard()) {
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:AndroidBuildTargetScopeProvider.java

示例3: getBuildTargetScopes

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public List<TargetTypeBuildScope> getBuildTargetScopes(
        final CompileScope baseScope,
        @SuppressWarnings("deprecation") final CompilerFilter filter,
        final Project project,
        final boolean forceBuild) {

    // Does any of the modules in the project have the Metaborg facet?
    if (!ProjectFacetManager.getInstance(project).hasFacets(MetaborgFacet.ID)) {
        // No, therefore we will not mess with the build.
        return Collections.emptyList();
    }

    // Gather the target IDs (module names) of the target modules.
    final List<String> targetIds = new ArrayList<>();
    for (final Module module : baseScope.getAffectedModules()) {
        final MetaborgFacet facet = MetaborgFacet.getInstance(module);
        if (facet == null) continue;

        targetIds.add(module.getName());
    }

    // Create a new TargetTypeBuildScope that uses the specified target type to build the target modules.
    return Collections.singletonList(
            CmdlineProtoUtil.createTargetsScope(TargetTypeConstants.PostTargetType, targetIds, forceBuild)
    );
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:31,代码来源:SpoofaxBuildTargetScopeProvider.java

示例4: getModulesToCompile

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
private static List<Module> getModulesToCompile(CompileScope scope) {
    final List<Module> result = new ArrayList<>();
    for (final Module module : scope.getAffectedModules()) {
        if (ModuleType.get(module) != NimModuleType.getInstance()) continue;
        result.add(module);
    }
    return result;
}
 
开发者ID:rokups,项目名称:intelli-nim,代码行数:9,代码来源:NimCompileTask.java

示例5: getModulesToCompile

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
private static List<Module> getModulesToCompile(CompileScope scope)
{
	final List<Module> result = new ArrayList<Module>();
	for(final Module module : scope.getAffectedModules())
	{
		if(ModuleUtilCore.getExtension(module, HaxeModuleExtension.class) == null)
		{
			continue;
		}
		result.add(module);
	}
	return result;
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:14,代码来源:HaxeCompiler.java

示例6: validateConfiguration

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
@Override
public boolean validateConfiguration(CompileScope compileScope)
{
	for(Module module : compileScope.getAffectedModules())
	{
		DotNetModuleExtension extension = ModuleUtilCore.getExtension(module, DotNetModuleExtension.class);
		if(extension != null && extension.getSdk() == null)
		{
			throw new IllegalArgumentException("Sdk for module " + module.getName() + " cant be empty");
		}
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:14,代码来源:DotNetDependencyCopier.java

示例7: validateConfiguration

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
@Override
public boolean validateConfiguration(CompileScope compileScope)
{
	for(Module module : compileScope.getAffectedModules())
	{
		DotNetModuleExtension extension = ModuleUtilCore.getExtension(module, DotNetModuleExtension.class);
		if(extension != null && extension.getSdk() == null && extension.isSupportCompilation())
		{
			throw new IllegalArgumentException("SDK for module " + module.getName() + " cant be empty");
		}
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:14,代码来源:DotNetCompiler.java

示例8: getBuildTargetScopes

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
@NotNull
@Override
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter,
                                                       @NotNull Project project, boolean forceBuild) {
  if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID) || Projects.isGradleProject(project)) {
    return Collections.emptyList();
  }
  final List<String> appTargetIds = new ArrayList<String>();
  final List<String> libTargetIds = new ArrayList<String>();
  final List<String> allTargetIds = new ArrayList<String>();
  final List<String> manifestMergingTargetIds = new ArrayList<String>();
  final boolean fullBuild = AndroidCompileUtil.isFullBuild(baseScope);

  for (Module module : baseScope.getAffectedModules()) {
    final AndroidFacet facet = AndroidFacet.getInstance(module);

    if (facet == null) {
      continue;
    }
    allTargetIds.add(module.getName());

    if (fullBuild) {
      if (facet.isLibraryProject()) {
        libTargetIds.add(module.getName());
      }
      else {
        if (facet.getProperties().ENABLE_MANIFEST_MERGING) {
          manifestMergingTargetIds.add(module.getName());
        }
        appTargetIds.add(module.getName());
      }
    }
  }
  final List<TargetTypeBuildScope> result = new ArrayList<TargetTypeBuildScope>();
  result.add(CmdlineProtoUtil.createTargetsScope(
    AndroidCommonUtils.MANIFEST_MERGING_BUILD_TARGET_TYPE_ID, manifestMergingTargetIds, forceBuild));

  if (fullBuild && !isProGuardUsed(project, baseScope)) {
    result.add(CmdlineProtoUtil.createTargetsScope(
      AndroidCommonUtils.PRE_DEX_BUILD_TARGET_TYPE_ID, Collections.singletonList("only"), forceBuild));
  }
  result.addAll(Arrays.asList(
    CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.AAR_DEPS_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild),
    CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.DEX_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild),
    CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.RESOURCE_CACHING_BUILD_TARGET_ID, allTargetIds, forceBuild),
    CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.RESOURCE_PACKAGING_BUILD_TARGET_ID, appTargetIds, forceBuild),
    CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.PACKAGING_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild),
    CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.LIBRARY_PACKAGING_BUILD_TARGET_ID, libTargetIds, forceBuild)));
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:AndroidBuildTargetScopeProvider.java

示例9: checkCompiler

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
public boolean checkCompiler(final CompileScope scope) {
  final Module[] modules = scope.getAffectedModules();
  final Set<Sdk> checkedJdks = new HashSet<Sdk>();
  for (final Module module : modules) {
    final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();
    if (jdk == null || checkedJdks.contains(jdk)) {
      continue;
    }
    checkedJdks.add(jdk);
    final SdkTypeId sdkType = jdk.getSdkType();
    if (!(sdkType instanceof JavaSdkType)) {
      continue;
    }
    final VirtualFile homeDirectory = jdk.getHomeDirectory();
    if (homeDirectory == null) {
      //noinspection DialogTitleCapitalization
      Messages.showMessageDialog(
          myProject,
          ErrorProneIdeaBundle.jdkHomeNotFoundMessage(jdk),
          ErrorProneIdeaBundle.compilerName(),
          Messages.getErrorIcon()
      );
      return false;
    }
    final String vmExecutablePath = ((JavaSdkType)sdkType).getVMExecutablePath(jdk);
    if (vmExecutablePath == null) {
      Messages.showMessageDialog(
          myProject,
          ErrorProneIdeaBundle.message("error-prone.error.vm.executable.missing", jdk.getName()),
          ErrorProneIdeaBundle.compilerName(),
          Messages.getErrorIcon()
      );
      return false;
    }
    final String toolsJarPath = ((JavaSdkType)sdkType).getToolsPath(jdk);
    if (toolsJarPath == null) {
      Messages.showMessageDialog(
          myProject,
          ErrorProneIdeaBundle.message("error-prone.error.tools.jar.missing", jdk.getName()),
          ErrorProneIdeaBundle.compilerName(),
          Messages.getErrorIcon()
      );
      return false;
    }
    final String versionString = jdk.getVersionString();
    if (versionString == null) {
      Messages.showMessageDialog(
          myProject,
          ErrorProneIdeaBundle.message("error-prone.error.unknown.jdk.version", jdk.getName()),
          ErrorProneIdeaBundle.compilerName(),
          Messages.getErrorIcon()
      );
      return false;
    }

    if (CompilerUtil.isOfVersion(versionString, "1.0")) {
      Messages.showMessageDialog(
          myProject,
          ErrorProneIdeaBundle.message("error-prone.error.1_0_compilation.not.supported"),
          ErrorProneIdeaBundle.compilerName(),
          Messages.getErrorIcon()
      );
      return false;
    }
  }

  return true;
}
 
开发者ID:diy1,项目名称:error-prone-aspirator,代码行数:69,代码来源:ErrorProneIdeaCompiler.java

示例10: checkCompiler

import com.intellij.openapi.compiler.CompileScope; //导入方法依赖的package包/类
public boolean checkCompiler(final CompileScope scope) {
  final Module[] modules = scope.getAffectedModules();
  final Set<Sdk> checkedJdks = new HashSet<Sdk>();
  for (final Module module : modules) {
    final Sdk jdk  = ModuleRootManager.getInstance(module).getSdk();
    if (jdk == null || checkedJdks.contains(jdk)) {
      continue;
    }
    checkedJdks.add(jdk);
    final SdkTypeId sdkType = jdk.getSdkType();
    if (!(sdkType instanceof JavaSdkType)) {
      continue;
    }
    final VirtualFile homeDirectory = jdk.getHomeDirectory();
    if (homeDirectory == null) {
      Messages.showMessageDialog(
        myProject, CompilerBundle.jdkHomeNotFoundMessage(jdk), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
      );
      return false;
    }
    final String vmExecutablePath = ((JavaSdkType)sdkType).getVMExecutablePath(jdk);
    if (vmExecutablePath == null) {
      Messages.showMessageDialog(
        myProject, CompilerBundle.message("javac.error.vm.executable.missing", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
      );
      return false;
    }
    final String toolsJarPath = ((JavaSdkType)sdkType).getToolsPath(jdk);
    if (toolsJarPath == null) {
      Messages.showMessageDialog(
        myProject, CompilerBundle.message("javac.error.tools.jar.missing", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
      );
      return false;
    }
    final String versionString = jdk.getVersionString();
    if (versionString == null) {
      Messages.showMessageDialog(
        myProject, CompilerBundle.message("javac.error.unknown.jdk.version", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
      );
      return false;
    }

    if (CompilerUtil.isOfVersion(versionString, "1.0")) {
      Messages.showMessageDialog(
        myProject, CompilerBundle.message("javac.error.1_0_compilation.not.supported"), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
      );
      return false;
    }
  }

  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:53,代码来源:JavacCompiler.java


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