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);
}
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);
}
}
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(""));
}
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());
}
}
});
}
}
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);
}
}
Aggregations