Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change source package path from io.kixi.* to io.kixi.core.* #4

Merged
merged 3 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,22 @@ jobs:
cache: gradle

- name: Gradle Check
run: ./gradlew build check
run: ./gradlew buildAll check

release:
name: Release
needs: build
if: ${{ needs.build.result == 'success' && contains('refs/heads/master', github.ref) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11 # release should always be done with min supported JDK
cache: gradle
- name: Publish Artifacts
run: ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127 changes: 119 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,35 +1,146 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

group = "io.kixi"
version = "1.0.0-beta-4"
description = "ki-core"

plugins {
`java-library`
`maven-publish`
kotlin("jvm") version "1.9.+"
id("org.jetbrains.dokka") version "1.9.+"
signing
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
}
}

repositories { mavenCentral() }

dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("stdlib-jdk8"))
testImplementation(platform("org.junit:junit-bom:5.10.+"))
testImplementation("org.junit.jupiter:junit-jupiter")

testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.9"
languageVersion = "1.9"
jvmTarget = "${JavaVersion.VERSION_11}"
// allWarningsAsErrors = true
// Ensure that artifacts for jar, kotlinSourcesJar, and dokkaJavadocJar
// tasks all start with same text (should be lowercase)
tasks.withType<org.gradle.jvm.tasks.Jar>() {
archiveBaseName.set("ki-core")
}

// use Dokka for generating a javadoc jar
tasks.register<Jar>("dokkaHtmlJar") {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("html-docs")
}
tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}

// Allows all artifacts to be built using: "./gradlew buildAll"
tasks.register("buildAll") {
dependsOn(":jar", ":kotlinSourcesJar", ":dokkaJavadocJar")
}

// todo: publishing to maven central will require signed artifacts
//signing {
// sign(publishing.publications["mavenJava"])
//}

val sourcesJar by tasks.named("kotlinSourcesJar")
val javadocJar by tasks.named("dokkaJavadocJar")

publishing {
repositories {
maven {
if (System.getenv().containsKey("CI")) {
// todo: Rather than use GitHub Packages it would be better to publish to maven central (requires signed artifacts)
name = "GitHub-Packages"
url = uri("https://maven.pkg.github.com/kixi-io/Ki.Core-JVM/")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
} else {
val releasesRepoUrl = layout.buildDirectory.dir("repos/releases")
val snapshotsRepoUrl = layout.buildDirectory.dir("repos/snapshots")
val localReleasePath = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
url = uri(localReleasePath)
name = "local-build-dir"
}
}
}
publications {
// This section configures all the required fields that are needed when releasing to a maven repo
// see: https://docs.gradle.org/current/userguide/publishing_maven.html
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)

pom {
groupId = "${project.group}"
artifactId = "ki-core"
name = "Ki.Core"
description = "A JVM implementation of the Ki.Core library"
url = "http://kixi.io"
properties = mapOf(
"project.build.sourceEncoding" to "UTF-8",
"project.reporting.outputEncoding" to "UTF-8",
"maven.compiler.source" to JavaVersion.VERSION_11.majorVersion
)
licenses {
license {
name = "MIT License"
url = "https://raw.githubusercontent.com/kixi-io/Ki.Core-JVM/master/LICENSE"
distribution = "repo"
}
}
developers {
developer {
id = "dleuck"
name = "Daniel Leuck"
}
developer {
id = "singingbush"
name = "Samael"
}
developer {
id = "alessiostalla"
name = "Alessio Stalla"
}
}
issueManagement {
system = "Pivotal-Tracker"
url = "https://www.pivotaltracker.com/n/projects/2462351"
}
scm {
connection = "scm:git:git://github.com:kixi-io/Ki.Core-JVM.git"
developerConnection = "scm:git:ssh://github.com:kixi-io/Ki.Core-JVM.git"
url = "http://github.com/kixi-io/Ki.Core-JVM/"
}
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.kixi
package io.kixi.core

import java.math.BigDecimal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.kixi
package io.kixi.core

/**
* A Call is a [KTS](https://github.com/kixi-io/Ki.Docs/wiki/Ki-Types) type that
Expand Down Expand Up @@ -122,4 +122,4 @@ open class Call {
* @return The hash (based on the output from toString())
*/
override fun hashCode(): Int = toString().hashCode()
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.kixi
package io.kixi.core

/**
* Stringify a collection with the given separator. The default is ", ".
Expand Down Expand Up @@ -36,4 +36,4 @@ fun Array<*>.toString(separator: String = ", "): String {
if (i.hasNext()) buffer.append(separator)
}
return buffer.toString()
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.kixi
package io.kixi.core

import java.time.Duration

fun Duration.kiFormat(zeroPad:Boolean = false): String {
return Ki.formatDuration(this, zeroPad)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.kixi
package io.kixi.core

import io.kixi.text.ParseException
import io.kixi.text.escape
import io.kixi.core.text.ParseException
import io.kixi.core.text.escape
import java.lang.Math.abs
import java.math.BigDecimal
import java.time.*
Expand Down Expand Up @@ -576,4 +576,4 @@ class Ki {
return true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.kixi
package io.kixi.core

import java.time.ZoneOffset

Expand Down Expand Up @@ -116,4 +116,4 @@ class KiTZ {
"US/SST" to ZoneOffset.of("-11")
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@file:Suppress("unused")
@file:JvmName("Log")

package io.kixi
package io.kixi.core

/**
* Ki standard logging. In the future, this will provide options for writing to the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.kixi
package io.kixi.core

/**
* Stringify a map with the given separator and assignment character.
Expand All @@ -21,4 +21,4 @@ fun Map<*,*>.toString(separator: CharSequence = ", ", assignment: CharSequence =
if (i.hasNext()) buffer.append(separator)
}
return buffer.toString()
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.kixi
package io.kixi.core

import io.kixi.text.ParseException
import io.kixi.text.isKiIdentifier
import io.kixi.core.text.ParseException
import io.kixi.core.text.isKiIdentifier

/**
* NSIDs are an ID (key identifier) with an optional namespace. They are used for
Expand Down Expand Up @@ -33,4 +33,4 @@ data class NSID(val name:String, val namespace:String = "") : Comparable<NSID> {
override fun toString() = if(namespace != "") "$namespace:$name" else name

override fun compareTo(other: NSID): Int = toString().compareTo(other.toString())
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.kixi
package io.kixi.core

/**
* A Ki Range can be inclusive or exclusive on both ends, may be reversed (e.g. 5..1),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.kixi
package io.kixi.core

import java.math.BigDecimal
import kotlin.reflect.KClass
Expand All @@ -17,10 +17,10 @@ enum class Type(val kclass: KClass<*>, val supertype: Type?) {
Date(java.time.LocalDate::class, Any), LocalDateTime(java.time.LocalDateTime::class, Any),
ZonedDateTime(java.time.ZonedDateTime::class, Any),
Duration(java.time.Duration::class, Any),
Version(io.kixi.Version::class, Any),
Version(io.kixi.core.Version::class, Any),
Blob(ByteArray::class, Any),
Quantity(io.kixi.uom.Quantity::class, Any),
Range(io.kixi.Range::class, Any),
Quantity(io.kixi.core.uom.Quantity::class, Any),
Range(io.kixi.core.Range::class, Any),
List(java.util.List::class, Any), Map(java.util.Map::class, Any),

// nil
Expand Down Expand Up @@ -49,13 +49,13 @@ enum class Type(val kclass: KClass<*>, val supertype: Type?) {
is java.time.LocalDateTime -> LocalDateTime
is java.time.ZonedDateTime -> ZonedDateTime
is java.time.Duration -> Duration
is io.kixi.Version -> Version
is io.kixi.core.Version -> Version
is ByteArray -> Blob
is io.kixi.uom.Quantity<*> -> Quantity
is io.kixi.Range<*> -> Range
is io.kixi.core.uom.Quantity<*> -> Quantity
is io.kixi.core.Range<*> -> Range
is kotlin.collections.List<*> -> List
is kotlin.collections.Map<*,*> -> Map
else -> null
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.kixi
package io.kixi.core

import io.kixi.uom.*
import io.kixi.core.uom.*
import kotlin.reflect.KClass

open class TypeDef(val type:Type, val nullable:Boolean) {
Expand Down Expand Up @@ -234,4 +234,4 @@ class MapDef(nullable:Boolean, val keyDef: TypeDef, val valueDef: TypeDef) :

return true
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.kixi
package io.kixi.core

import io.kixi.text.ParseException
import io.kixi.text.countDigits
import io.kixi.core.text.ParseException
import io.kixi.core.text.countDigits
import java.lang.IllegalArgumentException

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.kixi.text
package io.kixi.core.text

/**
* A ParseException represents an problem encountered while parsing text.
Expand Down Expand Up @@ -60,4 +60,4 @@ open class ParseException : RuntimeException {
}

override fun toString() : String = message
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("unused")

package io.kixi.text
package io.kixi.core.text

import java.util.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.kixi.uom
package io.kixi.core.uom

import java.lang.RuntimeException

class IncompatibleUnitsException(from:Unit, to:Unit) :
RuntimeException("Can't convert from ${from::class.java.simpleName} to ${to::class.java.simpleName}")
RuntimeException("Can't convert from ${from::class.java.simpleName} to ${to::class.java.simpleName}")
Loading