@@ -13,14 +13,7 @@ plugins{
13
13
}
14
14
15
15
group = rootProject.group
16
- tasks.withType<JavaExec > {
17
- systemProperty(" processing.version" , version)
18
- systemProperty(" processing.revision" , " 1300" )
19
- systemProperty(" processing.contributions.source" , " https://contributions-preview.processing.org/contribs.txt" )
20
- systemProperty(" processing.download.page" , " https://processing.org/download/" )
21
- systemProperty(" processing.download.latest" , " https://processing.org/download/latest.txt" )
22
- }
23
-
16
+ version = rootProject.version
24
17
25
18
repositories{
26
19
mavenCentral()
@@ -43,17 +36,25 @@ compose.desktop {
43
36
application {
44
37
mainClass = " processing.app.ui.Start"
45
38
39
+ jvmArgs(* listOf (
40
+ Pair (" processing.version" , version),
41
+ Pair (" processing.revision" , " 1300" ),
42
+ Pair (" processing.contributions.source" , " https://contributions-preview.processing.org/contribs.txt" ),
43
+ Pair (" processing.download.page" , " https://processing.org/download/" ),
44
+ Pair (" processing.download.latest" , " https://processing.org/download/latest.txt" ),
45
+ Pair (" processing.tutorials" , " https://processing.org/tutorials/" ),
46
+ ).map { " -D${it.first} =${it.second} " }.toTypedArray())
47
+
46
48
nativeDistributions{
47
- modules(" jdk.jdi" , " java.compiler" )
49
+ modules(" jdk.jdi" , " java.compiler" , " jdk.accessibility " )
48
50
targetFormats(TargetFormat .Dmg , TargetFormat .Msi , TargetFormat .Deb )
49
51
packageName = " Processing"
50
- packageVersion = rootProject.version.toString()
51
52
52
53
macOS{
53
54
bundleID = " org.processing.app"
54
55
iconFile = project.file(" ../build/macos/processing.icns" )
55
56
infoPlist{
56
- extraKeysRawXml = plistStrings
57
+ extraKeysRawXml = layout.projectDirectory.file( " info.plist " ).asFile.readText()
57
58
}
58
59
entitlementsFile.set(project.file(" entitlements.plist" ))
59
60
runtimeEntitlementsFile.set(project.file(" entitlements.plist" ))
@@ -69,9 +70,12 @@ compose.desktop {
69
70
iconFile = project.file(" ../build/linux/processing.png" )
70
71
// Fix fonts on some Linux distributions
71
72
jvmArgs(" -Dawt.useSystemAAFontSettings=on" )
72
- }
73
73
74
- appResourcesRootDir.set(layout.buildDirectory.dir(" resources-bundled" ))
74
+ fileAssociation(" pde" , " Processing Source Code" , " application/x-processing" )
75
+ fileAssociation(" pyde" , " Processing Python Source Code" , " application/x-processing" )
76
+ fileAssociation(" pdez" , " Processing Sketch Bundle" , " application/x-processing" )
77
+ fileAssociation(" pdex" , " Processing Contribution Bundle" , " application/x-processing" )
78
+ }
75
79
}
76
80
}
77
81
}
@@ -97,34 +101,38 @@ dependencies {
97
101
implementation(libs.kaml)
98
102
}
99
103
104
+ tasks.compileJava{
105
+ options.encoding = " UTF-8"
106
+ }
107
+
108
+
100
109
// LEGACY TASKS
101
110
// Most of these are shims to be compatible with the old build system
102
111
// They should be removed in the future, as we work towards making things more Gradle-native
103
- tasks.register<Copy >(" copyCore" ){
104
- val project = project(" :core" )
105
- dependsOn(project.tasks.jar)
106
- from(project.layout.buildDirectory.dir(" libs" ))
107
- from(project.configurations.runtimeClasspath)
108
- into(layout.buildDirectory.dir(" resources-bundled/common/core/library" ))
112
+ val composeResources = { subPath: String -> layout.buildDirectory.dir(" resources-bundled/common/$subPath " ) }
113
+ compose.desktop.application.nativeDistributions.appResourcesRootDir.set(composeResources(" ../" ))
114
+
115
+ tasks.register<Copy >(" includeCore" ){
116
+ val core = project(" :core" )
117
+ dependsOn(core.tasks.jar)
118
+ from(core.layout.buildDirectory.dir(" libs" ))
119
+ from(core.configurations.runtimeClasspath)
120
+ into(composeResources(" core/library" ))
109
121
}
110
- tasks.register<Copy >(" copyJava " ) {
111
- val project = project(" :java" )
112
- dependsOn(project .tasks.jar)
113
- from(project .layout.buildDirectory.dir(" libs" ))
114
- from(project .configurations.runtimeClasspath)
115
- into(layout.buildDirectory.dir( " resources-bundled/common/ modes/java/mode" ))
122
+ tasks.register<Copy >(" includeJavaMode " ) {
123
+ val java = project(" :java" )
124
+ dependsOn(java .tasks.jar)
125
+ from(java .layout.buildDirectory.dir(" libs" ))
126
+ from(java .configurations.runtimeClasspath)
127
+ into(composeResources( " modes/java/mode" ))
116
128
duplicatesStrategy = DuplicatesStrategy .EXCLUDE
117
129
}
118
- tasks.register<Download >(" downloadJDK" ) {
119
- val os: OperatingSystem = DefaultNativePlatform .getCurrentOperatingSystem()
120
- val arch: String = System .getProperty(" os.arch" ).let { originalArch ->
121
- when (originalArch) {
122
- " amd64" -> " x64"
123
- " x86_64" -> " x64"
124
- else -> originalArch
125
- }
130
+ tasks.register<Download >(" includeJdk" ) {
131
+ val os = DefaultNativePlatform .getCurrentOperatingSystem()
132
+ val arch = when (System .getProperty(" os.arch" )) {
133
+ " amd64" , " x86_64" -> " x64"
134
+ else -> System .getProperty(" os.arch" )
126
135
}
127
-
128
136
val platform = when {
129
137
os.isWindows -> " windows"
130
138
os.isMacOsX -> " mac"
@@ -142,73 +150,65 @@ tasks.register<Download>("downloadJDK") {
142
150
" hotspot/normal/eclipse?project=jdk" )
143
151
144
152
val extension = if (os.isWindows) " zip" else " tar.gz"
145
- dest(layout.buildDirectory.file(" jdk-$platform -$arch .$extension " ))
153
+ val jdk = layout.buildDirectory.file(" tmp/jdk-$platform -$arch .$extension " )
154
+ dest(jdk)
146
155
overwrite(false )
147
- }
148
- tasks.register<Copy >(" unzipJDK" ) {
149
- val dl = tasks.findByPath(" downloadJDK" ) as Download
150
- dependsOn(dl)
151
-
152
- val os = DefaultNativePlatform .getCurrentOperatingSystem()
153
- val archive = if (os.isWindows) {
154
- zipTree(dl.dest)
155
- } else {
156
- tarTree(dl.dest)
156
+ doLast {
157
+ copy {
158
+ val archive = if (os.isWindows) { zipTree(jdk) } else { tarTree(jdk) }
159
+ from(archive){ eachFile{ permissions{ unix(" 755" ) } } }
160
+ into(composeResources(" " ))
161
+ }
157
162
}
158
-
159
- from(archive){ eachFile{ permissions{ unix(" 755" ) } } }
160
- into(layout.buildDirectory.dir(" resources-bundled/common" ))
161
163
}
162
- tasks.register<Copy >(" copyShared " ){
164
+ tasks.register<Copy >(" includeSharedAssets " ){
163
165
from(" ../build/shared/" )
164
- into(layout.buildDirectory.dir( " resources-bundled/common " ))
166
+ into(composeResources( " " ))
165
167
}
166
- tasks.register<Download >(" downloadProcessingExamples" ) {
168
+ tasks.register<Download >(" includeProcessingExamples" ) {
169
+ val examples = layout.buildDirectory.file(" tmp/processing-examples.zip" )
167
170
src(" https://github.com/processing/processing-examples/archive/refs/heads/main.zip" )
168
- dest(layout.buildDirectory.file( " tmp/processing- examples.zip " ) )
171
+ dest(examples)
169
172
overwrite(false )
170
- }
171
- tasks.register<Copy >(" unzipExamples" ) {
172
- val dl = tasks.findByPath(" downloadProcessingExamples" ) as Download
173
- dependsOn(dl)
174
- from(zipTree(dl.dest)){ // remove top level directory
175
- exclude(" processing-examples-main/README.md" )
176
- exclude(" processing-examples-main/.github/**" )
177
- eachFile { relativePath = RelativePath (true , * relativePath.segments.drop(1 ).toTypedArray()) }
178
- includeEmptyDirs = false
173
+ doLast{
174
+ copy{
175
+ from(zipTree(examples)){ // remove top level directory
176
+ exclude(" processing-examples-main/README.md" )
177
+ exclude(" processing-examples-main/.github/**" )
178
+ eachFile { relativePath = RelativePath (true , * relativePath.segments.drop(1 ).toTypedArray()) }
179
+ includeEmptyDirs = false
180
+ }
181
+ into(composeResources(" /modes/java/examples" ))
182
+ }
179
183
}
180
- into(layout.buildDirectory.dir(" resources-bundled/common/modes/java/examples" ))
181
184
}
182
- tasks.register<Download >(" downloadProcessingWebsiteExamples" ) {
185
+ tasks.register<Download >(" includeProcessingWebsiteExamples" ) {
186
+ val examples = layout.buildDirectory.file(" tmp/processing-website.zip" )
183
187
src(" https://github.com/processing/processing-website/archive/refs/heads/main.zip" )
184
- dest(layout.buildDirectory.file( " tmp/processing-website.zip " ) )
188
+ dest(examples )
185
189
overwrite(false )
186
- }
187
- tasks.register<Copy >(" unzipWebsiteExamples" ) {
188
- val dl = tasks.findByPath(" downloadProcessingWebsiteExamples" ) as Download
189
- dependsOn(dl)
190
- dependsOn(" unzipExamples" )
191
- print (dl.dest)
192
- from(zipTree(dl.dest)){
193
- include(" processing-website-main/content/examples/**" )
194
- eachFile { relativePath = RelativePath (true , * relativePath.segments.drop(3 ).toTypedArray()) }
195
- includeEmptyDirs = false
196
- exclude {
197
- it.name.contains(" .es." ) || it.name == " liveSketch.js"
190
+ doLast{
191
+ copy{
192
+ from(zipTree(examples)){
193
+ include(" processing-website-main/content/examples/**" )
194
+ eachFile { relativePath = RelativePath (true , * relativePath.segments.drop(3 ).toTypedArray()) }
195
+ includeEmptyDirs = false
196
+ exclude { it.name.contains(" .es." ) || it.name == " liveSketch.js" }
197
+ }
198
+ into(composeResources(" modes/java/examples" ))
198
199
}
199
200
}
200
- into(layout.buildDirectory.dir(" resources-bundled/common/modes/java/examples" ))
201
201
}
202
- tasks.register<Copy >(" copyJavaMode " ) {
203
- dependsOn( " unzipExamples " , " unzipWebsiteExamples " )
204
- dependsOn(project( " : java" ) .tasks.named(" extraResources" ))
205
- from(project( " : java" ) .layout.buildDirectory.dir(" resources-bundled" ))
206
- into(layout.buildDirectory.dir( " resources-bundled " ))
202
+ tasks.register<Copy >(" includeJavaModeResources " ) {
203
+ val java = project( " :java " )
204
+ dependsOn(java.tasks.named(" extraResources" ))
205
+ from(java.layout.buildDirectory.dir(" resources-bundled" ))
206
+ into(composeResources( " ../ " ))
207
207
}
208
208
tasks.register<Copy >(" renameWindres" ) {
209
- dependsOn(" copyJavaMode " , " copyShared " , " unzipJDK " )
210
- val dir = layout.buildDirectory.dir( " resources-bundled/common/ modes/java/application/launch4j/bin/" )
211
- val os: OperatingSystem = DefaultNativePlatform .getCurrentOperatingSystem()
209
+ dependsOn(" includeSharedAssets " , " includeJavaModeResources " )
210
+ val dir = composeResources( " modes/java/application/launch4j/bin/" )
211
+ val os = DefaultNativePlatform .getCurrentOperatingSystem()
212
212
val platform = when {
213
213
os.isWindows -> " windows"
214
214
os.isMacOsX -> " macos"
@@ -222,7 +222,18 @@ tasks.register<Copy>("renameWindres") {
222
222
into(dir)
223
223
}
224
224
afterEvaluate {
225
- tasks.findByName(" prepareAppResources" )?.dependsOn(" unzipJDK" ," copyShared" , " copyCore" , " copyJava" , " unzipExamples" ," renameWindres" , " copyJavaMode" )
225
+ tasks.named(" prepareAppResources" ).configure {
226
+ dependsOn(
227
+ " includeCore" ,
228
+ " includeJavaMode" ,
229
+ " includeJdk" ,
230
+ " includeSharedAssets" ,
231
+ " includeProcessingExamples" ,
232
+ " includeProcessingWebsiteExamples" ,
233
+ " includeJavaModeResources" ,
234
+ " renameWindres"
235
+ )
236
+ }
226
237
tasks.register(" setExecutablePermissions" ) {
227
238
description = " Sets executable permissions on binaries in Processing.app resources"
228
239
group = " compose desktop"
@@ -243,82 +254,4 @@ afterEvaluate {
243
254
}
244
255
}
245
256
tasks.findByName(" createDistributable" )?.finalizedBy(" setExecutablePermissions" )
246
- }
247
-
248
- val plistStrings: String
249
- get() = """
250
- <key>CFBundleURLTypes</key>
251
- <array>
252
- <dict>
253
- <key>CFBundleURLName</key>
254
- <string>org.processing.app</string>
255
- <key>CFBundleURLSchemes</key>
256
- <array>
257
- <string>pde</string>
258
- </array>
259
- </dict>
260
- </array>
261
- <key>CFBundleDocumentTypes</key>
262
- <array>
263
- <dict>
264
- <key>CFBundleTypeExtensions</key>
265
- <array>
266
- <string>pde</string>
267
- </array>
268
- <key>LSTypeIsPackage</key>
269
- <false/>
270
- <key>CFBundleTypeIconFile</key>
271
- <string>macos/pde.icns</string>
272
- <key>CFBundleTypeName</key>
273
- <string>Processing Source Code</string>
274
- <key>CFBundleTypeRole</key>
275
- <string>Editor</string>
276
- </dict>
277
- <dict>
278
- <key>CFBundleTypeExtensions</key>
279
- <array>
280
- <string>pyde</string>
281
- </array>
282
- <key>LSTypeIsPackage</key>
283
- <false/>
284
- <key>CFBundleTypeIconFile</key>
285
- <string>macos/pde.icns</string>
286
- <key>CFBundleTypeName</key>
287
- <string>Processing Python Source Code</string>
288
- <key>CFBundleTypeRole</key>
289
- <string>Editor</string>
290
- </dict>
291
- <dict>
292
- <key>CFBundleTypeExtensions</key>
293
- <array>
294
- <string>pdez</string>
295
- </array>
296
- <key>LSTypeIsPackage</key>
297
- <false/>
298
- <key>CFBundleTypeIconFile</key>
299
- <string>macos/pdez.icns</string>
300
- <key>CFBundleTypeName</key>
301
- <string>Processing Sketch Bundle</string>
302
- <key>CFBundleTypeRole</key>
303
- <string>Editor</string>
304
- </dict>
305
- <dict>
306
- <key>CFBundleTypeExtensions</key>
307
- <array>
308
- <string>pdex</string>
309
- </array>
310
- <key>LSTypeIsPackage</key>
311
- <false/>
312
- <key>CFBundleTypeIconFile</key>
313
- <string>macos/pdex.icns</string>
314
- <key>CFBundleTypeName</key>
315
- <string>Processing Contribution Bundle</string>
316
- <key>CFBundleTypeRole</key>
317
- <string>Viewer</string>
318
- </dict>
319
- </array>
320
- <key>NSCameraUsageDescription</key>
321
- <string>The sketch you're running needs access to your video camera.</string>
322
- <key>NSMicrophoneUsageDescription</key>
323
- <string>The sketch you're running needs access to your microphone.</string>
324
- """
257
+ }
0 commit comments