【Android Gradle 插件】AndroidSourceSets 配置 ② ( BaseExtension#sourceSets 配置 | AndroidSourceSets 配置简介 )

Android Plugin DSL Reference 参考文档 :





一、BaseExtension#sourceSets 配置



BaseExtension 文档 : android-gradle-dsl/2.3/com.android.build.gradle.BaseExtension.html


1、源集配置


在 BaseExtension 中 使用

sourceSets {
    
     }

脚本块 , 用于配置 源集 ;

NamedDomainObjectContainer<AndroidSourceSet> sourceSets

源集属性 , 源集是存放在 NamedDomainObjectContainer 容器中的 ;


AppExtension 继承了 BaseExtension , 因此在 " build.gradle # android " 模块中可以设置 sourceSets 源集列表 ;


2、sourceSets { } 脚本块原型


sourceSets { } 脚本块原型 :

sourceSets {
    
     }
Configures source sets.

Note that the Android plugin uses its own implementation of source sets, AndroidSourceSet.

Delegates to:
NamedDomainObjectContainer<AndroidSourceSet> from sourceSets

3、NamedDomainObjectContainer sourceSets 属性原型


NamedDomainObjectContainer<AndroidSourceSet> sourceSets 属性原型 :

NamedDomainObjectContainer<AndroidSourceSet> sourceSets
All source sets. Note that the Android plugin uses its own implementation of source sets, AndroidSourceSet.




二、AndroidSourceSets 配置简介



AndroidSourceSets ( build.gradle#android#sourceSets 配置 ) 文档位置 : android-gradle-dsl/2.3/com.android.build.gradle.api.AndroidSourceSet.html


AndroidSourceSets 配置中的各个属性如下 , 都是 Android 工程中常见的目录属性 ;

aidl	
The Android AIDL source directory for this source set.
此源集的Android AIDL源目录。

assets	
The Android Assets directory for this source set.
此源集的Android资产目录。

compileConfigurationName	
The name of the compile configuration for this source set.
此源集的编译配置的名称。

java	
The Java source which is to be compiled by the Java compiler into the class output directory.
Java编译器将编译到类输出目录中的Java源代码。

jni	
The Android JNI source directory for this source set.
此源集的Android JNI源目录。

jniLibs	
The Android JNI libs directory for this source set.
此源集的Android JNI libs目录。

manifest	
The Android Manifest file for this source set.
此源集的Android清单文件。

name	
The name of this source set.
此源集的名称。

packageConfigurationName	
The name of the runtime configuration for this source set.
此源集的运行时配置的名称。

providedConfigurationName	
The name of the compiled-only configuration for this source set.
此源集的仅编译配置的名称。

renderscript	
The Android RenderScript source directory for this source set.
此源集的Android RenderScript源目录。

res	
The Android Resources directory for this source set.
此源集的Android资源目录。

resources	
The Java resources which are to be copied into the javaResources output directory.
要复制到javaResources输出目录的Java资源。

猜你喜欢

转载自blog.csdn.net/han1202012/article/details/124620969