Skip to content

Commit

Permalink
Extract non-Gradle dependencies to new module.
Browse files Browse the repository at this point in the history
  • Loading branch information
christiandeange committed Jan 19, 2023
1 parent 473ad1d commit e8f0056
Show file tree
Hide file tree
Showing 29 changed files with 62 additions and 25 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 2 additions & 18 deletions aaraar-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,10 @@ group = "sh.christian.aaraar"
version = "1.0-SNAPSHOT"

dependencies {
implementation(project(":core"))

implementation(platform(kotlin("bom")))
implementation(libs.agp.api)
implementation(libs.agp.layoutlib)
implementation(libs.agp.tools.common)
implementation(libs.agp.tools.manifestmerger)
implementation(libs.agp.tools.sdk)
implementation(libs.asm)
implementation(libs.jarjar) {
exclude(
group = libs.asm.get().module.group,
module = libs.asm.get().module.name,
)
}
implementation(libs.kotlinxml)

testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}

tasks.withType<KotlinCompile> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package sh.christian.aaraar

import com.android.SdkConstants.FD_OUTPUTS
import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.attributes.BuildTypeAttr
import com.android.build.api.dsl.LibraryExtension
Expand Down Expand Up @@ -86,7 +85,7 @@ class AarAarPlugin : Plugin<Project> {

val aar = variant.artifacts.get(SingleArtifact.AAR)
val fileName = "${project.name}-${variant.name}.aar"
val outFile = project.buildDir / FD_OUTPUTS / "aaraar" / fileName
val outFile = project.buildDir / "outputs" / "aaraar" / fileName

val packageVariantAar = project.tasks.register<PackageAarTask>(
variant.name("package", "Aar")
Expand Down
1 change: 1 addition & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
49 changes: 49 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
@Suppress("DSL_SCOPE_VIOLATION") val plugins = libs.plugins

alias(plugins.kotlin.jvm)
`kotlin-dsl`
}

group = "sh.christian.aaraar"
version = "1.0-SNAPSHOT"

dependencies {
implementation(platform(kotlin("bom")))
implementation(libs.agp.layoutlib)
implementation(libs.agp.tools.common)
implementation(libs.agp.tools.manifestmerger)
implementation(libs.agp.tools.sdk)
implementation(libs.asm)
implementation(libs.jarjar) {
exclude(
group = libs.asm.get().module.group,
module = libs.asm.get().module.name,
)
}
implementation(libs.kotlinxml)

testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}

kotlin {
sourceSets {
all {
languageSettings.apply {
optIn("kotlin.RequiresOptIn")
}
}
}

jvmToolchain(11)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import java.nio.file.FileSystems
import java.nio.file.Files
import java.nio.file.Path

internal operator fun File.div(path: String): File {
operator fun File.div(path: String): File {
return resolve(path)
}

internal operator fun Path.div(path: String): Path {
operator fun Path.div(path: String): Path {
return resolve(path)
}

internal operator fun FileSystem.div(path: String): Path {
operator fun FileSystem.div(path: String): Path {
return getPath(path)
}

internal fun Path.mkdirs(): Path {
fun Path.mkdirs(): Path {
return apply { parent?.let(Files::createDirectories) }
}

internal fun Path.deleteIfExists(): Path {
fun Path.deleteIfExists(): Path {
return apply { Files.deleteIfExists(this) }
}

Expand Down
2 changes: 2 additions & 0 deletions sample-lib/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
rootProject.name = "aaraar"

include(":aaraar-plugin")
include(":core")

pluginManagement {
repositories {
Expand Down

0 comments on commit e8f0056

Please sign in to comment.