Skip to content

Commit

Permalink
revert unified publish-pom.gradle.
Browse files Browse the repository at this point in the history
It was a wrong idea, Gradle was not mature enough to support decent scripting
much yet and requires separate buildSrc module that actually fails to compile
on multiple KMP modules (that should be the primary uses of shared build stuff).
  • Loading branch information
atsushieno committed Mar 8, 2024
1 parent 92c29a4 commit cc91622
Show file tree
Hide file tree
Showing 11 changed files with 308 additions and 105 deletions.
60 changes: 57 additions & 3 deletions ktmidi-android-ext/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,62 @@ dependencies {
}


ext["moduleDescription"] = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0 - Android Extensions"

val moduleDescription = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0 - Android Extensions"
// copypasting
afterEvaluate {
apply { from("../publish-pom.gradle") }
publishing {
publications {
publications.withType<MavenPublication>{
// https://github.com/gradle/gradle/issues/26091#issuecomment-1681343496
val dokkaJar = project.tasks.register("${name}DokkaJar", Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka into a Javadoc jar"
archiveClassifier.set("javadoc")
from(tasks.named("dokkaHtml"))

// Each archive name should be distinct, to avoid implicit dependency issues.
// We use the same format as the sources Jar tasks.
// https://youtrack.jetbrains.com/issue/KT-46466
archiveBaseName.set("${archiveBaseName.get()}-${name}")
}
artifact(dokkaJar)

pom {
name.set("$name")
description.set(moduleDescription)
url.set("https://github.com/atsushieno/ktmidi")
scm {
url.set("https://github.com/atsushieno/ktmidi")
}
licenses {
license {
name.set("the MIT License")
url.set("https://github.com/atsushieno/ktmidi/blob/main/LICENSE")
}
}
developers {
developer {
id.set("atsushieno")
name.set("Atsushi Eno")
email.set("atsushieno@gmail.com")
}
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}

// keep it as is. It is replaced by CI release builds
signing {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,3 @@ import android.content.Context
import android.media.midi.MidiDeviceInfo
import android.media.midi.MidiManager
import android.os.Build

class AndroidMidi2Access(applicationContext: Context, private val includeMidi1Transport: Boolean = false) : AndroidMidiAccess(applicationContext) {
override val ports : List<MidiPortDetails>
get() =
(if (includeMidi1Transport) ports1 else listOf())
.flatMap { d -> d.ports.map { port -> Pair(d, port) } }
.map { pair -> AndroidPortDetails(pair.first, pair.second, 1) } +
ports2.flatMap { d -> d.ports.map { port -> Pair(d, port) } }
.map { pair -> AndroidPortDetails(pair.first, pair.second, 2) }
private val ports2: List<MidiDeviceInfo>
get() =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
manager.getDevicesForTransport(MidiManager.TRANSPORT_UNIVERSAL_MIDI_PACKETS).toList()
else
manager.devices.toList()
}
1 change: 0 additions & 1 deletion ktmidi-ci-tool/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ kotlin {
implementation(libs.compose.ui.tooling.preview)
implementation(libs.androidx.activity.compose)
implementation(libs.kotlinx.coroutines.android)
implementation(project(":ktmidi-android-ext"))
implementation(libs.mpfilepicker)
}
commonMain.dependencies {
Expand Down
61 changes: 58 additions & 3 deletions ktmidi-ci/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,63 @@ android {
}
}

ext["moduleDescription"] = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0 - MIDI-CI support"

val moduleDescription = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0 - MIDI-CI support"
// copypasting
afterEvaluate {
apply { from("../publish-pom.gradle") }
publishing {
publications {
publications.withType<MavenPublication>{
// https://github.com/gradle/gradle/issues/26091#issuecomment-1681343496
val dokkaJar = project.tasks.register("${name}DokkaJar", Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka into a Javadoc jar"
archiveClassifier.set("javadoc")
from(tasks.named("dokkaHtml"))

// Each archive name should be distinct, to avoid implicit dependency issues.
// We use the same format as the sources Jar tasks.
// https://youtrack.jetbrains.com/issue/KT-46466
archiveBaseName.set("${archiveBaseName.get()}-${name}")
}
artifact(dokkaJar)

pom {
name.set("$name")
description.set(moduleDescription)
url.set("https://github.com/atsushieno/ktmidi")
scm {
url.set("https://github.com/atsushieno/ktmidi")
}
licenses {
license {
name.set("the MIT License")
url.set("https://github.com/atsushieno/ktmidi/blob/main/LICENSE")
}
}
developers {
developer {
id.set("atsushieno")
name.set("Atsushi Eno")
email.set("atsushieno@gmail.com")
}
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}

// keep it as is. It is replaced by CI release builds
signing {}
}

59 changes: 57 additions & 2 deletions ktmidi-jvm-desktop/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,62 @@ compileTestKotlin {
kotlinOptions.jvmTarget = '11'
}

ext["moduleDescription"] = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0 - ALSA and RtMidi"
var moduleDescription = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0 - ALSA and RtMidi"
afterEvaluate {
apply { from("../publish-pom.gradle") }
publishing {
publications {
maven(MavenPublication) {
// https://github.com/gradle/gradle/issues/26091#issuecomment-1681343496
var dokkaJar = project.tasks.register("${name}DokkaJar", Jar) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka into a Javadoc jar"
archiveClassifier.set("javadoc")
from(tasks.named("dokkaHtml"))

// Each archive name should be distinct, to avoid implicit dependency issues.
// We use the same format as the sources Jar tasks.
// https://youtrack.jetbrains.com/issue/KT-46466
archiveBaseName.set("${archiveBaseName.get()}-${name}")
}
artifact(dokkaJar)

pom {
name.set("$name")
description.set(moduleDescription)
url.set("https://github.com/atsushieno/ktmidi")
scm {
url.set("https://github.com/atsushieno/ktmidi")
}
licenses {
license {
name.set("the MIT License")
url.set("https://github.com/atsushieno/ktmidi/blob/main/LICENSE")
}
}
developers {
developer {
id.set("atsushieno")
name.set("Atsushi Eno")
email.set("atsushieno@gmail.com")
}
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}

// keep it as is. It is replaced by CI release builds
signing {}
}

60 changes: 58 additions & 2 deletions ktmidi-native-ext/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,63 @@ tasks {
}
}

ext["moduleDescription"] = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0 - Native specific"
val moduleDescription = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0 - Native specific"
// copypasting
afterEvaluate {
apply { from("../publish-pom.gradle") }
publishing {
publications {
publications.withType<MavenPublication>{
// https://github.com/gradle/gradle/issues/26091#issuecomment-1681343496
val dokkaJar = project.tasks.register("${name}DokkaJar", Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka into a Javadoc jar"
archiveClassifier.set("javadoc")
from(tasks.named("dokkaHtml"))

// Each archive name should be distinct, to avoid implicit dependency issues.
// We use the same format as the sources Jar tasks.
// https://youtrack.jetbrains.com/issue/KT-46466
archiveBaseName.set("${archiveBaseName.get()}-${name}")
}
artifact(dokkaJar)

pom {
name.set("$name")
description.set(moduleDescription)
url.set("https://github.com/atsushieno/ktmidi")
scm {
url.set("https://github.com/atsushieno/ktmidi")
}
licenses {
license {
name.set("the MIT License")
url.set("https://github.com/atsushieno/ktmidi/blob/main/LICENSE")
}
}
developers {
developer {
id.set("atsushieno")
name.set("Atsushi Eno")
email.set("atsushieno@gmail.com")
}
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}

// keep it as is. It is replaced by CI release builds
signing {}
}

5 changes: 5 additions & 0 deletions ktmidi/api/android/ktmidi.api
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
public final class dev/atsushieno/ktmidi/AndroidMidi2Access : dev/atsushieno/ktmidi/AndroidMidiAccess {
public fun <init> (Landroid/content/Context;Z)V
public synthetic fun <init> (Landroid/content/Context;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
}

public class dev/atsushieno/ktmidi/AndroidMidiAccess : dev/atsushieno/ktmidi/MidiAccess {
public fun <init> (Landroid/content/Context;)V
public fun getInputs ()Ljava/lang/Iterable;
Expand Down
73 changes: 57 additions & 16 deletions ktmidi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,6 @@ kotlin {
linuxX64()
mingwX64()

/*
appleTargets.onEach {
it.compilations.getByName("main") {
cinterops {
val coremidi by creating {
defFile = File(project.projectDir, "src/appleMain/coremidi.def")
packageName("dev.atsushieno.ktmidi.coremidi")
compilerOpts("-FCoreMIDI")
}
}
}
}*/

sourceSets {
val commonMain by getting {
dependencies {
Expand Down Expand Up @@ -179,8 +166,62 @@ android {
}
}

ext["moduleDescription"] = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0"

val moduleDescription = "Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0"
// copypasting
afterEvaluate {
apply { from("../publish-pom.gradle") }
publishing {
publications {
publications.withType<MavenPublication>{
// https://github.com/gradle/gradle/issues/26091#issuecomment-1681343496
val dokkaJar = project.tasks.register("${name}DokkaJar", Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka into a Javadoc jar"
archiveClassifier.set("javadoc")
from(tasks.named("dokkaHtml"))

// Each archive name should be distinct, to avoid implicit dependency issues.
// We use the same format as the sources Jar tasks.
// https://youtrack.jetbrains.com/issue/KT-46466
archiveBaseName.set("${archiveBaseName.get()}-${name}")
}
artifact(dokkaJar)

pom {
name.set("$name")
description.set(moduleDescription)
url.set("https://github.com/atsushieno/ktmidi")
scm {
url.set("https://github.com/atsushieno/ktmidi")
}
licenses {
license {
name.set("the MIT License")
url.set("https://github.com/atsushieno/ktmidi/blob/main/LICENSE")
}
}
developers {
developer {
id.set("atsushieno")
name.set("Atsushi Eno")
email.set("atsushieno@gmail.com")
}
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}

// keep it as is. It is replaced by CI release builds
signing {}
}

0 comments on commit cc91622

Please sign in to comment.