Search in sources :

Example 1 with ModuleBuildTarget

use of org.jetbrains.jps.incremental.ModuleBuildTarget in project intellij-community by JetBrains.

the class BuildTargetConfiguration method isTargetDirty.

public boolean isTargetDirty(CompileContext context) {
    final String currentState = getCurrentState(context);
    if (!currentState.equals(myConfiguration)) {
        LOG.debug(myTarget + " configuration was changed:");
        LOG.debug("Old:");
        LOG.debug(myConfiguration);
        LOG.debug("New:");
        LOG.debug(currentState);
        LOG.debug(myTarget + " will be recompiled");
        if (myTarget instanceof ModuleBuildTarget) {
            final JpsModule module = ((ModuleBuildTarget) myTarget).getModule();
            synchronized (MODULES_WITH_TARGET_CONFIG_CHANGED_KEY) {
                Set<JpsModule> modules = MODULES_WITH_TARGET_CONFIG_CHANGED_KEY.get(context);
                if (modules == null) {
                    MODULES_WITH_TARGET_CONFIG_CHANGED_KEY.set(context, modules = new THashSet<>());
                }
                modules.add(module);
            }
        }
        return true;
    }
    return false;
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) ModuleBuildTarget(org.jetbrains.jps.incremental.ModuleBuildTarget) THashSet(gnu.trove.THashSet)

Example 2 with ModuleBuildTarget

use of org.jetbrains.jps.incremental.ModuleBuildTarget in project intellij-community by JetBrains.

the class CheckResourcesTarget method computeDependencies.

@Override
public Collection<BuildTarget<?>> computeDependencies(BuildTargetRegistry targetRegistry, TargetOutputIndex outputIndex) {
    List<BuildTarget<?>> result = new ArrayList<>();
    ModuleBuildTarget compileTarget = new ModuleBuildTarget(myModule, JavaModuleBuildTargetType.getInstance(isTests()));
    result.add(compileTarget);
    for (BuildTarget<?> dep : compileTarget.computeDependencies(targetRegistry, outputIndex)) {
        if (dep instanceof ModuleBuildTarget) {
            result.add(new CheckResourcesTarget(((ModuleBuildTarget) dep).getModule(), ((ModuleBuildTarget) dep).isTests() ? TESTS : PRODUCTION));
        }
    }
    return result;
}
Also used : ModuleBuildTarget(org.jetbrains.jps.incremental.ModuleBuildTarget) ModuleBuildTarget(org.jetbrains.jps.incremental.ModuleBuildTarget)

Example 3 with ModuleBuildTarget

use of org.jetbrains.jps.incremental.ModuleBuildTarget in project intellij-community by JetBrains.

the class CompilingGroovycRunner method addStubRootsToJavacSourcePath.

private static void addStubRootsToJavacSourcePath(CompileContext context, Map<ModuleBuildTarget, String> generationOutputs) {
    final BuildRootIndex rootsIndex = context.getProjectDescriptor().getBuildRootIndex();
    for (ModuleBuildTarget target : generationOutputs.keySet()) {
        File root = new File(generationOutputs.get(target));
        rootsIndex.associateTempRoot(context, target, new JavaSourceRootDescriptor(root, target, true, true, "", Collections.<File>emptySet()));
    }
}
Also used : ModuleBuildTarget(org.jetbrains.jps.incremental.ModuleBuildTarget) BuildRootIndex(org.jetbrains.jps.builders.BuildRootIndex) JavaSourceRootDescriptor(org.jetbrains.jps.builders.java.JavaSourceRootDescriptor) File(java.io.File)

Example 4 with ModuleBuildTarget

use of org.jetbrains.jps.incremental.ModuleBuildTarget in project android by JetBrains.

the class AndroidBuildTarget method computeDependencies.

@Override
public Collection<BuildTarget<?>> computeDependencies(final BuildTargetRegistry registry, TargetOutputIndex outputIndex) {
    final List<BuildTarget<?>> result = new ArrayList<BuildTarget<?>>(3);
    fillDependencies(result);
    result.add(new ModuleBuildTarget(myModule, JavaModuleBuildTargetType.PRODUCTION));
    final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(myModule);
    if (extension != null && extension.isPackTestCode()) {
        result.add(new ModuleBuildTarget(myModule, JavaModuleBuildTargetType.TEST));
    }
    return result;
}
Also used : ModuleBuildTarget(org.jetbrains.jps.incremental.ModuleBuildTarget) ModuleBuildTarget(org.jetbrains.jps.incremental.ModuleBuildTarget) JpsAndroidModuleExtension(org.jetbrains.jps.android.model.JpsAndroidModuleExtension) ArrayList(java.util.ArrayList)

Example 5 with ModuleBuildTarget

use of org.jetbrains.jps.incremental.ModuleBuildTarget in project intellij-elixir by KronicDeth.

the class CompileScopeTestBuilder method module.

public CompileScopeTestBuilder module(JpsModule module) {
    myTargets.add(new ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION));
    myTargets.add(new ModuleBuildTarget(module, JavaModuleBuildTargetType.TEST));
    return this;
}
Also used : ModuleBuildTarget(org.jetbrains.jps.incremental.ModuleBuildTarget)

Aggregations

ModuleBuildTarget (org.jetbrains.jps.incremental.ModuleBuildTarget)10 File (java.io.File)4 NotNull (org.jetbrains.annotations.NotNull)3 JpsModule (org.jetbrains.jps.model.module.JpsModule)3 THashSet (gnu.trove.THashSet)2 ArrayList (java.util.ArrayList)2 JpsAndroidModuleExtension (org.jetbrains.jps.android.model.JpsAndroidModuleExtension)2 JavaSourceRootDescriptor (org.jetbrains.jps.builders.java.JavaSourceRootDescriptor)2 THashMap (gnu.trove.THashMap)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 BuildRootDescriptor (org.jetbrains.jps.builders.BuildRootDescriptor)1 BuildRootIndex (org.jetbrains.jps.builders.BuildRootIndex)1