com.android.dx.Version Java Examples

The following examples show how to use com.android.dx.Version. 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: Main.java    From Box with Apache License 2.0 4 votes vote down vote up
/**
 * Prints the version message.
 */
private static void version() {
    System.err.println("dx version " + Version.VERSION);
    System.exit(0);
}
 
Example #2
Source File: Main.java    From Box with Apache License 2.0 4 votes vote down vote up
/**
 * Prints the version message.
 */
private static void version() {
    System.err.println("dx version " + Version.VERSION);
    System.exit(0);
}
 
Example #3
Source File: AtlasDexArchiveBuilderCacheHander.java    From atlas with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a {@link FileCache.Inputs} object computed from the given parameters for the
 * predex-library task to use the build cache.
 */
@NonNull
public static FileCache.Inputs getBuildCacheInputs(
        @NonNull File inputFile,
        @NonNull DexOptions dexOptions,
        @NonNull DexerTool dexerTool,
        int minSdkVersion,
        boolean isDebuggable)
        throws Exception {
    // To use the cache, we need to specify all the inputs that affect the outcome of a pre-dex
    // (see DxDexKey for an exhaustive list of these inputs)
    FileCache.Inputs.Builder buildCacheInputs =
            new FileCache.Inputs.Builder(FileCache.Command.PREDEX_LIBRARY_TO_DEX_ARCHIVE);
    java.util.function.Predicate<String> CLASS_MATCHER = s -> s.endsWith(SdkConstants.DOT_CLASS);

    if (inputFile.isDirectory()){
        String hash = Files.walk(inputFile.toPath())
                .filter(p -> CLASS_MATCHER.test(p.toString())).sorted().map(new Function<Path, String>() {
                    @javax.annotation.Nullable
                    @Override
                    public String apply(@javax.annotation.Nullable Path input) {
                        try {
                            return com.google.common.io.Files.asByteSource(input.toFile()).hash(Hashing.sha256()).toString();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                        return "";
                    }
                }).collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString();



        buildCacheInputs
                .putString("hash",MD5Util.getMD5(hash))
                .putString(FileCacheInputParams.DX_VERSION.name(), Version.VERSION)
                .putBoolean(FileCacheInputParams.JUMBO_MODE.name(), isJumboModeEnabledForDx())
                .putBoolean(
                        FileCacheInputParams.OPTIMIZE.name(),
                        !dexOptions.getAdditionalParameters().contains("--no-optimize"))
                .putString(FileCacheInputParams.DEXER_TOOL.name(), dexerTool.name())
                .putLong(FileCacheInputParams.CACHE_KEY_VERSION.name(), CACHE_KEY_VERSION)
                .putLong(FileCacheInputParams.MIN_SDK_VERSION.name(), minSdkVersion)
                .putBoolean(FileCacheInputParams.IS_DEBUGGABLE.name(), isDebuggable);



    }else {
        buildCacheInputs
                .putFile(
                        FileCacheInputParams.FILE.name(),
                        inputFile,
                        FileCache.FileProperties.HASH)
                .putString(FileCacheInputParams.DX_VERSION.name(), Version.VERSION)
                .putBoolean(FileCacheInputParams.JUMBO_MODE.name(), isJumboModeEnabledForDx())
                .putBoolean(
                        FileCacheInputParams.OPTIMIZE.name(),
                        !dexOptions.getAdditionalParameters().contains("--no-optimize"))
                .putString(FileCacheInputParams.DEXER_TOOL.name(), dexerTool.name())
                .putLong(FileCacheInputParams.CACHE_KEY_VERSION.name(), CACHE_KEY_VERSION)
                .putLong(FileCacheInputParams.MIN_SDK_VERSION.name(), minSdkVersion)
                .putBoolean(FileCacheInputParams.IS_DEBUGGABLE.name(), isDebuggable);
    }
   if (project.hasProperty("light") && project.hasProperty("deepShrink")){
        buildCacheInputs.putBoolean("deepShrink",AtlasD8.deepShrink);
    }
    return buildCacheInputs.build();
}
 
Example #4
Source File: Main.java    From buck with Apache License 2.0 4 votes vote down vote up
/**
 * Prints the version message.
 */
private static void version() {
    System.err.println("dx version " + Version.VERSION);
    System.exit(0);
}