當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.getFiles方法代碼示例

本文整理匯總了Java中org.gradle.api.artifacts.Configuration.getFiles方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getFiles方法的具體用法?Java Configuration.getFiles怎麽用?Java Configuration.getFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.gradle.api.artifacts.Configuration的用法示例。


在下文中一共展示了Configuration.getFiles方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generate

import org.gradle.api.artifacts.Configuration; //導入方法依賴的package包/類
/**
 * Directory of so
 */
@TaskAction
void generate() throws IOException, DocumentException {

    Project project = getProject();
    File apBaseFile = null;

    File apFile = getApFile();
    if (null != apFile && apFile.exists()) {
        apBaseFile = apFile;
    } else {
        String apDependency = getApDependency();
        if (StringUtils.isNotBlank(apContext.getApDependency())) {
            Dependency dependency = project.getDependencies().create(apDependency);
            Configuration configuration = project.getConfigurations().detachedConfiguration(dependency);
            configuration.setTransitive(false);
            configuration.getResolutionStrategy().cacheChangingModulesFor(0, TimeUnit.MILLISECONDS);
            configuration.getResolutionStrategy().cacheDynamicVersionsFor(0, TimeUnit.MILLISECONDS);
            for (File file : configuration.getFiles()) {
                if (file.getName().endsWith(".ap")) {
                    apBaseFile = file;
                    break;
                }
            }
        }
    }

    if (null != apBaseFile && apBaseFile.exists()) {

        try {
            explodedDir = getExplodedDir();
            BetterZip.unzipDirectory(apBaseFile, explodedDir);
            apContext.setApExploredFolder(explodedDir);
            Set<String> awbBundles = getAwbBundles();
            if (awbBundles != null) {
                // Unzip the baseline Bundle
                for (String awbBundle : awbBundles) {
                    File awbFile = BetterZip.extractFile(new File(explodedDir, AP_INLINE_APK_FILENAME),
                                                         "lib/armeabi/" + awbBundle,
                                                         new File(explodedDir, AP_INLINE_AWB_EXTRACT_DIRECTORY));
                    File awbExplodedDir = new File(new File(explodedDir, AP_INLINE_AWB_EXPLODED_DIRECTORY),
                                                   FilenameUtils.getBaseName(awbBundle));
                    BetterZip.unzipDirectory(awbFile, awbExplodedDir);
                    FileUtils.renameTo(new File(awbExplodedDir, FN_APK_CLASSES_DEX),
                                       new File(awbExplodedDir, "classes2.dex"));
                }
                // Preprocessing increment androidmanifest.xml
                ManifestFileUtils.updatePreProcessBaseManifestFile(
                    FileUtils.join(explodedDir, "manifest-modify", ANDROID_MANIFEST_XML),
                    new File(explodedDir, ANDROID_MANIFEST_XML));
            }
            if (explodedDir.listFiles().length == 0){
                throw new RuntimeException("unzip ap exception, no files found");
            }
        }catch (Throwable e){
            FileUtils.deleteIfExists(apBaseFile);
            throw new GradleException(e.getMessage(),e);

        }
    }
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:64,代碼來源:PrepareAPTask.java


注:本文中的org.gradle.api.artifacts.Configuration.getFiles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。