Added maven publication, bintray, etc.
This commit is contained in:
parent
064a2967ef
commit
be620ca407
5 changed files with 290 additions and 2 deletions
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="14" />
|
<bytecodeTargetLevel target="1.8" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
|
@ -16,5 +16,10 @@
|
||||||
<option name="name" value="BintrayJCenter" />
|
<option name="name" value="BintrayJCenter" />
|
||||||
<option name="url" value="https://jcenter.bintray.com/" />
|
<option name="url" value="https://jcenter.bintray.com/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenLocal" />
|
||||||
|
<option name="name" value="MavenLocal" />
|
||||||
|
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="14" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="false" project-jdk-name="14" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
221
build.gradle.kts
221
build.gradle.kts
|
@ -1,10 +1,43 @@
|
||||||
|
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.ben-manes.versions") version "0.29.0"
|
id("com.github.ben-manes.versions") version "0.29.0"
|
||||||
|
id("com.jfrog.bintray") version "1.8.5"
|
||||||
id("io.gitlab.arturbosch.detekt") version "1.10.0"
|
id("io.gitlab.arturbosch.detekt") version "1.10.0"
|
||||||
|
id("org.jetbrains.dokka") version "0.10.1"
|
||||||
id("org.jetbrains.kotlin.jvm") version "1.3.72"
|
id("org.jetbrains.kotlin.jvm") version "1.3.72"
|
||||||
|
id("org.sonarqube") version "3.0"
|
||||||
`java-library`
|
`java-library`
|
||||||
|
`maven-publish`
|
||||||
|
jacoco
|
||||||
}
|
}
|
||||||
|
|
||||||
|
description = "Estimated Reading Time for Blog Posts, Articles, etc."
|
||||||
|
group = "net.thauvin.erik"
|
||||||
|
version = "0.9.0"
|
||||||
|
|
||||||
|
val deployDir = "deploy"
|
||||||
|
val gitHub = "ethauvin/$name"
|
||||||
|
val mavenUrl = "https://github.com/$gitHub"
|
||||||
|
val publicationName = "mavenJava"
|
||||||
|
var isRelease = "release" in gradle.startParameter.taskNames
|
||||||
|
|
||||||
|
// Load local.properties
|
||||||
|
File("local.properties").apply {
|
||||||
|
if (exists()) {
|
||||||
|
FileInputStream(this).use { fis ->
|
||||||
|
Properties().apply {
|
||||||
|
load(fis)
|
||||||
|
forEach { (k, v) ->
|
||||||
|
extra[k as String] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
@ -19,6 +52,194 @@ dependencies {
|
||||||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
|
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
detekt {
|
detekt {
|
||||||
baseline = project.rootDir.resolve("config/detekt/baseline.xml")
|
baseline = project.rootDir.resolve("config/detekt/baseline.xml")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jacoco {
|
||||||
|
toolVersion = "0.8.5"
|
||||||
|
}
|
||||||
|
|
||||||
|
sonarqube {
|
||||||
|
properties {
|
||||||
|
property("sonar.projectKey", "ethauvin_$name")
|
||||||
|
property("sonar.sourceEncoding", "UTF-8")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val sourcesJar by tasks.creating(Jar::class) {
|
||||||
|
archiveClassifier.set("sources")
|
||||||
|
from(sourceSets.getByName("main").allSource)
|
||||||
|
}
|
||||||
|
|
||||||
|
val javadocJar by tasks.creating(Jar::class) {
|
||||||
|
dependsOn(tasks.dokka)
|
||||||
|
from(tasks.dokka)
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
|
description = "Assembles a JAR of the generated Javadoc."
|
||||||
|
group = JavaBasePlugin.DOCUMENTATION_GROUP
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
withType<JacocoReport> {
|
||||||
|
reports {
|
||||||
|
xml.isEnabled = true
|
||||||
|
html.isEnabled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<KotlinCompile>().configureEach {
|
||||||
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<GenerateMavenPom> {
|
||||||
|
destination = file("$projectDir/pom.xml")
|
||||||
|
}
|
||||||
|
|
||||||
|
assemble {
|
||||||
|
dependsOn(sourcesJar, javadocJar)
|
||||||
|
}
|
||||||
|
|
||||||
|
clean {
|
||||||
|
doLast {
|
||||||
|
project.delete(fileTree(deployDir))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val copyToDeploy by registering(Copy::class) {
|
||||||
|
from(configurations.runtimeClasspath) {
|
||||||
|
exclude("annotations-*.jar")
|
||||||
|
}
|
||||||
|
from(jar)
|
||||||
|
into(deployDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
val gitIsDirty by registering(Exec::class) {
|
||||||
|
description = "Fails if git has uncommitted changes."
|
||||||
|
group = "verification"
|
||||||
|
commandLine("git", "diff", "--quiet", "--exit-code")
|
||||||
|
}
|
||||||
|
|
||||||
|
val gitTag by registering(Exec::class) {
|
||||||
|
description = "Tags the local repository with version ${project.version}"
|
||||||
|
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
||||||
|
dependsOn(gitIsDirty)
|
||||||
|
if (isRelease) {
|
||||||
|
commandLine("git", "tag", "-a", project.version, "-m", "Version ${project.version}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val bintrayUpload by existing(BintrayUploadTask::class) {
|
||||||
|
dependsOn(publishToMavenLocal, gitTag)
|
||||||
|
doFirst {
|
||||||
|
versionName = "${project.version}"
|
||||||
|
versionDesc = "${project.name} ${project.version}"
|
||||||
|
versionVcsTag = "${project.version}"
|
||||||
|
versionReleased = Date().toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
register("deploy") {
|
||||||
|
description = "Copies all needed files to the $deployDir directory."
|
||||||
|
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
||||||
|
dependsOn("build", "jar")
|
||||||
|
outputs.dir(deployDir)
|
||||||
|
inputs.files(copyToDeploy)
|
||||||
|
mustRunAfter("clean")
|
||||||
|
}
|
||||||
|
|
||||||
|
register("release") {
|
||||||
|
description = "Publishes version ${project.version} to Bintray."
|
||||||
|
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
||||||
|
dependsOn("wrapper", bintrayUpload)
|
||||||
|
}
|
||||||
|
|
||||||
|
"sonarqube" {
|
||||||
|
dependsOn("jacocoTestReport")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun findProperty(s: String) = project.findProperty(s) as String?
|
||||||
|
bintray {
|
||||||
|
user = findProperty("bintray.user")
|
||||||
|
key = findProperty("bintray.apikey")
|
||||||
|
publish = isRelease
|
||||||
|
setPublications(publicationName)
|
||||||
|
pkg.apply {
|
||||||
|
repo = "maven"
|
||||||
|
name = project.name
|
||||||
|
desc = description
|
||||||
|
websiteUrl = mavenUrl
|
||||||
|
issueTrackerUrl = "$mavenUrl/issues"
|
||||||
|
githubRepo = gitHub
|
||||||
|
githubReleaseNotesFile = "README.md"
|
||||||
|
vcsUrl = "$mavenUrl.git"
|
||||||
|
setLabels(
|
||||||
|
"articles",
|
||||||
|
"blog",
|
||||||
|
"java",
|
||||||
|
"kotlin",
|
||||||
|
"medium",
|
||||||
|
"min",
|
||||||
|
"posts",
|
||||||
|
"read",
|
||||||
|
"readingtime",
|
||||||
|
"readtime",
|
||||||
|
"weblog"
|
||||||
|
)
|
||||||
|
setLicenses("BSD 3-Clause")
|
||||||
|
publicDownloadNumbers = true
|
||||||
|
version.apply {
|
||||||
|
name = project.version as String
|
||||||
|
desc = description
|
||||||
|
vcsTag = project.version as String
|
||||||
|
gpg.apply {
|
||||||
|
sign = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>(publicationName) {
|
||||||
|
from(components["java"])
|
||||||
|
artifact(sourcesJar)
|
||||||
|
artifact(javadocJar)
|
||||||
|
pom.withXml {
|
||||||
|
asNode().apply {
|
||||||
|
appendNode("name", project.name)
|
||||||
|
appendNode("description", project.description)
|
||||||
|
appendNode("url", mavenUrl)
|
||||||
|
|
||||||
|
appendNode("licenses").appendNode("license").apply {
|
||||||
|
appendNode("name", "BSD 3-Clause")
|
||||||
|
appendNode("url", "https://opensource.org/licenses/BSD-3-Clause")
|
||||||
|
}
|
||||||
|
|
||||||
|
appendNode("developers").appendNode("developer").apply {
|
||||||
|
appendNode("id", "ethauvin")
|
||||||
|
appendNode("name", "Erik C. Thauvin")
|
||||||
|
appendNode("email", "erik@thauvin.net")
|
||||||
|
}
|
||||||
|
|
||||||
|
appendNode("scm").apply {
|
||||||
|
appendNode("connection", "scm:git:$mavenUrl.git")
|
||||||
|
appendNode("developerConnection", "scm:git:git@github.com:$gitHub.git")
|
||||||
|
appendNode("url", mavenUrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
appendNode("issueManagement").apply {
|
||||||
|
appendNode("system", "GitHub")
|
||||||
|
appendNode("url", "$mavenUrl/issues")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
62
pom.xml
Normal file
62
pom.xml
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<!-- This module was also published with a richer model, Gradle metadata, -->
|
||||||
|
<!-- which should be used instead. Do not delete the following line which -->
|
||||||
|
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
|
||||||
|
<!-- that they should prefer consuming it instead. -->
|
||||||
|
<!-- do_not_remove: published-with-gradle-metadata -->
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>net.thauvin.erik</groupId>
|
||||||
|
<artifactId>readingtime</artifactId>
|
||||||
|
<version>0.9.0</version>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-bom</artifactId>
|
||||||
|
<version>1.3.72</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||||
|
<version>1.3.72</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jsoup</groupId>
|
||||||
|
<artifactId>jsoup</artifactId>
|
||||||
|
<version>1.13.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<name>readingtime</name>
|
||||||
|
<description>Estimated Reading Time for Blog Posts, Articles, etc.</description>
|
||||||
|
<url>https://github.com/ethauvin/readingtime</url>
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>BSD 3-Clause</name>
|
||||||
|
<url>https://opensource.org/licenses/BSD-3-Clause</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<id>ethauvin</id>
|
||||||
|
<name>Erik C. Thauvin</name>
|
||||||
|
<email>erik@thauvin.net</email>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:https://github.com/ethauvin/readingtime.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:ethauvin/readingtime.git</developerConnection>
|
||||||
|
<url>https://github.com/ethauvin/readingtime</url>
|
||||||
|
</scm>
|
||||||
|
<issueManagement>
|
||||||
|
<system>GitHub</system>
|
||||||
|
<url>https://github.com/ethauvin/readingtime/issues</url>
|
||||||
|
</issueManagement>
|
||||||
|
</project>
|
Loading…
Add table
Add a link
Reference in a new issue