Java Code Examples for com.android.utils.FileUtils#join()

The following examples show how to use com.android.utils.FileUtils#join() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InjectTransformManager.java    From atlas with Apache License 2.0 6 votes vote down vote up
/**
 * Get the task outputStream
 *
 * @param injectTransform
 * @param scope
 * @param taskName
 * @param <T>
 * @return
 */
@NotNull
private <T extends Transform> IntermediateStream getOutputStream(T injectTransform,
                                                                 @NonNull VariantScope scope,
                                                                 String taskName) {
    File outRootFolder = FileUtils.join(project.getBuildDir(),
                                        StringHelper.toStrings(AndroidProject.FD_INTERMEDIATES,
                                                               FD_TRANSFORMS,
                                                               injectTransform.getName(),
                                                               scope.getDirectorySegments()));

    Set<? super Scope> requestedScopes = injectTransform.getScopes();

    // create the output
    return IntermediateStream.builder(project,injectTransform.getName())
            .addContentTypes(injectTransform.getOutputTypes())
            .addScopes(requestedScopes)
            .setTaskName(taskName)
            .setRootLocation(outRootFolder).build();

}
 
Example 2
Source File: TransformReplacer.java    From atlas with Apache License 2.0 6 votes vote down vote up
public void replaceShrinkResourcesTransform() {
    File shrinkerOutput =
            FileUtils.join(
                    variantContext.getScope().getGlobalScope().getIntermediatesDir(),
                    "res_stripped",
                    variantContext.getScope().getVariantConfiguration().getDirName());
    List<TransformTask> baseTransforms = TransformManager.findTransformTaskByTransformType(
            variantContext, ShrinkResourcesTransform.class);
    for (TransformTask transform : baseTransforms) {
        ShrinkResourcesTransform oldTransform = (ShrinkResourcesTransform) transform.getTransform();
        ResourcesShrinker resourcesShrinker = new ResourcesShrinker(oldTransform, variantContext.getVariantData(),
                variantContext.getScope().getOutput(TaskOutputHolder.TaskOutputType.PROCESSED_RES),
                shrinkerOutput,
                AaptGeneration.fromProjectOptions(variantContext.getScope().getGlobalScope().getProjectOptions()),
                variantContext.getScope().getOutput(TaskOutputHolder.TaskOutputType.SPLIT_LIST),
                variantContext.getProject().getLogger(),
                variantContext);
        ReflectUtils.updateField(transform, "transform",
                resourcesShrinker);

    }


}
 
Example 3
Source File: VariantContext.java    From atlas with Apache License 2.0 5 votes vote down vote up
public File getAwbShadersOutputDir(AwbBundle awbBundle) {
    return FileUtils.join(new File(
            scope.getGlobalScope().getGeneratedDir().getParentFile(),"/awb-generated/"),
            StringHelper.toStrings(
                    "assets", "shaders", scope.getDirectorySegments(),awbBundle.getName()));

}
 
Example 4
Source File: VariantScope.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
public File getGeneratedResourcesDir(String name) {
    return FileUtils.join(
            globalScope.getGeneratedDir(),
            "res",
            name,
            getVariantConfiguration().getDirName());
}
 
Example 5
Source File: AtlasDependencyGraph.java    From atlas with Apache License 2.0 5 votes vote down vote up
@NonNull
private static List<File> findLocalJarsAsFiles(@NonNull File folder) {
    File localJarRoot = FileUtils.join(folder, FD_JARS, FD_AAR_LIBS);

    if (!localJarRoot.isDirectory()) {
        return ImmutableList.of();
    }

    File[] jarFiles = localJarRoot.listFiles((dir, name) -> name.endsWith(DOT_JAR));
    if (jarFiles != null && jarFiles.length > 0) {
        return ImmutableList.copyOf(jarFiles);
    }

    return ImmutableList.of();
}
 
Example 6
Source File: ApContext.java    From atlas with Apache License 2.0 5 votes vote down vote up
public File getBaseSo(String soFileName){
    File file = FileUtils.join(baseUnzipBundleDirectory,soFileName);
    if (file.exists()){
        return file;
    }

    return null;
}
 
Example 7
Source File: ApContext.java    From atlas with Apache License 2.0 5 votes vote down vote up
public File getBaseExplodedAwb(String soFileName) {
    File file = FileUtils.join(baseExplodedAwbDirectory, FilenameUtils.getBaseName(soFileName));
    if (!file.exists()) {
        return null;
    }
    return file;
}
 
Example 8
Source File: ApContext.java    From atlas with Apache License 2.0 5 votes vote down vote up
public File getBaseAwb(String soFileName) {
    File file = FileUtils.join(baseAwbDirectory, soFileName);
    if (!file.exists()) {
        return null;
    }
    return file;
}
 
Example 9
Source File: ApContext.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void setApExploredFolder(File apExploredFolder) {
    this.apExploredFolder = apExploredFolder;
    this.baseManifest = new File(apExploredFolder, ANDROID_MANIFEST_XML);
    this.baseModifyManifest = FileUtils.join(apExploredFolder, "manifest-modify", ANDROID_MANIFEST_XML);
    this.baseApk = new File(apExploredFolder, AP_INLINE_APK_FILENAME);
    this.baseApkDirectory = new File(apExploredFolder, AP_INLINE_APK_EXTRACT_DIRECTORY);
    this.baseAwbDirectory = new File(apExploredFolder, AP_INLINE_AWB_EXTRACT_DIRECTORY);
    this.baseUnzipBundleDirectory = new File(apExploredFolder,SO_LOCATION_PREFIX);
    this.baseExplodedAwbDirectory = new File(apExploredFolder, AP_INLINE_AWB_EXPLODED_DIRECTORY);
    this.basePackageIdFile = new File(apExploredFolder, PACKAGE_ID_PROPERTIES_FILENAME);
    this.baseAtlasFrameworkPropertiesFile = new File(apExploredFolder, ATLAS_FRAMEWORK_PROPERTIES_FILENAME);
    this.baseDependenciesFile = new File(apExploredFolder, DEPENDENCIES_FILENAME);
    this.baseStableIdsFile = new File(apExploredFolder, STABLE_IDS_FILENAME);
}
 
Example 10
Source File: VariantContext.java    From atlas with Apache License 2.0 5 votes vote down vote up
public File getAwbResourceBlameLogDir(AwbBundle awbBundle) {
    return FileUtils.join(
            scope.getGlobalScope().getIntermediatesDir(),
            StringHelper.toStrings(
                    "awb-blame", "res", scope.getDirectorySegments(),awbBundle.getName()));

}
 
Example 11
Source File: AndroidExtension.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private File getGeneratedResourcesDirectory(String name) {
    return FileUtils.join(
            getGeneratedDirectory(),
            StringHelper.toStrings(
                    "res",
                    name,
                    Collections.singletonList("android")));
}
 
Example 12
Source File: DataLoaderTransform.java    From DataLoader with Apache License 2.0 4 votes vote down vote up
private String getAssetsPath() {
    return FileUtils.join(getMainPath(), "assets");
}
 
Example 13
Source File: VariantContext.java    From atlas with Apache License 2.0 4 votes vote down vote up
public File getAwbMergeNativeLibsOutputDir(AwbBundle awbBundle) {
    return FileUtils.join(scope.getGlobalScope().getIntermediatesDir(),
            "/awb-jniLibs/" + getVariantConfiguration().getDirName(),awbBundle.getName());
}
 
Example 14
Source File: VariantContext.java    From atlas with Apache License 2.0 4 votes vote down vote up
public File getMergeShadersOutputDir(AwbBundle awbBundle) {
    return FileUtils.join(scope.getGlobalScope().getIntermediatesDir(),
            "/awb-shaders/" + getVariantConfiguration().getDirName(),awbBundle.getName());
}
 
Example 15
Source File: VariantContext.java    From atlas with Apache License 2.0 4 votes vote down vote up
public File getRenderOutputDir(AwbBundle awbBundle) {
    return FileUtils.join(new File(scope.getGlobalScope().getGeneratedDir().getParentFile(),
                    "awb-generated"),
            StringHelper.toStrings("res","renderscript", scope.getDirectorySegments(),
                    awbBundle.getName()));
}
 
Example 16
Source File: VariantContext.java    From atlas with Apache License 2.0 4 votes vote down vote up
public File getPngsOutputDir(AwbBundle awbBundle) {
    return FileUtils.join(new File(scope.getGlobalScope().getGeneratedDir().getParentFile(),
                    "awb-generated"),
            StringHelper.toStrings("res", "pngs", scope.getDirectorySegments(),
                    awbBundle.getName()));
}
 
Example 17
Source File: DependencyLocationManager.java    From atlas with Apache License 2.0 4 votes vote down vote up
public static File getExploreDir(Project project, MavenCoordinates mavenCoordinates, File bundle, String type,
                                     String path) {

        if (!bundle.exists()) {
            project.getLogger().info("missing " + mavenCoordinates.toString());
        }

//        if (BuildAtlasEnvTask.allManifests.containsKey(mavenCoordinates.)){
//
//            return BuildAtlasEnvTask.allManifests.get(mavenCoordinates.toString().split("@")[0]);
//        }

//        AtlasDependencyGraph.HashableResolvedArtifactResult hashableResolvedArtifactResult = AtlasDependencyGraph.sLibraryMap.get(mavenCoordinates.toString().intern());
//
//        if (hashableResolvedArtifactResult!= null && hashableResolvedArtifactResult.getDelegate()!= null){
//            return hashableResolvedArtifactResult.getDelegate().getFile();
//        }

//        if (){
//
//            BuildCacheConfiguration
//        }
//
//
//
////        Optional<FileCache> buildCache =
////            AndroidGradleOptions.getBuildCache(project);
////        File explodedDir;
////        if (shouldUseBuildCache(project, mavenCoordinates, bundle, buildCache)) { //&& !"awb"
//            // .equals(type)
////            try {
////
////                explodedDir = buildCache.get().getFileInCache(
////                    PrepareLibraryTask.getBuildCacheInputs(bundle));
////
////                return explodedDir;
////
////            } catch (IOException e) {
////                throw new UncheckedIOException(e);
////            }
//        } else {

            return FileUtils.join(
                project.getBuildDir(),
                FD_INTERMEDIATES,
                "exploded-" + type,
                path);
//        }

        //throw new GradleException("set explored dir exception");

    }
 
Example 18
Source File: AndroidExtension.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public File getResourceBlameLogDirectory() {
    return FileUtils.join(
            getIntermediatesDirectory(),
            StringHelper.toStrings(
                    "blame", "res", Collections.singletonList("android")));
}
 
Example 19
Source File: AndroidExtension.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public File getIncrementalDirectory(String name) {
    return FileUtils.join(
            getIntermediatesDirectory(),
            "incremental",
            name);
}
 
Example 20
Source File: DataLoaderTransform.java    From DataLoader with Apache License 2.0 4 votes vote down vote up
private String getMainPath() {
    return FileUtils.join(getModuleRootDir().getAbsolutePath(),
            "src", "main");
}