Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit 7de2e0d

Browse files
committed
gradle 优化
1 parent c9062c5 commit 7de2e0d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ buildscript {
2626
allprojects {
2727
apply {
2828
from("${rootDir.path}/$extraScriptPath")
29+
plugin(Plugins.dependencyUpdate)
2930
plugin(Plugins.kotlinter)
3031
}
3132
kotlinter {

buildSrc/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ plugins {
55
apply("extra.gradle.kts")
66

77
dependencies {
8-
implementation(rootProject.extra.get("androidGradlePlugin").toString())
9-
implementation(rootProject.extra.get("kotlinPlugin").toString())
8+
implementation(rootProject.extra["androidGradlePlugin"].toString())
9+
implementation(rootProject.extra["kotlinPlugin"].toString())
1010
}

buildSrc/src/main/kotlin/ProjectConfig.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import com.android.build.gradle.BaseExtension
33
import com.android.build.gradle.LibraryExtension
44
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
55
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
6-
import org.gradle.api.GradleException
6+
import org.gradle.api.InvalidUserDataException
77
import org.gradle.api.JavaVersion
88
import org.gradle.api.Project
99
import org.gradle.api.artifacts.Dependency
@@ -106,8 +106,8 @@ fun PluginAware.applyPlugin(vararg names: String) {
106106
}
107107

108108
fun ExtensionAware.getExtra(name: String): Any {
109-
return extensions.extraProperties.get(name)
110-
?: throw GradleException("ExtraProperty $name is null")
109+
return extensions.extraProperties[name]
110+
?: throw InvalidUserDataException("ExtraProperty $name is null")
111111
}
112112

113113
fun Project.setupBase(module: Module? = null, block: BaseExtension.() -> Unit = {}): BaseExtension {

0 commit comments

Comments
 (0)