refactor: move hardcoded dependencies to version catalog

This commit is contained in:
Akash Yadav
2023-01-19 08:56:36 +05:30
parent bc156a9cb6
commit be3bcdc3a5
3 changed files with 14 additions and 12 deletions
+7
View File
@@ -1,5 +1,7 @@
[versions]
agp = "7.4.0"
agp-tooling = "7.3.1"
gradle-tooling = "7.6"
kotlin = "1.8.0"
tree-sitter = "1.0.10"
editor = "0.21.0"
@@ -95,6 +97,11 @@ tests-androidx-junit = { module = "androidx.test.ext:junit", version = "1.1.5" }
tests-androidx-espresso = { module = "androidx.test.espresso:espresso-core", version = "3.5.1" }
tests-mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version = "4.1.0" }
# Tooling
tooling-builderModel = { module="com.android.tools.build:builder-model", version.ref = "agp-tooling" }
tooling-gradleApi = { module="org.gradle:gradle-tooling-api", version.ref = "gradle-tooling" }
tooling-slf4j = { module = "org.slf4j:slf4j-api", version = "2.0.6" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
@@ -23,5 +23,5 @@ plugins {
dependencies {
implementation(libs.common.jkotlin)
api("com.android.tools.build:builder-model:7.3.1")
api(libs.tooling.builderModel)
}
+6 -11
View File
@@ -15,7 +15,6 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
import org.jetbrains.kotlin.utils.addToStdlib.ifTrue
@@ -26,9 +25,7 @@ plugins {
id("org.jetbrains.kotlin.jvm")
}
shadow {
archivesName.set("tooling-api")
}
shadow { archivesName.set("tooling-api") }
tasks.withType<Jar> {
manifest { attributes("Main-Class" to "com.itsaky.androidide.tooling.impl.Main") }
@@ -41,14 +38,12 @@ tasks.register<Copy>("copyJarToAssets") {
tasks.register("renameJar") {
finalizedBy("copyJarToAssets")
doLast {
val jar = project.file("${project.buildDir}/libs/tooling-api-${project.version}-all.jar")
val destJar = jar.parentFile.resolve("tooling-api-all.jar")
destJar.exists().ifTrue {
destJar.delete()
}
destJar.exists().ifTrue { destJar.delete() }
jar.renameTo(destJar)
}
}
@@ -63,11 +58,11 @@ dependencies {
implementation(libs.common.jkotlin)
implementation(libs.xml.xercesImpl)
implementation(libs.xml.apis)
implementation("org.gradle:gradle-tooling-api:7.6")
implementation(libs.tooling.gradleApi)
testImplementation(projects.subprojects.toolingApiTesting)
testImplementation(libs.tests.junit)
testImplementation(libs.tests.google.truth)
runtimeOnly("org.slf4j:slf4j-api:2.0.6")
runtimeOnly(libs.tooling.slf4j)
}