Skip to content

Commit

Permalink
Fixes for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeda88 committed Jun 12, 2024
1 parent efa24dc commit 666653c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ abstract class BaseKalugaAndroidSubprojectExtension(
objects: ObjectFactory,
) : BaseKalugaSubprojectExtension(versionCatalog, libraryExtension, namespacePostfix, objects) {

override fun Project.setupSubproject() {}

override fun Project.configureSubproject() {
extensions.configure(KotlinAndroidProjectExtension::class) {
compilerOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ sealed class BaseKalugaSubprojectExtension(
).map { it.asDependency() }

override fun Project.beforeEvaluated() {
setupSubproject()
libraryExtension.apply {
compileSdk = versionCatalog.findVersion("androidCompileSdk").get().displayName.toInt()
buildToolsVersion = versionCatalog.findVersion("androidBuildTools").get().displayName
Expand Down Expand Up @@ -113,6 +114,9 @@ sealed class BaseKalugaSubprojectExtension(
configure()
}
}

protected abstract fun Project.setupSubproject()

override fun Project.afterProjectEvaluated() {
if (moduleName.isEmpty()) {
throw RuntimeException("moduleName must be configured")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ open class KalugaMultiplatformSubprojectExtension @Inject constructor(
frameworkConfig = action
}

override fun Project.setupSubproject() {
// Android Target must be setup before project is evaluated as publishing will break otherwise
extensions.configure(KotlinMultiplatformExtension::class) {
androidTarget("androidLib") {
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishAllLibraryVariants()
}
}
}
@OptIn(ExperimentalKotlinGradlePluginApi::class)
override fun Project.configureSubproject() {
extensions.configure(KotlinMultiplatformExtension::class) {
Expand Down Expand Up @@ -142,12 +152,6 @@ open class KalugaMultiplatformSubprojectExtension @Inject constructor(
}
}

androidTarget("androidLib") {
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishLibraryVariants("release", "debug")
}

val iosTargets = project.iosTargets.map { iosTarget ->
when (iosTarget) {
IOSTarget.Arm64 -> iosArm64()
Expand Down
2 changes: 1 addition & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
# kotlin version is included since it will affect building
androidGradle = "8.5.0-rc01"
androidGradle = "8.5.0-rc02"
androidBuildTools = "34.0.0"
androidCompileSdk = "34"
androidMinSdk = "24"
Expand Down

0 comments on commit 666653c

Please sign in to comment.