-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.gradle
165 lines (140 loc) · 5.06 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
plugins {
id "com.gradle.plugin-publish" version "0.15.0"
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply from: "${buildscript.sourceFile.parentFile}/scripts/javapreprocessor.gradle"
group = 'de.inetsoftware'
def LIB_GRADLE_VERSION = System.getenv('LIB_GRADLE_VERSION') ?: '8.1.0' // Gradle version for the wrapper
def buildVersion = '22' // build version
def baseVersion = '8.0' // Base Version to build, depends on gradle version.
wrapper.gradleVersion = LIB_GRADLE_VERSION
def gVersion = org.gradle.util.VersionNumber.parse( gradle.gradleVersion )
println 'Gradle version: ' + gVersion
// Fetch version from script.
apply from: "${buildscript.sourceFile.parentFile}/scripts/SetupBuilderVersion.gradle"
version = setupBuilderVersion(buildVersion)
baseVersion += '.' + buildVersion
println 'SetupBuilder version: ' + version
sourceCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
}
dependencies {
api gradleApi()
}
sourceSets {
main {
java {
srcDirs = ['src']
if ( !version.equalsIgnoreCase(baseVersion) ) {
srcDirs = ["${buildDir}/preparedSrc-${gVersion}"]
}
}
resources {
srcDirs = ['src']
exclude '**/*.java'
exclude '**/package.html'
}
}
}
/* Configure for ClearReports Version and copy files if needed */
if ( !version.equalsIgnoreCase(baseVersion) ) {
JPP.setJPPSources( "src", [
"gradleVersion" : "${gVersion}",
"outputDirectory" : "${buildDir}/preparedSrc-${gVersion}"
]);
}
if( !System.getProperty("local") && file( '../BuildScripts/base.gradle' ).exists() ) {
apply from: '../BuildScripts/base.gradle' // for internal build system
preparePublish.dependsOn 'publishPluginJavaDocsJar'
preparePublish.dependsOn 'jar'
preparePublish.dependsOn 'publishPluginJar'
println "Uploading into internal Repository"
if ( System.getProperty("snapshot") ) {
version += '-SNAPSHOT' // setting version to snapshot
}
} else {
println "Uploading into local '../repo'"
version += System.getenv('DEPLOY') != null ?'':'-SNAPSHOT' // setting version to snapshot
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
url = '../repo'
}
}
}
publish.dependsOn 'assemble'
clean.doLast {
println "Cleaning local repository folder"
file('../repo').deleteDir()
}
}
javadoc {
// Third party libs
exclude "**/image4j"
exclude "**/icns"
}
pluginBundle {
website = 'https://github.com/i-net-software/SetupBuilder'
vcsUrl = 'https://github.com/i-net-software/SetupBuilder'
description = 'The Setup Builder is a plugin for Gradle which can create native setups for different platforms like Windows, Linux and OSX. The output is a *.msi, a *.deb, a *.rpm or a *.dmg file.'
tags = ['setup', 'installer', 'msi', 'dmg', 'deb', 'rpm', 'windows', 'linux', 'osx' ]
plugins {
setupBuilderPlugin {
id = 'de.inetsoftware.setupbuilder'
displayName = 'Gradle Setup Builder plugin'
}
appBunderPlugin {
id = 'de.inetsoftware.appbundler'
displayName = 'Gradle Application Bundler plugin for OSX'
tags = ['app']
}
}
}
// see https://discuss.gradle.org/t/add-apikey-and-apisecret-to-pluginbundle-extension-for-plugin-publish-plugin/8636/3
task setupPluginUpload {
publishPlugins.dependsOn 'setupPluginUpload'
doLast {
def key=System.env.gradlePublishKey
def secret = System.env.gradlePublishSecret
if( !key || !secret)
{
throw new RuntimeException("gradlePublishKey and/or gradlePublishSecret are not defined environment variables")
}
System.properties.setProperty("gradle.publish.key", key)
System.properties.setProperty("gradle.publish.secret", secret)
}
}
// Check for the current operating system to load the specific build task
import org.apache.tools.ant.taskdefs.condition.Os
def dependingTask = 'deb'
if (Os.isFamily(Os.FAMILY_MAC)) {
dependingTask = 'dmg'
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
dependingTask = 'msi'
}
// run the following task as a dependency to the "check"-task.
task runSetupBuilderTestTasks(type: GradleBuild) {
check.dependsOn runSetupBuilderTestTasks
buildFile = 'testBuilds/setupBuilder.gradle'
tasks = ['clean', dependingTask]
}
afterEvaluate {
// The first one ususally wins.
project.tasks.withType( Copy ).all {
println "Setting Duplication Strategy in afterEvaluate: ${it}"
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}
// The first one ususally wins.
project.tasks.withType( Jar ).all {
println "Setting Duplication Strategy in afterEvaluate: ${it}"
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}
}