forked from fvarrui/JavaPackager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
234 lines (198 loc) · 7.7 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
plugins {
id 'java'
id 'maven'
id 'maven-publish'
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.12.0'
id 'io.codearte.nexus-staging' version '0.21.2'
id 'eclipse'
id 'de.undercouch.download' version '4.1.1'
}
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
gradlePlugin {
plugins {
javaPackagerPlugin {
id = 'io.github.fvarrui.javapackager.plugin'
implementationClass = 'io.github.fvarrui.javapackager.gradle.PackagePlugin'
}
}
}
pluginBundle {
website = 'http://github.com/fvarrui/JavaPackager'
vcsUrl = 'http://github.com/fvarrui/JavaPackager.git'
description = 'Packages Java applications as native Windows, Mac OS X or GNU/Linux executables and creates installers for them'
tags = ['java', 'packager', 'gradle-plugin', 'maven-plugin', 'native', 'installer', 'debian-packages', 'rpm-packages', 'dmg', 'maven', 'gradle', 'distribution', 'javapackager', 'linux-executables', 'deb', 'rpm', 'native-windows', 'java-applications', 'pkg', 'msi']
plugins {
javaPackagerPlugin {
displayName = 'JavaPackager'
}
}
}
configurations {
mavenEmbedder
}
dependencies {
implementation 'org.apache.maven:maven-plugin-api:3.6.0'
implementation 'org.codehaus.plexus:plexus-utils:3.1.1'
implementation 'org.twdata.maven:mojo-executor:2.3.0'
implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.commons:commons-lang3:3.9'
implementation 'org.apache.commons:commons-collections4:4.1'
implementation 'org.apache.commons:commons-compress:1.21'
implementation 'org.apache.velocity:velocity-engine-core:2.0'
implementation 'org.vafer:jdeb:1.9'
implementation 'net.jsign:jsign-core:3.1'
implementation 'org.redline-rpm:redline:1.2.10'
implementation 'io.github.fvarrui:launch4j:2.5.2'
testImplementation 'junit:junit:4.12'
compileOnly 'org.apache.maven.plugin-tools:maven-plugin-annotations:3.6.0'
mavenEmbedder 'org.apache.maven:maven-embedder:3.6.0'
mavenEmbedder 'org.apache.maven:maven-compat:3.6.0'
mavenEmbedder 'org.slf4j:slf4j-simple:1.7.30'
mavenEmbedder 'org.eclipse.aether:aether-connector-basic:1.1.0'
mavenEmbedder 'org.eclipse.aether:aether-transport-wagon:1.1.0'
mavenEmbedder 'org.apache.maven.wagon:wagon-http:3.4.1'
mavenEmbedder 'org.apache.maven.wagon:wagon-provider-api:3.4.1'
}
group = 'io.github.fvarrui'
version = '1.6.6'
description = 'Hybrid Maven/Gradle plugin to package Java applications as native Windows, Mac OS X or GNU/Linux executables and create installers for them'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.encoding = 'UTF-8'
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
}
}
}
install.repositories.mavenInstaller.pom.with {
groupId = project.group
artifactId = project.name
version = project.version
description = project.description
packaging = 'maven-plugin'
}
build.dependsOn ':winrun4j-launcher:build'
// runs the plugin description generator
task generatePluginDescriptor(type: JavaExec, dependsOn: compileJava) {
def pomFile = file("$buildDir/pom.xml")
def pluginDescriptorFile = new File(project.compileJava.destinationDir, 'META-INF/maven/plugin.xml')
def directory = buildDir.canonicalPath
def outputDirectory = compileJava.destinationDir.canonicalPath
// FIXME: this does not seem to be working
inputs.files project.compileJava.outputs.files
outputs.file pluginDescriptorFile
classpath = configurations.mavenEmbedder
main = 'org.apache.maven.cli.MavenCli'
systemProperties['maven.multiModuleProjectDirectory'] = projectDir
args = [
'--errors',
'--batch-mode',
'--file', "${buildDir}/pom.xml",
'org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor',
'-Dproject.build.sourceEncoding=' + compileJava.options.encoding
]
doFirst {
install.repositories
.mavenInstaller
.pom
.withXml {
asNode().appendNode('repositories').appendNode('repository')
.with {
appendNode('id', 'gradle')
appendNode('name', 'Gradle Plugin Portal')
appendNode('url', 'https://plugins.gradle.org/m2/')
}
asNode().appendNode('build')
.with {
appendNode('directory', directory)
appendNode('outputDirectory', outputDirectory)
}
}
.writeTo(pomFile)
assert pomFile.file, "${pomFile.canonicalPath}: was not generated"
logger.info("POM is generated in ${pomFile.canonicalPath}")
}
doLast {
assert pluginDescriptorFile.file, "${pluginDescriptorFile.canonicalPath}: was not generated"
logger.info("Plugin descriptor is generated in ${pluginDescriptorFile.canonicalPath}")
}
}
project.jar.dependsOn(generatePluginDescriptor)
publishToMavenLocal.dependsOn(build)
if (project.hasProperty('release')) {
apply plugin: 'signing'
apply plugin: 'maven'
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
// Signature of artifacts
signing {
sign configurations.archives
}
// OSSRH publication
uploadArchives {
repositories {
mavenDeployer {
// POM signature
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// Target repository
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUser, password: ossrhPassword)
}
pom.project {
name project.name
description project.description
packaging = 'maven-plugin'
url 'https://github.com/fvarrui/JavaPackager'
scm {
connection 'scm:git:git://github.com/fvarrui/JavaPackager.git'
developerConnection 'scm:git:[email protected]:fvarrui/fvarrui.git'
url 'https://github.com/fvarrui/JavaPackager'
}
licenses {
license {
name 'GPL-v3.0'
url 'http://www.gnu.org/licenses/gpl-3.0.txt'
distribution 'repo'
}
}
developers {
developer {
id = 'fvarrui'
name = 'Francisco Vargas Ruiz'
url = 'https://github.com/fvarrui'
}
}
}
}
}
}
}
nexusStaging {
username = project.findProperty('ossrhUser') ?: ''
password = project.findProperty('ossrhPassword') ?: ''
}
task updateUniversalJavaApplicationStub(type: Download) {
group 'Update'
description 'Downloads universalJavaApplicationStub to src/main/resources/mac and overrides the existing one.'
src 'https://raw.githubusercontent.com/fvarrui/universalJavaApplicationStub/master/src/universalJavaApplicationStub'
dest file('src/main/resources/mac')
overwrite true
}