use of org.jetbrains.jps.model.module.JpsModuleSourceRoot in project intellij-community by JetBrains.
the class ContentEntryTreeCellRenderer method getPresentablePrefix.
private static String getPresentablePrefix(final ContentEntry entry, final VirtualFile file) {
for (final SourceFolder sourceFolder : entry.getSourceFolders()) {
if (file.equals(sourceFolder.getFile())) {
JpsModuleSourceRoot element = sourceFolder.getJpsElement();
JavaSourceRootProperties properties = element.getProperties(JavaModuleSourceRootTypes.SOURCES);
if (properties != null)
return properties.getPackagePrefix();
JavaResourceRootProperties resourceRootProperties = element.getProperties(JavaModuleSourceRootTypes.RESOURCES);
if (resourceRootProperties != null)
return resourceRootProperties.getRelativeOutputPath();
}
}
return "";
}
use of org.jetbrains.jps.model.module.JpsModuleSourceRoot in project intellij-community by JetBrains.
the class MavenSourceFoldersModuleExtension method addSourceFolder.
public <P extends JpsElement> void addSourceFolder(@NotNull final Url url, @NotNull final JpsModuleSourceRootType<P> rootType, @NotNull final P properties) {
for (Iterator<JpsSourceFolder> iterator = myJpsSourceFolders.iterator(); iterator.hasNext(); ) {
JpsSourceFolder eachFolder = iterator.next();
if (VfsUtilCore.isEqualOrAncestor(url.getUrl(), eachFolder.getUrl()) || VfsUtilCore.isEqualOrAncestor(eachFolder.getUrl(), url.getUrl())) {
iterator.remove();
Disposer.dispose(eachFolder);
}
}
final JpsModuleSourceRoot jpsModuleSourceRoot = JpsElementFactory.getInstance().createModuleSourceRoot(url.getUrl(), rootType, properties);
addJspSourceFolder(jpsModuleSourceRoot, url.getUrl());
isJpsSourceFoldersChanged = true;
}
use of org.jetbrains.jps.model.module.JpsModuleSourceRoot in project kotlin by JetBrains.
the class KannotatorJpsTest method testMakeKannotator.
public void testMakeKannotator() throws IOException {
initProject();
rebuildAll();
FileUtil.copyDir(getOutDir(), getOutDirAfterRebuild());
for (JpsModule module : myProject.getModules()) {
for (JpsModuleSourceRoot sourceRoot : module.getSourceRoots()) {
processFile(sourceRoot.getFile());
}
}
}
use of org.jetbrains.jps.model.module.JpsModuleSourceRoot in project android by JetBrains.
the class AndroidSourceGeneratingBuilder method filterExcludedByOtherProviders.
@NotNull
private static List<String> filterExcludedByOtherProviders(@NotNull JpsModule module, @NotNull Collection<String> genRoots) {
final Set<String> genRootPaths = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
for (String genRoot : genRoots) {
genRootPaths.add(FileUtil.toSystemIndependentName(genRoot));
}
final List<String> result = new ArrayList<String>();
final List<JpsModuleSourceRoot> genSourceRoots = new ArrayList<JpsModuleSourceRoot>();
for (JpsModuleSourceRoot root : module.getSourceRoots()) {
if (genRootPaths.contains(FileUtil.toSystemIndependentName(root.getFile().getPath()))) {
genSourceRoots.add(root);
}
}
final Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class);
for (JpsModuleSourceRoot genSourceRoot : genSourceRoots) {
boolean excluded = false;
for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) {
if (!(provider instanceof AndroidExcludedJavaSourceRootProvider) && provider.isExcludedFromCompilation(module, genSourceRoot)) {
excluded = true;
break;
}
}
final String genRootFilePath = genSourceRoot.getFile().getPath();
if (!excluded) {
result.add(genRootFilePath);
}
}
return result;
}
use of org.jetbrains.jps.model.module.JpsModuleSourceRoot in project intellij-plugins by JetBrains.
the class CompilerConfigGeneratorRt method getCustomLinkReportPath.
@Nullable
private static String getCustomLinkReportPath(final JpsFlexBuildConfiguration rlmBC) {
final JpsFlexBuildConfiguration appBC = rlmBC.getModule().getProperties().findConfigurationByName(rlmBC.getName());
if (appBC != null) {
final List<String> linkReports = FlexCommonUtils.getOptionValues(appBC.getCompilerOptions().getAdditionalOptions(), "link-report");
if (!linkReports.isEmpty()) {
final String path = linkReports.get(0);
if (new File(path).isFile())
return path;
final String absPath = FlexCommonUtils.getFlexCompilerWorkDirPath(appBC.getModule().getProject()) + "/" + path;
if (new File(absPath).isFile())
return absPath;
} else {
final String configFilePath = appBC.getCompilerOptions().getAdditionalConfigFilePath();
if (!configFilePath.isEmpty()) {
final File configFile = new File(configFilePath);
if (configFile.isFile()) {
final String path = FlexCommonUtils.findXMLElement(configFile, "<flex-config><link-report>");
if (path != null) {
if (new File(path).isFile())
return path;
// I have no idea why Flex compiler treats path relative to source root for "link-report" option
for (JpsModuleSourceRoot srcRoot : appBC.getModule().getSourceRoots(JavaSourceRootType.SOURCE)) {
final String absPath = srcRoot.getFile().getPath() + "/" + path;
if (new File(absPath).isFile())
return absPath;
}
}
}
}
}
}
return null;
}
Aggregations