Search in sources :

Example 21 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 22 with JpsModuleSourceRoot

use of org.jetbrains.jps.model.module.JpsModuleSourceRoot in project intellij-plugins by JetBrains.

the class OsgiBuildSession method prepare.

private void prepare() throws OsgiBuildException {
    myModuleOutputDir = JpsJavaExtensionService.getInstance().getOutputDirectory(myModule, false);
    if (myModuleOutputDir == null) {
        throw new OsgiBuildException("Unable to determine the compiler output path for the module.");
    }
    String jarFileLocation = myExtension.getJarFileLocation();
    if (jarFileLocation.isEmpty()) {
        throw new OsgiBuildException("Bundle path is empty - please check OSGi facet settings.");
    }
    myOutputJarFile = new File(jarFileLocation);
    myOutputJarFiles = myTarget.getOutputRoots(myContext);
    for (File jarFile : myOutputJarFiles) {
        if (!FileUtil.delete(jarFile)) {
            throw new OsgiBuildException("Can't delete bundle file '" + jarFile + "'.");
        }
    }
    if (!FileUtil.createParentDirs(myOutputJarFile)) {
        throw new OsgiBuildException("Cannot create a directory for bundles '" + myOutputJarFile.getParent() + "'.");
    }
    List<File> classes = ContainerUtil.newSmartList();
    if (myModuleOutputDir.exists()) {
        classes.add(myModuleOutputDir);
    }
    for (JpsDependencyElement dependency : myModule.getDependenciesList().getDependencies()) {
        if (dependency instanceof JpsModuleDependency) {
            JpsModule module = ((JpsModuleDependency) dependency).getModule();
            if (module != null && JpsOsmorcExtensionService.getExtension(module) == null) {
                File outputDir = JpsJavaExtensionService.getInstance().getOutputDirectory(module, false);
                if (outputDir != null && outputDir.exists()) {
                    classes.add(outputDir);
                }
            }
        }
    }
    myClasses = classes.isEmpty() ? ArrayUtil.EMPTY_FILE_ARRAY : classes.toArray(new File[classes.size()]);
    List<File> sources = ContainerUtil.newSmartList();
    for (JpsModuleSourceRoot sourceRoot : myModule.getSourceRoots()) {
        File sourceDir = sourceRoot.getFile();
        if (sourceDir.exists()) {
            sources.add(sourceDir);
        }
    }
    mySources = sources.isEmpty() ? ArrayUtil.EMPTY_FILE_ARRAY : sources.toArray(new File[sources.size()]);
    myBndWrapper = new BndWrapper(this);
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsModuleSourceRoot(org.jetbrains.jps.model.module.JpsModuleSourceRoot) JpsModuleDependency(org.jetbrains.jps.model.module.JpsModuleDependency) JpsDependencyElement(org.jetbrains.jps.model.module.JpsDependencyElement) File(java.io.File)

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