分plugin多重逻辑,重写toString 格式化 log
This commit is contained in:
@@ -42,7 +42,7 @@ class Constants {
|
|||||||
public static String SDK_PRE = 'sdk-'
|
public static String SDK_PRE = 'sdk-'
|
||||||
public static String IMPL_PRE = 'impl-'
|
public static String IMPL_PRE = 'impl-'
|
||||||
public static String COMPONENT_PRE = 'component-'
|
public static String COMPONENT_PRE = 'component-'
|
||||||
public static String DEBUG_COMPONENT_PRE = 'debugDependency-'
|
public static String DEBUG_COMPONENT_PRE = 'component(Debug)-'
|
||||||
public static String CORE_DEPENDENCY = "com.effective.android:component-core:1.0.4"
|
public static String CORE_DEPENDENCY = "com.effective.android:component-core:1.0.4"
|
||||||
|
|
||||||
//sourceSet - default
|
//sourceSet - default
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package com.plugin.component
|
|||||||
|
|
||||||
import com.plugin.component.extension.ComponentExtension
|
import com.plugin.component.extension.ComponentExtension
|
||||||
import com.plugin.component.extension.module.ProjectInfo
|
import com.plugin.component.extension.module.ProjectInfo
|
||||||
|
import com.plugin.component.extension.option.pin.PinOption
|
||||||
import com.plugin.component.extension.option.sdk.CompileOptions
|
import com.plugin.component.extension.option.sdk.CompileOptions
|
||||||
import com.plugin.component.extension.option.debug.DebugConfiguration
|
import com.plugin.component.extension.option.debug.DebugConfiguration
|
||||||
import com.plugin.component.extension.option.sdk.PublicationOption
|
import com.plugin.component.extension.option.sdk.PublicationOption
|
||||||
import com.plugin.component.extension.option.debug.DebugOption
|
import com.plugin.component.extension.option.debug.DebugOption
|
||||||
|
import com.plugin.component.extension.option.sdk.SdkOption
|
||||||
import com.plugin.component.utils.ProjectUtil
|
import com.plugin.component.utils.ProjectUtil
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
|
||||||
@@ -18,44 +20,25 @@ class Runtimes {
|
|||||||
//模块信息
|
//模块信息
|
||||||
private static Map<String, ProjectInfo> sProjectInfoMap = new HashMap<>()
|
private static Map<String, ProjectInfo> sProjectInfoMap = new HashMap<>()
|
||||||
|
|
||||||
//本地 android jar 路径
|
private static String sAndroidJarPath
|
||||||
|
public static DebugOption sDebugOption
|
||||||
|
public static SdkOption sSdkOption
|
||||||
|
public static PinOption sPinOption
|
||||||
|
public static ComponentExtension sExtension
|
||||||
|
public static List<String> sAssembleModules = new ArrayList<>()
|
||||||
public static File sSdkDir
|
public static File sSdkDir
|
||||||
public static File sImplDir
|
public static File sImplDir
|
||||||
|
|
||||||
public static List<String> sAssembleModules = new ArrayList<>()
|
|
||||||
public static String sAndroidJarPath
|
|
||||||
public static CompileOptions sCompileOption
|
|
||||||
public static DebugOption sDebugOption
|
|
||||||
public static int sCompileSdkVersion
|
|
||||||
public static Set<String> sValidComponents
|
|
||||||
|
|
||||||
static initRuntimeConfiguration(Project root, ComponentExtension componentExtension) {
|
static initRuntimeConfiguration(Project root, ComponentExtension componentExtension) {
|
||||||
|
sExtension = componentExtension
|
||||||
|
sDebugOption = sExtension.debugOption
|
||||||
|
sSdkOption = sExtension.sdkOption
|
||||||
|
sPinOption = sExtension.pinOption
|
||||||
|
root.extensions.add("targetDebugName", sDebugOption.targetDebugName)
|
||||||
sAndroidJarPath = ProjectUtil.getAndroidJarPath(root, componentExtension.sdkOption.compileSdkVersion)
|
sAndroidJarPath = ProjectUtil.getAndroidJarPath(root, componentExtension.sdkOption.compileSdkVersion)
|
||||||
sCompileSdkVersion = componentExtension.sdkOption.compileSdkVersion
|
|
||||||
sCompileOption = componentExtension.sdkOption.compileOption
|
|
||||||
sDebugOption = componentExtension.debugOption
|
|
||||||
Set<String> includeModules = ProjectUtil.getModuleName(componentExtension.includes)
|
|
||||||
Set<String> excludeModules = ProjectUtil.getModuleName(componentExtension.excludes)
|
|
||||||
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("")
|
||||||
Logger.buildOutput(" =====> component.gradle配置信息 <===== ")
|
Logger.buildOutput(" =====> component.gradle配置信息 <===== ")
|
||||||
|
Logger.buildOutput("")
|
||||||
Logger.buildOutput(" 全局配置")
|
Logger.buildOutput(" 全局配置")
|
||||||
Logger.buildOutput(componentExtension.toString())
|
Logger.buildOutput(componentExtension.toString())
|
||||||
Logger.buildOutput(" SDK配置")
|
Logger.buildOutput(" SDK配置")
|
||||||
@@ -68,8 +51,16 @@ class Runtimes {
|
|||||||
Logger.buildOutput("")
|
Logger.buildOutput("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CompileOptions getCompileOption(){
|
||||||
|
return sSdkOption.compileOption
|
||||||
|
}
|
||||||
|
|
||||||
|
static getAndroidJarPath(){
|
||||||
|
return sAndroidJarPath
|
||||||
|
}
|
||||||
|
|
||||||
static boolean shouldApplyComponentPlugin(Project project) {
|
static boolean shouldApplyComponentPlugin(Project project) {
|
||||||
return sValidComponents.contains(ProjectUtil.getProjectName(project))
|
return sExtension.shouldApplyComponentPlugin(project)
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getDebugModuleName() {
|
static String getDebugModuleName() {
|
||||||
@@ -100,6 +91,10 @@ class Runtimes {
|
|||||||
return sSdkPublicationMap.get(projectName)
|
return sSdkPublicationMap.get(projectName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Map<String, PublicationOption> getSdkPublicationMap() {
|
||||||
|
return sSdkPublicationMap
|
||||||
|
}
|
||||||
|
|
||||||
static void addProjectInfo(String projectName, ProjectInfo projectInfo) {
|
static void addProjectInfo(String projectName, ProjectInfo projectInfo) {
|
||||||
sProjectInfoMap.put(projectName, projectInfo)
|
sProjectInfoMap.put(projectName, projectInfo)
|
||||||
}
|
}
|
||||||
@@ -110,28 +105,12 @@ class Runtimes {
|
|||||||
|
|
||||||
static ProjectInfo getCompileProjectWhenAssemble() {
|
static ProjectInfo getCompileProjectWhenAssemble() {
|
||||||
Set<String> keys = sProjectInfoMap.keySet()
|
Set<String> keys = sProjectInfoMap.keySet()
|
||||||
for(String key : keys){
|
for (String key : keys) {
|
||||||
ProjectInfo projectInfo = sProjectInfoMap.get(key)
|
ProjectInfo projectInfo = sProjectInfoMap.get(key)
|
||||||
if(projectInfo.isCompileModuleAndAssemble()){
|
if (projectInfo.isCompileModuleAndAssemble()) {
|
||||||
return projectInfo
|
return projectInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<String> getValidComponents(Project root, Set<String> includeModules, Set<String> excludeModules, boolean includeModel) {
|
|
||||||
Set<String> result = new HashSet<>()
|
|
||||||
root.allprojects.each {
|
|
||||||
if (includeModel) {
|
|
||||||
if (includeModules.contains(ProjectUtil.getProjectName(it))) {
|
|
||||||
result.add(it.name)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!excludeModules.contains(ProjectUtil.getProjectName(it))) {
|
|
||||||
result.add(it.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.plugin.component.Runtimes
|
|||||||
import com.plugin.component.extension.option.pin.PinOption
|
import com.plugin.component.extension.option.pin.PinOption
|
||||||
import com.plugin.component.extension.option.debug.DebugOption
|
import com.plugin.component.extension.option.debug.DebugOption
|
||||||
import com.plugin.component.extension.option.sdk.SdkOption
|
import com.plugin.component.extension.option.sdk.SdkOption
|
||||||
|
import com.plugin.component.utils.ProjectUtil
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.util.ConfigureUtil
|
import org.gradle.util.ConfigureUtil
|
||||||
|
|
||||||
@@ -17,8 +18,9 @@ class ComponentExtension {
|
|||||||
SdkOption sdkOption //sdk选项
|
SdkOption sdkOption //sdk选项
|
||||||
PinOption pinOption //pin选项
|
PinOption pinOption //pin选项
|
||||||
|
|
||||||
String includes = ""
|
Set<String> includeModules = new HashSet<>()
|
||||||
String excludes = ""
|
Set<String> excludeModules = new HashSet<>()
|
||||||
|
Set<String> validModules
|
||||||
Project project
|
Project project
|
||||||
|
|
||||||
ComponentExtension(Project project) {
|
ComponentExtension(Project project) {
|
||||||
@@ -37,19 +39,27 @@ class ComponentExtension {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 过滤哪些模块,格式为 ':library' 或者 'library' ,多个使用 "," 隔开 比如 "library,:libraryKotlin"
|
* 过滤哪些模块,格式为 ':library' 或者 'library' ,多个使用 "," 隔开 比如 "library",":libraryKotlin"
|
||||||
* @param modules
|
* @param modules
|
||||||
*/
|
*/
|
||||||
void include(String modules) {
|
void include(String... modules) {
|
||||||
this.includes = modules
|
if(modules != null && modules.size() > 0){
|
||||||
|
for(String module: modules){
|
||||||
|
includeModules.add(ProjectUtil.getProjectName(module))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 包含哪些模块,格式为 ':library' 或者 'library' ,多个使用 "," 隔开 比如 "library,:libraryKotlin"
|
* 包含哪些模块,格式为 ':library' 或者 'library' ,多个使用 "," 隔开 比如 "library",":libraryKotlin"
|
||||||
* @param modules
|
* @param modules
|
||||||
*/
|
*/
|
||||||
void exclude(String modules) {
|
void exclude(String... modules) {
|
||||||
this.excludes = modules
|
if(modules != null && modules.size() > 0){
|
||||||
|
for(String module: modules){
|
||||||
|
excludeModules.add(ProjectUtil.getProjectName(module))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -77,12 +87,42 @@ class ComponentExtension {
|
|||||||
ConfigureUtil.configure(closure, debugOption)
|
ConfigureUtil.configure(closure, debugOption)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean shouldApplyComponentPlugin(Project project) {
|
||||||
|
getValidModules().contains(ProjectUtil.getProjectName(project))
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> getValidComponents(Project root, Set<String> includeModules, Set<String> excludeModules, boolean includeModel) {
|
||||||
|
Set<String> result = new HashSet<>()
|
||||||
|
root.allprojects.each {
|
||||||
|
if (includeModel) {
|
||||||
|
if (includeModules.contains(ProjectUtil.getProjectName(it))) {
|
||||||
|
result.add(it.name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!excludeModules.contains(ProjectUtil.getProjectName(it))) {
|
||||||
|
result.add(it.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set<String> getValidModules(){
|
||||||
|
if(validModules == null){
|
||||||
|
validModules = new HashSet<>()
|
||||||
|
validModules = getValidComponents(project, includeModules, excludeModules, !includeModules.isEmpty())
|
||||||
|
}
|
||||||
|
return validModules
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
String toString() {
|
String toString() {
|
||||||
StringBuilder stringBuilder = new StringBuilder("\n")
|
StringBuilder stringBuilder = new StringBuilder("\n")
|
||||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||||
stringBuilder.append(" | include = " + includes+ "\n")
|
stringBuilder.append(" | include = " + includeModules.toList().toString() + "\n")
|
||||||
stringBuilder.append(" | exclude = " + excludes + "\n")
|
stringBuilder.append(" | exclude = " + excludeModules.toList().toString() + "\n")
|
||||||
|
stringBuilder.append(" | Select by " + (!includeModules.isEmpty() ? "includeModel" : "excludeModel") + "\n")
|
||||||
|
stringBuilder.append(" | 插件作用模块 = " + getValidModules().toList().toString() + "\n")
|
||||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||||
return stringBuilder.toString()
|
return stringBuilder.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
package com.plugin.component.extension.option.debug
|
package com.plugin.component.extension.option.debug
|
||||||
|
|
||||||
import com.plugin.component.Constants
|
|
||||||
import org.gradle.api.NamedDomainObjectContainer
|
import org.gradle.api.NamedDomainObjectContainer
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.util.ConfigureUtil
|
import org.gradle.util.ConfigureUtil
|
||||||
@@ -43,32 +41,18 @@ class DebugOption {
|
|||||||
return !configurationList.isEmpty()
|
return !configurationList.isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
String toString() {
|
||||||
return "DebugOption{" + '\n' +
|
StringBuilder stringBuilder = new StringBuilder("\n")
|
||||||
" targetModuleName = '" + targetModuleName + "," + "\n" +
|
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||||
" targetDebugNam = '" + targetDebugName + "," + "\n" +
|
stringBuilder.append(" | targetModuleName = " + targetModuleName + "\n" )
|
||||||
" configurationLis = [" + configurationListToString() + '\n' +
|
stringBuilder.append(" | targetDebugName = " + targetDebugName + "\n" )
|
||||||
" ]} "
|
stringBuilder.append(" | configuration = [ " + "\n" )
|
||||||
}
|
for(DebugConfiguration configuration: configurationList){
|
||||||
|
stringBuilder.append(" | name = " + configuration.name + ", dependencies = " + configuration.dependencies.implementation.toString() + "\n" )
|
||||||
String configurationListToString() {
|
|
||||||
StringBuffer stringBuffer = new StringBuffer("\n")
|
|
||||||
for (DebugConfiguration debugConfiguration : configurationList) {
|
|
||||||
stringBuffer.append(" { name=")
|
|
||||||
stringBuffer.append(debugConfiguration.name)
|
|
||||||
if (debugConfiguration.dependencies != null && !debugConfiguration.dependencies.implementation.isEmpty()) {
|
|
||||||
stringBuffer.append(" dependencies=[")
|
|
||||||
for (Object obj : debugConfiguration.dependencies.implementation) {
|
|
||||||
if (obj instanceof String) {
|
|
||||||
stringBuffer.append(" " + obj.toString().replace(Constants.DEBUG_COMPONENT_PRE, ""))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stringBuffer.append(" ]")
|
|
||||||
}
|
|
||||||
stringBuffer.append(" }\n")
|
|
||||||
}
|
}
|
||||||
return stringBuffer.toString()
|
stringBuilder.append(" | ] " + "\n" )
|
||||||
|
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||||
|
return stringBuilder.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.plugin.component.extension.option.pin
|
package com.plugin.component.extension.option.pin
|
||||||
|
|
||||||
|
|
||||||
import org.gradle.api.NamedDomainObjectContainer
|
import org.gradle.api.NamedDomainObjectContainer
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.util.ConfigureUtil
|
import org.gradle.util.ConfigureUtil
|
||||||
@@ -8,7 +7,6 @@ import org.gradle.util.ConfigureUtil
|
|||||||
class PinOption {
|
class PinOption {
|
||||||
|
|
||||||
Project project
|
Project project
|
||||||
|
|
||||||
List<PinConfiguration> configurationList = new ArrayList<>() //配置信息
|
List<PinConfiguration> configurationList = new ArrayList<>() //配置信息
|
||||||
|
|
||||||
PinOption(Project project) {
|
PinOption(Project project) {
|
||||||
@@ -27,6 +25,12 @@ class PinOption {
|
|||||||
String toString() {
|
String toString() {
|
||||||
StringBuilder stringBuilder = new StringBuilder("\n")
|
StringBuilder stringBuilder = new StringBuilder("\n")
|
||||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||||
|
stringBuilder.append(" | configuration = [ " + "\n" )
|
||||||
|
for(PinConfiguration configuration: configurationList){
|
||||||
|
stringBuilder.append(" | name = " + configuration.name + ", codeCheckEnabled = " + configuration.codeCheckEnabled + ", mathPath = " + configuration.mainPath
|
||||||
|
+ ", include = " + configuration.includePins.toString() + ", export = " + configuration.export.toString() + "\n" )
|
||||||
|
}
|
||||||
|
stringBuilder.append(" | ] " + "\n" )
|
||||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||||
return stringBuilder.toString()
|
return stringBuilder.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,13 +76,20 @@ class SdkOption {
|
|||||||
String toString() {
|
String toString() {
|
||||||
StringBuilder stringBuilder = new StringBuilder("\n")
|
StringBuilder stringBuilder = new StringBuilder("\n")
|
||||||
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
stringBuilder.append(" ------------------------------------------------------------------" + "\n")
|
||||||
stringBuilder.append(" | targetDebugName = " + Runtimes.sDebugOption.targetDebugName + "\n")
|
stringBuilder.append(" | AndroidJarPath = " + Runtimes.getAndroidJarPath() + "\n" )
|
||||||
stringBuilder.append(" | AndroidJarPath = " + Runtimes.sAndroidJarPath + "\n" )
|
stringBuilder.append(" | compileSdkVersion = " + compileSdkVersion + "\n" )
|
||||||
stringBuilder.append(" | compileSdkVersion = " + Runtimes.sCompileSdkVersion + "\n" )
|
stringBuilder.append(" | CompileOptions = " + compileOption.toString()+ "\n" )
|
||||||
stringBuilder.append(" | CompileOptions = " + Runtimes.sCompileOption.toString()+ "\n" )
|
stringBuilder.append(" | configuration = [ " + "\n" )
|
||||||
|
Set<String> keys = Runtimes.getSdkPublicationMap().keySet()
|
||||||
|
for(String key: keys){
|
||||||
|
PublicationOption publicationOption = Runtimes.getSdkPublication(key)
|
||||||
|
stringBuilder.append(" | name = " + publicationOption.name + ", gav = " + publicationOption.groupId + "." + publicationOption.artifactId + "\n" )
|
||||||
|
}
|
||||||
|
stringBuilder.append(" | ] " + "\n" )
|
||||||
stringBuilder.append(" -------------------------------------------------------------------" + "\n")
|
stringBuilder.append(" -------------------------------------------------------------------" + "\n")
|
||||||
return stringBuilder.toString()
|
return stringBuilder.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 未开放
|
// * 未开放
|
||||||
// * @param closure
|
// * @param closure
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class CompileSdkTask extends DefaultTask {
|
|||||||
@TaskAction
|
@TaskAction
|
||||||
void compileSource() {
|
void compileSource() {
|
||||||
def project = getProject()
|
def project = getProject()
|
||||||
def releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.sAndroidJarPath, Runtimes.sCompileOption, false)
|
def releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.getAndroidJarPath(), Runtimes.getCompileOption(), false)
|
||||||
if (releaseJar == null) {
|
if (releaseJar == null) {
|
||||||
throw new RuntimeException("nothing to push.")
|
throw new RuntimeException("nothing to push.")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ class JarUtil {
|
|||||||
|
|
||||||
if (target.exists()) {
|
if (target.exists()) {
|
||||||
if (hasModifiedSource) {
|
if (hasModifiedSource) {
|
||||||
def releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.sAndroidJarPath, Runtimes.sCompileOption, true)
|
def releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.getAndroidJarPath(), Runtimes.getCompileOption(), true)
|
||||||
if (releaseJar == null) {
|
if (releaseJar == null) {
|
||||||
publication.invalid = true
|
publication.invalid = true
|
||||||
PublicationManager.getInstance().addPublication(publication)
|
PublicationManager.getInstance().addPublication(publication)
|
||||||
@@ -380,7 +380,7 @@ class JarUtil {
|
|||||||
PublicationManager.getInstance().addPublication(publication)
|
PublicationManager.getInstance().addPublication(publication)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
def releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.sAndroidJarPath, Runtimes.sCompileOption, false)
|
def releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.getAndroidJarPath(), Runtimes.getCompileOption(), false)
|
||||||
if (releaseJar == null) {
|
if (releaseJar == null) {
|
||||||
publication.invalid = true
|
publication.invalid = true
|
||||||
PublicationManager.getInstance().addPublication(publication)
|
PublicationManager.getInstance().addPublication(publication)
|
||||||
@@ -401,7 +401,7 @@ class JarUtil {
|
|||||||
}
|
}
|
||||||
publication.useLocal = false
|
publication.useLocal = false
|
||||||
} else {
|
} else {
|
||||||
releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.sAndroidJarPath, Runtimes.sCompileOption, true)
|
releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.getAndroidJarPath(), Runtimes.getCompileOption(), true)
|
||||||
FileUtil.copyFile(releaseJar, target)
|
FileUtil.copyFile(releaseJar, target)
|
||||||
publication.useLocal = true
|
publication.useLocal = true
|
||||||
}
|
}
|
||||||
@@ -434,7 +434,7 @@ class JarUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.sAndroidJarPath, Runtimes.sCompileOption, true)
|
File releaseJar = JarUtil.packJavaSourceJar(project, publication, Runtimes.getAndroidJarPath(), Runtimes.getCompileOption(), true)
|
||||||
if (releaseJar == null) {
|
if (releaseJar == null) {
|
||||||
publication.invalid = true
|
publication.invalid = true
|
||||||
PublicationManager.getInstance().addPublication(publication)
|
PublicationManager.getInstance().addPublication(publication)
|
||||||
|
|||||||
@@ -180,19 +180,37 @@ class ProjectUtil {
|
|||||||
Logger.buildOutput("hasDebugOptions", false)
|
Logger.buildOutput("hasDebugOptions", false)
|
||||||
}
|
}
|
||||||
Logger.buildOutput("DebugModule[" + project.name + "]" + "Main sourceSets: ")
|
Logger.buildOutput("DebugModule[" + project.name + "]" + "Main sourceSets: ")
|
||||||
Logger.buildOutput("java", objMain.java.srcDirs.toString())
|
Logger.buildOutput("java", sourceSetDirToString(objMain.java.srcDirs))
|
||||||
Logger.buildOutput("res", objMain.res.srcDirs.toString())
|
Logger.buildOutput("res", sourceSetDirToString(objMain.res.srcDirs))
|
||||||
Logger.buildOutput("assets", objMain.assets.srcDirs.toString())
|
Logger.buildOutput("assets", sourceSetDirToString(objMain.assets.srcDirs))
|
||||||
Logger.buildOutput("jniLibs", objMain.jniLibs.srcDirs.toString())
|
Logger.buildOutput("jniLibs", sourceSetDirToString(objMain.jniLibs.srcDirs))
|
||||||
Logger.buildOutput("manifest", objAndroidTest.manifest.srcFile.path)
|
Logger.buildOutput("manifest", objAndroidTest.manifest.srcFile.path)
|
||||||
Logger.buildOutput("DebugModule[" + project.name + "]" + "AndroidTest sourceSets: ")
|
Logger.buildOutput("DebugModule[" + project.name + "]" + "AndroidTest sourceSets: ")
|
||||||
Logger.buildOutput("java", objAndroidTest.java.srcDirs.toString())
|
Logger.buildOutput("java", sourceSetDirToString(objAndroidTest.java.srcDirs))
|
||||||
Logger.buildOutput("res", objAndroidTest.res.srcDirs.toString())
|
Logger.buildOutput("res", sourceSetDirToString(objAndroidTest.res.srcDirs))
|
||||||
Logger.buildOutput("assets", objAndroidTest.assets.srcDirs.toString())
|
Logger.buildOutput("assets", sourceSetDirToString(objAndroidTest.assets.srcDirs))
|
||||||
Logger.buildOutput("jniLibs", objAndroidTest.jniLibs.srcDirs.toString())
|
Logger.buildOutput("jniLibs", sourceSetDirToString(objAndroidTest.jniLibs.srcDirs))
|
||||||
Logger.buildOutput("manifest", objAndroidTest.manifest.srcFile.path)
|
Logger.buildOutput("manifest", objAndroidTest.manifest.srcFile.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String sourceSetDirToString(Set<File> set) {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder()
|
||||||
|
if (set != null && !set.isEmpty()) {
|
||||||
|
if(set.size() == 1){
|
||||||
|
for (File file : set) {
|
||||||
|
stringBuilder.append("[ " + file.path + " ]")
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
stringBuilder.append("[ \n")
|
||||||
|
for (File file : set) {
|
||||||
|
stringBuilder.append(" " + file.path + "\n")
|
||||||
|
}
|
||||||
|
stringBuilder.append(" ]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stringBuilder.toString()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回项目设置的android jar路径
|
* 返回项目设置的android jar路径
|
||||||
* @param project
|
* @param project
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ component {
|
|||||||
|
|
||||||
//申明插件的作用域,用于有 include 和 exclude
|
//申明插件的作用域,用于有 include 和 exclude
|
||||||
//生效的模块会自动添加组件依赖 core,可使用 component(:{projectName}) 使用其他组件提供的sdk,同时可在 componentSdks 中配置自己模块暴露的sdk
|
//生效的模块会自动添加组件依赖 core,可使用 component(:{projectName}) 使用其他组件提供的sdk,同时可在 componentSdks 中配置自己模块暴露的sdk
|
||||||
exclude 'libraryWithoutPlugin,component-core'
|
exclude 'libraryWithoutPlugin','component-core'
|
||||||
|
|
||||||
// 上述 语句等价于下面语句
|
// 上述 语句等价于下面语句
|
||||||
// include ':app,library,libraryKotlin,debugModule'
|
include ':app','library','libraryKotlin','debugModule'
|
||||||
|
|
||||||
|
|
||||||
sdk {
|
sdk {
|
||||||
|
|||||||
Reference in New Issue
Block a user