Java Code Examples for com.android.build.api.transform.QualifiedContent#Scope

The following examples show how to use com.android.build.api.transform.QualifiedContent#Scope . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DesugarTask.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void processSingle(
        @NonNull Path input, @NonNull Path output, @NonNull Set<? super QualifiedContent.Scope> scopes)
        throws Exception {
    waitableExecutor.execute(
            () -> {
                if (output.toString().endsWith(SdkConstants.DOT_JAR)) {
                    Files.createDirectories(output.getParent());
                } else {
                    Files.createDirectories(output);
                }

                FileCache cacheToUse;
                if (Files.isRegularFile(input)
                        && Objects.equals(
                        scopes, Collections.singleton(QualifiedContent.Scope.EXTERNAL_LIBRARIES))) {
                    cacheToUse = userCache;
                } else {
                    cacheToUse = null;
                }

                processUsingCache(input, output, cacheToUse);
                return null;
            });
}
 
Example 2
Source File: TransformReplacer.java    From atlas with Apache License 2.0 6 votes vote down vote up
public void replaceMergeJavaResourcesTransform(AppVariantContext appVariantContext, BaseVariantOutput vod) {
    List<TransformTask> baseTransforms = TransformManager.findTransformTaskByTransformType(
            variantContext, MergeJavaResourcesTransform.class);
    for (TransformTask transformTask : baseTransforms) {
        MergeJavaResourcesTransform transform = (MergeJavaResourcesTransform) transformTask.getTransform();
        PackagingOptions packagingOptions = (PackagingOptions) ReflectUtils.getField(transform, "packagingOptions");
        packagingOptions.exclude("**.aidl");
        packagingOptions.exclude("**.cfg");
        Set<? super QualifiedContent.Scope> mergeScopes = (Set<? super QualifiedContent.Scope>) ReflectUtils.getField(transform, "mergeScopes");
        Set<QualifiedContent.ContentType> mergedType = (Set<QualifiedContent.ContentType>) ReflectUtils.getField(transform, "mergedType");
        String name = (String) ReflectUtils.getField(transform, "name");
        AtlasMergeJavaResourcesTransform atlasMergeJavaResourcesTransform = new AtlasMergeJavaResourcesTransform(appVariantContext.getAppVariantOutputContext(ApkDataUtils.get(vod)), packagingOptions, mergeScopes, mergedType.iterator().next(), name, appVariantContext.getScope());
        ReflectUtils.updateField(transformTask, "transform",
                atlasMergeJavaResourcesTransform);
    }

}
 
Example 3
Source File: AtlasIntermediateStreamHelper.java    From atlas with Apache License 2.0 6 votes vote down vote up
public void replaceProvider(TransformInvocation transformInvocation){
    try {
        Field field = intermediateStream.getClass().getDeclaredField("folderUtils");
        field.setAccessible(true);
        IntermediateFolderUtils intermediateFolderUtils = (IntermediateFolderUtils) field.get(intermediateStream);
        Set<QualifiedContent.ContentType> types = (Set<QualifiedContent.ContentType>) ReflectUtils.getField(intermediateFolderUtils,"types");
        Set<? super QualifiedContent.Scope> scopes = (Set<? super QualifiedContent.Scope>) ReflectUtils.getField(intermediateFolderUtils,"scopes");
        AtlasIntermediateFolderUtils atlasIntermediateFolderUtils = new AtlasIntermediateFolderUtils(intermediateFolderUtils.getRootFolder(),types,scopes);
        field.set(intermediateStream,atlasIntermediateFolderUtils);
        TransformOutputProvider transformOutputProvider = transformInvocation.getOutputProvider();
        ReflectUtils.updateField(transformOutputProvider,"folderUtils",atlasIntermediateFolderUtils);

    }catch (Exception e){

    }


}
 
Example 4
Source File: InlineRTransform.java    From shrinker with Apache License 2.0 5 votes vote down vote up
@Override
public Set<? super QualifiedContent.Scope> getScopes() {
    if (!config.inlineR) // empty scope
        return ImmutableSet.of();
    // full
    return Sets.immutableEnumSet(
            QualifiedContent.Scope.PROJECT,
            QualifiedContent.Scope.SUB_PROJECTS,
            QualifiedContent.Scope.EXTERNAL_LIBRARIES);
}
 
Example 5
Source File: AtlasDexMerger.java    From atlas with Apache License 2.0 5 votes vote down vote up
@NonNull
protected File getDexOutputLocation(
        @NonNull TransformOutputProvider outputProvider,
        @NonNull String name,
        @NonNull Set<? super QualifiedContent.Scope> scopes) {
    return outputProvider.getContentLocation(name, TransformManager.CONTENT_DEX, scopes, Format.DIRECTORY);
}
 
Example 6
Source File: TransformInputUtils.java    From atlas with Apache License 2.0 5 votes vote down vote up
public static DirectoryInput makeDirectoryInput(File file, AppVariantContext variantContext) {
    return new DirectoryInput() {
        @Override
        public Map<File, Status> getChangedFiles() {
            return ImmutableMap.of(file, Status.CHANGED);
        }

        @Override
        public String getName() {
            return "folder";
        }

        @Override
        public File getFile() {
            return file;
        }

        @Override
        public Set<QualifiedContent.ContentType> getContentTypes() {
            return ImmutableSet.of(QualifiedContent.DefaultContentType.CLASSES);
        }

        @Override
        public Set<? super QualifiedContent.Scope> getScopes() {
            return ImmutableSet.of(Scope.EXTERNAL_LIBRARIES);
        }
    };

}
 
Example 7
Source File: TransformInputUtils.java    From atlas with Apache License 2.0 5 votes vote down vote up
public static JarInput makeJarInput(File file,AppVariantContext variantContext) {
    BuildAtlasEnvTask.FileIdentity finalFileIdentity = AtlasBuildContext.atlasMainDexHelperMap.get(variantContext.getVariantName()).get(file);
    return new JarInput() {
        @Override
        public Status getStatus() {
            return Status.ADDED;
        }

        @Override
        public String getName() {

            return MD5Util.getFileMD5(file);
        }

        @Override
        public File getFile() {
            return file;
        }

        @Override
        public Set<QualifiedContent.ContentType> getContentTypes() {
            return ImmutableSet.of(QualifiedContent.DefaultContentType.CLASSES);
        }

        @Override
        public Set<? super QualifiedContent.Scope> getScopes() {
            if (finalFileIdentity == null){
                return  ImmutableSet.of(Scope.EXTERNAL_LIBRARIES);
            }
            if (finalFileIdentity.subProject) {
                return ImmutableSet.of(Scope.SUB_PROJECTS);
            } else {
                return ImmutableSet.of(Scope.EXTERNAL_LIBRARIES);
            }
        }
    };
}
 
Example 8
Source File: DataLoaderTransform.java    From DataLoader with Apache License 2.0 4 votes vote down vote up
@Override
public Set<? super QualifiedContent.Scope> getScopes() {
    return TransformManager.SCOPE_FULL_PROJECT;
}
 
Example 9
Source File: WMRouterTransform.java    From WMRouter with Apache License 2.0 4 votes vote down vote up
@Override
public Set<? super QualifiedContent.Scope> getScopes() {
    return TransformManager.SCOPE_FULL_PROJECT;
}
 
Example 10
Source File: InlineRTransform.java    From shrinker with Apache License 2.0 4 votes vote down vote up
@Override
public Set<? super QualifiedContent.Scope> getReferencedScopes() {
    if (config.inlineR) // empty
        return ImmutableSet.of();
    return Sets.immutableEnumSet(QualifiedContent.Scope.PROJECT);
}
 
Example 11
Source File: TaobaoInstantRunDependenciesApkBuilder.java    From atlas with Apache License 2.0 4 votes vote down vote up
@Override
public Set<QualifiedContent.Scope> getScopes() {
    return com.android.build.gradle.internal.pipeline.TransformManager.SCOPE_FULL_PROJECT;
}
 
Example 12
Source File: TaobaoInstantRunSlicer.java    From atlas with Apache License 2.0 4 votes vote down vote up
@Override
public Set<QualifiedContent.Scope> getScopes() {
    return TransformManager.SCOPE_FULL_PROJECT;
}
 
Example 13
Source File: AbstractTransform.java    From SocialSdkLibrary with Apache License 2.0 4 votes vote down vote up
@Override
public Set<? super QualifiedContent.Scope> getScopes() {
    return TransformManager.SCOPE_FULL_PROJECT;
}
 
Example 14
Source File: LibraryTransform.java    From EasyRouter with Apache License 2.0 4 votes vote down vote up
@Override
public Set<? super QualifiedContent.Scope> getScopes() {
    return Sets.immutableEnumSet(QualifiedContent.Scope.PROJECT);
}
 
Example 15
Source File: ApplicationTransform.java    From EasyRouter with Apache License 2.0 4 votes vote down vote up
@Override
public Set<? super QualifiedContent.Scope> getScopes() {
    return TransformManager.SCOPE_FULL_PROJECT;
}