Skip to content

Commit

Permalink
Bintray/Jcenter publish setting
Browse files Browse the repository at this point in the history
  • Loading branch information
wanasit committed Jun 19, 2020
1 parent cc98904 commit d8847dd
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ hs_err_pid*
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle project-specific properties
gradle.properties

# Ignore Gradle build output directory
build
out
Expand Down
52 changes: 48 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,59 @@
import de.undercouch.gradle.tasks.download.Download
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
java
kotlin("jvm") version Kotlin.version apply false
`maven-publish`
kotlin("jvm") version Kotlin.version

id("de.undercouch.download") version "4.0.4"

`maven-publish`
id(Release.MavenPublish.plugin)
id(Release.Bintray.plugin) version Release.Bintray.version
}

repositories {
jcenter()
allprojects {

repositories {
jcenter()
}

// compile bytecode to java 8 (default is java 6)
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

apply {
plugin(Release.MavenPublish.plugin)
plugin(Release.Bintray.plugin)
}

version = Kotori.version
group = Kotori.groupId

bintray {
user = findProperty("BINTRAY_USER") as? String
key = findProperty("BINTRAY_KEY") as? String
setPublications(project.name)
with(pkg) {
repo = Kotori.Package.repo
name = Kotori.Package.name
desc = Kotori.Package.desc
userOrg = Kotori.Package.userOrg
websiteUrl = Kotori.Package.url
vcsUrl = Kotori.Package.url
setLicenses(Kotori.Package.licenseName)
with(version) {
name = Kotori.version
}
}
}

publishing {
publications {
// Empty publish
}
}
}

task("prepareData") {
Expand Down
24 changes: 23 additions & 1 deletion buildSrc/src/main/kotlin/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
// Library version
object Kotori {
const val groupId = "com.github.wanasit.kotori"
const val version = "0.0.1"
const val version = "0.0.3"

object Package {
const val repo = "maven"
const val name = "Kotori"
const val desc = "A Japanese tokenizer and morphological analysis engine written in Kotlin"
const val userOrg = "wanasit"
const val url = "https://github.com/wanasit/kotori"
const val scm = "[email protected]:wanasit/kotori.git"
const val licenseName = "MIT License"
}
}

object Kotlin {
const val version = "1.3.70"
object Dependencies {
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
const val reflect = "org.jetbrains.kotlin:kotlin-reflect:$version"

const val test = "org.jetbrains.kotlin:kotlin-test:$version"
const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$version"
Expand All @@ -22,6 +33,17 @@ object Kuromoji {
}


object Release {
object MavenPublish {
const val plugin = "maven-publish"
}

object Bintray {
const val version = "1.8.4"
const val plugin = "com.jfrog.bintray"
}
}

object Data {

const val SudachiDictVersion = "sudachi-dictionary-20200330"
Expand Down
7 changes: 1 addition & 6 deletions kotori-benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ plugins {
kotlin("jvm")
}

repositories {
jcenter()
maven(url="http://www.atilika.org/nexus/content/repositories/atilika")
}


dependencies {
implementation(project(":kotori"))

Expand All @@ -17,6 +11,7 @@ dependencies {
implementation("com.beust:klaxon:5.0.1")

implementation(Kotlin.Dependencies.stdlib)
implementation(Kotlin.Dependencies.reflect)

testImplementation(Kotlin.Dependencies.test)
testImplementation(Kotlin.Dependencies.testJunit)
Expand Down
14 changes: 0 additions & 14 deletions kotori-dictionary-builder/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ plugins {
kotlin("jvm")
}

repositories {
jcenter()
maven(url="http://www.atilika.org/nexus/content/repositories/atilika")
}


dependencies {
implementation(project(":kotori"))
implementation(project(":kotori-benchmark"))
Expand All @@ -19,12 +13,4 @@ dependencies {

testImplementation(Kotlin.Dependencies.test)
testImplementation(Kotlin.Dependencies.testJunit)
}

task<JavaExec>("runBenchmark") {

dependsOn(":prepareData")

main = "com.github.wanasit.kotori.benchmark.BenchmarkKt"
classpath = sourceSets["main"].runtimeClasspath
}
28 changes: 16 additions & 12 deletions kotori/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`java-library`
kotlin("jvm")
`maven-publish`
}

repositories {
jcenter()
}

// compile bytecode to java 8 (default is java 6)
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
task<Jar>("sourcesJar") {
from(sourceSets["main"].allSource)
archiveClassifier.set("sources")
}

dependencies {
Expand All @@ -25,20 +19,30 @@ dependencies {

publishing {
publications {
create<MavenPublication>(name) {
val sourcesJar by tasks
register(project.name, MavenPublication::class) {
groupId = Kotori.groupId
version = Kotori.version
artifactId = name

artifactId = project.name
from(components["java"])
artifact(sourcesJar)

pom {
name.set(project.name)
description.set(Kotori.Package.desc)
url.set(Kotori.Package.url)

licenses {
license {
name.set("MIT License")
url.set("http://www.opensource.org/licenses/mit-license.php")
}
}
scm {
url.set(Kotori.Package.url)
connection.set(Kotori.Package.scm)
developerConnection.set(Kotori.Package.scm)
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
rootProject.name = "kotori"

include("kotori")
include("kotori-benchmark")
include("kotori-dictionary-builder")

0 comments on commit d8847dd

Please sign in to comment.