-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
183 lines (166 loc) · 5.03 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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}
group 'de.inetsoftware'
archivesBaseName = 'jwebassembly-api'
version = '0.4'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
// dependencies for the emulator
compileOnly 'org.ow2.asm:asm:+'
def fxVersion = getJavaFxVersion()
if( fxVersion > 8 ) { // version 8 is build into the OpenJDK
// JavaFX depends the platform and JDK version
def platform = getJavaFxPlatform()
def modules = ['javafx-base', 'javafx-controls', 'javafx-graphics', 'javafx-media', 'javafx-web' ]
for (String module : modules) {
compileOnly 'org.openjfx:' + module + ':' + fxVersion + '.+:' + platform
testImplementation 'org.openjfx:' + module + ':' + fxVersion + '.+:' + platform
}
}
testImplementation 'junit:junit:+'
testImplementation 'org.ow2.asm:asm:+'
}
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
}
resources {
srcDir 'test'
}
}
}
/**
* The String for Javafx classifier
*/
def getJavaFxPlatform() {
def osname = System.properties['os.name'].toLowerCase()
if( osname.contains( 'windows' ) ) {
return 'win'
} else if( osname.contains( 'mac' ) ) {
return 'mac'
}
return 'linux'
}
/**
* The Javafx version that is compatible with the current JDK
*/
def getJavaFxVersion() {
def fxVersion = JavaVersion.current().getMajorVersion() as int
if( fxVersion > 8 && fxVersion < 11 ) {
// There is no version 9 and 10, version 8 is build into the OpenJDK
fxVersion = 11
}
println 'fxVersion: ' + fxVersion
return fxVersion;
}
jar {
manifest {
attributes( 'Specification-Title': 'JWebAssembly-API',
'Specification-Vendor': 'i-net software',
'Specification-Version': version,
'Implementation-Title': 'JWebAssembly-API',
'Implementation-Vendor': 'i-net software',
'Implementation-Version': version,
'Premain-Class': 'de.inetsoftware.jwebassembly.emulator.PremainEmulator',
)
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.java
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
build {
dependsOn sourcesJar
dependsOn javadocJar
}
artifacts {
archives sourcesJar
archives javadocJar
}
test {
dependsOn 'jar'
jvmArgs "-javaagent:${jar.archivePath}"
testLogging {
showStandardStreams = true
showStackTraces = true
exceptionFormat = 'full'
events 'passed', 'skipped', 'failed'
}
}
/****************************************
* Deploy to Sonatype
****************************************/
publishing {
publications {
JWebAssemblyApi(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
artifactId archivesBaseName
pom {
name = 'JWebAssembly-API'
description = 'The API for using WebAssembly features in your Java classes.'
url = 'https://github.com/i-net-software/JWebAssembly-API'
developers {
developer {
id = 'Horcrux7'
name = 'Volker Berlin'
email = 'vberlin@inetsoftware.de'
organization = 'i-net software'
organizationUrl = 'https://www.inetsoftware.de'
}
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection = 'scm:git:git@github.com:i-net-software/JWebAssembly-API.git'
developerConnection = 'scm:git:git@github.com:i-net-software/JWebAssembly-API.git'
url = 'https://github.com/i-net-software/JWebAssembly-API'
}
}
}
}
repositories {
maven {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
if (project.hasProperty("ossrhUsername") ) {
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
}
signing {
if (project.hasProperty("signing.keyId") ){
sign publishing.publications.JWebAssemblyApi
// does not create sha256 and sha512 checksums
System.setProperty('org.gradle.internal.publish.checksums.insecure', 'true' )
}
}