Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extraction for custom process starter executable #288

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>PathWeaver</string>
<key>CFBundleExecutable</key>
<string>PathWeaver</string>
<key>CFBundleDisplayName</key>
<string>PathWeaver</string>
<key>CFBundleIdentifier</key>
<string>edu.wpi.first.tools.PathWeaver</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>2021</string>
<key>CFBundleVersion</key>
<string>2021</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ tasks.withType(Jar).configureEach {
}
}

apply from: 'procstart.gradle'

wrapper {
gradleVersion = '7.5.1'
}
68 changes: 68 additions & 0 deletions procstart.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import org.gradle.internal.os.OperatingSystem
import java.nio.file.Paths
import java.nio.file.Files
import java.nio.file.attribute.PosixFilePermission

configurations {
processstarter
}

def wpilibClassifier = wpilibTools.deps.platformMapper.wpilibClassifier
def wpilibVersion = wpilibTools.deps.wpilibVersion

dependencies {
processstarter "edu.wpi.first.tools:processstarter:$wpilibVersion:$wpilibClassifier@zip"
}

tasks.register("extractProcessStarterBinary", Sync) {
from(project.zipTree(configurations.processstarter.resolvedConfiguration.resolvedArtifacts.first().file)) {
exclude "LICENSE.md"
exclude "ThirdPartyNotices.txt"
eachFile {
def oldName = name
name = name.replace('processstarter', 'PathWeaver')
}
}
into "$buildDir/procstarter"

if (!OperatingSystem.current().isWindows()) {
doLast {
new File("$buildDir/procstarter").eachFileRecurse { def file ->
def path = Paths.get(file.absolutePath)
def perms = Files.getPosixFilePermissions(path)
perms << PosixFilePermission.OWNER_EXECUTE << PosixFilePermission.GROUP_EXECUTE << PosixFilePermission.OTHERS_EXECUTE
Files.setPosixFilePermissions(path, perms)
}
}
}
}

tasks.register("createProcessStarterBundle", Sync) {
if (OperatingSystem.current().isMacOsX()) {
from(extractProcessStarterBinary) {
into "/${rootProject.name}.app/Contents/MacOS"
}
from(project.file("Info.plist")) {
into "/${rootProject.name}.app/Contents"
}
} else {
from extractProcessStarterBinary
}

into ("$buildDir/bundle")
}

tasks.register('createProcessStarterZip', Zip) {
from createProcessStarterBundle

classifier = wpilibTools.deps.platformMapper.currentPlatform.platformName
archiveBaseName = "${rootProject.name}Launcher"
archiveVersion = ""

destinationDirectory = project.file("$buildDir/bundleZip")
}

copyAllOutputs.configure {
dependsOn createProcessStarterZip
from createProcessStarterZip
}