2018-06-30 19:36:50 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2018 dorkbox, llc
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2018-07-23 05:02:13 +02:00
|
|
|
|
|
|
|
import java.nio.file.Paths
|
2018-06-20 17:13:10 +02:00
|
|
|
import java.time.Instant
|
|
|
|
|
2018-07-23 05:02:13 +02:00
|
|
|
buildscript {
|
|
|
|
// load properties from custom location
|
|
|
|
def propsFile = Paths.get("${projectDir}/../../gradle.properties").toAbsolutePath().normalize().toFile()
|
|
|
|
println("Loading custom property data from: ${propsFile}")
|
|
|
|
|
|
|
|
def props = new Properties()
|
|
|
|
propsFile.withInputStream {props.load(it)}
|
2018-08-13 00:23:25 +02:00
|
|
|
props.each {key, val -> project.ext.set(key, val)}
|
2018-07-23 05:02:13 +02:00
|
|
|
|
2018-08-13 00:23:25 +02:00
|
|
|
// for plugin publishing and license sources
|
2018-07-23 05:02:13 +02:00
|
|
|
repositories {
|
2018-08-13 00:23:25 +02:00
|
|
|
maven {url "https://plugins.gradle.org/m2/"}
|
2018-07-23 05:02:13 +02:00
|
|
|
}
|
|
|
|
dependencies {
|
2018-08-13 00:23:25 +02:00
|
|
|
// this is the only way to also get the source code for IDE auto-complete
|
|
|
|
classpath "gradle.plugin.com.dorkbox:Licensing:1.2.2"
|
|
|
|
classpath "gradle.plugin.com.dorkbox:Licensing:1.2.2:sources"
|
2018-07-23 05:02:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:13:10 +02:00
|
|
|
plugins {
|
|
|
|
id 'java'
|
|
|
|
id 'maven-publish'
|
|
|
|
id 'signing'
|
2018-07-17 21:42:38 +02:00
|
|
|
|
2018-08-18 12:57:48 +02:00
|
|
|
// close and release on sonatype
|
|
|
|
id 'io.codearte.nexus-staging' version '0.11.0'
|
|
|
|
|
2018-08-13 00:23:25 +02:00
|
|
|
id "com.dorkbox.CrossCompile" version "1.0.1"
|
2018-08-18 12:20:35 +02:00
|
|
|
id "com.dorkbox.VersionUpdate" version "1.2"
|
2018-08-18 14:34:16 +02:00
|
|
|
|
|
|
|
// setup checking for the latest version of a plugin or dependency (and updating the gradle build)
|
|
|
|
id "se.patrikerdes.use-latest-versions" version "0.2.3"
|
|
|
|
id 'com.github.ben-manes.versions' version '0.16.0'
|
2018-06-20 17:13:10 +02:00
|
|
|
}
|
|
|
|
|
2018-08-13 00:23:25 +02:00
|
|
|
// this is the only way to also get the source code for IDE auto-complete
|
|
|
|
apply plugin: "com.dorkbox.Licensing"
|
|
|
|
|
2018-08-18 12:57:48 +02:00
|
|
|
// give us access to api/implementation differences for building java libraries
|
2018-08-18 12:10:15 +02:00
|
|
|
apply plugin: 'java-library'
|
|
|
|
|
|
|
|
|
|
|
|
// optionally let us specify which SWT to use. options are win32/mac32/linux32 and win64/mac64/linux64
|
|
|
|
// this is needed when building the SWT test example for a different OS combinations
|
|
|
|
//ext.swt = 'win64'
|
|
|
|
apply from: '../Utilities/scripts/gradle/swt.gradle'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
project.description = 'Cross-platform SystemTray support for Swing/AWT, GtkStatusIcon, and AppIndicator on Java 6+'
|
|
|
|
project.group = 'com.dorkbox'
|
2018-08-18 14:35:32 +02:00
|
|
|
project.version = '3.15'
|
2018-08-18 12:10:15 +02:00
|
|
|
|
|
|
|
project.ext.name = 'SystemTray'
|
|
|
|
project.ext.url = 'https://git.dorkbox.com/dorkbox/SystemTray'
|
|
|
|
|
|
|
|
|
|
|
|
sourceCompatibility = 1.6
|
|
|
|
targetCompatibility = 1.6
|
|
|
|
|
|
|
|
|
|
|
|
licensing {
|
|
|
|
license(License.APACHE_2) {
|
|
|
|
author 'dorkbox, llc'
|
|
|
|
url project.ext.url
|
|
|
|
note project.description
|
|
|
|
}
|
|
|
|
|
|
|
|
license('Dorkbox Utils', License.APACHE_2) {
|
|
|
|
author 'dorkbox, llc'
|
|
|
|
url 'https://git.dorkbox.com/dorkbox/Utilities'
|
|
|
|
}
|
|
|
|
|
|
|
|
license('JNA', License.APACHE_2) {
|
|
|
|
copyright 2011
|
|
|
|
author 'Timothy Wall'
|
|
|
|
url 'https://github.com/twall/jna'
|
|
|
|
}
|
|
|
|
|
|
|
|
license('Lantern', License.APACHE_2) {
|
|
|
|
copyright 2010
|
|
|
|
author 'Brave New Software Project, Inc.'
|
|
|
|
url 'https://github.com/getlantern/lantern'
|
|
|
|
}
|
|
|
|
|
|
|
|
license('QZTray', License.APACHE_2) {
|
|
|
|
copyright 2016
|
|
|
|
author 'Tres Finocchiaro, QZ Industries, LLC'
|
|
|
|
url 'https://github.com/tresf/tray/blob/dorkbox/src/qz/utils/ShellUtilities.java'
|
|
|
|
note 'Partial code released as Apache 2.0 for use in the SystemTray project by dorkbox, llc. Used with permission.'
|
|
|
|
}
|
|
|
|
|
|
|
|
license('SLF4J', License.MIT) {
|
|
|
|
copyright 2008
|
|
|
|
author 'QOS.ch'
|
|
|
|
url 'http://www.slf4j.org'
|
|
|
|
}
|
|
|
|
}
|
2018-06-20 17:13:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
static String[] javaFile(String... fileNames) {
|
|
|
|
def fileList = [] as ArrayList
|
|
|
|
|
|
|
|
for (name in fileNames) {
|
|
|
|
def fixed = name.replace('.', '/') + '.java'
|
|
|
|
fileList.add(fixed)
|
|
|
|
}
|
|
|
|
|
|
|
|
return fileList
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
swtExampleJar
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java {
|
|
|
|
setSrcDirs Collections.singletonList('src')
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
setSrcDirs Collections.singletonList('src')
|
|
|
|
include 'dorkbox/systemTray/gnomeShell/extension.js',
|
|
|
|
'dorkbox/systemTray/util/error_32.png'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
|
|
|
java {
|
|
|
|
setSrcDirs Collections.singletonList('test')
|
|
|
|
|
|
|
|
// this is required because we reset the srcDirs to 'test' above, and 'main' must manually be added back
|
|
|
|
srcDir main.java
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
setSrcDirs Collections.singletonList('test')
|
|
|
|
include 'dorkbox/*.png'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
swingExample {
|
|
|
|
java {
|
|
|
|
setSrcDirs Collections.singletonList('test')
|
|
|
|
include javaFile('dorkbox.TestTray',
|
2018-06-20 17:29:09 +02:00
|
|
|
'dorkbox.CustomSwingUI')
|
2018-06-20 17:13:10 +02:00
|
|
|
srcDir main.java
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
setSrcDirs Collections.singletonList('test')
|
|
|
|
include 'dorkbox/*.png'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
javaFxExample {
|
|
|
|
java {
|
|
|
|
setSrcDirs Collections.singletonList('test')
|
|
|
|
include javaFile('dorkbox.TestTray',
|
2018-06-20 17:29:09 +02:00
|
|
|
'dorkbox.TestTrayJavaFX',
|
|
|
|
'dorkbox.CustomSwingUI')
|
2018-06-20 17:13:10 +02:00
|
|
|
srcDir main.java
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
setSrcDirs Collections.singletonList('test')
|
|
|
|
include 'dorkbox/*.png'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
swtExample {
|
|
|
|
java {
|
|
|
|
setSrcDirs Collections.singletonList('test')
|
|
|
|
include javaFile('dorkbox.TestTray',
|
2018-06-20 17:29:09 +02:00
|
|
|
'dorkbox.TestTraySwt',
|
|
|
|
'dorkbox.CustomSwingUI')
|
2018-06-20 17:13:10 +02:00
|
|
|
srcDir main.java
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
setSrcDirs Collections.singletonList('test')
|
|
|
|
include 'dorkbox/*.png'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenLocal() // this must be first!
|
|
|
|
|
|
|
|
maven {
|
|
|
|
// because the eclipse release of SWT is abandoned on maven, this MAVEN repo has newer version of SWT,
|
|
|
|
url 'http://maven-eclipse.github.io/maven'
|
|
|
|
}
|
2018-06-30 19:36:50 +02:00
|
|
|
jcenter()
|
2018-06-20 17:13:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dependencies {
|
2018-08-18 12:10:15 +02:00
|
|
|
implementation(project('Utilities')) {
|
2018-06-20 17:13:10 +02:00
|
|
|
// don't include any of the project dependencies for anything
|
|
|
|
transitive = false
|
|
|
|
}
|
|
|
|
|
|
|
|
// our main dependencies are ALSO the same as the limited utilities (they are not automatically pulled in from other sourceSets)
|
|
|
|
// needed by the utilities (custom since we don't want to include everything). IntelliJ includes everything, but our builds do not
|
2018-08-13 00:23:25 +02:00
|
|
|
|
2018-08-18 14:35:32 +02:00
|
|
|
api 'com.dorkbox:ShellExecutor:1.1'
|
2018-08-13 00:23:25 +02:00
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
api 'org.javassist:javassist:3.23.0-GA'
|
2018-08-18 14:17:30 +02:00
|
|
|
api 'net.java.dev.jna:jna:4.5.2'
|
|
|
|
api 'net.java.dev.jna:jna-platform:4.5.2'
|
2018-08-18 12:10:15 +02:00
|
|
|
api 'org.slf4j:slf4j-api:1.7.25'
|
2018-06-20 17:13:10 +02:00
|
|
|
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
def log = implementation 'ch.qos.logback:logback-classic:1.1.6'
|
2018-06-20 17:13:10 +02:00
|
|
|
|
|
|
|
// because the eclipse release of SWT is abandoned on maven, this repo has a newer version of SWT,
|
|
|
|
// http://maven-eclipse.github.io/maven
|
|
|
|
// 4.4 is the oldest version that works with us. We use reflection to access SWT, so we can compile the project without needing SWT
|
2018-08-18 12:10:15 +02:00
|
|
|
def swtDep = swtExampleJar "org.eclipse.swt:org.eclipse.swt.${swtWindowingLibrary}.${swtPlatform}.${swtArch}:4.4+"
|
|
|
|
|
|
|
|
testCompileOnly swtDep
|
2018-06-20 17:13:10 +02:00
|
|
|
|
|
|
|
// JavaFX isn't always added to the compile classpath....
|
2018-06-30 19:36:50 +02:00
|
|
|
testImplementation files("${System.getProperty('java.home', '.')}/lib/ext/jfxrt.jar")
|
2018-06-20 17:13:10 +02:00
|
|
|
|
|
|
|
// dependencies for our test examples
|
2018-08-18 12:10:15 +02:00
|
|
|
swingExampleImplementation configurations.implementation, log
|
|
|
|
javaFxExampleImplementation configurations.implementation, log
|
|
|
|
swtExampleImplementation configurations.implementation, log, swtDep
|
2018-06-20 17:13:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
project('Utilities') {
|
|
|
|
tasks.withType(Test) {
|
|
|
|
// want to remove utilities project from unit tests. It's unnecessary to run unit tests for the entire Utilities project
|
|
|
|
exclude('**/*')
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
options.encoding = 'UTF-8'
|
|
|
|
options.incremental = true
|
|
|
|
|
|
|
|
// setup compile options. we specifically want to suppress usage of "Unsafe"
|
|
|
|
options.compilerArgs = ['-XDignore.symbol.file', '-Xlint:deprecation']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
////// Task defaults
|
|
|
|
///////////////////////////////
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
options.encoding = 'UTF-8'
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(Jar) {
|
|
|
|
duplicatesStrategy DuplicatesStrategy.FAIL
|
|
|
|
|
|
|
|
manifest {
|
|
|
|
attributes['Implementation-Version'] = version
|
|
|
|
attributes['Build-Date'] = Instant.now().toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
////// UTILITIES COMPILE (for inclusion into jars)
|
|
|
|
///////////////////////////////
|
|
|
|
task compileUtils(type: JavaCompile) {
|
|
|
|
// we don't want the default include of **/*.java
|
|
|
|
getIncludes().clear()
|
|
|
|
|
|
|
|
source = Collections.singletonList('../Utilities/src')
|
|
|
|
include javaFile('dorkbox.util.SwingUtil',
|
2018-06-20 17:29:09 +02:00
|
|
|
'dorkbox.util.OS',
|
|
|
|
'dorkbox.util.OSUtil',
|
|
|
|
'dorkbox.util.OSType',
|
|
|
|
'dorkbox.util.ImageResizeUtil',
|
|
|
|
'dorkbox.util.ImageUtil',
|
|
|
|
'dorkbox.util.CacheUtil',
|
|
|
|
'dorkbox.util.IO',
|
|
|
|
'dorkbox.util.JavaFX',
|
|
|
|
'dorkbox.util.Property',
|
|
|
|
'dorkbox.util.Keep',
|
|
|
|
'dorkbox.util.FontUtil',
|
|
|
|
'dorkbox.util.ScreenUtil',
|
|
|
|
'dorkbox.util.ClassLoaderUtil',
|
|
|
|
'dorkbox.util.Swt',
|
|
|
|
'dorkbox.util.NamedThreadFactory',
|
|
|
|
'dorkbox.util.ActionHandlerLong',
|
|
|
|
'dorkbox.util.FileUtil',
|
|
|
|
'dorkbox.util.MathUtil',
|
|
|
|
'dorkbox.util.LocationResolver',
|
|
|
|
'dorkbox.util.Desktop')
|
2018-06-20 17:13:10 +02:00
|
|
|
|
|
|
|
// entire packages/directories
|
|
|
|
include('dorkbox/util/jna/**/*.java')
|
|
|
|
include('dorkbox/util/windows/**/*.java')
|
|
|
|
include('dorkbox/util/swing/**/*.java')
|
|
|
|
|
|
|
|
classpath = sourceSets.main.compileClasspath
|
|
|
|
destinationDir = file("$rootDir/build/classes_utilities")
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
////// Tasks to launch examples from gradle
|
|
|
|
///////////////////////////////
|
|
|
|
task swingExample(type: JavaExec) {
|
|
|
|
classpath sourceSets.swingExample.runtimeClasspath
|
2018-08-18 14:17:30 +02:00
|
|
|
|
|
|
|
group = 'examples'
|
2018-06-20 17:13:10 +02:00
|
|
|
main = 'dorkbox.TestTray'
|
|
|
|
standardInput = System.in
|
|
|
|
}
|
|
|
|
|
|
|
|
task javaFxExample(type: JavaExec) {
|
|
|
|
classpath sourceSets.javaFxExample.runtimeClasspath
|
2018-08-18 14:17:30 +02:00
|
|
|
|
|
|
|
group = 'examples'
|
2018-06-20 17:13:10 +02:00
|
|
|
main = 'dorkbox.TestTrayJavaFX'
|
|
|
|
standardInput = System.in
|
|
|
|
}
|
|
|
|
|
|
|
|
task swtExample(type: JavaExec) {
|
|
|
|
classpath sourceSets.swtExample.runtimeClasspath
|
|
|
|
|
2018-08-18 14:17:30 +02:00
|
|
|
group = 'examples'
|
2018-06-20 17:13:10 +02:00
|
|
|
main = 'dorkbox.TestTraySwt'
|
|
|
|
standardInput = System.in
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
////// Jar Tasks
|
|
|
|
///////////////////////////////
|
|
|
|
jar {
|
|
|
|
dependsOn compileUtils
|
|
|
|
|
|
|
|
// include applicable class files from subset of Utilities project
|
|
|
|
from compileUtils.destinationDir
|
|
|
|
}
|
|
|
|
|
|
|
|
task jarSwingExample(type: Jar) {
|
|
|
|
dependsOn jar
|
|
|
|
|
|
|
|
baseName = 'SystemTray-SwingExample'
|
|
|
|
group = BasePlugin.BUILD_GROUP
|
|
|
|
description = 'Create an all-in-one example for testing, using Swing'
|
|
|
|
|
|
|
|
from sourceSets.swingExample.output.classesDirs
|
|
|
|
from sourceSets.swingExample.output.resourcesDir
|
|
|
|
|
|
|
|
// include applicable class files from subset of Utilities project
|
|
|
|
from compileUtils.destinationDir
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
// add all of the main project jars as a fat-jar for all examples, exclude the Utilities.jar contents
|
|
|
|
from configurations.runtimeClasspath
|
|
|
|
.findAll {it.name.endsWith('jar') && it.name != 'Utilities.jar'}
|
|
|
|
.collect {zipTree(it)}
|
|
|
|
|
2018-06-20 17:13:10 +02:00
|
|
|
manifest {
|
|
|
|
attributes['Main-Class'] = 'dorkbox.TestTray'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
task jarJavaFxExample(type: Jar) {
|
|
|
|
dependsOn jar
|
|
|
|
|
|
|
|
baseName = 'SystemTray-JavaFxExample'
|
|
|
|
group = BasePlugin.BUILD_GROUP
|
|
|
|
description = 'Create an all-in-one example for testing, using JavaFX'
|
|
|
|
|
|
|
|
from sourceSets.javaFxExample.output.classesDirs
|
|
|
|
from sourceSets.javaFxExample.output.resourcesDir
|
|
|
|
|
|
|
|
// include applicable class files from subset of Utilities project
|
|
|
|
from compileUtils.destinationDir
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
// add all of the main project jars as a fat-jar for all examples, exclude the Utilities.jar contents
|
|
|
|
from configurations.runtimeClasspath
|
|
|
|
.findAll {it.name.endsWith('jar') && it.name != 'Utilities.jar'}
|
|
|
|
.collect {zipTree(it)}
|
|
|
|
|
2018-06-20 17:13:10 +02:00
|
|
|
manifest {
|
|
|
|
attributes['Main-Class'] = 'dorkbox.TestTrayJavaFX'
|
|
|
|
attributes['Class-Path'] = "${System.getProperty('java.home', '.')}/lib/ext/jfxrt.jar"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task jarSwtExample(type: Jar) {
|
|
|
|
dependsOn jar
|
|
|
|
|
|
|
|
baseName = 'SystemTray-SwtExample'
|
|
|
|
group = BasePlugin.BUILD_GROUP
|
|
|
|
description = 'Create an all-in-one example for testing, using SWT'
|
|
|
|
|
|
|
|
from sourceSets.swtExample.output.classesDirs
|
|
|
|
from sourceSets.swtExample.output.resourcesDir
|
|
|
|
|
|
|
|
// include applicable class files from subset of Utilities project
|
|
|
|
from compileUtils.destinationDir
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
// include SWT
|
|
|
|
from configurations.swtExampleJar
|
|
|
|
.collect {zipTree(it)}
|
|
|
|
|
|
|
|
// add all of the main project jars as a fat-jar for all examples, exclude the Utilities.jar contents
|
|
|
|
from configurations.runtimeClasspath
|
|
|
|
.findAll {it.name.endsWith('jar') && it.name != 'Utilities.jar'}
|
|
|
|
.collect {zipTree(it)}
|
|
|
|
|
2018-06-20 17:13:10 +02:00
|
|
|
manifest {
|
|
|
|
attributes['Main-Class'] = 'dorkbox.TestTraySwt'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
task jarAllExamples {
|
|
|
|
dependsOn jarSwingExample
|
|
|
|
dependsOn jarJavaFxExample
|
|
|
|
dependsOn jarSwtExample
|
|
|
|
|
|
|
|
group = BasePlugin.BUILD_GROUP
|
|
|
|
description = 'Create all-in-one examples for testing, using Swing, JavaFX, and SWT'
|
|
|
|
}
|
|
|
|
|
2018-08-13 00:23:25 +02:00
|
|
|
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
/////////////////////////////
|
|
|
|
//// Maven Publishing + Release
|
|
|
|
/////////////////////////////
|
2018-06-20 17:13:10 +02:00
|
|
|
task sourceJar(type: Jar) {
|
|
|
|
description = "Creates a JAR that contains the source code."
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
from sourceSets.main.java
|
2018-06-20 17:13:10 +02:00
|
|
|
from compileUtils.source
|
|
|
|
|
|
|
|
classifier = "sources"
|
|
|
|
}
|
|
|
|
|
|
|
|
task javaDocJar(type: Jar) {
|
|
|
|
description = "Creates a JAR that contains the javadocs."
|
|
|
|
|
|
|
|
classifier = "javadoc"
|
|
|
|
}
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
// for testing, we don't publish to maven central, but only to local maven
|
2018-06-20 17:13:10 +02:00
|
|
|
publishing {
|
|
|
|
publications {
|
2018-08-18 17:03:20 +02:00
|
|
|
maven(MavenPublication) {
|
2018-06-20 17:13:10 +02:00
|
|
|
from components.java
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
artifact(javaDocJar)
|
|
|
|
artifact(sourceJar)
|
|
|
|
|
|
|
|
groupId project.group
|
|
|
|
artifactId project.ext.name
|
|
|
|
version project.version
|
|
|
|
|
2018-06-20 17:13:10 +02:00
|
|
|
pom {
|
|
|
|
withXml {
|
2018-08-18 12:10:15 +02:00
|
|
|
// eliminate logback and utilities (no need in maven POMs)
|
2018-07-17 21:42:38 +02:00
|
|
|
def root = asNode()
|
|
|
|
|
|
|
|
root.dependencies.'*'.findAll() {
|
2018-08-18 12:10:15 +02:00
|
|
|
it.artifactId.text() == "logback-classic" || it.artifactId.text() == "Utilities"
|
2018-07-17 21:42:38 +02:00
|
|
|
}.each() {
|
|
|
|
it.parent().remove(it)
|
2018-06-20 17:13:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
name = project.ext.name
|
|
|
|
url = project.ext.url
|
|
|
|
description = project.description
|
2018-06-20 17:13:10 +02:00
|
|
|
|
|
|
|
issueManagement {
|
2018-08-18 12:10:15 +02:00
|
|
|
url = "${project.ext.url}/issues".toString()
|
2018-06-20 17:13:10 +02:00
|
|
|
system = 'Gitea Issues'
|
|
|
|
}
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
organization {
|
|
|
|
name = 'dorkbox, llc'
|
|
|
|
url = 'https://dorkbox.com'
|
|
|
|
}
|
2018-06-20 17:13:10 +02:00
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
name = 'dorkbox, llc'
|
|
|
|
email = 'email@dorkbox.com'
|
|
|
|
}
|
|
|
|
}
|
2018-06-20 17:13:10 +02:00
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
scm {
|
|
|
|
url = project.ext.url
|
|
|
|
connection = "scm:${project.ext.url}.git".toString()
|
|
|
|
}
|
2018-06-20 17:13:10 +02:00
|
|
|
}
|
2018-08-18 12:10:15 +02:00
|
|
|
}
|
|
|
|
}
|
2018-06-20 17:13:10 +02:00
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
|
|
|
credentials {
|
|
|
|
username sonatypeUsername
|
|
|
|
password sonatypePassword
|
|
|
|
}
|
2018-06-20 17:13:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-18 14:35:32 +02:00
|
|
|
nexusStaging {
|
|
|
|
username sonatypeUsername
|
|
|
|
password sonatypePassword
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:13:10 +02:00
|
|
|
signing {
|
2018-08-18 12:10:15 +02:00
|
|
|
required {hasProperty('sonatypeUsername')}
|
2018-08-18 17:03:20 +02:00
|
|
|
sign publishing.publications.maven
|
2018-06-20 17:13:10 +02:00
|
|
|
}
|
|
|
|
|
2018-08-18 15:17:19 +02:00
|
|
|
// output the release URL in the console
|
|
|
|
releaseRepository.doLast {
|
|
|
|
def URL = 'https://oss.sonatype.org/content/repositories/releases/'
|
|
|
|
def projectName = project.group.toString().replaceAll('\\.', '/')
|
|
|
|
def name = project.ext.name
|
|
|
|
def version = project.version
|
|
|
|
|
|
|
|
println("Maven URL: ${URL}${projectName}/${name}/${version}/")
|
|
|
|
}
|
|
|
|
|
2018-08-18 12:10:15 +02:00
|
|
|
// we don't use maven with the plugin (it's uploaded separately to gradle plugins)
|
|
|
|
tasks.withType(PublishToMavenRepository) {
|
|
|
|
onlyIf {
|
2018-08-18 17:03:20 +02:00
|
|
|
repository == publishing.repositories.maven && publication == publishing.publications.maven
|
2018-08-18 12:10:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
tasks.withType(PublishToMavenLocal) {
|
|
|
|
onlyIf {
|
2018-08-18 17:03:20 +02:00
|
|
|
publication == publishing.publications.maven
|
2018-08-18 12:10:15 +02:00
|
|
|
}
|
|
|
|
}
|