分离多模块配置功能,解析pins
This commit is contained in:
@@ -40,17 +40,30 @@ class Runtimes {
|
||||
boolean includeModel = !includeModules.isEmpty()
|
||||
sValidComponents = getValidComponents(root, includeModules, excludeModules, includeModel)
|
||||
|
||||
// Logger.buildOutput("")
|
||||
// Logger.buildOutput(" =====> component.gradle配置信息 <===== ")
|
||||
// root.extensions.add("targetDebugName", sDebugOption.targetDebugName)
|
||||
// Logger.buildOutput("AndroidJarPath", sAndroidJarPath)
|
||||
// Logger.buildOutput("compileSdkVersion", sCompileSdkVersion)
|
||||
// Logger.buildOutput("CompileOptions", sCompileOption.toString())
|
||||
// Logger.buildOutput("includes", componentExtension.includes)
|
||||
// Logger.buildOutput("excludes", componentExtension.excludes)
|
||||
// Logger.buildOutput("Select module by " + (includeModel ? "include" : "exclude"))
|
||||
// Logger.buildOutput("生效模块", sValidComponents.toList().toString())
|
||||
// Logger.buildOutput("调试信息", sDebugOption.toString())
|
||||
// Logger.buildOutput(" =====> component.gradle配置信息 <===== ")
|
||||
// Logger.buildOutput("")
|
||||
|
||||
Logger.buildOutput("")
|
||||
Logger.buildOutput(" =====> component.gradle配置信息 <===== ")
|
||||
root.extensions.add("targetDebugName", sDebugOption.targetDebugName)
|
||||
Logger.buildOutput("AndroidJarPath", sAndroidJarPath)
|
||||
Logger.buildOutput("compileSdkVersion", sCompileSdkVersion)
|
||||
Logger.buildOutput("CompileOptions", sCompileOption.toString())
|
||||
Logger.buildOutput("includes", componentExtension.includes)
|
||||
Logger.buildOutput("excludes", componentExtension.excludes)
|
||||
Logger.buildOutput("Select module by " + (includeModel ? "include" : "exclude"))
|
||||
Logger.buildOutput("生效模块", sValidComponents.toList().toString())
|
||||
Logger.buildOutput("调试信息", sDebugOption.toString())
|
||||
Logger.buildOutput(" 全局配置")
|
||||
Logger.buildOutput(componentExtension.toString())
|
||||
Logger.buildOutput(" SDK配置")
|
||||
Logger.buildOutput(componentExtension.sdkOption.toString())
|
||||
Logger.buildOutput(" PIN配置")
|
||||
Logger.buildOutput(componentExtension.pinOption.toString())
|
||||
Logger.buildOutput(" DEBUG配置")
|
||||
Logger.buildOutput(componentExtension.debugOption.toString())
|
||||
Logger.buildOutput(" =====> component.gradle配置信息 <===== ")
|
||||
Logger.buildOutput("")
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.plugin.component.extension
|
||||
|
||||
import com.plugin.component.extension.option.sdk.CompileOptions
|
||||
import com.plugin.component.Runtimes
|
||||
import com.plugin.component.extension.option.pin.PinOption
|
||||
import com.plugin.component.extension.option.debug.DebugOption
|
||||
import com.plugin.component.extension.option.sdk.SdkOption
|
||||
import org.gradle.api.Project
|
||||
@@ -14,6 +15,7 @@ class ComponentExtension {
|
||||
|
||||
DebugOption debugOption //调试选项
|
||||
SdkOption sdkOption //sdk选项
|
||||
PinOption pinOption //pin选项
|
||||
|
||||
String includes = ""
|
||||
String excludes = ""
|
||||
@@ -23,6 +25,7 @@ class ComponentExtension {
|
||||
this.project = project
|
||||
debugOption = new DebugOption(project)
|
||||
sdkOption = new SdkOption(project)
|
||||
pinOption = new PinOption(project)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,10 +57,18 @@ class ComponentExtension {
|
||||
* sdk模块
|
||||
* @param closure
|
||||
*/
|
||||
void componentSdks(Closure closure) {
|
||||
void sdk(Closure closure) {
|
||||
ConfigureUtil.configure(closure, sdkOption)
|
||||
}
|
||||
|
||||
/**
|
||||
* sdk模块
|
||||
* @param closure
|
||||
*/
|
||||
void pin(Closure closure) {
|
||||
ConfigureUtil.configure(closure, pinOption)
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试模块
|
||||
* @param closure
|
||||
@@ -65,4 +76,14 @@ class ComponentExtension {
|
||||
void debug(Closure closure) {
|
||||
ConfigureUtil.configure(closure, debugOption)
|
||||
}
|
||||
|
||||
@Override
|
||||
String toString() {
|
||||
StringBuilder stringBuilder = new StringBuilder("\n")
|
||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||
stringBuilder.append(" | include = " + includes+ "\n")
|
||||
stringBuilder.append(" | exclude = " + excludes + "\n")
|
||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||
return stringBuilder.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.plugin.component.extension.option.pin
|
||||
import com.plugin.component.Logger
|
||||
|
||||
class PinConfiguration {
|
||||
|
||||
String name
|
||||
boolean codeCheckEnabled = true
|
||||
Set<String> includePins = new HashSet<>()
|
||||
Set<String> export = new HashSet<>()
|
||||
String mainPath
|
||||
|
||||
PinConfiguration(String name) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
void codeCheckEnabled(boolean enabled) {
|
||||
this.codeCheckEnabled = enabled
|
||||
}
|
||||
|
||||
void export(String... pinPaths) {
|
||||
int size = pinPaths.size()
|
||||
for (int i = 0; i < size; i++) {
|
||||
includePins.add(pinPaths[i])
|
||||
}
|
||||
}
|
||||
|
||||
void include(String... pinPaths) {
|
||||
int size = pinPaths.size()
|
||||
for (int i = 0; i < size; i++) {
|
||||
export.add(pinPaths[i])
|
||||
}
|
||||
}
|
||||
|
||||
void includeMain(String pinPath) {
|
||||
this.mainPath = pinPath
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.plugin.component.extension.option.pin
|
||||
|
||||
|
||||
import org.gradle.api.NamedDomainObjectContainer
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.util.ConfigureUtil
|
||||
|
||||
class PinOption {
|
||||
|
||||
Project project
|
||||
|
||||
List<PinConfiguration> configurationList = new ArrayList<>() //配置信息
|
||||
|
||||
PinOption(Project project) {
|
||||
this.project = project
|
||||
}
|
||||
|
||||
void configuration(Closure closure) {
|
||||
NamedDomainObjectContainer<PinConfiguration> configurations = project.container(PinConfiguration)
|
||||
ConfigureUtil.configure(closure, configurations)
|
||||
configurations.each {
|
||||
configurationList.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
String toString() {
|
||||
StringBuilder stringBuilder = new StringBuilder("\n")
|
||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||
return stringBuilder.toString()
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,17 @@ class SdkOption {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
String toString() {
|
||||
StringBuilder stringBuilder = new StringBuilder("\n")
|
||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||
stringBuilder.append(" | targetDebugName = " + Runtimes.sDebugOption.targetDebugName + "\n")
|
||||
stringBuilder.append(" | AndroidJarPath = " + Runtimes.sAndroidJarPath + "\n" )
|
||||
stringBuilder.append(" | compileSdkVersion = " + Runtimes.sCompileSdkVersion + "\n" )
|
||||
stringBuilder.append(" | CompileOptions = " + Runtimes.sCompileOption.toString()+ "\n" )
|
||||
stringBuilder.append(" -------------------------------------------------------------------" + "\n")
|
||||
return stringBuilder.toString()
|
||||
}
|
||||
// /**
|
||||
// * 未开放
|
||||
// * @param closure
|
||||
|
||||
@@ -12,7 +12,7 @@ component {
|
||||
// include ':app,library,libraryKotlin,debugModule'
|
||||
|
||||
|
||||
componentSdks {
|
||||
sdk {
|
||||
|
||||
//编译版本
|
||||
compileSdkVersion 27
|
||||
@@ -45,6 +45,21 @@ component {
|
||||
}
|
||||
}
|
||||
|
||||
pin {
|
||||
|
||||
configuration {
|
||||
'library' {
|
||||
codeCheckEnabled true
|
||||
include ':p_base'
|
||||
include ':p_common'
|
||||
include ':p_home'
|
||||
|
||||
export ':main', ':p_home'
|
||||
export ':p_common'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//组件调试声明
|
||||
debug {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user