Skip to content

Commit

Permalink
configure maven publish for kotlin multiplatform
Browse files Browse the repository at this point in the history
upgrade to version 2.1.0-PREVIEW
  • Loading branch information
lorenzHeinrich committed Sep 5, 2024
1 parent 625c26e commit 2a33401
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 24 deletions.
35 changes: 34 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
import java.util.*

plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
kotlin("jvm") apply false
kotlin("multiplatform") apply false
}
}

subprojects {
group = "electionguard-kotlin-multiplatform"

apply(plugin = "maven-publish")
configure<PublishingExtension> {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/kastel-security/electionguard-kotlin-multiplatform")
credentials {
username = project.findLocalProperty("github.user") as String? ?: System.getenv("USERNAME")
password = project.findLocalProperty("github.key") as String? ?: System.getenv("TOKEN")
}
}
}
}
}


// looks for local.properties file and provides the property if it exists
fun Project.findLocalProperty(name: String): Any? {
val localProperties = file("${project.rootDir}/local.properties")
return if (localProperties.exists()) {
val properties = Properties()
localProperties.inputStream().use { properties.load(it) }
properties[name]
} else {
null
}
}
24 changes: 1 addition & 23 deletions egklib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ plugins {
kotlin("multiplatform")
alias(libs.plugins.serialization)
application
id("maven-publish")
id("com.adarshr.test-logger") version "4.0.0"
}

repositories {
mavenCentral()
}

group = "electionguard-kotlin-multiplatform"
version = "2.0.4-SNAPSHOT"
version = "2.1.0-PREVIEW"


kotlin {
Expand Down Expand Up @@ -136,22 +133,3 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>()
dependencies {
implementation(kotlin("stdlib-jdk8"))
}

// publish github package
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/votingworks/electionguard-kotlin-multiplatform")
credentials {
username = project.findProperty("github.user") as String? ?: System.getenv("GITHUB_USER")
password = project.findProperty("github.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
register<MavenPublication>("gpr") {
from(components["java"])
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import electionguard.ballot.EncryptedTally
import electionguard.core.productionGroup
import electionguard.publish.makeConsumer
import electionguard.tally.AccumulateTally
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertNotNull

Expand All @@ -23,6 +24,7 @@ class RunTallyAccumulationTest {
}

@Test
@Ignore // there is no proto test data
fun runTallyAccumulationTestProto() {
RunAccumulateTally.main(
arrayOf(
Expand Down

0 comments on commit 2a33401

Please sign in to comment.