[hal] Add initial SystemServer support (#7463)

This commit is contained in:
Thad House
2024-12-01 04:31:26 +00:00
committed by GitHub
parent 82132c3272
commit c51f65bd4f
39 changed files with 1658 additions and 83 deletions

View File

@@ -64,30 +64,22 @@ def simProjects = ['halsim_gui']
deploy {
targets {
roborio(RemoteTarget) {
directory = '/home/lvuser'
systemcore(RemoteTarget) {
directory = '/home/systemcore'
maxChannels = 4
locations {
ssh(SshDeployLocation) {
address = "172.22.11.2"
user = 'admin'
password = ''
address = "robot.local"
user = 'systemcore'
password = 'systemcorerules2027'
ipv6 = false
}
}
def remote = it
artifacts.registerFactory(WPIJREArtifact) {
return objects.newInstance(WPIJREArtifact, it, remote)
}
artifacts {
all {
predeploy << { ctx ->
ctx.execute('. /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t 2> /dev/null')
ctx.execute("sed -i -e 's/\"exec /\"/' /usr/local/frc/bin/frcRunRobot.sh")
}
postdeploy << { ctx ->
ctx.execute("sync")
ctx.execute("ldconfig")
@@ -95,43 +87,40 @@ deploy {
}
developerRobotCpp(NativeExecutableArtifact) {
libraryDirectory = '/usr/local/frc/third-party/lib'
libraryDirectory = '/home/systemcore/frc/third-party/lib'
def excludes = getLibraryFilter().getExcludes()
excludes.add('**/*.so.debug')
excludes.add('**/*.so.*.debug')
postdeploy << { ctx ->
ctx.execute("echo '/home/lvuser/developerRobotCpp' > /home/lvuser/robotCommand")
ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand")
ctx.execute("setcap cap_sys_nice+eip \"/home/lvuser/developerRobotCpp\"")
ctx.execute("echo '/home/systemcore/developerRobotCpp' > /home/systemcore/robotCommand")
ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand")
ctx.execute("setcap cap_sys_nice+eip \"/home/systemcore/developerRobotCpp\"")
ctx.execute('chmod +x developerRobotCpp')
}
}
developerRobotCppStatic(NativeExecutableArtifact) {
libraryDirectory = '/usr/local/frc/third-party/lib'
libraryDirectory = '/home/systemcore/frc/third-party/lib'
postdeploy << { ctx ->
ctx.execute("echo '/home/lvuser/developerRobotCppStatic' > /home/lvuser/robotCommand")
ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand")
ctx.execute("setcap cap_sys_nice+eip \"/home/lvuser/developerRobotCppStatic\"")
ctx.execute("echo '/home/systemcore/developerRobotCppStatic' > /home/systemcore/robotCommand")
ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand")
ctx.execute("setcap cap_sys_nice+eip \"/home/systemcore/developerRobotCppStatic\"")
ctx.execute('chmod +x developerRobotCppStatic')
}
}
developerRobotCppJava(NativeExecutableArtifact) {
libraryDirectory = '/usr/local/frc/third-party/lib'
libraryDirectory = '/home/systemcore/frc/third-party/lib'
def excludes = getLibraryFilter().getExcludes()
excludes.add('**/*.so.debug')
excludes.add('**/*.so.*.debug')
}
jre(WPIJREArtifact) {
}
developerRobotJava(JavaArtifact) {
jarTask = shadowJar
postdeploy << { ctx ->
ctx.execute("echo '/usr/local/frc/JRE/bin/java -XX:+UseSerialGC -Djava.library.path=/usr/local/frc/third-party/lib -Djava.lang.invoke.stringConcat=BC_SB -jar /home/lvuser/developerRobot-all.jar' > /home/lvuser/robotCommand")
ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand")
ctx.execute("echo '/usr/bin/java -XX:+UseG1GC -Djava.library.path=/home/systemcore/frc/third-party/lib -jar /home/systemcore/developerRobot-all.jar' > /home/systemcore/robotCommand")
ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand")
}
}
}
@@ -141,23 +130,23 @@ deploy {
tasks.register('deployJava') {
try {
dependsOn tasks.named('deployjreroborio')
dependsOn tasks.named('deploydeveloperRobotJavaroborio')
dependsOn tasks.named('deploydeveloperRobotCppJavaroborio') // Deploying shared C++ is how to get the Java shared libraries.
dependsOn tasks.named('deployjresystemcore')
dependsOn tasks.named('deploydeveloperRobotJavasystemcore')
dependsOn tasks.named('deploydeveloperRobotCppJavasystemcore') // Deploying shared C++ is how to get the Java shared libraries.
} catch (ignored) {
}
}
tasks.register('deployShared') {
try {
dependsOn tasks.named('deploydeveloperRobotCpproborio')
dependsOn tasks.named('deploydeveloperRobotCppsystemcore')
} catch (ignored) {
}
}
tasks.register('deployStatic') {
try {
dependsOn tasks.named('deploydeveloperRobotCppStaticroborio')
dependsOn tasks.named('deploydeveloperRobotCppStaticsystemcore')
} catch (ignored) {
}
}
@@ -179,10 +168,10 @@ model {
}
}
binaries.all { binary ->
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) {
if (binary.buildType.name == 'debug') {
deploy.targets.roborio.artifacts.developerRobotCpp.binary = binary
deploy.targets.roborio.artifacts.developerRobotCppJava.binary = binary
deploy.targets.systemcore.artifacts.developerRobotCpp.binary = binary
deploy.targets.systemcore.artifacts.developerRobotCppJava.binary = binary
}
}
lib project: ':apriltag', library: 'apriltag', linkage: 'shared'
@@ -201,14 +190,10 @@ model {
project(':hal').addHalJniDependency(binary)
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries')
} else {
def systemArch = getCurrentArch()
if (binary.targetPlatform.name == systemArch) {
simProjects.each {
lib project: ":simulation:$it", library: it, linkage: 'shared'
}
def systemArch = getCurrentArch()
if (binary.targetPlatform.name == systemArch) {
simProjects.each {
lib project: ":simulation:$it", library: it, linkage: 'shared'
}
}
}
@@ -229,9 +214,9 @@ model {
}
}
binaries.all { binary ->
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) {
if (binary.buildType.name == 'debug') {
deploy.targets.roborio.artifacts.developerRobotCppStatic.binary = binary
deploy.targets.systemcore.artifacts.developerRobotCppStatic.binary = binary
}
}
lib project: ':apriltag', library: 'apriltag', linkage: 'static'
@@ -244,9 +229,6 @@ model {
project(':hal').addHalDependency(binary, 'static')
lib project: ':wpinet', library: 'wpinet', linkage: 'static'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries')
}
}
}
}
@@ -302,20 +284,6 @@ model {
}
}
}
installAthena(Task) {
$.binaries.each {
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'developerRobotCpp') {
dependsOn it.tasks.install
}
}
}
installAthenaStatic(Task) {
$.binaries.each {
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'developerRobotCppStatic') {
dependsOn it.tasks.install
}
}
}
installSystemCore(Task) {
$.binaries.each {
@@ -324,6 +292,7 @@ model {
}
}
}
installSystemCoreStatic(Task) {
$.binaries.each {
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore && it.component.name == 'developerRobotCppStatic') {