build.gradle
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlinLangVersion = '1.6'
ext.dokkaVersion = '1.4.30'
ext.junitVersion = '4.13'
ext.licensePluginVersion = '0.15.0'
ext.jmhPlugin = '0.5.3'
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version "$kotlin_version"
id 'org.jetbrains.dokka' version "$dokkaVersion"
id 'com.github.hierynomus.license' version "$licensePluginVersion"
id "me.champeau.gradle.jmh" version "$jmhPlugin"
}
wrapper {
gradleVersion = '6.9.1'
}
group 'com.github.penemue'
version = hasProperty('keapVersion') ? project.keapVersion : '0.3.0-SNAPSHOT'
def isSnapshot = version.endsWith('SNAPSHOT')
def mavenPublishUrl = hasProperty('mavenPublishUrl') ? project.mavenPublishUrl : ''
def mavenPublishUsername = hasProperty('mavenPublishUsername') ? project.mavenPublishUsername : ''
def mavenPublishPassword = hasProperty('mavenPublishPassword') ? project.mavenPublishPassword : ''
def signingKeyId = hasProperty('signingKeyId') ? project.signingKeyId : ''
def signingPassword = hasProperty('signingPassword') ? project.signingPassword : ''
def signingSecretKeyRingFile = hasProperty('signingSecretKeyRingFile') ? project.signingSecretKeyRingFile : ''
defaultTasks 'clean', 'build'
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'maven'
apply plugin: 'signing'
license {
header rootProject.file('copyright.ftl')
strictCheck true
ext.inceptionYear = 2016
ext.year = Calendar.getInstance().get(Calendar.YEAR)
ext.owner = 'Vyacheslav Lukianov'
ext.ownerURL = 'https://github.com/penemue'
include "**/*.kt"
include "**/*.java"
mapping {
kt = 'JAVADOC_STYLE'
}
}
repositories {
mavenCentral()
// necessary for dokka 1.4.30
maven {
url "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven"
}
}
test {
// uncomment the following line in order to test mergeSort instead of timSort
//jvmArgs = ['-Djava.util.Arrays.useLegacyMergeSort=true']
testLogging.showStandardStreams = true
}
jmh {
jmhVersion = '1.21'
jvmArgsPrepend = ['-Xmx1g', '-Xms1g']
duplicateClassesStrategy = 'warn'
forceGC = true
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: "$junitVersion"
}
compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
languageVersion = "$kotlinLangVersion"
apiVersion = "$kotlinLangVersion"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = '1.8'
languageVersion = "$kotlinLangVersion"
apiVersion = "$kotlinLangVersion"
}
}
dokkaJavadoc {
dokkaSourceSets {
configureEach {
reportUndocumented.set(false)
}
}
}
jar {
manifest {
attributes 'Implementation-Title': project.name, 'Implementation-Version': version
}
}
task sourceJar(type: Jar) {
classifier = 'sources'
from project.sourceSets.main.kotlin
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
classifier = 'javadoc'
from dokkaJavadoc.outputDirectory
}
artifacts {
archives jar, javadocJar, sourceJar
}
if (!isSnapshot) {
ext.'signing.keyId' = signingKeyId
ext.'signing.password' = signingPassword
ext.'signing.secretKeyRingFile' = signingSecretKeyRingFile
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: mavenPublishUrl) {
authentication(userName: mavenPublishUsername, password: mavenPublishPassword)
}
pom.project {
name 'Keap'
description 'Keap is a heap data structure presenting stable PriorityQueue and stable Keapsort sorting algorithm'
packaging 'jar'
url 'https://github.com/penemue/keap'
scm {
url 'https://github.com/penemue/keap'
connection 'scm:git:https://github.com/penemue/keap.git'
developerConnection 'scm:git:https://github.com/penemue/keap.git'
}
inceptionYear '2016'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'penemue'
name 'Vyacheslav Lukianov'
}
}
}
}
}
}
signing {
required { !isSnapshot && gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}
}