Search in sources :

Example 1 with FilteredResourceRootDescriptor

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

the class ResourcesTarget method computeRootDescriptors.

@NotNull
@Override
public List<ResourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
    List<ResourceRootDescriptor> roots = new ArrayList<>();
    JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
    Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class);
    for (JpsTypedModuleSourceRoot<JavaSourceRootProperties> sourceRoot : myModule.getSourceRoots(type)) {
        if (!isExcludedFromCompilation(excludedRootProviders, sourceRoot)) {
            final String packagePrefix = sourceRoot.getProperties().getPackagePrefix();
            final File rootFile = sourceRoot.getFile();
            roots.add(new FilteredResourceRootDescriptor(rootFile, this, packagePrefix, computeRootExcludes(rootFile, index)));
        }
    }
    JavaResourceRootType resourceType = isTests() ? JavaResourceRootType.TEST_RESOURCE : JavaResourceRootType.RESOURCE;
    for (JpsTypedModuleSourceRoot<JavaResourceRootProperties> root : myModule.getSourceRoots(resourceType)) {
        if (!isExcludedFromCompilation(excludedRootProviders, root)) {
            File rootFile = root.getFile();
            String relativeOutputPath = root.getProperties().getRelativeOutputPath();
            roots.add(new ResourceRootDescriptor(rootFile, this, relativeOutputPath.replace('/', '.'), computeRootExcludes(rootFile, index)));
        }
    }
    return roots;
}
Also used : ArrayList(java.util.ArrayList) ExcludedJavaSourceRootProvider(org.jetbrains.jps.builders.java.ExcludedJavaSourceRootProvider) ResourceRootDescriptor(org.jetbrains.jps.builders.java.ResourceRootDescriptor) FilteredResourceRootDescriptor(org.jetbrains.jps.builders.java.FilteredResourceRootDescriptor) File(java.io.File) FilteredResourceRootDescriptor(org.jetbrains.jps.builders.java.FilteredResourceRootDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1 ExcludedJavaSourceRootProvider (org.jetbrains.jps.builders.java.ExcludedJavaSourceRootProvider)1 FilteredResourceRootDescriptor (org.jetbrains.jps.builders.java.FilteredResourceRootDescriptor)1 ResourceRootDescriptor (org.jetbrains.jps.builders.java.ResourceRootDescriptor)1