-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
878 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" ?> | ||
<SmellBaseline> | ||
<ManuallySuppressedIssues> | ||
</ManuallySuppressedIssues> | ||
<CurrentIssues> | ||
</CurrentIssues> | ||
</SmellBaseline> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build documentation on commits. | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
gradle: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: zulu | ||
java-version: 17 | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Fix Permissions | ||
run: chmod +x ./gradlew | ||
|
||
- name: Build Documentation | ||
run: ./gradlew dokkaHtml | ||
|
||
- uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: build/dokka/html/ | ||
|
||
deploy: | ||
needs: gradle | ||
|
||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Copyright © 2023 Matthew M. Gast & Contributors | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Kotlin - Enum Utils | ||
|
||
![Maven Central](https://img.shields.io/maven-central/v/com.iamincendium.common/enum-utils) | ||
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.iamincendium.common/enum-utils?server=https%3A%2F%2Foss.sonatype.org) | ||
![GitHub](https://img.shields.io/github/license/incendium/enum-utils) | ||
|
||
This project is a simple utility library that helps in constructing lookup tables for enums and creating sealed class | ||
hierarchies that function similar to enums. The latter can be useful if for maintaining type safety in the event that | ||
an unknown value is received, but preserving the value is desirable over converting it to an standardized "UNKNOWN" | ||
value. | ||
|
||
### Installation | ||
|
||
Add the following to your `gradle.build` or `gradle.build.kts` file: | ||
|
||
```kotlin | ||
// build.gradle.kts | ||
dependencies { | ||
implementation("com.iamincendium.common:enum-utils:0.1.0") | ||
} | ||
``` | ||
|
||
Refer to the KDocs for more information on usage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
alias(libs.plugins.dokka) | ||
alias(libs.plugins.detekt) | ||
alias(libs.plugins.versions) | ||
|
||
`maven-publish` | ||
signing | ||
idea | ||
} | ||
|
||
// recommended to define this in ~/.gradle/gradle.properties or pass through -P | ||
val ossrhUsername: String? by project | ||
val ossrhPassword: String? by project | ||
|
||
group = "com.iamincendium.common" | ||
version = "0.1.0-SNAPSHOT" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
detekt { | ||
ignoreFailures = false | ||
|
||
config.from("${rootDir}/.detekt/config.yml") | ||
buildUponDefaultConfig = true | ||
|
||
baseline = file("${rootDir}/.detekt/baseline.xml") | ||
} | ||
|
||
idea { | ||
module { | ||
isDownloadSources = true | ||
isDownloadJavadoc = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(kotlin("reflect")) | ||
|
||
testImplementation(libs.bundles.commonTest) | ||
} | ||
|
||
tasks { | ||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
val javadocJar by registering(Jar::class) { | ||
dependsOn(dokkaHtml) | ||
archiveClassifier.set("javadoc") | ||
from(dokkaHtml.flatMap { it.outputDirectory }) | ||
} | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(17) | ||
explicitApi() | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
publishing { | ||
publications.create<MavenPublication>("enumUtils") { | ||
from(components["java"]) | ||
|
||
pom { | ||
name.set("enum-utils") | ||
description.set("A utility for working with Enums and Enum-like Sealed Interface/Classes in Kotlin.") | ||
url.set("https://github.com/incendium/enum-utils") | ||
|
||
licenses { | ||
license { | ||
name.set("ISC License") | ||
url.set("https://spdx.org/licenses/ISC.html") | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("incendium") | ||
name.set("Matthew Gast") | ||
email.set("[email protected]") | ||
} | ||
} | ||
|
||
scm { | ||
url.set("https://github.com/incendium/enum-utils") | ||
connection.set("scm:git:https://github.com/incendium/enum-utils.git") | ||
developerConnection.set("scm:git:https://github.com/incendium/enum-utils.git") | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "ossrhSnapshots" | ||
url = uri("https://oss.sonatype.org/content/repositories/snapshots/") | ||
|
||
credentials { | ||
username = ossrhUsername ?: System.getenv("OSSRH_USERNAME") | ||
password = ossrhPassword ?: System.getenv("OSSRH_PASSWORD") | ||
} | ||
} | ||
|
||
maven { | ||
name = "ossrhStaging" | ||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
|
||
credentials { | ||
username = ossrhUsername ?: System.getenv("OSSRH_USERNAME") | ||
password = ossrhPassword ?: System.getenv("OSSRH_PASSWORD") | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
if (System.getenv("SIGNING_KEY_PATH") != null) { | ||
useInMemoryPgpKeys(System.getenv("SIGNING_KEY_PATH"), System.getenv("SIGNING_KEY_PASSWORD")) | ||
} else { | ||
useGpgCmd() | ||
} | ||
publishing.publications.forEach { sign(it) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kotlin.code.style=official |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[versions] | ||
assertk = "0.28.0" | ||
gradle-plugin-detekt = "1.23.4" | ||
gradle-plugin-dokka = "1.9.10" | ||
gradle-plugin-versions = "0.45.0" | ||
junit = "5.10.1" | ||
kotest = "5.8.0" | ||
kotlin = "1.9.21" | ||
|
||
[libraries] | ||
test-assertk-jvm = { module = "com.willowtreeapps.assertk:assertk-jvm", version.ref = "assertk" } | ||
test-junit-all = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" } | ||
test-kotest-framework-engine-jvm = { module = "io.kotest:kotest-framework-engine-jvm", version.ref = "kotest" } | ||
test-kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" } | ||
|
||
[bundles] | ||
commonTest = [ | ||
"test-assertk-jvm", | ||
"test-junit-all", | ||
"test-kotest-framework-engine-jvm", | ||
"test-kotest-runner-junit5", | ||
] | ||
|
||
[plugins] | ||
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "gradle-plugin-detekt" } | ||
dokka = { id = "org.jetbrains.dokka", version.ref = "gradle-plugin-dokka" } | ||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } | ||
versions = { id = "com.github.ben-manes.versions", version.ref = "gradle-plugin-versions" } |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Thu Dec 28 09:28:53 CST 2023 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.