Skip to content

Commit

Permalink
Science
Browse files Browse the repository at this point in the history
  • Loading branch information
kizitonwose committed Jul 19, 2024
1 parent bbed89b commit 5fa0138
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 13 deletions.
20 changes: 20 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import com.kizitonwose.calendar.buildsrc.Version
import com.kizitonwose.calendar.buildsrc.Version.isNoPublish
import com.kizitonwose.calendar.buildsrc.androidProjects
import com.kizitonwose.calendar.buildsrc.multiplatformProjects
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin

Expand Down Expand Up @@ -25,6 +29,22 @@ allprojects {
}
}
}
afterEvaluate {
disableMavenPublicationsIfNeeded(multiplatformProjects, Version.multiplatfrom)
disableMavenPublicationsIfNeeded(androidProjects, Version.android)
}
}


fun Project.disableMavenPublicationsIfNeeded(
projects: List<String>,
version: String,
) {
if (version.isNoPublish() && project.name in projects) {
tasks.withType<AbstractPublishToMaven> {
enabled = false
}
}
}

apiValidation {
Expand Down
17 changes: 14 additions & 3 deletions buildSrc/src/main/java/com/kizitonwose/calendar/buildsrc/Build.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,35 @@

package com.kizitonwose.calendar.buildsrc

import com.kizitonwose.calendar.buildsrc.Version.isNoPublish
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.withType
import kotlin.math.max

object Config {
val compatibleJavaVersion = JavaVersion.VERSION_17
val compatibleJavaLanguageVersion = JavaLanguageVersion.of(compatibleJavaVersion.majorVersion.toInt())
}

object Versions {
val core = "2.6.0-alpha04"
val multiplatfrom = "2.6.0-SNAPSHOT"
object Version {
val android = VERSION_NO_PUBLISH
val multiplatfrom = "2.6.0-alpha04"

fun String.isNoPublish() = this == VERSION_NO_PUBLISH
}

private val VERSION_NO_PUBLISH = "NO_PUBLISH"

object Android {
const val minSdkViewLibrary = 19
const val minSdkComposeLibrary = 21
val minSdkSampleApp = max(minSdkViewLibrary, minSdkComposeLibrary)
const val targetSdk = 34
const val compileSdk = 34
}

val multiplatformProjects = listOf("library")
val androidProjects = listOf("core", "data", "view", "compose")
4 changes: 2 additions & 2 deletions compose-multiplatform/library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import com.kizitonwose.calendar.buildsrc.Android
import com.kizitonwose.calendar.buildsrc.Config
import com.kizitonwose.calendar.buildsrc.Versions
import com.kizitonwose.calendar.buildsrc.Version
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

Expand Down Expand Up @@ -112,5 +112,5 @@ android {
}

mavenPublishing {
coordinates(version = Versions.multiplatfrom)
coordinates(version = Version.multiplatfrom)
}
4 changes: 2 additions & 2 deletions compose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import com.kizitonwose.calendar.buildsrc.Android
import com.kizitonwose.calendar.buildsrc.Config
import com.kizitonwose.calendar.buildsrc.Versions
import com.kizitonwose.calendar.buildsrc.Version

plugins {
alias(libs.plugins.androidLibrary)
Expand Down Expand Up @@ -45,5 +45,5 @@ dependencies {
}

mavenPublishing {
coordinates(version = Versions.core)
coordinates(version = Version.android)
}
4 changes: 2 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import com.kizitonwose.calendar.buildsrc.Config
import com.kizitonwose.calendar.buildsrc.Versions
import com.kizitonwose.calendar.buildsrc.Version

plugins {
alias(libs.plugins.kotlinJvm)
Expand All @@ -23,5 +23,5 @@ dependencies {
}

mavenPublishing {
coordinates(version = Versions.core)
coordinates(version = Version.android)
}
4 changes: 2 additions & 2 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import com.kizitonwose.calendar.buildsrc.Config
import com.kizitonwose.calendar.buildsrc.Versions
import com.kizitonwose.calendar.buildsrc.Version

plugins {
alias(libs.plugins.kotlinJvm)
Expand All @@ -27,5 +27,5 @@ dependencies {
}

mavenPublishing {
coordinates(version = Versions.core)
coordinates(version = Version.android)
}
4 changes: 2 additions & 2 deletions view/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import com.kizitonwose.calendar.buildsrc.Android
import com.kizitonwose.calendar.buildsrc.Config
import com.kizitonwose.calendar.buildsrc.Versions
import com.kizitonwose.calendar.buildsrc.Version

plugins {
alias(libs.plugins.androidLibrary)
Expand Down Expand Up @@ -37,5 +37,5 @@ dependencies {
}

mavenPublishing {
coordinates(version = Versions.core)
coordinates(version = Version.android)
}

0 comments on commit 5fa0138

Please sign in to comment.