Skip to content

Commit e980861

Browse files
committed
Add pulication support
1 parent e9e9b8d commit e980861

File tree

3 files changed

+126
-5
lines changed

3 files changed

+126
-5
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# kotlin-math
2+
3+
[![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)
4+
25
Set of Kotlin APIs to make graphics math easier to write. These APIs are mostly
36
modeled after GLSL (OpenGL Shading Language) to make porting code to and from
47
shaders easier.
@@ -12,6 +15,19 @@ val v = Float3(1.0f, 3.0f, 4.0f)
1215
val n = normalize(v)
1316
```
1417

18+
## Maven
19+
20+
```gradle
21+
repositories {
22+
// ...
23+
mavenCentral()
24+
}
25+
26+
dependencies {
27+
implementation 'dev.romainguy:kotlin-math:1.0.0'
28+
}
29+
```
30+
1531
## Building the project
1632

1733
Simply run the following command to generate `build/libs/kotlin-math.jar`:

build.gradle

Lines changed: 90 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,106 @@
11
plugins {
2-
id "org.jetbrains.kotlin.jvm" version "1.5.31"
2+
id 'org.jetbrains.kotlin.jvm' version '1.5.31'
3+
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
4+
id 'maven-publish'
5+
id 'signing'
36
}
47

5-
apply plugin: 'idea'
6-
apply plugin: 'kotlin'
7-
88
repositories {
99
mavenCentral()
1010
}
1111

1212
dependencies {
13-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31"
13+
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31'
1414

1515
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.5.31'
1616
testImplementation 'junit:junit:4.13.2'
1717
}
1818

19+
compileJava {
20+
sourceCompatibility = '1.8'
21+
targetCompatibility = '1.8'
22+
}
23+
1924
sourceSets {
2025
main.kotlin.srcDirs += 'src/main/kotlin'
2126
}
27+
28+
group = GROUP
29+
version = VERSION_NAME
30+
31+
java {
32+
withJavadocJar()
33+
withSourcesJar()
34+
}
35+
36+
// Publish and release with:
37+
// ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
38+
// Both tasks must be executed in one pass
39+
// https://github.com/gradle-nexus/publish-plugin/
40+
nexusPublishing {
41+
repositories {
42+
sonatype {
43+
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
44+
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
45+
}
46+
}
47+
}
48+
49+
def configurePom(pom) {
50+
pom.name = POM_NAME
51+
pom.packaging = POM_PACKAGING
52+
pom.description = POM_DESCRIPTION
53+
pom.url = POM_URL
54+
55+
pom.scm {
56+
url = POM_SCM_URL
57+
connection = POM_SCM_CONNECTION
58+
developerConnection = POM_SCM_DEV_CONNECTION
59+
}
60+
61+
pom.licenses {
62+
license {
63+
name = POM_LICENCE_NAME
64+
url = POM_LICENCE_URL
65+
distribution = POM_LICENCE_DIST
66+
}
67+
}
68+
69+
pom.developers {
70+
developer {
71+
id = POM_DEVELOPER_ID
72+
name = POM_DEVELOPER_NAME
73+
}
74+
}
75+
}
76+
77+
publishing {
78+
repositories {
79+
maven {
80+
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
81+
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
82+
url = !VERSION_NAME.contains("SNAPSHOT") ? releasesRepoUrl : snapshotsRepoUrl
83+
84+
credentials(PasswordCredentials) {
85+
username = SONATYPE_NEXUS_USERNAME
86+
password = SONATYPE_NEXUS_PASSWORD
87+
}
88+
}
89+
}
90+
91+
publications {
92+
mavenJava(MavenPublication) {
93+
artifactId = POM_ARTIFACT_ID
94+
groupId = GROUP
95+
version = VERSION_NAME
96+
97+
configurePom(pom)
98+
99+
from components.java
100+
}
101+
}
102+
}
103+
104+
signing {
105+
sign publishing.publications.mavenJava
106+
}

gradle.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
GROUP=dev.romainguy
2+
VERSION_NAME=1.0.0
3+
4+
POM_DESCRIPTION=Graphics oriented math library for Kotlin
5+
6+
POM_NAME=Kotlin Math
7+
POM_ARTIFACT_ID=kotlin-math
8+
POM_PACKAGING=jar
9+
10+
POM_URL=https://github.com/romainguy/kotlin-math
11+
POM_SCM_URL=https://github.com/romainguy/kotlin-math
12+
POM_SCM_CONNECTION=scm:git:git://github.com/romainguy/kotlin-math.git
13+
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/romainguy/kotlin-math.git
14+
15+
POM_LICENCE_NAME=The Apache Software License, Version 2.0
16+
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
17+
POM_LICENCE_DIST=repo
18+
19+
POM_DEVELOPER_ID=romainguy
20+
POM_DEVELOPER_NAME=Romain Guy

0 commit comments

Comments
 (0)