-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now the `ozone-multiplatform` convention plugin is typically the main entrypoint for configuring which targets are available for a module.
- Loading branch information
1 parent
64f8f2b
commit 807e679
Showing
41 changed files
with
124 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
plugins { | ||
id("com.android.application") | ||
kotlin("android") | ||
id("ozone-android") | ||
id("ozone-multiplatform") | ||
id("ozone-compose") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":app:common")) | ||
implementation(libs.androidx.activity.compose) | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.androidx.core) | ||
implementation(libs.retainedactivity) | ||
} | ||
ozone { | ||
androidApp { | ||
namespace = "sh.christian.ozone" | ||
|
||
android { | ||
namespace = "sh.christian.ozone" | ||
defaultConfig { | ||
applicationId = "sh.christian.ozone" | ||
versionCode = 100 | ||
versionName = version.toString() | ||
} | ||
} | ||
} | ||
|
||
defaultConfig { | ||
applicationId = "sh.christian.ozone" | ||
versionCode = 100 | ||
versionName = version.toString() | ||
kotlin { | ||
sourceSets { | ||
val androidMain by getting { | ||
dependencies { | ||
implementation(project(":app:common")) | ||
implementation(libs.androidx.activity.compose) | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.androidx.core) | ||
implementation(libs.retainedactivity) | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
59 changes: 59 additions & 0 deletions
59
build-logic/src/main/kotlin/sh/christian/plugin/OzoneExtension.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,59 @@ | ||
package sh.christian.plugin | ||
|
||
import com.android.build.gradle.AppExtension | ||
import com.android.build.gradle.LibraryExtension | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension | ||
|
||
abstract class OzoneExtension( | ||
private val project: Project, | ||
) { | ||
init { | ||
project.plugins.apply("org.jetbrains.kotlin.multiplatform") | ||
project.plugins.apply("ozone-base") | ||
} | ||
|
||
fun androidLibrary(configure: LibraryExtension.() -> Unit = {}) { | ||
project.plugins.apply("com.android.library") | ||
project.plugins.apply("ozone-android") | ||
kotlin { | ||
androidTarget() | ||
} | ||
project.extensions.configure(configure) | ||
} | ||
|
||
fun androidApp(configure: AppExtension.() -> Unit = {}) { | ||
project.plugins.apply("com.android.application") | ||
project.plugins.apply("ozone-android") | ||
kotlin { | ||
androidTarget() | ||
} | ||
project.extensions.configure(configure) | ||
} | ||
|
||
fun js() { | ||
kotlin { | ||
js(IR) { | ||
browser() | ||
nodejs() | ||
binaries.executable() | ||
} | ||
} | ||
} | ||
|
||
fun jvm() { | ||
kotlin { | ||
jvm { | ||
compilations.all { | ||
kotlinOptions.jvmTarget = "11" | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun kotlin(configure: KotlinMultiplatformExtension.() -> Unit) { | ||
configure(project.kotlinExtension as KotlinMultiplatformExtension) | ||
} | ||
} |