本文整理汇总了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);
}
}
示例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);
}
}