-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
105 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
apply plugin: 'java' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
|
||
// Lombok is KING | ||
|