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


Java TransformInvocation类代码示例

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


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

示例1: runTransform

import com.android.build.api.transform.TransformInvocation; //导入依赖的package包/类
private void runTransform(
        Transform transform,
        TransformOutputProvider outputProvider) throws Exception {

    //Cleaning output directory.
    FileUtil.deleteDirectory(outputJarsDir);
    outputJarsDir.mkdirs();

    //Preparing Transform invocation.
    TransformInput input =
            new TransformInputBuilder().addJarInputFolder(inputJarsDir).build();
    TransformInput referencedInput =
            new TransformInputBuilder().addJarInput(androidClassPath).build();

    TransformInvocation invocation = new TransformInvocationBuilder()
            .addInput(input)
            .addReferencedInput(referencedInput)
            .setOutputProvider(outputProvider)
            .build();

    //Running the transform invocation.
    transform.transform(invocation);
}
 
开发者ID:uber,项目名称:okbuck,代码行数:24,代码来源:TransformRunner.java

示例2: 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

示例3: build

import com.android.build.api.transform.TransformInvocation; //导入依赖的package包/类
/**
 * Builds the {@link TransformInvocation}.
 *
 * @return a new {@link TransformInvocation} with the specified inputs.
 */

TransformInvocation build() {
    if (outputProvider == null) {
        throw new IllegalArgumentException("Output provider needs to be specified.");
    }
    return new CustomTransformInvocation(inputs, referencedInputs, outputProvider);
}
 
开发者ID:uber,项目名称:okbuck,代码行数:13,代码来源:TransformInvocationBuilder.java

示例4: addInput_shouldAddAnInput

import com.android.build.api.transform.TransformInvocation; //导入依赖的package包/类
@Test
public void addInput_shouldAddAnInput() throws Exception {
    TransformInvocation invocation = builder
            .addInput(transformInput)
            .setOutputProvider(outputProvider)
            .build();
    assertThat(invocation.getInputs()).containsExactly(transformInput);
    assertThat(invocation.getReferencedInputs()).isEmpty();
    assertThat(invocation.getOutputProvider()).isEqualTo(outputProvider);
}
 
开发者ID:uber,项目名称:okbuck,代码行数:11,代码来源:TransformInvocationBuilderTest.java

示例5: addReferencedInput_shouldAddReferencedInput

import com.android.build.api.transform.TransformInvocation; //导入依赖的package包/类
@Test
public void addReferencedInput_shouldAddReferencedInput() throws Exception {
    TransformInvocation invocation = builder
            .addReferencedInput(transformInput)
            .setOutputProvider(outputProvider)
            .build();
    assertThat(invocation.getInputs()).isEmpty();
    assertThat(invocation.getReferencedInputs()).containsExactly(transformInput);
    assertThat(invocation.getOutputProvider()).isEqualTo(outputProvider);
}
 
开发者ID:uber,项目名称:okbuck,代码行数:11,代码来源:TransformInvocationBuilderTest.java

示例6: 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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。