com.android.build.gradle.api.BaseVariantOutput Java Examples

The following examples show how to use com.android.build.gradle.api.BaseVariantOutput. 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: ApplicationVariantFactory.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
public static void createApkOutputApiObjects(
        @NonNull Instantiator instantiator,
        @NonNull BaseVariantData<? extends BaseVariantOutputData> variantData,
        @NonNull ApkVariantImpl variant) {
    List<? extends BaseVariantOutputData> outputList = variantData.getOutputs();
    List<BaseVariantOutput> apiOutputList = Lists.newArrayListWithCapacity(outputList.size());

    for (BaseVariantOutputData variantOutputData : outputList) {
        ApkVariantOutputData apkOutput = (ApkVariantOutputData) variantOutputData;

        ApkVariantOutputImpl output = instantiator.newInstance(
                ApkVariantOutputImpl.class, apkOutput);

        apiOutputList.add(output);
    }

    variant.addOutputs(apiOutputList);
}
 
Example #2
Source File: TransformReplacer.java    From atlas with Apache License 2.0 6 votes vote down vote up
public void replaceDexMerge(BaseVariantOutput vod) {
    List<TransformTask> list = TransformManager.findTransformTaskByTransformType(variantContext,
            DexMergerTransform.class);
    DexingType dexingType = variantContext.getScope().getDexingType();
    if (variantContext.getScope().getInstantRunBuildContext().isInInstantRunMode() && variantContext.getVariantConfiguration().getMinSdkVersion().getApiLevel() < 21) {
        dexingType = DexingType.LEGACY_MULTIDEX;
    }
    DexMergerTool dexMergerTool = variantContext.getScope().getDexMerger();
    int sdkVerision = variantContext.getScope().getMinSdkVersion().getFeatureLevel();
    boolean debug = variantContext.getScope().getVariantConfiguration().getBuildType().isDebuggable();
    ErrorReporter errorReporter = variantContext.getScope().getGlobalScope().getAndroidBuilder().getErrorReporter();
    for (TransformTask transformTask : list) {
        AtlasDexMergerTransform dexMergerTransform = new AtlasDexMergerTransform(
                variantContext.getAppVariantOutputContext(ApkDataUtils.get(vod))
                , dexingType,
                dexingType == DexingType.LEGACY_MULTIDEX
                        ? variantContext.getProject().files(variantContext.getScope().getMainDexListFile())
                        : null,
                errorReporter, dexMergerTool, sdkVerision, debug);
        ReflectUtils.updateField(transformTask, "transform", dexMergerTransform);

    }
}
 
Example #3
Source File: LibraryVariantFactory.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@Override
@NonNull
public LibraryVariant createVariantApi(
        @NonNull BaseVariantData<? extends BaseVariantOutputData> variantData,
        @NonNull ReadOnlyObjectProvider readOnlyObjectProvider) {
    LibraryVariantImpl variant = instantiator.newInstance(
            LibraryVariantImpl.class, variantData, androidBuilder, readOnlyObjectProvider);

    // now create the output objects
    List<? extends BaseVariantOutputData> outputList = variantData.getOutputs();
    List<BaseVariantOutput> apiOutputList = Lists.newArrayListWithCapacity(outputList.size());

    for (BaseVariantOutputData variantOutputData : outputList) {
        LibVariantOutputData libOutput = (LibVariantOutputData) variantOutputData;

        LibraryVariantOutputImpl output = instantiator.newInstance(
                LibraryVariantOutputImpl.class, libOutput);

        apiOutputList.add(output);
    }

    variant.addOutputs(apiOutputList);

    return variant;
}
 
Example #4
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 #5
Source File: TaobaoInstantRunDex.java    From atlas with Apache License 2.0 6 votes vote down vote up
public TaobaoInstantRunDex(
        AppVariantContext variantContext,
        @NonNull InstantRunVariantScope transformVariantScope,
        DexByteCodeConverter dexByteCodeConverter,
        @NonNull DexOptions dexOptions,
        @NonNull Logger logger,
        int minSdkForDx,
        BaseVariantOutput variantOutput) {
    this.variantScope = transformVariantScope;
    this.variantContext = variantContext;
    this.dexByteCodeConverter = dexByteCodeConverter;
    this.dexOptions = dexOptions;
    this.logger = new LoggerWrapper(logger);
    this.minSdkForDx = minSdkForDx;
    this.variantOutput = variantOutput;
}
 
Example #6
Source File: TransformReplacer.java    From atlas with Apache License 2.0 6 votes vote down vote up
public void replaceDesugarTransform(BaseVariantOutput vod) {
    List<TransformTask> baseTransforms = TransformManager.findTransformTaskByTransformType(
            variantContext, DesugarTransform.class);
    for (TransformTask transformTask : baseTransforms) {
        DesugarTransform transform = (DesugarTransform) transformTask.getTransform();
        AtlasDesugarTransform atlasDesugarTransform = new AtlasDesugarTransform(
                variantContext.getAppVariantOutputContext(ApkDataUtils.get(vod)),
                (Supplier<List<File>>) ReflectUtils.getField(transform, "androidJarClasspath"),
                (List) ReflectUtils.getField(transform, "compilationBootclasspath"),
                variantContext.getScope().getGlobalScope().getBuildCache(),
                (int) ReflectUtils.getField(transform, "minSdk"),
                (JavaProcessExecutor) ReflectUtils.getField(transform, "executor"),
                (boolean) ReflectUtils.getField(transform, "verbose"),
                (boolean) ReflectUtils.getField(transform, "enableGradleWorkers"),
                (Path) ReflectUtils.getField(transform, "tmpDir"));
        atlasDesugarTransform.oldTransform = transform;
        ReflectUtils.updateField(transformTask, "transform",
                atlasDesugarTransform);
    }
}
 
Example #7
Source File: AtlasTransformUtils.java    From atlas with Apache License 2.0 6 votes vote down vote up
public static Collection<File> getTransformInputs(AppVariantContext appVariantContext,
        TransformInvocation invocation) {
    ImmutableSet.Builder<File> builder = ImmutableSet.builder();
    Collection<File> transformInputs = TransformInputUtil.getAllFiles(invocation.getInputs());
    builder.addAll(transformInputs);
    AtlasDependencyTree atlasDependencyTree = AtlasBuildContext.androidDependencyTrees.get(
            appVariantContext.getVariantConfiguration().getFullName());

    if (atlasDependencyTree.getAwbBundles().size() > 0) {

        BaseVariantOutput vod =
                (BaseVariantOutput) appVariantContext.getVariantOutputData().iterator().next();
        AppVariantOutputContext appVariantOutputContext =
                appVariantContext.getAppVariantOutputContext(ApkDataUtils.get(vod));
        Collection<AwbTransform> awbTransforms =
                appVariantOutputContext.getAwbTransformMap().values();
        awbTransforms.forEach(awbTransform -> {
            builder.addAll(awbTransform.getInputLibraries());
        });
    }
    return builder.build();
}
 
Example #8
Source File: MtlTaskFactoryImpl.java    From atlas with Apache License 2.0 6 votes vote down vote up
private Constructor<? extends MtlBaseTaskAction> getConstructor(Class<? extends MtlBaseTaskAction> baseTaskAction,
                                                                Class variantClazz) throws NoSuchMethodException {

    try {
        return baseTaskAction.getConstructor(variantClazz, BaseVariantOutput.class);
    } catch (NoSuchMethodException ex1) {

        Class superClazz = variantClazz.getSuperclass();

        if (null != superClazz) {
            return getConstructor(baseTaskAction, superClazz);
        } else {
            throw ex1;
        }

    }

}
 
Example #9
Source File: TransformManager.java    From atlas with Apache License 2.0 6 votes vote down vote up
public static <T extends Transform> T createTransform(AppVariantContext appVariantContext,
                                                      Class<T> clazz, BaseVariantOutput vod) {

    if (null == clazz) {
        return null;
    }
    try {

        return (T)getConstructor(appVariantContext, clazz,ApkDataUtils.get(vod)).newInstance(
            appVariantContext, ApkDataUtils.get(vod));

    } catch (Throwable e) {
        e.printStackTrace();
    }
    return null;

}
 
Example #10
Source File: MergeSoLibTask.java    From atlas with Apache License 2.0 5 votes vote down vote up
public ConfigAction(AppVariantContext appVariantContext,
                    BaseVariantOutput baseVariantOutputData) {
    super(appVariantContext, baseVariantOutputData);

    this.appVariantContext = appVariantContext;
    GradleVariantConfiguration config = scope.getVariantConfiguration();
    dependencyTree = AtlasBuildContext.androidDependencyTrees.get(config.getFullName());
}
 
Example #11
Source File: AndroidPublishTask.java    From gradle-android-publisher with Apache License 2.0 5 votes vote down vote up
private File getApkFile(AndroidPublisherExtension publisherExtension) {
	String variantName = publisherExtension.getVariantName();
	DomainObjectSet<ApplicationVariant> variants = getProject().getExtensions().getByType(AppExtension.class).getApplicationVariants();
	ApplicationVariant variant = null;
	getLogger().info(String.format("Looking for %s variant in outputs", variantName));
	for (ApplicationVariant v : variants) {
		getLogger().debug(String.format("Found variant %s", v.getName()));
		if (v.getName().equals(variantName)) {
			getLogger().debug(String.format("Variant %s will be used", variantName));
			variant = v;
			break;
		}
	}
	if (variant == null) {
		throw new InvalidUserDataException(String.format(
				"Cannot find %s variant for android configuration", variantName));
	}

	for(BaseVariantOutput output : variant.getOutputs()) {
		getLogger().debug(String.format("Found output %s (%s)", output.getName(), output.getBaseName()));
		if (output!=null) {
			getLogger().debug(String.format("Output %s will be used", output.getName()));
			return output.getOutputFile();
		}
	}
	throw new InvalidUserDataException(String.format(
			"Cannot find APK output file for %s variant", variantName));
}
 
Example #12
Source File: AtlasDexArchiveBuilderTransform.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AtlasDexArchiveBuilderTransform(AppVariantContext variantContext, VariantOutput variantOutput,
                                       @NonNull DexOptions dexOptions,
                                       @NonNull ErrorReporter errorReporter,
                                       @Nullable FileCache userLevelCache,
                                       int minSdkVersion,
                                       @NonNull DexerTool dexer,
                                       boolean useGradleWorkers,
                                       @Nullable Integer inBufferSize,
                                       @Nullable Integer outBufferSize,
                                       boolean isDebuggable) {

    this.variantContext = variantContext;
    this.variantOutput = (BaseVariantOutput) variantOutput;
    this.dexOptions = dexOptions;
    this.errorReporter = errorReporter;
    this.minSdkVersion = minSdkVersion;
    this.dexer = dexer;
    this.executor = WaitableExecutor.useGlobalSharedThreadPool();
    this.cacheHandler =
            new AtlasDexArchiveBuilderCacheHander(variantContext.getProject(),
                    userLevelCache, dexOptions, minSdkVersion, isDebuggable, dexer);
    this.useGradleWorkers = useGradleWorkers;
    this.inBufferSize =
            (inBufferSize == null ? DEFAULT_BUFFER_SIZE_IN_KB : inBufferSize) * 1024;
    this.outBufferSize =
            (outBufferSize == null ? DEFAULT_BUFFER_SIZE_IN_KB : outBufferSize) * 1024;
    this.isDebuggable = isDebuggable;

}
 
Example #13
Source File: TransformReplacer.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void replaceFixStackFramesTransform(BaseVariantOutput vod) {
    List<TransformTask> baseTransforms = TransformManager.findTransformTaskByTransformType(
            variantContext, FixStackFramesTransform.class);
    for (TransformTask transformTask : baseTransforms) {
        FixStackFramesTransform transform = (FixStackFramesTransform) transformTask.getTransform();

        AtlasFixStackFramesTransform atlasFixStackFramesTransform = new AtlasFixStackFramesTransform(variantContext.getAppVariantOutputContext(ApkDataUtils.get(vod)), (Supplier<List<File>>) ReflectUtils.getField(transform, "androidJarClasspath"), (List<Path>) ReflectUtils.getField(transform, "compilationBootclasspath"), (FileCache) ReflectUtils.getField(transform, "userCache"));
        atlasFixStackFramesTransform.oldTransform = transform;
        ReflectUtils.updateField(transformTask, "transform",
                atlasFixStackFramesTransform);
    }
}
 
Example #14
Source File: MtlBaseTaskAction.java    From atlas with Apache License 2.0 5 votes vote down vote up
public MtlBaseTaskAction(VariantContext variantContext,
                         BaseVariantOutput baseVariantOutput) {
    this.variantContext = variantContext;
    this.baseVariantData = variantContext.getBaseVariantData();
    this.scope = baseVariantData.getScope();
    this.baseVariantOutput = baseVariantOutput;
}
 
Example #15
Source File: TransformReplacer.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void replaceDexTransform(AppVariantContext appVariantContext, BaseVariantOutput vod) {
    List<TransformTask> baseTransforms = TransformManager.findTransformTaskByTransformType(
            variantContext, DexTransform.class);

    DefaultDexOptions dexOptions = appVariantContext.getAppExtension().getDexOptions();
    DexingType dexingType = appVariantContext.getScope().getDexingType();
    DexByteCodeConverterHook dexByteCodeConverterHook = new DexByteCodeConverterHook(variantContext
            , variantContext.getAppVariantOutputContext(ApkDataUtils.get(vod))
            , LoggerWrapper.getLogger(DexByteCodeConverterHook.class)
            , appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getTargetInfo()
            , new GradleJavaProcessExecutor(appVariantContext.getProject())
            , appVariantContext.getProject().getLogger().isEnabled(LogLevel.INFO)
            , new ExtraModelInfo(appVariantContext.getScope().getGlobalScope().getProjectOptions(), appVariantContext.getProject().getLogger()));

    for (TransformTask transformTask : baseTransforms) {
        DexTransform newTransform = new DexTransform(dexOptions
                , dexingType
                , false
                , appVariantContext.getProject().files(variantContext.getScope().getMainDexListFile())
                , verifyNotNull(appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getTargetInfo(), "Target Info not set.")
                , dexByteCodeConverterHook
                , appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getErrorReporter()
                , variantContext.getScope().getMinSdkVersion().getFeatureLevel());
        ReflectUtils.updateField(transformTask, "transform",
                newTransform);
    }

}
 
Example #16
Source File: MtlTaskFactoryImpl.java    From atlas with Apache License 2.0 5 votes vote down vote up
@Override
public Task createTask(VariantContext variantContext, BaseVariantOutput vod,
                       Class<? extends MtlBaseTaskAction> baseTaskAction) {

    if (null == baseTaskAction) {
        return null;
    }

    try {

        MtlBaseTaskAction mtlBaseTaskAction = getConstructor(baseTaskAction, variantContext.getClass()).newInstance(
            variantContext, vod);

        Task task = variantContext.getProject().getTasks().findByName(mtlBaseTaskAction.getName());

        if (null == task) {
            task = variantContext.getProject().getTasks().create(mtlBaseTaskAction.getName(),
                                                                 mtlBaseTaskAction.getType());
            mtlBaseTaskAction.execute(task);
        } else {
            sLogger.info(mtlBaseTaskAction.getName() + " is already added");
        }

        return task;

    } catch (Throwable e) {
        //sLogger.error("add task exception", e);
        throw new GradleException(e.getMessage(),e);
    }

    //return null;
}
 
Example #17
Source File: TransformReplacer.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void replaceDexExternalLibMerge(BaseVariantOutput vod) {
    List<TransformTask> list = TransformManager.findTransformTaskByTransformType(variantContext,
            ExternalLibsMergerTransform.class);
    for (TransformTask transformTask : list) {
        transformTask.setEnabled(false);


    }
}
 
Example #18
Source File: MergeAwbResource.java    From atlas with Apache License 2.0 5 votes vote down vote up
public MergeAwbResourceConfigAction(VariantContext variantContext,
                                    BaseVariantOutput baseVariantOutput,
                                    AwbBundle awbBundle) {
    super(variantContext, baseVariantOutput);
    this.variantContext = variantContext;
    this.awbBundle = awbBundle;
    this.scope = variantContext.getScope();
    this.outputLocation = variantContext.getMergeResources(awbBundle);
    this.mergedNotCompiledOutputDirectory = variantContext.getMergeNotCompiledFolder(awbBundle);
    this.includeDependencies = true;
    this.processResources = true;
}
 
Example #19
Source File: MergeAwbAssets.java    From atlas with Apache License 2.0 5 votes vote down vote up
public MergeAwbAssetConfigAction(VariantContext variantContext, BaseVariantOutput baseVariantOutput, AwbBundle awbBundle) {
    super(variantContext, baseVariantOutput);
    this.variantContext = variantContext;
    this.scope = variantContext.getScope();
    this.awbBundle = awbBundle;
    this.outputDir = variantContext.getMergeAssets(awbBundle);
}
 
Example #20
Source File: AwbPackagingScope.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AwbPackagingScope(VariantScope variantOutputScope, AppVariantContext appVariantContext,
                         AwbBundle awbBundle, BaseVariantOutput variantOutput) {
    super(variantOutputScope);
    this.variantScope = variantOutputScope;
    this.globalScope = variantScope.getGlobalScope();
    this.appVariantContext = appVariantContext;
    config = variantScope.getVariantConfiguration();
    appVariantOutputContext = appVariantContext.getAppVariantOutputContext(ApkDataUtils.get(variantOutput));
    this.awbBundle = awbBundle;
}
 
Example #21
Source File: ProcessAwbAndroidResources.java    From atlas with Apache License 2.0 5 votes vote down vote up
public ConfigAction(VariantScope scope, File symbolLocation, boolean generateResourcePackage, AwbBundle awbBundle, AndroidBuilder androidBuilder, AppVariantOutputContext appVariantOutputContext, BaseVariantOutput variantOutput) {
    this.scope = scope;
    this.symbolLocation = symbolLocation;
    this.generateResourcePackage = generateResourcePackage;
    this.awbBundle = awbBundle;
    this.tAndroidBuilder = androidBuilder;
    this.appVariantOutputContext = appVariantOutputContext;
    this.variantOutput = variantOutput;
}
 
Example #22
Source File: AtlasProguardHelper.java    From atlas with Apache License 2.0 5 votes vote down vote up
public static File applyBundleInOutConfigration(final AppVariantContext appVariantContext,
                                                ProGuardTransform proGuardTransform) {

    VariantScope variantScope = appVariantContext.getScope();

    GlobalScope globalScope = variantScope.getGlobalScope();
    File proguardOut = new File(Joiner.on(File.separatorChar)
                                    .join(String.valueOf(globalScope.getBuildDir()), FD_OUTPUTS, "mapping",
                                          variantScope.getVariantConfiguration().getDirName()));

    File awbInOutConfig = new File(proguardOut, "awb_inout_config.cfg");

    //Add awb configuration
    AtlasDependencyTree dependencyTree = AtlasBuildContext.androidDependencyTrees.get(
        variantScope.getVariantConfiguration().getFullName());

    if (dependencyTree.getAwbBundles().size() > 0) {

        BaseVariantOutput vod = (BaseVariantOutput) appVariantContext.getVariantOutputData().iterator().next();
        AppVariantOutputContext appVariantOutputContext = appVariantContext.getAppVariantOutputContext(ApkDataUtils.get(vod));
        File awbObfuscatedDir = new File(globalScope.getIntermediatesDir(),
                                         "/classes-proguard/" + variantScope.getVariantConfiguration()
                                             .getDirName());
        AwbProguardConfiguration awbProguardConfiguration = new AwbProguardConfiguration(
            appVariantOutputContext.getAwbTransformMap().values(), awbObfuscatedDir, appVariantOutputContext);

        try {
            configs = awbProguardConfiguration.printConfigFile(awbInOutConfig);
        } catch (IOException e) {
            throw new GradleException("", e);
        }

        proGuardTransform.setConfigurationFiles(appVariantContext.getScope().getGlobalScope().getProject().files(awbInOutConfig));

    }

    return awbInOutConfig;
}
 
Example #23
Source File: DelegateProguardTransform.java    From atlas with Apache License 2.0 5 votes vote down vote up
public File applyBundleInOutConfigration(final AppVariantContext appVariantContext) {

        VariantScope variantScope = appVariantContext.getScope();

        GlobalScope globalScope = variantScope.getGlobalScope();
        File proguardOut = new File(Joiner.on(File.separatorChar)
                .join(String.valueOf(globalScope.getBuildDir()), FD_OUTPUTS, "mapping",
                        variantScope.getVariantConfiguration().getDirName()));

        File awbInOutConfig = new File(proguardOut, "awb_inout_config.cfg");

        //Add awb configuration
        AtlasDependencyTree dependencyTree = AtlasBuildContext.androidDependencyTrees.get(
                variantScope.getVariantConfiguration().getFullName());

        if (dependencyTree.getAwbBundles().size() > 0) {
            BaseVariantOutput vod = (BaseVariantOutput) appVariantContext.getVariantOutputData().iterator().next();
            AppVariantOutputContext appVariantOutputContext = appVariantContext.getAppVariantOutputContext(ApkDataUtils.get(vod));
            File awbObfuscatedDir = new File(globalScope.getIntermediatesDir(),
                    "/classes-proguard/" + variantScope.getVariantConfiguration()
                            .getDirName());
            AwbProguardConfiguration awbProguardConfiguration = new AwbProguardConfiguration(
                    appVariantOutputContext.getAwbTransformMap().values(), awbObfuscatedDir, appVariantOutputContext);

            try {
                awbProguardConfiguration.printConfigFile(awbInOutConfig);
            } catch (IOException e) {
                throw new GradleException("", e);
            }

            defaultProguardFiles.add(awbInOutConfig);

        }

        return awbInOutConfig;
    }
 
Example #24
Source File: TransformReplacer.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void replaceDexArchiveBuilderTransform(BaseVariantOutput vod) {
    List<TransformTask> list = TransformManager.findTransformTaskByTransformType(variantContext,
            DexArchiveBuilderTransform.class);

    DefaultDexOptions dexOptions = variantContext.getAppExtension().getDexOptions();

    boolean minified = variantContext.getScope().getCodeShrinker() != null;

    ProjectOptions projectOptions = variantContext.getScope().getGlobalScope().getProjectOptions();

    FileCache userLevelCache = getUserDexCache(minified, dexOptions.getPreDexLibraries());
    for (TransformTask transformTask : list) {
        AtlasDexArchiveBuilderTransform atlasDexArchiveBuilderTransform = new AtlasDexArchiveBuilderTransform(variantContext, vod,
                dexOptions,
                variantContext.getScope().getGlobalScope().getAndroidBuilder().getErrorReporter(),
                userLevelCache,
                variantContext.getScope().getMinSdkVersion().getFeatureLevel(),
                variantContext.getScope().getDexer(),
                projectOptions.get(BooleanOption.ENABLE_GRADLE_WORKERS),
                projectOptions.get(IntegerOption.DEXING_READ_BUFFER_SIZE),
                projectOptions.get(IntegerOption.DEXING_WRITE_BUFFER_SIZE),
                variantContext.getScope().getVariantConfiguration().getBuildType().isDebuggable());
        atlasDexArchiveBuilderTransform.setTransformTask(transformTask);
        ReflectUtils.updateField(transformTask, "transform", atlasDexArchiveBuilderTransform);
        if (variantContext.getScope().getInstantRunBuildContext().isInInstantRunMode() && variantContext.getVariantConfiguration().getMinSdkVersion().getApiLevel() < 21) {
            transformTask.doLast(task -> {
                task.getLogger().info("generate maindexList......");
                generateMainDexList(variantContext.getScope());

            });
        }

    }

}
 
Example #25
Source File: PackageTPatchConfigAction.java    From atlas with Apache License 2.0 4 votes vote down vote up
public PackageTPatchConfigAction(VariantContext variantContext, BaseVariantOutput baseVariantOutputData) {
    super(variantContext, baseVariantOutputData);
}
 
Example #26
Source File: PrepareAPTask.java    From atlas with Apache License 2.0 4 votes vote down vote up
public ConfigAction(VariantContext variantContext, BaseVariantOutput baseVariantOutput) {
    super(variantContext, baseVariantOutput);
}
 
Example #27
Source File: BuildAtlasEnvTask.java    From atlas with Apache License 2.0 4 votes vote down vote up
public ConfigAction(AppVariantContext appVariantContext,
                    BaseVariantOutput baseVariantOutputData) {
    super(appVariantContext, baseVariantOutputData);
    this.appVariantContext = appVariantContext;
}
 
Example #28
Source File: JavacAwbsTask.java    From atlas with Apache License 2.0 4 votes vote down vote up
public ConfigAction(AppVariantContext appVariantContext, BaseVariantOutput baseVariantOutputData) {
    super(appVariantContext, baseVariantOutputData);
}
 
Example #29
Source File: MtlTransformInjector.java    From atlas with Apache License 2.0 4 votes vote down vote up
public void injectTasks(List<MtlTransformContext> mtlTaskContexts) {



        for (final Object vod : appVariantContext.getVariantOutputData()) {

            for (MtlTransformContext mtlTransformContext : mtlTaskContexts) {

                TransformTask transformTask = findTransformTask(mtlTransformContext);

                TransformTask injectedTask = appVariantContext.getInjectTransformManager()
                    .addInjectTransformBeforeTransform(transformTask.getTransform().getClass(),
                                                       TransformManager.createTransform(appVariantContext,
                                                                                        mtlTransformContext
                                                                                            .getTransformTask(), (BaseVariantOutput) vod),
                                                       appVariantContext.getScope());

                injectedTask.dependsOn(appVariantContext.getVariantData().compileTask);

            }

        }

    }
 
Example #30
Source File: MergeAwbAssets.java    From atlas with Apache License 2.0 4 votes vote down vote up
public MergeAwbJniLibFoldersConfigAction(VariantContext variantContext, BaseVariantOutput baseVariantOutput, AwbBundle awbBundle) {
    super(variantContext,baseVariantOutput);
    this.awbBundle = awbBundle;
}