use of org.jetbrains.jps.model.java.JavaResourceRootType in project intellij by bazelbuild.
the class JavaSourceFolderProvider method setSourceFolderForLocation.
@Override
public SourceFolder setSourceFolderForLocation(ContentEntry contentEntry, SourceFolder parentFolder, File file, boolean isTestSource) {
SourceFolder sourceFolder;
if (isResource(parentFolder)) {
JavaResourceRootType resourceRootType = isTestSource ? JavaResourceRootType.TEST_RESOURCE : JavaResourceRootType.RESOURCE;
sourceFolder = contentEntry.addSourceFolder(UrlUtil.pathToUrl(file.getPath()), resourceRootType);
} else {
sourceFolder = contentEntry.addSourceFolder(UrlUtil.pathToUrl(file.getPath()), isTestSource);
}
sourceFolder.setPackagePrefix(derivePackagePrefix(file, parentFolder));
JpsModuleSourceRoot sourceRoot = sourceFolder.getJpsElement();
JpsElement properties = sourceRoot.getProperties();
if (properties instanceof JavaSourceRootProperties) {
((JavaSourceRootProperties) properties).setForGeneratedSources(isGenerated(parentFolder));
}
return sourceFolder;
}
Aggregations