ProGuard 应用Gradle Task

来源:互联网 发布:唐安琪烧伤真相知乎 编辑:程序博客网 时间:2024/06/06 05:57

ProGuard can be run as a task in the Java-based build tool Gradle (version 2.1 or higher).

ProGuard可以作为一个任务运行在基于java的构建工具Gradle(版本2.1或更高版本)。

Before you can use the proguard task, you have to make sure Gradle can find it in its class path at build time. One way is to add the following line to your build.gradle file:

您可以使用ProGuard 之前,您必须确保它可以找到它在构建时的类路径。一种方法是添加 build.gradle 文件

buildscript {    repositories {        flatDir dirs: '/usr/local/java/proguard/lib'    }    dependencies {        classpath ':proguard:'    }}

Please make sure the class path is set correctly for your system.

请确保您的系统类路径设置正确。

You can then define a task:

你可以定义一个task

task myProguardTask(type: proguard.gradle.ProGuardTask) {    .....}

The embedded configuration is much like a standard ProGuard configuration. Notable similarities and differences:

嵌入的配置是更像一个标准ProGuard 配置。明显的异同

  • Like in ProGuard-style configurations, we’re using all lower-case names for the settings.
  • The options don’t have a dash as prefix.
  • Arguments typically have quotes.
  • Some settings are specified as named arguments.

    • 像ProGuard的配置,我们使用所有小写名称的设置
    • 选项没有前缀
    • 参数通常有引用
    • 一些设置指定为命名参数

You can find some sample build files in the examples/gradle directory of the ProGuard distribution.

你可以在examples/ gradle 目录下找到一些ProGuard 描述的示例构建文件

Setting

The ProGuard task supports the following settings in its closure:
ProGuard 任务支持以下设置

configuration files

  • Read and merge options from the given ProGuard-style configuration files. The files are resolved and parsed lazily, during the execution phase.

从给定的ProGuard-style阅读和合并选项配置文件。文件在执行阶段解析

injars class_path

未完待续

0 0
原创粉丝点击