Search in sources :

Example 1 with BuildDataPaths

use of org.jetbrains.jps.builders.storage.BuildDataPaths 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 2 with BuildDataPaths

use of org.jetbrains.jps.builders.storage.BuildDataPaths 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 3 with BuildDataPaths

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

the class GradleResourcesBuilder method build.

@Override
public void build(@NotNull final GradleResourcesTarget target, @NotNull final DirtyFilesHolder<GradleResourceRootDescriptor, GradleResourcesTarget> holder, @NotNull final BuildOutputConsumer outputConsumer, @NotNull final CompileContext context) throws ProjectBuildException, IOException {
    if (!JavaBuilder.IS_ENABLED.get(context, Boolean.TRUE)) {
        return;
    }
    final BuildDataPaths dataPaths = context.getProjectDescriptor().dataManager.getDataPaths();
    final GradleProjectConfiguration projectConfig = JpsGradleExtensionService.getInstance().getGradleProjectConfiguration(dataPaths);
    final GradleModuleResourceConfiguration config = target.getModuleResourcesConfiguration(dataPaths);
    if (config == null)
        return;
    final Map<GradleResourceRootDescriptor, List<File>> files = new HashMap<>();
    holder.processDirtyFiles(new FileProcessor<GradleResourceRootDescriptor, GradleResourcesTarget>() {

        @Override
        public boolean apply(GradleResourcesTarget t, File file, GradleResourceRootDescriptor rd) throws IOException {
            assert target == t;
            List<File> fileList = files.get(rd);
            if (fileList == null) {
                fileList = new ArrayList<>();
                files.put(rd, fileList);
            }
            fileList.add(file);
            return true;
        }
    });
    GradleResourceRootDescriptor[] roots = files.keySet().toArray(new GradleResourceRootDescriptor[files.keySet().size()]);
    Arrays.sort(roots, (r1, r2) -> {
        int res = r1.getIndexInPom() - r2.getIndexInPom();
        if (r1.isOverwrite()) {
            assert r2.isOverwrite();
            return res;
        }
        if (r1.getConfiguration().isFiltered && !r2.getConfiguration().isFiltered)
            return 1;
        if (!r1.getConfiguration().isFiltered && r2.getConfiguration().isFiltered)
            return -1;
        if (!r1.getConfiguration().isFiltered) {
            res = -res;
        }
        return res;
    });
    GradleResourceFileProcessor fileProcessor = new GradleResourceFileProcessor(projectConfig, target.getModule().getProject(), config);
    for (GradleResourceRootDescriptor rd : roots) {
        for (File file : files.get(rd)) {
            String relPath = FileUtil.getRelativePath(rd.getRootFile(), file);
            if (relPath == null)
                continue;
            final File outputDir = GradleResourcesTarget.getOutputDir(target.getModuleOutputDir(), rd.getConfiguration(), config.outputDirectory);
            if (outputDir == null)
                continue;
            context.processMessage(new ProgressMessage("Copying resources... [" + target.getModule().getName() + "]"));
            final Ref<File> fileRef = Ref.create(new File(outputDir, relPath));
            fileProcessor.copyFile(file, fileRef, rd.getConfiguration(), context, FileUtilRt.ALL_FILES);
            outputConsumer.registerOutputFile(fileRef.get(), Collections.singleton(file.getPath()));
            if (context.getCancelStatus().isCanceled())
                return;
        }
    }
    context.checkCanceled();
    context.processMessage(new ProgressMessage(""));
}
Also used : ProgressMessage(org.jetbrains.jps.incremental.messages.ProgressMessage) IOException(java.io.IOException) BuildDataPaths(org.jetbrains.jps.builders.storage.BuildDataPaths) File(java.io.File)

Example 4 with BuildDataPaths

use of org.jetbrains.jps.builders.storage.BuildDataPaths in project intellij-plugins by JetBrains.

the class OsgiBuildUtil method collectMavenProjectProperties.

private static void collectMavenProjectProperties(CompileContext context, JpsModule module, final Properties result) {
    BuildDataPaths dataPaths = context.getProjectDescriptor().dataManager.getDataPaths();
    MavenProjectConfiguration projectConfig = JpsMavenExtensionService.getInstance().getMavenProjectConfiguration(dataPaths);
    if (projectConfig != null) {
        JpsJavaExtensionService.dependencies(module).recursively().productionOnly().processModules(module1 -> {
            MavenModuleResourceConfiguration moduleConfig = projectConfig.moduleConfigurations.get(module1.getName());
            if (moduleConfig != null) {
                for (Map.Entry<String, String> entry : moduleConfig.properties.entrySet()) {
                    result.setProperty(entry.getKey(), entry.getValue());
                }
            }
        });
    }
}
Also used : MavenProjectConfiguration(org.jetbrains.jps.maven.model.impl.MavenProjectConfiguration) BuildDataPaths(org.jetbrains.jps.builders.storage.BuildDataPaths) MavenModuleResourceConfiguration(org.jetbrains.jps.maven.model.impl.MavenModuleResourceConfiguration) Map(java.util.Map)

Example 5 with BuildDataPaths

use of org.jetbrains.jps.builders.storage.BuildDataPaths in project intellij-elixir by KronicDeth.

the class JpsBuildTestCase method createProjectDescriptor.

protected ProjectDescriptor createProjectDescriptor(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)

Aggregations

BuildDataPaths (org.jetbrains.jps.builders.storage.BuildDataPaths)11 IOException (java.io.IOException)5 File (java.io.File)4 BuildDataPathsImpl (org.jetbrains.jps.builders.impl.BuildDataPathsImpl)4 BuildRootIndexImpl (org.jetbrains.jps.builders.impl.BuildRootIndexImpl)4 BuildTargetRegistryImpl (org.jetbrains.jps.builders.impl.BuildTargetRegistryImpl)4 ModuleExcludeIndex (org.jetbrains.jps.indices.ModuleExcludeIndex)4 IgnoredFileIndexImpl (org.jetbrains.jps.indices.impl.IgnoredFileIndexImpl)4 ModuleExcludeIndexImpl (org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl)4 BuildTargetIndexImpl (org.jetbrains.jps.builders.impl.BuildTargetIndexImpl)3 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)3 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)3 BuildDataManager (org.jetbrains.jps.incremental.storage.BuildDataManager)3 BuildTargetsState (org.jetbrains.jps.incremental.storage.BuildTargetsState)3 ProjectTimestamps (org.jetbrains.jps.incremental.storage.ProjectTimestamps)3 ProjectDescriptor (org.jetbrains.jps.cmdline.ProjectDescriptor)2 BuildFSState (org.jetbrains.jps.incremental.fs.BuildFSState)2 MavenModuleResourceConfiguration (org.jetbrains.jps.maven.model.impl.MavenModuleResourceConfiguration)2 MavenProjectConfiguration (org.jetbrains.jps.maven.model.impl.MavenProjectConfiguration)2 HashSet (com.intellij.util.containers.HashSet)1