Skip to content

Commit 0a3a252

Browse files
author
chenenyu
authored
Merge pull request #144 from chenenyu/dev
fix issue #143
2 parents 0a023b9 + 4c17d5e commit 0a3a252

File tree

3 files changed

+11
-37
lines changed

3 files changed

+11
-37
lines changed

gradle-plugin/src/main/groovy/com/chenenyu/router/RouterPlugin.groovy

+6-32
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@ import com.android.build.gradle.TestPlugin
66
import org.gradle.api.GradleException
77
import org.gradle.api.Plugin
88
import org.gradle.api.Project
9-
import org.gradle.api.initialization.dsl.ScriptHandler
109
import org.gradle.api.plugins.ExtraPropertiesExtension
1110

1211
/**
1312
* Created by chenenyu on 2018/7/24.
1413
*/
1514
class RouterPlugin implements Plugin<Project> {
16-
static final String APT_OPTION_NAME = "moduleName"
15+
private static final String APT_OPTION_NAME = "moduleName"
1716

18-
String DEFAULT_ROUTER_RUNTIME_VERSION = "1.7.2"
19-
String DEFAULT_ROUTER_COMPILER_VERSION = "1.7.2"
20-
21-
String androidBuildGradleVersion
17+
String DEFAULT_ROUTER_RUNTIME_VERSION = "1.7.3"
18+
String DEFAULT_ROUTER_COMPILER_VERSION = "1.7.3"
2219

2320
@Override
2421
void apply(Project project) {
@@ -32,32 +29,16 @@ class RouterPlugin implements Plugin<Project> {
3229
throw new GradleException("android plugin required.")
3330
}
3431

35-
project.rootProject.buildscript.configurations.each {
36-
if (it.name == ScriptHandler.CLASSPATH_CONFIGURATION) { // classpath
37-
it.resolvedConfiguration.firstLevelModuleDependencies.each {
38-
// println("${it.moduleGroup}:${it.moduleName}:${it.moduleVersion}")
39-
if (it.moduleGroup == "com.android.tools.build" && it.moduleName == "gradle") {
40-
androidBuildGradleVersion = it.moduleVersion
41-
}
42-
}
43-
}
44-
}
45-
if (!androidBuildGradleVersion) {
46-
throw new IllegalArgumentException("Unknown android build gradle plugin version.")
47-
}
48-
4932
// kotlin project ?
50-
def isKotlinProject = project.plugins.hasPlugin('kotlin-android')
33+
// https://github.com/JetBrains/kotlin/tree/master/libraries/tools/kotlin-gradle-plugin/src/main/resources/META-INF/gradle-plugins
34+
def isKotlinProject = project.plugins.hasPlugin('kotlin-android') || project.plugins.hasPlugin('org.jetbrains.kotlin.android')
5135
if (isKotlinProject) {
52-
if (!project.plugins.hasPlugin('kotlin-kapt')) {
36+
if (!project.plugins.hasPlugin('kotlin-kapt') && !project.plugins.hasPlugin('org.jetbrains.kotlin.kapt')) {
5337
project.plugins.apply('kotlin-kapt')
5438
}
5539
}
5640

5741
String compileConf = 'implementation'
58-
if (!is3_xVersion()) {
59-
compileConf = 'compile'
60-
}
6142
String aptConf = 'annotationProcessor'
6243
if (isKotlinProject) {
6344
aptConf = 'kapt'
@@ -97,11 +78,4 @@ class RouterPlugin implements Plugin<Project> {
9778
android.registerTransform(transform)
9879
}
9980
}
100-
101-
/**
102-
* Whether the android gradle plugin version is 3.x
103-
*/
104-
boolean is3_xVersion() {
105-
return androidBuildGradleVersion.split("\\.")[0].toInteger() >= 3
106-
}
10781
}

gradle.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ android.useAndroidX=true
1616
# apply router plugin
1717
applyRemotePlugin=false
1818
# router gradle plugin version
19-
PLUGIN_VERSION=1.7.2
19+
PLUGIN_VERSION=1.7.3
2020
# router library version
21-
ROUTER_VERSION=1.7.2
21+
ROUTER_VERSION=1.7.3
2222
# compiler library version
23-
COMPILER_VERSION=1.7.2
23+
COMPILER_VERSION=1.7.3
2424
# annotation library version
2525
ANNOTATION_VERSION=0.4.0

release.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# annotation
2-
./gradlew clean pBPTML -p annotation
3-
./gradlew bintrayUpload -p annotation
2+
#./gradlew clean pBPTML -p annotation
3+
#./gradlew bintrayUpload -p annotation
44

55
# compiler
66
./gradlew clean pBPTML -p compiler

0 commit comments

Comments
 (0)