-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev'
- Loading branch information
Showing
12 changed files
with
174 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 8 additions & 49 deletions
57
android-aop-plugin/src/main/kotlin/com/flyjingfish/android_aop_plugin/plugin/BasePlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,37 @@ | ||
package com.flyjingfish.android_aop_plugin.plugin | ||
|
||
import com.flyjingfish.android_aop_plugin.config.RootBooleanConfig | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
abstract class BasePlugin :Plugin<Project> { | ||
private var reflectInvokeMethod = false | ||
private var reflectInvokeMethodOnlyDebug = false | ||
private var debugMode = false | ||
private var onlyDebug = false | ||
private var isIncremental = true | ||
private var buildConfig = true | ||
private lateinit var pluginConfig: PluginConfig | ||
private fun init(project: Project){ | ||
val reflectInvokeMethodStr = project.properties[RootBooleanConfig.REFLECT_INVOKE_METHOD.propertyName]?:"${RootBooleanConfig.REFLECT_INVOKE_METHOD.defaultValue}" | ||
val debugModeStr = project.properties[RootBooleanConfig.DEBUG_MODE.propertyName]?:"${RootBooleanConfig.DEBUG_MODE.defaultValue}" | ||
val onlyModeStr = project.properties[RootBooleanConfig.ONLY_DEBUG.propertyName]?:"${RootBooleanConfig.ONLY_DEBUG.defaultValue}" | ||
val isIncrementalStr = project.properties[RootBooleanConfig.INCREMENTAL.propertyName]?:"${RootBooleanConfig.INCREMENTAL.defaultValue}" | ||
val reflectInvokeMethodDebugStr = project.properties[RootBooleanConfig.REFLECT_INVOKE_METHOD_ONLY_DEBUG.propertyName]?:"${RootBooleanConfig.REFLECT_INVOKE_METHOD_ONLY_DEBUG.defaultValue}" | ||
val buildConfigStr = project.properties[RootBooleanConfig.BUILD_CONFIG.propertyName]?:"${RootBooleanConfig.BUILD_CONFIG.defaultValue}" | ||
debugMode = debugModeStr.toString() == "true" | ||
reflectInvokeMethod = reflectInvokeMethodStr.toString() == "true" | ||
onlyDebug = onlyModeStr.toString() == "true" | ||
isIncremental = isIncrementalStr.toString() == "true" | ||
reflectInvokeMethodOnlyDebug = reflectInvokeMethodDebugStr.toString() == "true" | ||
buildConfig = buildConfigStr.toString() == "true" | ||
pluginConfig = PluginConfig(project) | ||
} | ||
|
||
fun isIncremental():Boolean{ | ||
return isIncremental | ||
return pluginConfig.isIncremental() | ||
} | ||
|
||
override fun apply(project: Project) { | ||
init(project) | ||
} | ||
|
||
fun isDebugMode(buildTypeName :String?,variantName :String):Boolean{ | ||
return if (debugMode){ | ||
if (onlyDebug){ | ||
if (buildTypeName != null){ | ||
buildTypeName.lowercase() == "debug" | ||
}else{ | ||
variantName.lowercase().contains("debug") | ||
} | ||
}else{ | ||
true | ||
} | ||
}else{ | ||
false | ||
} | ||
return pluginConfig.isDebugMode(buildTypeName, variantName) | ||
} | ||
|
||
fun isReflectInvokeMethod(buildTypeName :String?,variantName :String):Boolean{ | ||
return if (reflectInvokeMethod){ | ||
if (reflectInvokeMethodOnlyDebug){ | ||
if (buildTypeName != null){ | ||
buildTypeName.lowercase() == "debug" | ||
}else{ | ||
variantName.lowercase().contains("debug") | ||
} | ||
}else{ | ||
true | ||
} | ||
}else{ | ||
false | ||
} | ||
return pluginConfig.isReflectInvokeMethod(buildTypeName, variantName) | ||
} | ||
|
||
fun isDebugMode():Boolean{ | ||
return debugMode | ||
return pluginConfig.isDebugMode() | ||
} | ||
fun isReflectInvokeMethod():Boolean{ | ||
return reflectInvokeMethod | ||
return pluginConfig.isReflectInvokeMethod() | ||
} | ||
fun hasBuildConfig():Boolean{ | ||
return buildConfig | ||
return pluginConfig.hasBuildConfig() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
android-aop-plugin/src/main/kotlin/com/flyjingfish/android_aop_plugin/plugin/PluginConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.flyjingfish.android_aop_plugin.plugin | ||
|
||
import com.flyjingfish.android_aop_plugin.config.RootBooleanConfig | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
class PluginConfig(private val project: Project) { | ||
private var reflectInvokeMethod = false | ||
private var reflectInvokeMethodOnlyDebug = false | ||
private var debugMode = false | ||
private var onlyDebug = false | ||
private var isIncremental = true | ||
private var buildConfig = true | ||
|
||
init{ | ||
val reflectInvokeMethodStr = project.properties[RootBooleanConfig.REFLECT_INVOKE_METHOD.propertyName]?:"${RootBooleanConfig.REFLECT_INVOKE_METHOD.defaultValue}" | ||
val debugModeStr = project.properties[RootBooleanConfig.DEBUG_MODE.propertyName]?:"${RootBooleanConfig.DEBUG_MODE.defaultValue}" | ||
val onlyModeStr = project.properties[RootBooleanConfig.ONLY_DEBUG.propertyName]?:"${RootBooleanConfig.ONLY_DEBUG.defaultValue}" | ||
val isIncrementalStr = project.properties[RootBooleanConfig.INCREMENTAL.propertyName]?:"${RootBooleanConfig.INCREMENTAL.defaultValue}" | ||
val reflectInvokeMethodDebugStr = project.properties[RootBooleanConfig.REFLECT_INVOKE_METHOD_ONLY_DEBUG.propertyName]?:"${RootBooleanConfig.REFLECT_INVOKE_METHOD_ONLY_DEBUG.defaultValue}" | ||
val buildConfigStr = project.properties[RootBooleanConfig.BUILD_CONFIG.propertyName]?:"${RootBooleanConfig.BUILD_CONFIG.defaultValue}" | ||
debugMode = debugModeStr.toString() == "true" | ||
reflectInvokeMethod = reflectInvokeMethodStr.toString() == "true" | ||
onlyDebug = onlyModeStr.toString() == "true" | ||
isIncremental = isIncrementalStr.toString() == "true" | ||
reflectInvokeMethodOnlyDebug = reflectInvokeMethodDebugStr.toString() == "true" | ||
buildConfig = buildConfigStr.toString() == "true" | ||
} | ||
|
||
fun isIncremental():Boolean{ | ||
return isIncremental | ||
} | ||
|
||
fun isDebugMode(buildTypeName :String?,variantName :String):Boolean{ | ||
return if (debugMode){ | ||
if (onlyDebug){ | ||
if (buildTypeName != null){ | ||
buildTypeName.lowercase() == "debug" | ||
}else{ | ||
variantName.lowercase().contains("debug") | ||
} | ||
}else{ | ||
true | ||
} | ||
}else{ | ||
false | ||
} | ||
} | ||
|
||
fun isReflectInvokeMethod(buildTypeName :String?,variantName :String):Boolean{ | ||
return if (reflectInvokeMethod){ | ||
if (reflectInvokeMethodOnlyDebug){ | ||
if (buildTypeName != null){ | ||
buildTypeName.lowercase() == "debug" | ||
}else{ | ||
variantName.lowercase().contains("debug") | ||
} | ||
}else{ | ||
true | ||
} | ||
}else{ | ||
false | ||
} | ||
} | ||
|
||
fun isDebugMode():Boolean{ | ||
return debugMode | ||
} | ||
fun isReflectInvokeMethod():Boolean{ | ||
return reflectInvokeMethod | ||
} | ||
fun hasBuildConfig():Boolean{ | ||
return buildConfig | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.