-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.gradle
221 lines (184 loc) · 6.32 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
//gradle build file for Beads
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:6.0.0'
}
}
repositories {
mavenCentral()
maven { url "https://clojars.org/repo" }
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'signing'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version="4.1" // Add '-SNAPSHOT' at the end for non-release uploads
group='net.beadsproject'
archivesBaseName = "beads"
sourceSets {
main {
java {
srcDirs = ['src/beads_main/java', 'src/beads_io/java']
}
}
}
dependencies {
//implementation fileTree(dir: 'libs', include: '*.jar') // - Thin Jar
//compile fileTree(dir: 'libs', include: '*.jar') // - Fat Jar
implementation 'javazoom:jlayer:1.0.1'
implementation 'com.googlecode.soundlibs:mp3spi:1.9.5.4'
implementation 'org.clojars.automata:tritonus-aos:1.0.0'
implementation 'org.clojars.automata:tritonus-share:1.0.0'
implementation 'org.jaudiolibs:audioservers-javasound:2.0.0'
implementation 'org.jaudiolibs:audioservers-jack:2.0.0'
implementation 'org.jaudiolibs:jnajack:1.4.0'
}
shadowJar {
baseName = 'beads'
classifier = null
version = null
}
javadoc {
failOnError(false)
}
//Add javadocs and sourceJars as artifact
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
// Import ShadowJar plugin and create custom shadowJar task
// to flatten package structure for Processing
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
task flattenShadowJar (type: ShadowJar, dependsOn: 'shadowJar') {
from sourceSets.main.output
configurations = [project.configurations.runtime]
classifier = 'flat'
version = null
relocate 'org.jaudiolibs.beads', 'beads'
//Flatten hierarchical structure, starting from leaves
relocate 'net.beadsproject.beads.analysis.featureextractors', 'beads'
relocate 'net.beadsproject.beads.analysis.segmenters', 'beads'
relocate 'net.beadsproject.beads.analysis', 'beads'
relocate 'net.beadsproject.beads.core.io', 'beads'
relocate 'net.beadsproject.beads.core', 'beads'
relocate 'net.beadsproject.beads.data.audiofile', 'beads'
relocate 'net.beadsproject.beads.data.buffers', 'beads'
relocate 'net.beadsproject.beads.data', 'beads'
relocate 'net.beadsproject.beads.events', 'beads'
relocate 'net.beadsproject.beads.ugens', 'beads'
}
task generateProcessingLibrary(dependsOn: ['javadoc','flattenShadowJar']) {
doLast {
copy {
from("${buildDir}/docs/javadoc")
into("${buildDir}/processing/beads/reference")
}
copy {
from("packages/Processing/examples")
into("${buildDir}/processing/beads/examples")
}
copy {
from("src")
into("${buildDir}/processing/beads/src")
}
// Transfer flat .jar to Processing folder
copy {
from("${buildDir}/libs/beads-flat.jar")
into("${buildDir}/processing/beads/library")
rename('beads-flat.jar', 'beads.jar')
}
// Copy all dependencies over to Processing
copy {
from configurations.compileClasspath
into("${buildDir}/libs")
}
copy {
from configurations.compileClasspath
into("${buildDir}/processing/beads/library")
}
copy {
from("packages/Processing/library.properties")
into("${buildDir}/processing/beads")
}
}
task zipProcessingLibrary(type: Zip, dependsOn: 'generateProcessingLibrary') {
from("${buildDir}/processing/")
exclude("*.DS_Store")
archiveName("beads.zip")
destinationDir(file("${buildDir}"))
}
// Delete leftover original flat .jar file, as only Processing will need it
task deleteTemporaryFiles(type: Delete, dependsOn: 'generateProcessingLibrary') {
delete("${buildDir}/libs/beads-flat.jar")
}
}
task deployJarAndJavaDocToHappyBrackets (dependsOn: ['javadoc', 'shadowJar']) {
copy {
from 'build/docs/javadoc/net/beadsproject'
into '../HappyBrackets/HappyBrackets/libs/docs/net/beadsproject'
}
copy {
from 'build/libs/'
into '../HappyBrackets/HappyBrackets/libs'
}
println "copied jars"
}
// Add POM metadata to artifact for Central Maven upload
// NOTE: You will need a gradle.properties file with the following:
// - signing.keyId=pubkey ID, signing.password=privkey passphrase, signing.secretKeyRingFile= /path/to/SecretKeyringFile.gpg
// - ossrhUsername=user, ossrhPassword=pass
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'Beads'
packaging 'jar'
// optionally artifactId can be defined here
description 'A software library written in Java for realtime audio.'
url 'http://www.beadsproject.net'
scm {
connection 'scm:git:git://github.com/orsjb/beads.git'
developerConnection 'scm:git:[email protected]:orsjb/beads.git'
url 'https://github.com/orsjb/beads/'
}
licenses {
license {
name 'GNU General Public License, Version 3'
url 'https://www.gnu.org/licenses/gpl-3.0.txt'
}
}
developers {
developer {
id 'orsjb'
name 'Ollie Bown'
email '[email protected]'
}
}
}
}
}
}
task deploy(dependsOn: ['zipProcessingLibrary', 'deleteTemporaryFiles'])
task fullDeploy(dependsOn: ['zipProcessingLibrary', 'deleteTemporaryFiles', 'uploadArchives'])