Search in sources :

Example 1 with ModuleExcludeIndexImpl

use of org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl in project intellij-community by JetBrains.

the class JpsBuildTestCase method createProjectDescriptor.

protected ProjectDescriptor createProjectDescriptor(final BuildLoggingManager buildLoggingManager) {
    try {
        BuildTargetRegistryImpl targetRegistry = new BuildTargetRegistryImpl(myModel);
        ModuleExcludeIndex index = new ModuleExcludeIndexImpl(myModel);
        IgnoredFileIndexImpl ignoredFileIndex = new IgnoredFileIndexImpl(myModel);
        BuildDataPaths dataPaths = new BuildDataPathsImpl(myDataStorageRoot);
        BuildRootIndexImpl buildRootIndex = new BuildRootIndexImpl(targetRegistry, myModel, index, dataPaths, ignoredFileIndex);
        BuildTargetIndexImpl targetIndex = new BuildTargetIndexImpl(targetRegistry, buildRootIndex);
        BuildTargetsState targetsState = new BuildTargetsState(dataPaths, myModel, buildRootIndex);
        ProjectTimestamps timestamps = new ProjectTimestamps(myDataStorageRoot, targetsState);
        BuildDataManager dataManager = new BuildDataManager(dataPaths, targetsState, true);
        return new ProjectDescriptor(myModel, new BuildFSState(true), timestamps, dataManager, buildLoggingManager, index, targetsState, targetIndex, buildRootIndex, ignoredFileIndex);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : ProjectTimestamps(org.jetbrains.jps.incremental.storage.ProjectTimestamps) BuildTargetRegistryImpl(org.jetbrains.jps.builders.impl.BuildTargetRegistryImpl) BuildRootIndexImpl(org.jetbrains.jps.builders.impl.BuildRootIndexImpl) IgnoredFileIndexImpl(org.jetbrains.jps.indices.impl.IgnoredFileIndexImpl) BuildTargetIndexImpl(org.jetbrains.jps.builders.impl.BuildTargetIndexImpl) IOException(java.io.IOException) BuildTargetsState(org.jetbrains.jps.incremental.storage.BuildTargetsState) BuildFSState(org.jetbrains.jps.incremental.fs.BuildFSState) BuildDataPaths(org.jetbrains.jps.builders.storage.BuildDataPaths) ModuleExcludeIndex(org.jetbrains.jps.indices.ModuleExcludeIndex) ProjectDescriptor(org.jetbrains.jps.cmdline.ProjectDescriptor) ModuleExcludeIndexImpl(org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl) BuildDataPathsImpl(org.jetbrains.jps.builders.impl.BuildDataPathsImpl) BuildDataManager(org.jetbrains.jps.incremental.storage.BuildDataManager)

Example 2 with ModuleExcludeIndexImpl

use of org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl in project intellij-community by JetBrains.

the class ModuleExcludeIndexTest method testInnerModules.

public void testInnerModules() {
    File outerRoot = new File(myRoot, "outer");
    File inner1Root = new File(outerRoot, "inner1");
    File inner2Root = new File(outerRoot, "inner2");
    JpsModule outer = addModule("outer");
    addContentRoot(outer, outerRoot);
    JpsModule inner1 = addModule("inner1");
    JpsModule inner2 = addModule("inner2");
    addContentRoot(inner1, inner1Root);
    addContentRoot(inner2, inner2Root);
    assertNotExcluded(outerRoot);
    assertNotExcluded(inner1Root);
    assertNotExcluded(inner2Root);
    assertSameElements(getModuleExcludes(outer), inner1Root, inner2Root);
    assertEmpty(getModuleExcludes(inner1));
    assertEmpty(getModuleExcludes(inner2));
    ModuleExcludeIndexImpl index = createIndex();
    assertTrue(index.isExcludedFromModule(inner1Root, outer));
    assertTrue(index.isExcludedFromModule(inner2Root, outer));
    assertFalse(index.isExcludedFromModule(inner1Root, inner1));
    assertFalse(index.isExcludedFromModule(inner2Root, inner2));
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) ModuleExcludeIndexImpl(org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl) File(java.io.File)

Example 3 with ModuleExcludeIndexImpl

use of org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl in project intellij-community by JetBrains.

the class CompilerEncodingConfigurationTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    BuildTargetRegistryImpl targetRegistry = new BuildTargetRegistryImpl(myModel);
    ModuleExcludeIndex index = new ModuleExcludeIndexImpl(myModel);
    IgnoredFileIndexImpl ignoredFileIndex = new IgnoredFileIndexImpl(myModel);
    myDataStorageRoot = FileUtil.createTempDirectory("compile-server-" + StringUtil.decapitalize(StringUtil.trimStart(getName(), "test")), null);
    BuildDataPaths dataPaths = new BuildDataPathsImpl(myDataStorageRoot);
    myRootIndex = new BuildRootIndexImpl(targetRegistry, myModel, index, dataPaths, ignoredFileIndex);
}
Also used : BuildTargetRegistryImpl(org.jetbrains.jps.builders.impl.BuildTargetRegistryImpl) BuildDataPaths(org.jetbrains.jps.builders.storage.BuildDataPaths) BuildRootIndexImpl(org.jetbrains.jps.builders.impl.BuildRootIndexImpl) ModuleExcludeIndex(org.jetbrains.jps.indices.ModuleExcludeIndex) ModuleExcludeIndexImpl(org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl) IgnoredFileIndexImpl(org.jetbrains.jps.indices.impl.IgnoredFileIndexImpl) BuildDataPathsImpl(org.jetbrains.jps.builders.impl.BuildDataPathsImpl)

Example 4 with ModuleExcludeIndexImpl

use of org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl in project intellij-community by JetBrains.

the class BuildRunner method load.

public ProjectDescriptor load(MessageHandler msgHandler, File dataStorageRoot, BuildFSState fsState) throws IOException {
    final JpsModel jpsModel = myModelLoader.loadModel();
    BuildDataPaths dataPaths = new BuildDataPathsImpl(dataStorageRoot);
    BuildTargetRegistryImpl targetRegistry = new BuildTargetRegistryImpl(jpsModel);
    ModuleExcludeIndex index = new ModuleExcludeIndexImpl(jpsModel);
    IgnoredFileIndexImpl ignoredFileIndex = new IgnoredFileIndexImpl(jpsModel);
    BuildRootIndexImpl buildRootIndex = new BuildRootIndexImpl(targetRegistry, jpsModel, index, dataPaths, ignoredFileIndex);
    BuildTargetIndexImpl targetIndex = new BuildTargetIndexImpl(targetRegistry, buildRootIndex);
    BuildTargetsState targetsState = new BuildTargetsState(dataPaths, jpsModel, buildRootIndex);
    ProjectTimestamps projectTimestamps = null;
    BuildDataManager dataManager = null;
    try {
        projectTimestamps = new ProjectTimestamps(dataStorageRoot, targetsState);
        dataManager = new BuildDataManager(dataPaths, targetsState, STORE_TEMP_CACHES_IN_MEMORY);
        if (dataManager.versionDiffers()) {
            myForceCleanCaches = true;
            msgHandler.processMessage(new CompilerMessage("build", BuildMessage.Kind.INFO, "Dependency data format has changed, project rebuild required"));
        }
    } catch (Exception e) {
        // second try
        LOG.info(e);
        if (projectTimestamps != null) {
            projectTimestamps.close();
        }
        if (dataManager != null) {
            dataManager.close();
        }
        myForceCleanCaches = true;
        FileUtil.delete(dataStorageRoot);
        targetsState = new BuildTargetsState(dataPaths, jpsModel, buildRootIndex);
        projectTimestamps = new ProjectTimestamps(dataStorageRoot, targetsState);
        dataManager = new BuildDataManager(dataPaths, targetsState, STORE_TEMP_CACHES_IN_MEMORY);
        // second attempt succeeded
        msgHandler.processMessage(new CompilerMessage("build", BuildMessage.Kind.INFO, "Project rebuild forced: " + e.getMessage()));
    }
    return new ProjectDescriptor(jpsModel, fsState, projectTimestamps, dataManager, BuildLoggingManager.DEFAULT, index, targetsState, targetIndex, buildRootIndex, ignoredFileIndex);
}
Also used : ProjectTimestamps(org.jetbrains.jps.incremental.storage.ProjectTimestamps) BuildTargetRegistryImpl(org.jetbrains.jps.builders.impl.BuildTargetRegistryImpl) JpsModel(org.jetbrains.jps.model.JpsModel) BuildRootIndexImpl(org.jetbrains.jps.builders.impl.BuildRootIndexImpl) CompilerMessage(org.jetbrains.jps.incremental.messages.CompilerMessage) IgnoredFileIndexImpl(org.jetbrains.jps.indices.impl.IgnoredFileIndexImpl) BuildTargetIndexImpl(org.jetbrains.jps.builders.impl.BuildTargetIndexImpl) BuildTargetsState(org.jetbrains.jps.incremental.storage.BuildTargetsState) IOException(java.io.IOException) BuildDataPaths(org.jetbrains.jps.builders.storage.BuildDataPaths) ModuleExcludeIndex(org.jetbrains.jps.indices.ModuleExcludeIndex) ModuleExcludeIndexImpl(org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl) BuildDataPathsImpl(org.jetbrains.jps.builders.impl.BuildDataPathsImpl) BuildDataManager(org.jetbrains.jps.incremental.storage.BuildDataManager)

Example 5 with ModuleExcludeIndexImpl

use of org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl in project intellij-community by JetBrains.

the class ModuleExcludeIndexTest method testContentRootUnderExcluded.

public void testContentRootUnderExcluded() {
    File contentRoot = new File(myRoot, "project");
    File excluded = new File(contentRoot, "exc");
    File unexcluded = new File(excluded, "src");
    JpsModule module = addModule();
    addContentRoot(module, contentRoot);
    addExcludedRoot(module, excluded);
    addContentRoot(module, unexcluded);
    assertNotExcluded(contentRoot);
    assertExcluded(excluded);
    assertNotExcluded(unexcluded);
    ModuleExcludeIndexImpl index = createIndex();
    assertFalse(index.isExcludedFromModule(contentRoot, module));
    assertTrue(index.isExcludedFromModule(excluded, module));
    assertFalse(index.isExcludedFromModule(unexcluded, module));
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) ModuleExcludeIndexImpl(org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl) File(java.io.File)

Aggregations

ModuleExcludeIndexImpl (org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl)7 BuildDataPathsImpl (org.jetbrains.jps.builders.impl.BuildDataPathsImpl)4 BuildRootIndexImpl (org.jetbrains.jps.builders.impl.BuildRootIndexImpl)4 BuildTargetRegistryImpl (org.jetbrains.jps.builders.impl.BuildTargetRegistryImpl)4 BuildDataPaths (org.jetbrains.jps.builders.storage.BuildDataPaths)4 ModuleExcludeIndex (org.jetbrains.jps.indices.ModuleExcludeIndex)4 IgnoredFileIndexImpl (org.jetbrains.jps.indices.impl.IgnoredFileIndexImpl)4 File (java.io.File)3 IOException (java.io.IOException)3 BuildTargetIndexImpl (org.jetbrains.jps.builders.impl.BuildTargetIndexImpl)3 BuildDataManager (org.jetbrains.jps.incremental.storage.BuildDataManager)3 BuildTargetsState (org.jetbrains.jps.incremental.storage.BuildTargetsState)3 JpsModule (org.jetbrains.jps.model.module.JpsModule)3 ProjectDescriptor (org.jetbrains.jps.cmdline.ProjectDescriptor)2 BuildFSState (org.jetbrains.jps.incremental.fs.BuildFSState)2 ProjectTimestamps (org.jetbrains.jps.incremental.storage.ProjectTimestamps)2 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)1 PathRelativizerService (org.jetbrains.jps.incremental.relativizer.PathRelativizerService)1 ProjectStamps (org.jetbrains.jps.incremental.storage.ProjectStamps)1 JpsModel (org.jetbrains.jps.model.JpsModel)1