Search in sources :

Example 11 with JpsAndroidModuleExtension

use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension in project android by JetBrains.

the class AndroidPackagingBuildTarget method getOutputRoots.

@NotNull
@Override
public Collection<File> getOutputRoots(CompileContext context) {
    final File moduleOutputDir = ProjectPaths.getModuleOutputDir(myModule, false);
    final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(myModule);
    if (moduleOutputDir == null || extension == null) {
        return Collections.emptyList();
    }
    final String outputPath = AndroidJpsUtil.getApkPath(extension, moduleOutputDir);
    if (outputPath == null) {
        return Collections.emptyList();
    }
    return Collections.singletonList(new File(outputPath));
}
Also used : JpsAndroidModuleExtension(org.jetbrains.jps.android.model.JpsAndroidModuleExtension) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with JpsAndroidModuleExtension

use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension 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 13 with JpsAndroidModuleExtension

use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension 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 14 with JpsAndroidModuleExtension

use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension in project android by JetBrains.

the class AndroidResourcePackagingBuildTarget method writeConfiguration.

@Override
public void writeConfiguration(ProjectDescriptor pd, PrintWriter out) {
    final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(myModule);
    assert extension != null;
    if (extension.isUseCustomManifestPackage()) {
        out.println(extension.getCustomManifestPackage());
    }
    out.println(extension.getAdditionalPackagingCommandLineParameters());
}
Also used : JpsAndroidModuleExtension(org.jetbrains.jps.android.model.JpsAndroidModuleExtension)

Example 15 with JpsAndroidModuleExtension

use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension in project android by JetBrains.

the class AndroidResourcePackagingBuildTarget method fillDependencies.

@Override
protected void fillDependencies(List<BuildTarget<?>> result) {
    super.fillDependencies(result);
    result.add(new AndroidResourceCachingBuildTarget(myModule));
    for (JpsAndroidModuleExtension depExtension : AndroidJpsUtil.getAllAndroidDependencies(myModule, true)) {
        result.add(new AndroidResourceCachingBuildTarget(depExtension.getModule()));
    }
}
Also used : JpsAndroidModuleExtension(org.jetbrains.jps.android.model.JpsAndroidModuleExtension)

Aggregations

JpsAndroidModuleExtension (org.jetbrains.jps.android.model.JpsAndroidModuleExtension)30 File (java.io.File)16 JpsModule (org.jetbrains.jps.model.module.JpsModule)14 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)11 NotNull (org.jetbrains.annotations.NotNull)9 HashMap (com.intellij.util.containers.HashMap)8 ArrayList (java.util.ArrayList)8 BuildRootDescriptor (org.jetbrains.jps.builders.BuildRootDescriptor)7 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)7 HashSet (com.intellij.util.containers.HashSet)6 TObjectLongHashMap (gnu.trove.TObjectLongHashMap)6 IAndroidTarget (com.android.sdklib.IAndroidTarget)3 THashSet (gnu.trove.THashSet)3 IOException (java.io.IOException)3 AndroidBuildTestingManager (org.jetbrains.android.util.AndroidBuildTestingManager)3 AndroidCompilerMessageKind (org.jetbrains.android.util.AndroidCompilerMessageKind)3 BuildRootDescriptorImpl (org.jetbrains.jps.builders.impl.BuildRootDescriptorImpl)3 AndroidArtifactSigningMode (org.jetbrains.android.compiler.artifact.AndroidArtifactSigningMode)2 Nullable (org.jetbrains.annotations.Nullable)2 AndroidPlatform (org.jetbrains.jps.android.AndroidPlatform)2