Search in sources :

Example 1 with AndroidPlatform

use of org.jetbrains.jps.android.AndroidPlatform in project android by JetBrains.

the class AndroidPreDexBuildTarget method computeRootDescriptors.

@NotNull
@Override
public List<AndroidPreDexBuildTarget.MyRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
    final List<AndroidPreDexBuildTarget.MyRootDescriptor> result = new ArrayList<AndroidPreDexBuildTarget.MyRootDescriptor>();
    final Set<JpsModule> libModules = new HashSet<JpsModule>();
    final Set<String> externalJars = new HashSet<String>();
    for (JpsModule module : myProject.getModules()) {
        final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
        if (extension != null && !extension.isLibrary() && extension.isPreDexingEnabled()) {
            final AndroidPlatform platform = AndroidJpsUtil.getAndroidPlatform(module, null, null);
            if (platform != null) {
                fillDepsRecursively(module, libModules, externalJars, dataPaths, platform);
            }
        }
    }
    for (JpsModule libModule : libModules) {
        final File classesJarFile = new AndroidLibraryPackagingTarget(libModule).getOutputFile(dataPaths);
        result.add(new MyRootDescriptor(this, classesJarFile, libModule.getName()));
    }
    for (String externalJarPath : externalJars) {
        result.add(new MyRootDescriptor(this, new File(externalJarPath), null));
    }
    return result;
}
Also used : AndroidPlatform(org.jetbrains.jps.android.AndroidPlatform) JpsModule(org.jetbrains.jps.model.module.JpsModule) 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 AndroidPlatform

use of org.jetbrains.jps.android.AndroidPlatform 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)

Aggregations

File (java.io.File)2 NotNull (org.jetbrains.annotations.NotNull)2 AndroidPlatform (org.jetbrains.jps.android.AndroidPlatform)2 JpsAndroidModuleExtension (org.jetbrains.jps.android.model.JpsAndroidModuleExtension)2 HashSet (com.intellij.util.containers.HashSet)1 ArrayList (java.util.ArrayList)1 BuildRootDescriptor (org.jetbrains.jps.builders.BuildRootDescriptor)1 BuildRootDescriptorImpl (org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl)1 JpsModule (org.jetbrains.jps.model.module.JpsModule)1