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


Java VariantConfiguration类代码示例

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


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

示例1: findTransformTaskByTransformType

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
public static List<TransformTask> findTransformTaskByTransformType(AppVariantContext appVariantContext, Class<?>
    transformClass) {
    List<TransformTask> transformTasksList = Lists.newArrayList();
    VariantConfiguration config = appVariantContext.getVariantConfiguration();
    TaskCollection<TransformTask> transformTasks = appVariantContext.getProject().getTasks().withType(
        TransformTask.class);
    SortedMap<String, TransformTask> transformTaskSortedMap = transformTasks.getAsMap();
    String variantName = config.getFullName();
    for (String taskName : transformTaskSortedMap.keySet()) {
        TransformTask transformTask = transformTaskSortedMap.get(taskName);
        if (variantName == transformTask.getVariantName()) {
            if (transformTask.getTransform().getClass() == transformClass) {
                transformTasksList.add(transformTask);
            }
        }
    }
    return transformTasksList;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:19,代码来源:TransformManager.java

示例2: getJniFolders

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
/**
 * Calculate the list of folders that can contain jni artifacts for this variant.
 *
 * @return a potentially empty list of directories that exist or not and that may contains
 * native resources.
 */
@NonNull
public Set<File> getJniFolders(@NonNull VariantScope scope) {

    BaseVariantData variantData = scope.getVariantData();
    VariantConfiguration config = variantData.getVariantConfiguration();
    // for now only the project's compilation output.
    Set<File> set = Sets.newHashSet();
    addAllIfNotNull(set, scope.getNdkSoFolder());
    set.add(variantData.renderscriptCompileTask.getLibOutputDir());
    //noinspection unchecked
    addAllIfNotNull(set, config.getLibraryJniFolders());
    //noinspection unchecked
    addAllIfNotNull(set, config.getJniLibsList());

    if (Boolean.TRUE.equals(config.getMergedFlavor().getRenderscriptSupportModeEnabled())) {
        File rsLibs = androidBuilder.getSupportNativeLibFolder();
        if (rsLibs != null && rsLibs.isDirectory()) {
            set.add(rsLibs);
        }

    }

    return set;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:TaskManager.java

示例3: configureScopeForNdk

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
public static void configureScopeForNdk(VariantScope scope) {
    VariantConfiguration config = scope.getVariantConfiguration();
    ImmutableSet.Builder<File> builder = ImmutableSet.builder();
    for (Abi abi : NdkHandler.getAbiList()) {
        scope.addNdkDebuggableLibraryFolders(
                abi,
                new File(
                        scope.getGlobalScope().getBuildDir(),
                        NdkNamingScheme.getDebugLibraryDirectoryName(
                                config.getBuildType().getName(),
                                config.getFlavorName(),
                                abi.getName())));

        // Return the parent directory of the binaries' output.
        // If output directory is "/path/to/lib/platformName".  We want to return
        // "/path/to/lib".
        builder.add(new File(
                scope.getGlobalScope().getBuildDir(),
                NdkNamingScheme.getOutputDirectoryName(
                        config.getBuildType().getName(),
                        config.getFlavorName(),
                        abi.getName())).getParentFile());
    }
    scope.setNdkSoFolder(builder.build());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NdkComponentModelPlugin.java

示例4: execute

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
@Override
public void execute(@NonNull CopyAwoSolibTask copyAwoSolibTask) {

    //            final File mainJniOutputFolder = libVariantContext.getBaseVariantData().ndkCompileTask.getSoFolder();
    copyAwoSolibTask.outputDir = new File(awbBundle.getAndroidLibrary().getJniFolder(), "lib");

    copyAwoSolibTask.awbBundle = awbBundle;

    final VariantConfiguration<CoreBuildType, CoreProductFlavor, CoreProductFlavor> config = libVariantContext
            .getVariantConfiguration();
    copyAwoSolibTask.setVariantName(config.getFullName());
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:13,代码来源:CopyAwoSolibTask.java

示例5: execute

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
@Override
public void execute(@NonNull MergeAwoManifests processManifestTask) {
    final VariantConfiguration<CoreBuildType, CoreProductFlavor, CoreProductFlavor> config = libVariantContext
        .getVariantConfiguration();
    processManifestTask.setAndroidBuilder(scope.getGlobalScope().getAndroidBuilder());
    processManifestTask.setVariantName(config.getFullName());

    processManifestTask.awbBundle = awbBundle;
    processManifestTask.versionCode = String.valueOf(config.getVersionCode());

    awbBundle.setMergedManifest(libVariantContext.getMergedManifest());

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

示例6: execute

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
@Override
public void execute(@NonNull PrepareBaseApkTask prepareBaseApkTask) {
    final VariantConfiguration<?, ?, ?> variantConfiguration = scope.getVariantConfiguration();

    prepareBaseApkTask.setAndroidBuilder(scope.getGlobalScope().getAndroidBuilder());
    prepareBaseApkTask.setVariantName(scope.getVariantConfiguration().getFullName());
    prepareBaseApkTask.setIncrementalFolder(scope.getIncrementalDir(getName()));
    ConventionMappingHelper.map(prepareBaseApkTask, "baseApk", new Callable<File>() {
        @Override
        public File call() {
            return variantContext.apContext.getBaseApk();
        }
    });
    ConventionMappingHelper.map(prepareBaseApkTask, "dexFilesCount", new Callable<Integer>() {
        @Override
        public Integer call() {
            int dexFilesCount = 0;
            Set<File> dexFolders = scope.getTransformManager().getPipelineOutput(StreamFilter.DEX).keySet();
            // Preconditions.checkState(dexFolders.size() == 1,
            //                          "There must be exactly one output");
            for (File dexFolder : dexFolders) {
                dexFilesCount += scope.getGlobalScope().getProject().fileTree(
                    ImmutableMap.of("dir", dexFolder, "includes", ImmutableList.of("classes*.dex"))).getFiles()
                    .size();
            }
            return dexFilesCount;
        }
    });
    ConventionMappingHelper.map(prepareBaseApkTask, "outputDir", new Callable<File>()

    {
        @Override
        public File call() {
            return new File(variantContext.apContext.getBaseApk() + "_");
        }
    });
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:38,代码来源:PrepareBaseApkTask.java

示例7: isLintVariant

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
/**
 * Is the given variant relevant for lint?
 */
private static boolean isLintVariant(
        @NonNull BaseVariantData<? extends BaseVariantOutputData> baseVariantData) {
    // Only create lint targets for variants like debug and release, not debugTest
    VariantConfiguration config = baseVariantData.getVariantConfiguration();
    return !config.getType().isForTesting();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TaskManager.java

示例8: getBinaries

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
/**
 * Return library binaries for a VariantConfiguration.
 */
public Collection<SharedLibraryBinarySpec> getBinaries(final VariantConfiguration variantConfig) {
    if (variantConfig.getType().isForTesting()) {
        // Do not return binaries for test variants as test source set is not supported at the
        // moment.
        return Collections.emptyList();
    }
    final GradleVariantConfiguration config = (GradleVariantConfiguration) variantConfig;

    BinaryContainer binaries = (BinaryContainer) project.getExtensions().getByName("binaries");

    return binaries.withType(SharedLibraryBinarySpec.class).matching(
            new Spec<SharedLibraryBinarySpec>() {
                @Override
                public boolean isSatisfiedBy(SharedLibraryBinarySpec binary) {
                    return (binary.getBuildType().getName()
                            .equals(config.getBuildType().getName())
                            && (binary.getFlavor().getName().equals(config.getFlavorName())
                            || (binary.getFlavor().getName().equals("default")
                            && config.getFlavorName().isEmpty()))
                            && (config.getNdkConfig().getAbiFilters() == null
                            || config.getNdkConfig().getAbiFilters().isEmpty()
                            || config.getNdkConfig().getAbiFilters().contains(
                            binary.getTargetPlatform().getName())));
                }
            });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:NdkComponentModelPlugin.java

示例9: writeDependencyPackageRJavaFiles

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
void writeDependencyPackageRJavaFiles(
    List<DependencyAndroidData> dependencyData,
    String customPackageForR,
    Path androidManifest,
    Path sourceOut)
    throws IOException {
  List<SymbolFileProvider> libraries = new ArrayList<>();
  for (DependencyAndroidData dataDep : dependencyData) {
    SymbolFileProvider library = dataDep.asSymbolFileProvider();
    libraries.add(library);
  }
  String appPackageName = customPackageForR;
  if (appPackageName == null) {
    appPackageName = VariantConfiguration.getManifestPackage(androidManifest.toFile());
  }
  Multimap<String, ResourceSymbols> libSymbolMap = ArrayListMultimap.create();
  Path primaryRTxt = sourceOut != null ? sourceOut.resolve("R.txt") : null;
  if (primaryRTxt != null && !libraries.isEmpty()) {
    ResourceSymbols fullSymbolValues =
        loadResourceSymbolTable(libraries, appPackageName, primaryRTxt, libSymbolMap);
    // Loop on all the package name, merge all the symbols to write, and write.
    for (String packageName : libSymbolMap.keySet()) {
      Collection<ResourceSymbols> symbols = libSymbolMap.get(packageName);
      fullSymbolValues.writeSourcesTo(sourceOut, packageName, symbols, true /* finalFields */);
    }
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:28,代码来源:AndroidResourceProcessor.java

示例10: execute

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
@Override
    public void execute(MergeSourceSetFolders task) {
        final VariantScope scope = variantContext.getScope();
        BaseVariantData<? extends BaseVariantOutputData> variantData = scope.getVariantData();
        final VariantConfiguration variantConfig = variantData.getVariantConfiguration();

        task.setAndroidBuilder(scope.getGlobalScope().getAndroidBuilder());
        task.setVariantName(variantConfig.getFullName());
        task.setIncrementalFolder(scope.getIncrementalDir(getName()));
        ConventionMappingHelper.map(task, "inputDirectorySets", new Callable<List<AssetSet>>() {

            @Override
            public List<AssetSet> call() throws Exception {
                List<AssetSet> assetSets = Lists.newArrayList();
                List<? extends AndroidLibrary> bundleDeps = awbBundle.getAndroidLibraries();
                // the list of dependency must be reversed to use the right overlay order.
                for (int n = bundleDeps.size() - 1; n >= 0; n--) {
                    AndroidLibrary dependency = bundleDeps.get(n);

                    File assetFolder = dependency.getAssetsFolder();
                    if (assetFolder.isDirectory()) {
                        AssetSet assetSet = new AssetSet(dependency.getFolder().getName());
                        assetSet.addSource(assetFolder);
                        assetSets.add(assetSet);
                    }
                }

                File awbAssetFolder = awbBundle.getAndroidLibrary().getAssetsFolder();
                if (awbAssetFolder.isDirectory()) {
                    AssetSet awbAssetSet = new AssetSet(awbBundle.getAndroidLibrary().getFolder().getName());
                    awbAssetSet.addSource(awbAssetFolder);
                    assetSets.add(awbAssetSet);
                }
                return assetSets;
            }
        });
        ConventionMappingHelper.map(task, "outputDir", new Callable<File>() {

            @Override
            public File call() throws Exception {
                GlobalScope globalScope = scope.getGlobalScope();
                return variantContext.getMergeAssets(awbBundle);
            }
        });
//        if (variantContext instanceof AppVariantContext) {
//            AppVariantContext appVariantContext = (AppVariantContext) variantContext;
//            appVariantContext.getAwbMergeAssetTasks().put(awbBundle.getName(), task);
//        }
    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:50,代码来源:MergeAwbAssetConfigAction.java

示例11: setVariantConfiguration

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
public void setVariantConfiguration(
        VariantConfiguration variantConfiguration) {
    this.variantConfiguration = variantConfiguration;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:TestModuleProGuardTask.java

示例12: getVariantConfiguration

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
@NonNull
VariantConfiguration getVariantConfiguration();
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:TestedVariantData.java

示例13: createSplitResourcesTasks

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
/**
 * Creates the split resources packages task if necessary. AAPT will produce split packages for
 * all --split provided parameters. These split packages should be signed and moved unchanged to
 * the APK build output directory.
 */
public void createSplitResourcesTasks(@NonNull VariantScope scope) {
    BaseVariantData<? extends BaseVariantOutputData> variantData = scope.getVariantData();

    checkState(variantData.getSplitHandlingPolicy().equals(
                    BaseVariantData.SplitHandlingPolicy.RELEASE_21_AND_AFTER_POLICY),
            "Can only create split resources tasks for pure splits.");

    final VariantConfiguration config = variantData.getVariantConfiguration();
    Set<String> densityFilters = variantData.getFilters(OutputFile.FilterType.DENSITY);
    Set<String> abiFilters = variantData.getFilters(OutputFile.FilterType.ABI);
    Set<String> languageFilters = variantData.getFilters(OutputFile.FilterType.LANGUAGE);

    List<? extends BaseVariantOutputData> outputs = variantData.getOutputs();
    if (outputs.size() != 1) {
        throw new RuntimeException(
                "In release 21 and later, there can be only one main APK, " +
                        "found " + outputs.size());
    }

    final BaseVariantOutputData variantOutputData = outputs.get(0);
    VariantOutputScope variantOutputScope = variantOutputData.getScope();
    variantOutputData.packageSplitResourcesTask = project.getTasks().create(
            scope.getTaskName("package", "SplitResources"),
            PackageSplitRes.class);
    variantOutputData.packageSplitResourcesTask.setInputDirectory(
            variantOutputScope.getProcessResourcePackageOutputFile().getParentFile());
    variantOutputData.packageSplitResourcesTask.setDensitySplits(densityFilters);
    variantOutputData.packageSplitResourcesTask.setLanguageSplits(languageFilters);
    variantOutputData.packageSplitResourcesTask.setOutputBaseName(config.getBaseName());
    variantOutputData.packageSplitResourcesTask.setSigningConfig(config.getSigningConfig());
    variantOutputData.packageSplitResourcesTask.setOutputDirectory(new File(
            scope.getGlobalScope().getIntermediatesDir(), "splits/" + config.getDirName()));
    variantOutputData.packageSplitResourcesTask.setAndroidBuilder(androidBuilder);
    variantOutputData.packageSplitResourcesTask.dependsOn(
            variantOutputScope.getProcessResourcesTask().getName());

    SplitZipAlign zipAlign = project.getTasks().create(
            scope.getTaskName("zipAlign", "SplitPackages"),
            SplitZipAlign.class);
    ConventionMappingHelper.map(zipAlign, "zipAlignExe", new Callable<File>() {
        @Override
        public File call() throws Exception {
            final TargetInfo info = androidBuilder.getTargetInfo();
            if (info == null) {
                return null;
            }
            String path = info.getBuildTools().getPath(ZIP_ALIGN);
            if (path == null) {
                return null;
            }
            return new File(path);
        }
    });

    zipAlign.setOutputDirectory(new File(scope.getGlobalScope().getBuildDir(), "outputs/apk"));
    ConventionMappingHelper.map(zipAlign, "densityOrLanguageInputFiles",
            new Callable<List<File>>() {
                @Override
                public List<File> call() {
                    return variantOutputData.packageSplitResourcesTask.getOutputFiles();
                }
            });
    zipAlign.setOutputBaseName(config.getBaseName());
    zipAlign.setAbiFilters(abiFilters);
    zipAlign.setLanguageFilters(languageFilters);
    zipAlign.setDensityFilters(densityFilters);
    File metadataDirectory = new File(zipAlign.getOutputDirectory().getParentFile(),
            "metadata");
    zipAlign.setApkMetadataFile(new File(metadataDirectory, config.getFullName() + ".mtd"));
    ((ApkVariantOutputData) variantOutputData).splitZipAlign = zipAlign;
    zipAlign.dependsOn(variantOutputData.packageSplitResourcesTask);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:78,代码来源:TaskManager.java

示例14: AbstractTestDataImpl

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
public AbstractTestDataImpl(@NonNull VariantConfiguration<?, ?, ?> testVariantConfig) {
    this.testVariantConfig = checkNotNull(testVariantConfig);
    this.extraInstrumentationTestRunnerArgs = Maps.newHashMap();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:AbstractTestDataImpl.java

示例15: call

import com.android.builder.core.VariantConfiguration; //导入依赖的package包/类
@Override
public String call() throws Exception {
  return VariantConfiguration.getManifestPackage(manifest);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:5,代码来源:ResourceSymbols.java


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