Skip to content

Commit

Permalink
Add pulication support
Browse files Browse the repository at this point in the history
  • Loading branch information
romainguy committed Nov 13, 2021
1 parent e9e9b8d commit e980861
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 5 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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`:
Expand Down
95 changes: 90 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
20 changes: 20 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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://[email protected]/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

0 comments on commit e980861

Please sign in to comment.