Search in sources :

Example 16 with JpsModuleSourceRoot

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 "";
}
Also used : SourceFolder(com.intellij.openapi.roots.SourceFolder) JpsModuleSourceRoot(org.jetbrains.jps.model.module.JpsModuleSourceRoot) JavaResourceRootProperties(org.jetbrains.jps.model.java.JavaResourceRootProperties) JavaSourceRootProperties(org.jetbrains.jps.model.java.JavaSourceRootProperties)

Example 17 with JpsModuleSourceRoot

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;
}
Also used : JpsModuleSourceRoot(org.jetbrains.jps.model.module.JpsModuleSourceRoot) JpsSourceFolder(com.intellij.project.model.impl.module.content.JpsSourceFolder)

Example 18 with JpsModuleSourceRoot

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());
        }
    }
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsModuleSourceRoot(org.jetbrains.jps.model.module.JpsModuleSourceRoot)

Example 19 with JpsModuleSourceRoot

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;
}
Also used : JpsModuleSourceRoot(org.jetbrains.jps.model.module.JpsModuleSourceRoot) ExcludedJavaSourceRootProvider(org.jetbrains.jps.builders.java.ExcludedJavaSourceRootProvider) THashSet(gnu.trove.THashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 20 with JpsModuleSourceRoot

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;
}
Also used : JpsModuleSourceRoot(org.jetbrains.jps.model.module.JpsModuleSourceRoot) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

JpsModuleSourceRoot (org.jetbrains.jps.model.module.JpsModuleSourceRoot)22 File (java.io.File)9 NotNull (org.jetbrains.annotations.NotNull)8 JpsModule (org.jetbrains.jps.model.module.JpsModule)4 ArrayList (java.util.ArrayList)3 JpsElement (org.jetbrains.jps.model.JpsElement)3 SourceFolder (com.intellij.openapi.roots.SourceFolder)2 JpsSourceFolder (com.intellij.project.model.impl.module.content.JpsSourceFolder)2 THashSet (gnu.trove.THashSet)2 Element (org.jdom.Element)2 JavaSourceRootProperties (org.jetbrains.jps.model.java.JavaSourceRootProperties)2 JpsLibrary (org.jetbrains.jps.model.library.JpsLibrary)2 ApplicationStarter (com.intellij.openapi.application.ApplicationStarter)1 PathManager (com.intellij.openapi.application.PathManager)1 Logger (com.intellij.openapi.diagnostic.Logger)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 com.intellij.openapi.projectRoots (com.intellij.openapi.projectRoots)1 JavaDependentSdkType (com.intellij.openapi.projectRoots.impl.JavaDependentSdkType)1