2016-07-21 6 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:他のgradleモジュールなど、同じアンドロイドスタジオプロジェクト内の依存関係。たとえば、ではピカソのクラスファイルを解析できません。
  • SUB_PROJECTS_LOCAL_DEPS:同じアンドロイドスタジオプロジェクト内の依存関係のローカル "libs"ファイル。
  • EXTERNAL_LIBRARIES:Mavenから引き出されたライブラリ。たとえば、で、ピカソのクラスファイルを分析できます。
+1

更新:adt-devからの応答を得ました。私の観察を確認します。 https://groups.google.com/forum/#!topic/adt-dev/IdqxwvWaLb8 –

関連する問題