Skip to content

Commit

Permalink
Various updates (Java 7 --> 8, Gradle Wrapper 3.1 --> 6.8.3, ...) + u…
Browse files Browse the repository at this point in the history
…se Maven Central instead of Bintray/JCenter

* Features
  * No new features
* Bugfixes
  * No bug fixes
* Changes
  * Minimum Java version 8 (instead of 7)
  * Update gradle wrapper to 6.8.2 (from 3.1)
  * Use Groovy 2.5.x in the tests (instead of 2.4.x)
  * Publish to Maven Central instead Bintray/JCenter (Bintray/JCenter will be shut down soon)
  * Simplify build setup: remove Jacoco and Coveralls
  • Loading branch information
Petikoch committed Apr 5, 2021
1 parent 5f06993 commit 854ebcb
Show file tree
Hide file tree
Showing 12 changed files with 249 additions and 308 deletions.
14 changes: 4 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
language: java

jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
- openjdk8

# https://joerglenhard.wordpress.com/2013/10/01/using-travis-ci-with-gradle-wrapper
before_install:
- chmod +x gradlew
install:
- ./gradlew build -x signArchives

env:
- TERM=dumb

after_success:
- ./gradlew jacocoTestReport coveralls
- TERM=dumb
29 changes: 10 additions & 19 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ Peti Koch
:project-name: jtrag
:github-branch: master
:github-user: Petikoch
:bintray-user: petikoch

image:http://img.shields.io/badge/license-ASF2-blue.svg["Apache License 2", link="http://www.apache.org/licenses/LICENSE-2.0.txt"]
image:http://img.shields.io/badge/download-latest-bb00bb.svg[link="https://bintray.com/{bintray-user}/maven/{project-name}/_latestVersion"]
image:http://img.shields.io/badge/download-latest-bb00bb.svg[link="https://search.maven.org/search?q=g:ch.petikoch.libs%20AND%20a:{project-name}"]
image:https://travis-ci.org/{github-user}/{project-name}.svg?branch={github-branch}["Build Status", link="https://travis-ci.org/{github-user}/{project-name}"]
image:http://img.shields.io/coveralls/{github-user}/{project-name}.svg["Coverage Status", link="https://coveralls.io/r/{github-user}/{project-name}"]

== Introduction

Expand Down Expand Up @@ -122,16 +120,16 @@ If you would like to use jtwfg single-threaded and have performance issues, let
=== Limitations of jtrag/jtwfg

* At the moment jtrag/jtwfg support only simple, synchronous dependencies in graphs.
* jtrag doesn't fully encapsulate jtwfg (1.0.0). Therefore you need to program using the jtrag *and* the https:/Petikoch/jtwfg[jtwfg] API and understand both of them.
* jtrag doesn't fully encapsulate jtwfg. Therefore you need to program using the jtrag *and* the https:/Petikoch/jtwfg[jtwfg] API and understand both of them.
* The algorithms are not yet tuned and work more or less in a "brute force" manner. Please create a github issue if you have zillions of tasks/resources and run into performance/memory issues.

== Requirements

To use the *jtrag* library you need

* Java 7 or later
* the https:/Petikoch/jtwfg[jtwfg] library
* no other libs
* Java 8 or later

There is a transitive dependency to the https:/Petikoch/jtwfg[jtwfg] library

== Installation

Expand All @@ -144,13 +142,13 @@ Add the following dependency in your gradle build file:
[source,groovy]
----
repositories {
jcenter() // Bintray's JCenter repository
mavenCentral()
}
dependencies {
compile 'ch.petikoch.libs:jtrag:x.y.z'
compile 'ch.petikoch.libs:jtrag:x.y.z' // replace x.y.z with the real version
// or "latest" release, for the braves:
// or "latest", for the braves:
//compile 'ch.petikoch.libs:jtrag:+'
}
----
Expand All @@ -164,20 +162,13 @@ Add jtrag as dependency to your pom.xml:
<dependency>
<groupId>ch.petikoch.libs</groupId>
<artifactId>jtrag</artifactId>
<version>x.y.z</version>
<!-- or latest release, for the braves
<version>x.y.z</version> <!-- replace x.y.z with the real version -->
<!-- or latest release (not snapshot), for the braves
<version>RELEASE</version>
-->
</dependency>
----

Be sure to have Bintray's JCenter repository in your maven settings.xml. If not, see "Set me up!" on the
https://bintray.com/bintray/jcenter page for instructions to set it up.

==== Just the jar

image:http://img.shields.io/badge/download-latest-bb00bb.svg[link="https://bintray.com/{bintray-user}/maven/{project-name}/_latestVersion"] The jar of the latest version

== Release notes

See https:/Petikoch/jtrag/releases.
Expand Down
193 changes: 64 additions & 129 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
plugins {
id "com.jfrog.bintray" version '1.6' // https:/bintray/gradle-bintray-plugin
id 'nu.studer.credentials' version '1.0.3' // https:/etiennestuder/gradle-credentials-plugin
id 'com.github.kt3k.coveralls' version '2.7.1' // https:/kt3k/coveralls-gradle-plugin
id 'com.github.hierynomus.license' version '0.11.0' // https:/hierynomus/license-gradle-plugin
id "com.github.ben-manes.versions" version "0.13.0"
id 'nu.studer.credentials' version '2.1' // https:/etiennestuder/gradle-credentials-plugin
id 'com.github.hierynomus.license' version '0.15.0' // https:/hierynomus/license-gradle-plugin
id "com.github.ben-manes.versions" version "0.38.0"
}

apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'jacoco'
apply plugin: 'maven'
apply plugin: 'signing'

version = '1.0.4'
group = "ch.petikoch.libs"
archivesBaseName = "jtrag"
version = '2.0.0'

ext.artifactGroupId = 'ch.petikoch.libs'
ext.description = 'A small java 7+ library (on top of jtwfg) using a "task resource assignment graph" model to detect deadlocks'
sourceCompatibility = 1.8
targetCompatibility = 1.8

sourceCompatibility = 1.7
targetCompatibility = 1.7

ext.fileEncoding = 'UTF-8'
ext["fileEncoding"] = 'UTF-8'
ext["signing.keyId"] = credentials.gpgKeyId
ext["signing.password"] = credentials.gpgKeyPassword
ext["signing.secretKeyRingFile"] = credentials.gpgKeyFile
ext["ossrhUsername"] = credentials.ossrhUsername
ext["ossrhPassword"] = credentials.ossrhPassword

repositories {
jcenter()
mavenCentral()
}

dependencies {
compile 'ch.petikoch.libs:jtwfg:1.0.4'
compile 'ch.petikoch.libs:jtwfg:2.0.0'

testCompile 'org.codehaus.groovy:groovy-all:2.4.7'
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
testCompile 'org.codehaus.groovy:groovy-all:2.5.14'
testCompile('org.spockframework:spock-core:1.3-groovy-2.5') {
exclude group: 'org.codehaus.groovy'
}
testCompile 'cglib:cglib-nodep:3.2.4' // spock mocks
testCompile 'com.google.guava:guava:20.0' // provides e.g. nice Multimap
testCompile 'cglib:cglib-nodep:3.3.0' // spock mocks
testCompile 'com.google.guava:guava:30.1.1-jre' // provides e.g. nice Multimap
}

jar {
Expand All @@ -56,13 +58,22 @@ sourceSets.test.java.srcDirs = []
sourceSets.main.groovy.srcDirs = []
sourceSets.test.groovy.srcDirs = ['src/test/groovy']

task javadocJar(type: Jar, dependsOn: classes) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives sourcesJar
archives javadocJar, sourcesJar
}

signing {
sign configurations.archives
}

tasks.withType(GroovyCompile) {
Expand All @@ -79,127 +90,51 @@ tasks.withType(Test) {
maxParallelForks = Runtime.getRuntime().availableProcessors()
}

task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
// https://central.sonatype.org/pages/gradle.html
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

def pomConfig = {
name project.name
description project.description
url 'https:/Petikoch/jtrag'
inceptionYear '2015'
repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

scm { url 'https:/Petikoch/jtrag.git' }
snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

developers {
developer {
id 'petikoch'
name 'Peti Koch'
email '[email protected]'
url 'https://www.google.com/+PetiKoch'
}
}
pom.project {
name project.archivesBaseName
packaging 'jar'
description 'A small java 8+ library (on top of jtwfg) using a "task resource assignment graph" model to detect deadlocks'
url 'https:/Petikoch/jtrag'

/* contributors {
contributor {
name 'John Doe'
}
}*/
}
scm {
connection = 'https:/Petikoch/jtrag.git'
developerConnection = 'https:/Petikoch/jtrag.git'
url = 'https:/Petikoch/jtrag'
}

publishing {
publications {
mavenCustom(MavenPublication) {
groupId project.artifactGroupId
artifactId project.name
version project.version
from components.java

pom.withXml {

asNode().children().last() + pomConfig

def licencesNode = asNode().appendNode('licenses')
def licenseNode = licencesNode.appendNode('license')
licenseNode.appendNode('name', 'The Apache Software License, Version 2.0')
licenseNode.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
licenseNode.appendNode('distribution', 'repo')

// ugly dirty hack... build up the test dependencies ourselve
// why? because maven-publish plugin creates crapy dependencies in pom.xml (gradle 2.2)
// see http://stackoverflow.com/questions/20131915/publishing-artifact-from-gradle-project-to-bintray-maven-repository
// solution: http://stackoverflow.com/questions/24743562/gradle-not-including-dependencies-in-published-pom-xml

node.remove(node.dependencies)

def dependenciesNode = node.appendNode('dependencies')
configurations.testCompile.allDependencies.each {
if (it.name != 'jtwfg') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
if (it.version == '+') {
dependencyNode.appendNode('version', 'RELEASE')
} else {
dependencyNode.appendNode('version', it.version)
}
dependencyNode.appendNode('scope', 'test')
} else {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
if (it.version == '+') {
dependencyNode.appendNode('version', 'RELEASE')
} else {
dependencyNode.appendNode('version', it.version)
}
dependencyNode.appendNode('scope', 'compile')
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

return node
}

artifact sourceJar {
classifier "sources"
developers {
developer {
id = 'petikoch'
name 'Peti Koch'
email '[email protected]'
}
}
}
}
}
}

model {
tasks.generatePomFileForMavenCustomPublication {
destination = file("$buildDir/generated_pom.xml")
}
}

bintray {
user = credentials.bintrayUserName // https:/etiennestuder/gradle-credentials-plugin
key = credentials.bintrayApiKey // https:/etiennestuder/gradle-credentials-plugin
publications = ['mavenCustom'] // see publications closure

publish true

pkg {
repo = 'maven'
name = project.name
desc = project.description // doesn't work
websiteUrl = 'https:/Petikoch/jtrag'
issueTrackerUrl = 'https:/Petikoch/jtrag/issues'
vcsUrl = 'https:/Petikoch/jtrag.git'
licenses = ['Apache-2.0']
labels = ['java']
publicDownloadNumbers = true
}
}

jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}

license {
header = rootProject.file('config/HEADER')
strictCheck = true
Expand Down
2 changes: 1 addition & 1 deletion config/HEADER
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2015 Peti Koch
Copyright 2021 Peti Koch

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sat Nov 12 15:05:16 CET 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
Loading

0 comments on commit 854ebcb

Please sign in to comment.