Search in sources :

Example 1 with BuildRootDescriptorImpl

use of org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl in project android by JetBrains.

the class AndroidResourceCachingBuildTarget method doComputeRootDescriptors.

@NotNull
@Override
protected List<BuildRootDescriptor> doComputeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
    final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(myModule);
    if (extension != null) {
        final List<BuildRootDescriptor> result = new ArrayList<BuildRootDescriptor>();
        for (File resOverlayDir : extension.getResourceOverlayDirs()) {
            result.add(new BuildRootDescriptorImpl(this, resOverlayDir));
        }
        final File resourceDir = AndroidJpsUtil.getResourceDirForCompilationPath(extension);
        if (resourceDir != null) {
            result.add(new BuildRootDescriptorImpl(this, resourceDir));
        }
        if (!extension.isLibrary()) {
            final Set<String> aarResDirPaths = new HashSet<String>();
            AndroidJpsUtil.collectResDirectoriesFromAarDeps(myModule, aarResDirPaths);
            for (JpsAndroidModuleExtension depExtension : AndroidJpsUtil.getAllAndroidDependencies(myModule, true)) {
                AndroidJpsUtil.collectResDirectoriesFromAarDeps(depExtension.getModule(), aarResDirPaths);
            }
            for (String path : aarResDirPaths) {
                result.add(new BuildRootDescriptorImpl(this, new File(path)));
            }
        }
        return result;
    }
    return Collections.emptyList();
}
Also used : BuildRootDescriptorImpl(org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl) BuildRootDescriptor(org.jetbrains.jps.builders.BuildRootDescriptor) JpsAndroidModuleExtension(org.jetbrains.jps.android.model.JpsAndroidModuleExtension) File(java.io.File) HashSet(com.intellij.util.containers.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with BuildRootDescriptorImpl

use of org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl in project intellij-plugins by JetBrains.

the class OsmorcBuildTarget method computeRootDescriptors.

@NotNull
@Override
public List<BuildRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
    List<BuildRootDescriptor> rootDescriptors = ContainerUtil.newArrayList();
    JpsOsmorcModuleExtension extension = JpsOsmorcExtensionService.getExtension(getModule());
    if (extension != null) {
        File file = extension.getBundleDescriptorFile();
        if (file != null) {
            rootDescriptors.add(new BuildRootDescriptorImpl(this, file, true));
        }
    }
    JpsJavaExtensionService.dependencies(getModule()).recursively().productionOnly().processModules(module -> {
        if (module == getModule() || JpsOsmorcExtensionService.getExtension(module) == null) {
            File root = JpsJavaExtensionService.getInstance().getOutputDirectory(myModule, false);
            if (root != null) {
                rootDescriptors.add(new BuildRootDescriptorImpl(this, root, true));
            }
        }
    });
    return rootDescriptors;
}
Also used : BuildRootDescriptorImpl(org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl) JpsOsmorcModuleExtension(org.jetbrains.osgi.jps.model.JpsOsmorcModuleExtension) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with BuildRootDescriptorImpl

use of org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl in project android by JetBrains.

the class AndroidAarDepsBuildTarget method doComputeRootDescriptors.

@NotNull
@Override
protected List<BuildRootDescriptor> doComputeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
    final Set<JpsLibrary> libraries = JpsJavaExtensionService.getInstance().enumerateDependencies(Collections.singleton(myModule)).runtimeOnly().productionOnly().getLibraries();
    final List<BuildRootDescriptor> result = new ArrayList<BuildRootDescriptor>();
    for (JpsLibrary library : libraries) {
        final Pair<File, List<File>> pair = AndroidJpsUtil.getResDirAndJarsIfAar(library);
        final List<File> jars = pair != null ? pair.getSecond() : null;
        if (jars != null) {
            for (File jar : jars) {
                result.add(new BuildRootDescriptorImpl(this, jar));
            }
        }
    }
    return result;
}
Also used : BuildRootDescriptorImpl(org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl) BuildRootDescriptor(org.jetbrains.jps.builders.BuildRootDescriptor) JpsLibrary(org.jetbrains.jps.model.library.JpsLibrary) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with BuildRootDescriptorImpl

use of org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl in project android by JetBrains.

the class AndroidPackagingBuildTarget method doComputeRootDescriptors.

@NotNull
@Override
protected List<BuildRootDescriptor> doComputeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
    final File resPackage = AndroidResourcePackagingBuildTarget.getOutputFile(dataPaths, myModule);
    final File classesDexFile = AndroidDexBuildTarget.getOutputFile(dataPaths, myModule);
    final List<BuildRootDescriptor> roots = new ArrayList<BuildRootDescriptor>();
    roots.add(new BuildRootDescriptorImpl(this, resPackage));
    roots.add(new BuildRootDescriptorImpl(this, classesDexFile));
    final AndroidPlatform platform = AndroidJpsUtil.getAndroidPlatform(myModule, null, null);
    if (platform != null) {
        for (String jarOrLibDir : AndroidJpsUtil.getExternalLibraries(dataPaths, myModule, platform, false, true, false)) {
            roots.add(new BuildRootDescriptorImpl(this, new File(jarOrLibDir), false));
        }
    }
    for (File resourceRoot : AndroidJpsUtil.getJavaOutputRootsForModuleAndDependencies(myModule)) {
        roots.add(new MyResourceRootDescriptor(this, resourceRoot));
    }
    final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(myModule);
    assert extension != null;
    for (String nativeLibDir : collectNativeLibsFolders(extension, false)) {
        roots.add(new BuildRootDescriptorImpl(this, new File(nativeLibDir)));
    }
    return roots;
}
Also used : BuildRootDescriptorImpl(org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl) BuildRootDescriptor(org.jetbrains.jps.builders.BuildRootDescriptor) JpsAndroidModuleExtension(org.jetbrains.jps.android.model.JpsAndroidModuleExtension) ArrayList(java.util.ArrayList) AndroidPlatform(org.jetbrains.jps.android.AndroidPlatform) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with BuildRootDescriptorImpl

use of org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl in project android by JetBrains.

the class AndroidResourcePackagingBuildTarget method doComputeRootDescriptors.

@NotNull
@Override
protected List<BuildRootDescriptor> doComputeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
    final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(myModule);
    assert extension != null;
    final String[] resourceDirs = AndroidJpsUtil.collectResourceDirsForCompilation(extension, true, dataPaths, false);
    final List<String> assertDirs = new ArrayList<String>();
    collectAssetDirs(extension, assertDirs, false);
    final File manifestFile = AndroidJpsUtil.getPreprocessedManifestFile(extension, dataPaths);
    final List<BuildRootDescriptor> result = new ArrayList<BuildRootDescriptor>();
    for (String resourceDir : resourceDirs) {
        result.add(new BuildRootDescriptorImpl(this, new File(resourceDir)));
    }
    for (String assetDir : assertDirs) {
        result.add(new BuildRootDescriptorImpl(this, new File(assetDir)));
    }
    if (manifestFile != null) {
        result.add(new BuildRootDescriptorImpl(this, manifestFile));
    }
    return result;
}
Also used : BuildRootDescriptorImpl(org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl) BuildRootDescriptor(org.jetbrains.jps.builders.BuildRootDescriptor) JpsAndroidModuleExtension(org.jetbrains.jps.android.model.JpsAndroidModuleExtension) ArrayList(java.util.ArrayList) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

File (java.io.File)5 NotNull (org.jetbrains.annotations.NotNull)5 BuildRootDescriptorImpl (org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl)5 BuildRootDescriptor (org.jetbrains.jps.builders.BuildRootDescriptor)4 JpsAndroidModuleExtension (org.jetbrains.jps.android.model.JpsAndroidModuleExtension)3 ArrayList (java.util.ArrayList)2 HashSet (com.intellij.util.containers.HashSet)1 AndroidPlatform (org.jetbrains.jps.android.AndroidPlatform)1 JpsLibrary (org.jetbrains.jps.model.library.JpsLibrary)1 JpsOsmorcModuleExtension (org.jetbrains.osgi.jps.model.JpsOsmorcModuleExtension)1