-
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.
- Loading branch information
Showing
30 changed files
with
265 additions
and
710 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
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
38 changes: 38 additions & 0 deletions
38
build-logic/convention-plugins/src/main/kotlin/social.androiddev.android.common.gradle.kts
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,38 @@ | ||
/** | ||
* Convention plugin to apply android configuration that's common across both library and app | ||
* modules. | ||
*/ | ||
plugins { | ||
id("social.androiddev.codequality") | ||
} | ||
|
||
android { | ||
compileSdk = 33 | ||
|
||
defaultConfig { | ||
minSdk = 33 | ||
} | ||
|
||
// targetSdk is in a different interface for library and application projects | ||
when (this) { | ||
is com.android.build.api.dsl.ApplicationBaseFlavor -> { | ||
targetSdk = 33 | ||
} | ||
is com.android.build.api.dsl.LibraryBaseFlavor -> { | ||
targetSdk = 33 | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
} | ||
|
||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
kotlinOptions.jvmTarget = "11" | ||
} | ||
|
||
fun Project.android(configure: com.android.build.api.dsl.CommonExtension<*, *, *, *>.() -> Unit) { | ||
extensions.configure("android", configure) | ||
} |
16 changes: 16 additions & 0 deletions
16
build-logic/convention-plugins/src/main/kotlin/social.androiddev.codequality.gradle.kts
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,16 @@ | ||
/** | ||
* Convention plugin to apply various code-quality tools. Since this should be included in every | ||
* module, it's applied automatically by other convention plugins, but can be applied directly for | ||
* any module that doesn't use any. | ||
*/ | ||
plugins { | ||
id("com.diffplug.spotless") | ||
} | ||
|
||
spotless { | ||
kotlin { | ||
target("src/*/kotlin/**/*.kt") | ||
ktlint("0.43.2") | ||
licenseHeaderFile(File(rootDir, "copyright.txt")) | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
build-logic/convention-plugins/src/main/kotlin/social.androiddev.library.common.gradle.kts
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,40 @@ | ||
/** | ||
* Convention plugin to apply common configurations for library modules. Instead of depending on | ||
* this directly you should depend on `social.androiddev.library` or `social.androiddev.library.ui`. | ||
*/ | ||
plugins { | ||
id("org.jetbrains.kotlin.multiplatform") | ||
id("com.android.library") | ||
id("social.androiddev.android.common") | ||
} | ||
|
||
android { | ||
sourceSets { | ||
named("main") { | ||
manifest.srcFile("src/androidMain/AndroidManifest.xml") | ||
res.srcDirs("src/androidMain/res") | ||
} | ||
} | ||
} | ||
|
||
// Workaround for: | ||
// | ||
// The Kotlin source set androidAndroidTestRelease was configured but not added to any | ||
// Kotlin compilation. You can add a source set to a target's compilation by connecting it | ||
// with the compilation's default source set using 'dependsOn'. | ||
// See https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets | ||
// | ||
// Remove log pollution until Android support in KMP improves. | ||
// | ||
afterEvaluate { | ||
project.extensions.findByType<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension>()?.let { ext -> | ||
ext.sourceSets.removeAll { sourceSet -> | ||
setOf( | ||
"androidAndroidTestRelease", | ||
"androidTestFixtures", | ||
"androidTestFixturesDebug", | ||
"androidTestFixturesRelease", | ||
).contains(sourceSet.name) | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
build-logic/convention-plugins/src/main/kotlin/social.androiddev.library.gradle.kts
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,44 @@ | ||
/** | ||
* Convention plugin for non-ui library modules. | ||
*/ | ||
plugins { | ||
id("social.androiddev.library.common") | ||
} | ||
|
||
val libs = the<org.gradle.accessors.dm.LibrariesForLibs>() | ||
|
||
kotlin { | ||
jvm("desktop") | ||
android() | ||
ios() | ||
|
||
sourceSets { | ||
// shared | ||
val commonMain by getting | ||
|
||
val androidMain by getting { | ||
dependsOn(commonMain) | ||
} | ||
|
||
// testing | ||
val commonTest by getting { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
implementation(libs.org.jetbrains.kotlin.test.common) | ||
implementation(libs.org.jetbrains.kotlin.test.annotations.common) | ||
} | ||
} | ||
val androidTest by getting { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
implementation(libs.org.jetbrains.kotlin.test.junit) | ||
} | ||
} | ||
val desktopTest by getting { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
implementation(libs.org.jetbrains.kotlin.test.junit) | ||
} | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
build-logic/convention-plugins/src/main/kotlin/social.androiddev.library.ui.gradle.kts
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,42 @@ | ||
/** | ||
* Convention plugin for ui library modules. Includes compose dependencies. Currently does not | ||
* support iOS. | ||
*/ | ||
plugins { | ||
id("social.androiddev.library.common") | ||
id("org.jetbrains.compose") | ||
} | ||
|
||
val libs = the<org.gradle.accessors.dm.LibrariesForLibs>() | ||
|
||
kotlin { | ||
jvm("desktop") | ||
android() | ||
|
||
sourceSets { | ||
// shared | ||
val commonMain by getting { | ||
dependencies { | ||
implementation(compose.runtime) | ||
implementation(compose.foundation) | ||
implementation(compose.material) | ||
} | ||
} | ||
|
||
// android | ||
val androidMain by getting { | ||
dependencies { | ||
implementation(libs.androidx.core.ktx) | ||
// Workaround for https://github.com/JetBrains/compose-jb/issues/2340 | ||
implementation(libs.androidx.compose.foundation) | ||
} | ||
} | ||
|
||
// desktop | ||
val desktopMain by getting { | ||
dependencies { | ||
implementation(compose.desktop.common) | ||
} | ||
} | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
...d-logic/convention-plugins/src/main/kotlin/social/androiddev/plugins/CodeQualityPlugin.kt
This file was deleted.
Oops, something went wrong.
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.