Search in sources :

Example 1 with ModuleBasedTarget

use of org.jetbrains.jps.builders.ModuleBasedTarget in project intellij-community by JetBrains.

the class CompileScopeImpl method isAffectedByAssociatedModule.

private boolean isAffectedByAssociatedModule(BuildTarget<?> target) {
    if (target instanceof ModuleBasedTarget) {
        final JpsModule module = ((ModuleBasedTarget) target).getModule();
        // this target is associated with module
        JavaModuleBuildTargetType targetType = JavaModuleBuildTargetType.getInstance(((ModuleBasedTarget) target).isTests());
        if (myTypes.contains(targetType) || myTargets.contains(new ModuleBuildTarget(module, targetType))) {
            return true;
        }
    }
    return false;
}
Also used : JavaModuleBuildTargetType(org.jetbrains.jps.builders.java.JavaModuleBuildTargetType) JpsModule(org.jetbrains.jps.model.module.JpsModule) ModuleBasedTarget(org.jetbrains.jps.builders.ModuleBasedTarget)

Example 2 with ModuleBasedTarget

use of org.jetbrains.jps.builders.ModuleBasedTarget in project intellij-community by JetBrains.

the class BuildTargetRegistryImpl method getModuleBasedTargets.

@NotNull
@Override
public Collection<ModuleBasedTarget<?>> getModuleBasedTargets(@NotNull JpsModule module, @NotNull BuildTargetRegistry.ModuleTargetSelector selector) {
    final List<ModuleBasedTarget> targets = myModuleBasedTargets.get(module);
    if (targets == null || targets.isEmpty()) {
        return Collections.emptyList();
    }
    final List<ModuleBasedTarget<?>> result = new SmartList<>();
    for (ModuleBasedTarget target : targets) {
        switch(selector) {
            case ALL:
                result.add(target);
                break;
            case PRODUCTION:
                if (!target.isTests()) {
                    result.add(target);
                }
                break;
            case TEST:
                if (target.isTests()) {
                    result.add(target);
                }
        }
    }
    return result;
}
Also used : SmartList(com.intellij.util.SmartList) ModuleBasedTarget(org.jetbrains.jps.builders.ModuleBasedTarget) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ModuleBasedTarget (org.jetbrains.jps.builders.ModuleBasedTarget)2 SmartList (com.intellij.util.SmartList)1 NotNull (org.jetbrains.annotations.NotNull)1 JavaModuleBuildTargetType (org.jetbrains.jps.builders.java.JavaModuleBuildTargetType)1 JpsModule (org.jetbrains.jps.model.module.JpsModule)1