当前位置: 首页>>代码示例>>Java>>正文


Java TransformInvocation.getInputs方法代码示例

本文整理汇总了Java中com.android.build.api.transform.TransformInvocation.getInputs方法的典型用法代码示例。如果您正苦于以下问题:Java TransformInvocation.getInputs方法的具体用法?Java TransformInvocation.getInputs怎么用?Java TransformInvocation.getInputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.build.api.transform.TransformInvocation的用法示例。


在下文中一共展示了TransformInvocation.getInputs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fastTransform

import com.android.build.api.transform.TransformInvocation; //导入方法依赖的package包/类
public void fastTransform(TransformInvocation invocation) throws TransformException {

        try {

            Profiler.start("start");

            List<File> mainJars = new ArrayList<>();
            for (TransformInput transformInput : invocation.getInputs()) {
                for (JarInput jarInput : transformInput.getJarInputs()) {
                    mainJars.add(jarInput.getFile());
                }
            }

            Profiler.enter("bundleproguard");
            //Do the concurrent proguard for the bundle, and the cache first
            AtlasProguardHelper.doBundleProguard(appVariantContext, mainJars);
            Profiler.release();

            Profiler.enter("mainproguard");
            doMainBundleProguard(invocation);
            Profiler.release();

            Profiler.release();

            //if (appVariantContext.getProject().getGradle().getStartParameter().isProfile()) {
            //    appVariantContext.getProject().getLogger().warn("proguard profile >>>>>" );
            //    appVariantContext.getProject().getLogger().warn( Profiler.dump());
            //}
            FileLogger.getInstance("proguard").log(Profiler.dump());

        } catch (Exception e) {
            throw new GradleException(e.getMessage(), e);
        }
    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:35,代码来源:AtlasProguardTransform.java

示例2: doMainBundleProguard

import com.android.build.api.transform.TransformInvocation; //导入方法依赖的package包/类
private void doMainBundleProguard(TransformInvocation invocation) throws Exception {

        //apply bundle Inout
        Profiler.enter("bundleKeep");
        File bundleKeep = AtlasProguardHelper.generateBundleKeepCfg(appVariantContext);
        Profiler.release();

        Input input = new Input();
        AwbBundle awbBundle = new AwbBundle();
        awbBundle.getAndroidLibraries().addAll(AtlasBuildContext.androidDependencyTrees.get(appVariantContext.getVariantName()).getMainBundle().getAndroidLibraries());
        AwbTransform awbTransform = new AwbTransform(awbBundle);
        input.getAwbBundles().add(awbTransform);

        List<File> unProguardJars = new ArrayList<>();
        //Enter the input
        for (TransformInput transformInput : invocation.getInputs()) {
            for (JarInput jarInput : transformInput.getJarInputs()) {
                File file = jarInput.getFile();
                if (file.getName().startsWith("combined-rmerge")) {
                    unProguardJars.add(file);
                } else {
                    awbTransform.getInputLibraries().add(file);
                }
            }
            for (DirectoryInput directoryInput : transformInput.getDirectoryInputs()) {
                awbTransform.getInputLibraries().add(directoryInput.getFile());
            }
        }

        //inputting librarys
        input.getLibraries().addAll(
            appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getBootClasspath(true));
        input.getLibraries().addAll(unProguardJars);

        //The default proguard configuration
        input.getDefaultProguardFiles().addAll(defaultProguardFiles);

        //bundle keeps
        input.getParentKeeps().add(bundleKeep);

        File outFile = invocation.getOutputProvider().getContentLocation("main", getOutputTypes(), getScopes(),
                                                                         Format.JAR);
        outFile.delete();
        input.proguardOutputDir = outFile.getParentFile();
        input.printMapping = (File)ReflectUtils.getField(oldTransform, "printMapping");
        input.dump = (File)ReflectUtils.getField(oldTransform, "dump");
        input.printSeeds = (File)ReflectUtils.getField(oldTransform, "printSeeds");
        input.printUsage = (File)ReflectUtils.getField(oldTransform, "printUsage");
        input.printConfiguration = new File(appVariantContext.getProject().getBuildDir(), "outputs/proguard.cfg");

        Profiler.enter("executeproguard");
        BundleProguarder.execute(appVariantContext, input);
        Profiler.release();

        for (File jar : unProguardJars) {

            File to = invocation.getOutputProvider().getContentLocation(FileNameUtils.getUniqueJarName(jar),
                                                                        getOutputTypes(), getScopes(),
                                                                        Format.JAR);
            FileUtils.copyFile(jar, to);

        }

    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:65,代码来源:AtlasProguardTransform.java


注:本文中的com.android.build.api.transform.TransformInvocation.getInputs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。