blob: 925fa96476c9d69e272f5e9b99f20c8daa669fe7 [file] [log] [blame]
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001apply plugin: 'maven-publish'
2
3def baseArtifactId = 'processstarter'
4def artifactGroupId = 'edu.wpi.first.tools'
5def zipBaseName = '_GROUP_edu_wpi_first_tools_ID_processstarter_CLS'
6
7def outputsFolder = file("$project.buildDir/outputs")
8
9model {
10 tasks {
11 // Create the run task.
12 $.components.processstarter.binaries.each { bin ->
13 if (bin.buildable && bin.name.toLowerCase().contains("debug") && nativeUtils.isNativeDesktopPlatform(bin.targetPlatform)) {
14 Task run = project.tasks.create("run", Exec) {
15 commandLine bin.tasks.install.runScriptFile.get().asFile.toString()
16 }
17 run.dependsOn bin.tasks.install
18 }
19 }
20 }
21 publishing {
22 def processstarterTaskList = []
23 $.components.each { component ->
24 component.binaries.each { binary ->
25 if (binary in NativeExecutableBinarySpec && binary.component.name.contains("processstarter")) {
26 if (binary.buildable && (binary.name.contains('Release') || binary.name.contains('release'))) {
27 // We are now in the binary that we want.
28 // This is the default application path for the ZIP task.
29 def applicationPath = binary.executable.file
30
31 // Create the ZIP.
32 def task = project.tasks.create("copyprocessstarterExecutable" + binary.targetPlatform.architecture.name, Zip) {
33 description("Copies the processstarter executable to the outputs directory.")
34 destinationDirectory = outputsFolder
35
36 archiveBaseName = '_M_' + zipBaseName
37 duplicatesStrategy = 'exclude'
38 archiveClassifier = nativeUtils.getPublishClassifier(binary)
39
40 from(licenseFile) {
41 into '/'
42 }
43
44 from(applicationPath)
45 }
46
47 task.dependsOn binary.tasks.link
48 processstarterTaskList.add(task)
49 project.build.dependsOn task
50 project.artifacts { task }
51 addTaskToCopyAllOutputs(task)
52 }
53 }
54 }
55 }
56
57 publications {
58 processstarter(MavenPublication) {
59 processstarterTaskList.each { artifact it }
60
61 artifactId = baseArtifactId
62 groupId = artifactGroupId
63 version wpilibVersioning.version.get()
64 }
65 }
66 }
67}