Skip to content

Commit

Permalink
Gradle fixes for Bintray jcenter
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek99 committed Sep 5, 2016
1 parent ca1d754 commit 3cd91e7
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ MIT License.

Use it at will, just don't sue me.

# Dependencies
## Dependencies

The only dependency is the SLF4 API (MIT License as well).

Expand Down
104 changes: 104 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,107 @@


import java.text.SimpleDateFormat
def globalVersion = new Version(version)

task wrapper(type: Wrapper) {
gradleVersion = '3.0'
}

// configures all sub-projects consistently
subprojects {
apply plugin: 'java'

version = globalVersion
status = version.status

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
mavenCentral()
jcenter()
}

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
}
}

task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// publishing artifacts to Bintray JCenter
configurations {
published
}

// upload to JCenter
artifacts {
published sourceJar
published javadocJar
}

apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven'

ext.publish = true
bintray {
// grab credentials from environment variables
user = "$System.env.BINTRAY_USER"
key = "$System.env.BINTRAY_API_KEY"

configurations = ['published', 'archives']
dryRun = false //Whether to run this as dry-run, without deploying
publish = true //If version should be auto published after an upload
pkg {
repo = 'structlog4j'
name = project.name
desc = 'Structured logging for Java on top of the SLF4jAPI'
websiteUrl = 'https://github.com/jacek99/structlog4j'
issueTrackerUrl = 'https://github.com/jacek99/structlog4j'
vcsUrl = 'https://github.com/jacek99/structlog4j'
licenses = ['MIT']
publicDownloadNumbers = true
}
}
}

class Version {
String originalVersion
String thisVersion
String status
Date buildTime

Version(String versionValue) {
buildTime = new Date()
originalVersion = versionValue
if (originalVersion.endsWith('-SNAPSHOT')) {
status = 'integration'
thisVersion = originalVersion.substring(0, originalVersion.length() - 'SNAPSHOT'.length()) + getTimestamp()
} else {
status = 'release'
thisVersion = versionValue
}
}

String getTimestamp() {
// Convert local file timestamp to UTC
def format = new SimpleDateFormat('yyyyMMddHHmmss')
format.setCalendar(Calendar.getInstance(TimeZone.getTimeZone('UTC')));
return format.format(buildTime)
}

String toString() {
thisVersion
}
}
6 changes: 0 additions & 6 deletions structlog4j-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
apply plugin: 'java'

repositories {
mavenCentral()
}

dependencies {

// Lombok is KING
Expand Down

0 comments on commit 3cd91e7

Please sign in to comment.