-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
c05cb42
commit 8a91ec2
Showing
17 changed files
with
612 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,10 @@ jobs: | |
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | ||
|
||
- name: Build with Gradle Wrapper | ||
run: ./gradlew assemble | ||
- name: Build libraries | ||
run: ./gradlew assemble -x :composeApp:assemble | ||
- name: Build sample | ||
run: ./gradlew :composeApp:assembleDebug | ||
|
||
dependency-submission: | ||
needs: build | ||
|
@@ -87,11 +89,11 @@ jobs: | |
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | ||
|
||
- name: Generate Dokkatoo site | ||
run: ./gradlew dokkatooGenerate | ||
run: ./gradlew :dokkatooGenerate | ||
- name: Upload GitHub Pages artifact | ||
uses: actions/[email protected] | ||
with: | ||
path: 'core/build/dokka/html' | ||
path: 'build/dokka/html' | ||
|
||
deploy-api-reference: | ||
needs: generate-api-reference | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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,31 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
group = "io.shortway.kobankat.buildlogic" | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_17.toString() | ||
} | ||
} | ||
|
||
dependencies { | ||
compileOnly(libs.android.gradlePlugin) | ||
compileOnly(libs.kotlin.gradlePlugin) | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
register("Library") { | ||
id = "kobankat.library" | ||
implementationClass = "io.shortway.kobankat.buildlogic.plugin.LibraryConventionPlugin" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
build-logic/convention/src/main/kotlin/io/shortway/kobankat/buildlogic/ktx/VersionCatalog.kt
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,17 @@ | ||
package io.shortway.kobankat.buildlogic.ktx | ||
|
||
import org.gradle.api.artifacts.VersionCatalog | ||
import org.gradle.api.artifacts.VersionConstraint | ||
|
||
internal fun VersionCatalog.getVersion(alias: String): String = | ||
findVersion(alias).get().version | ||
|
||
/** | ||
* Uses the same logic as VersionFactory.doGetVersion(). | ||
*/ | ||
internal val VersionConstraint.version: String | ||
get() = requiredVersion.ifEmpty { | ||
strictVersion.ifEmpty { | ||
preferredVersion | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...vention/src/main/kotlin/io/shortway/kobankat/buildlogic/plugin/LibraryConventionPlugin.kt
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,81 @@ | ||
package io.shortway.kobankat.buildlogic.plugin | ||
|
||
import com.android.build.gradle.LibraryExtension | ||
import io.shortway.kobankat.buildlogic.ktx.getVersion | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.VersionCatalogsExtension | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
|
||
/** | ||
* A build convention plugin to be applied to all published library modules, to reduce duplication | ||
* in build scripts. | ||
*/ | ||
class LibraryConventionPlugin : Plugin<Project> { | ||
|
||
override fun apply(target: Project) = with(target) { | ||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
val javaVersion = libs.getVersion("java") | ||
|
||
with(pluginManager) { | ||
apply("org.jetbrains.kotlin.multiplatform") | ||
apply("com.android.library") | ||
apply("dev.adamko.dokkatoo-html") | ||
apply("io.gitlab.arturbosch.detekt") | ||
apply("com.vanniktech.maven.publish") | ||
apply("com.gradleup.nmcp") | ||
} | ||
|
||
extensions.configure<KotlinMultiplatformExtension> { | ||
// Compilation targets: | ||
androidTarget { | ||
compilations.all { | ||
kotlinOptions { | ||
jvmTarget = javaVersion | ||
} | ||
} | ||
|
||
publishLibraryVariants("release") | ||
} | ||
iosX64() | ||
iosArm64() | ||
iosSimulatorArm64() | ||
|
||
// Compiler flags: | ||
targets.all { | ||
compilations.all { | ||
compilerOptions.configure { | ||
freeCompilerArgs.apply { | ||
add("-Xexpect-actual-classes") | ||
} | ||
} | ||
} | ||
} | ||
sourceSets.all { | ||
languageSettings.apply { | ||
if (name.lowercase().startsWith("ios")) { | ||
optIn("kotlinx.cinterop.ExperimentalForeignApi") | ||
} | ||
} | ||
} | ||
|
||
// Explicit API: | ||
explicitApi() | ||
} | ||
|
||
// Android library setup: | ||
extensions.configure<LibraryExtension> { | ||
compileSdk = libs.getVersion("android-compileSdk").toInt() | ||
defaultConfig { | ||
minSdk = libs.getVersion("android-minSdk").toInt() | ||
} | ||
compileOptions { | ||
sourceCompatibility(javaVersion) | ||
targetCompatibility(javaVersion) | ||
} | ||
} | ||
} | ||
|
||
} |
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,3 @@ | ||
org.gradle.parallel=true | ||
org.gradle.caching=true | ||
org.gradle.configureondemand=true |
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 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "build-logic" | ||
include(":convention") |
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
Oops, something went wrong.