2016-07-21 24 views
1

Gradle的transform API定義了多個示波器。但是,幾乎沒有關於每個範圍的含義的文檔。有人知道嗎?gradle Transform API示波器的定義

/** 
* The scope of the content. 
* 
* <p/> 
* This indicates what the content represents, so that Transforms can apply to only part(s) 
* of the classes or resources that the build manipulates. 
*/ 
enum Scope { 
    /** Only the project content */ 
    PROJECT(0x01), 
    /** Only the project's local dependencies (local jars) */ 
    PROJECT_LOCAL_DEPS(0x02), 
    /** Only the sub-projects. */ 
    SUB_PROJECTS(0x04), 
    /** Only the sub-projects's local dependencies (local jars). */ 
    SUB_PROJECTS_LOCAL_DEPS(0x08), 
    /** Only the external libraries */ 
    EXTERNAL_LIBRARIES(0x10), 
    /** Code that is being tested by the current variant, including dependencies */ 
    TESTED_CODE(0x20), 
    /** Local or remote dependencies that are provided-only */ 
    PROVIDED_ONLY(0x40); 

    private final int value; 

    Scope(int value) { 
     this.value = value; 
    } 

    public int getValue() { 
     return value; 
    } 
} 

鑑於Android N源代碼尚未發佈,因此沒有太多好的示例可供閱讀。迄今爲止我發現的最好的是realm-java其中包含幾個變壓器。

回答

1

試驗了許多不同的作用域組合。並確定以下內容;

  • PROJECT:該範圍代表目標gradle模塊。
  • PROJECT_LOCAL_DEPS:目標模塊的「libs」文件夾內的依賴項
  • SUB_PROJECTS:同一個android studio項目中的依賴項,例如其他gradle模塊。例如,這個不允許允許我們分析畢加索的類文件。
  • SUB_PROJECTS_LOCAL_DEPS:同一個android studio項目內的依賴項的本地「libs」文件。
  • EXTERNAL_LIBRARIES:從maven中提取圖書館。例如,這確實允許我們分析畢加索的類文件。
+1

更新:得到了adt-dev的迴應。證實了我的觀察。 https://groups.google.com/forum/#!topic/adt-dev/IdqxwvWaLb8 –