diff --git a/README.md b/README.md index 1094aa8..a18c531 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # kotlin-math + +[![kotlin-math](https://maven-badges.herokuapp.com/maven-central/dev.romainguy/kotlin-math/badge.svg?subject=kotlin-math)](https://maven-badges.herokuapp.com/maven-central/dev.romainguy/kotlin-math) + Set of Kotlin APIs to make graphics math easier to write. These APIs are mostly modeled after GLSL (OpenGL Shading Language) to make porting code to and from shaders easier. @@ -12,6 +15,19 @@ val v = Float3(1.0f, 3.0f, 4.0f) val n = normalize(v) ``` +## Maven + +```gradle +repositories { + // ... + mavenCentral() +} + +dependencies { + implementation 'dev.romainguy:kotlin-math:1.0.0' +} +``` + ## Building the project Simply run the following command to generate `build/libs/kotlin-math.jar`: diff --git a/build.gradle b/build.gradle index 824ab33..b167ab1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,106 @@ plugins { - id "org.jetbrains.kotlin.jvm" version "1.5.31" + id 'org.jetbrains.kotlin.jvm' version '1.5.31' + id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' + id 'maven-publish' + id 'signing' } -apply plugin: 'idea' -apply plugin: 'kotlin' - repositories { mavenCentral() } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31" + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31' testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.5.31' testImplementation 'junit:junit:4.13.2' } +compileJava { + sourceCompatibility = '1.8' + targetCompatibility = '1.8' +} + sourceSets { main.kotlin.srcDirs += 'src/main/kotlin' } + +group = GROUP +version = VERSION_NAME + +java { + withJavadocJar() + withSourcesJar() +} + +// Publish and release with: +// ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository +// Both tasks must be executed in one pass +// https://github.com/gradle-nexus/publish-plugin/ +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + } + } +} + +def configurePom(pom) { + pom.name = POM_NAME + pom.packaging = POM_PACKAGING + pom.description = POM_DESCRIPTION + pom.url = POM_URL + + pom.scm { + url = POM_SCM_URL + connection = POM_SCM_CONNECTION + developerConnection = POM_SCM_DEV_CONNECTION + } + + pom.licenses { + license { + name = POM_LICENCE_NAME + url = POM_LICENCE_URL + distribution = POM_LICENCE_DIST + } + } + + pom.developers { + developer { + id = POM_DEVELOPER_ID + name = POM_DEVELOPER_NAME + } + } +} + +publishing { + repositories { + maven { + def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' + def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' + url = !VERSION_NAME.contains("SNAPSHOT") ? releasesRepoUrl : snapshotsRepoUrl + + credentials(PasswordCredentials) { + username = SONATYPE_NEXUS_USERNAME + password = SONATYPE_NEXUS_PASSWORD + } + } + } + + publications { + mavenJava(MavenPublication) { + artifactId = POM_ARTIFACT_ID + groupId = GROUP + version = VERSION_NAME + + configurePom(pom) + + from components.java + } + } +} + +signing { + sign publishing.publications.mavenJava +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..cc2dffb --- /dev/null +++ b/gradle.properties @@ -0,0 +1,20 @@ +GROUP=dev.romainguy +VERSION_NAME=1.0.0 + +POM_DESCRIPTION=Graphics oriented math library for Kotlin + +POM_NAME=Kotlin Math +POM_ARTIFACT_ID=kotlin-math +POM_PACKAGING=jar + +POM_URL=https://github.com/romainguy/kotlin-math +POM_SCM_URL=https://github.com/romainguy/kotlin-math +POM_SCM_CONNECTION=scm:git:git://github.com/romainguy/kotlin-math.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/romainguy/kotlin-math.git + +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo + +POM_DEVELOPER_ID=romainguy +POM_DEVELOPER_NAME=Romain Guy