mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
This adds support for two serialization formats for complex data types: - Protobuf for complex objects with variable length internals that need forward and backward wire compatibility (lower speed, more flexible) - Raw struct (ByteBuffer-style) for fixed-length objects (higher speed, less flexible) Deserialization can be done either by creating a new object (for immutable objects) or overwriting the contents of an existing object (for mutable objects). Implementing classes should provide inner classes that implement the Protobuf or Struct interface (in Java) or specialize the wpi::Protobuf or wpi::Struct struct (in C++). It is possible for classes to implement both. If the class itself does not implement serialization, it's possible for third parties/users to provide an implementation instead. Uses the Google protobuf implementation for C++ and the QuickBuffers alternative protobuf implementation for Java.
176 lines
4.7 KiB
Groovy
176 lines
4.7 KiB
Groovy
import edu.wpi.first.toolchain.*
|
|
|
|
buildscript {
|
|
repositories {
|
|
maven {
|
|
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'com.hubspot.jinjava:jinjava:2.7.1'
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'base'
|
|
id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '2023.0.1'
|
|
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2'
|
|
id 'edu.wpi.first.NativeUtils' apply false
|
|
id 'edu.wpi.first.GradleJni' version '1.1.0'
|
|
id 'edu.wpi.first.GradleVsCode'
|
|
id 'idea'
|
|
id 'visual-studio'
|
|
id 'net.ltgt.errorprone' version '3.1.0' apply false
|
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
|
id 'com.diffplug.spotless' version '6.20.0' apply false
|
|
id 'com.github.spotbugs' version '5.1.3' apply false
|
|
id 'com.google.protobuf' version '0.9.3' apply false
|
|
}
|
|
|
|
wpilibVersioning.buildServerMode = project.hasProperty('buildServer')
|
|
wpilibVersioning.releaseMode = project.hasProperty('releaseMode')
|
|
|
|
allprojects {
|
|
repositories {
|
|
maven {
|
|
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
|
|
}
|
|
}
|
|
if (project.hasProperty('releaseMode')) {
|
|
wpilibRepositories.addAllReleaseRepositories(it)
|
|
} else {
|
|
wpilibRepositories.addAllDevelopmentRepositories(it)
|
|
}
|
|
}
|
|
|
|
buildScan {
|
|
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
|
|
termsOfServiceAgree = 'yes'
|
|
|
|
publishAlways()
|
|
}
|
|
|
|
ext.licenseFile = files("$rootDir/LICENSE.md", "$rootDir/ThirdPartyNotices.txt")
|
|
|
|
if (project.hasProperty("publishVersion")) {
|
|
wpilibVersioning.version.set(project.publishVersion)
|
|
}
|
|
|
|
wpilibVersioning.version.finalizeValue()
|
|
|
|
def outputsFolder = file("$buildDir/allOutputs")
|
|
|
|
def versionFile = file("$outputsFolder/version.txt")
|
|
|
|
task outputVersions() {
|
|
description = 'Prints the versions of wpilib to a file for use by the downstream packaging project'
|
|
group = 'Build'
|
|
outputs.files(versionFile)
|
|
|
|
doFirst {
|
|
buildDir.mkdir()
|
|
outputsFolder.mkdir()
|
|
}
|
|
|
|
doLast {
|
|
versionFile.write wpilibVersioning.version.get()
|
|
}
|
|
}
|
|
|
|
task libraryBuild() {}
|
|
|
|
build.dependsOn outputVersions
|
|
|
|
task copyAllOutputs(type: Copy) {
|
|
destinationDir outputsFolder
|
|
}
|
|
|
|
build.dependsOn copyAllOutputs
|
|
copyAllOutputs.dependsOn outputVersions
|
|
|
|
def copyReleaseOnly = project.hasProperty('ciReleaseOnly')
|
|
|
|
ext.addTaskToCopyAllOutputs = { task ->
|
|
if (copyReleaseOnly && task.name.contains('debug')) {
|
|
return
|
|
}
|
|
copyAllOutputs.dependsOn task
|
|
copyAllOutputs.inputs.file task.archiveFile
|
|
copyAllOutputs.from task.archiveFile
|
|
}
|
|
|
|
subprojects {
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'idea'
|
|
|
|
def subproj = it
|
|
|
|
plugins.withType(NativeComponentPlugin) {
|
|
subproj.apply plugin: MultiBuilds
|
|
}
|
|
|
|
plugins.withType(JavaPlugin) {
|
|
java {
|
|
sourceCompatibility = 11
|
|
targetCompatibility = 11
|
|
}
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/java/javastyle.gradle"
|
|
|
|
// Disables doclint in java 8.
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
|
tasks.withType(Javadoc) {
|
|
if (project.name != "docs") {
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs.add '-XDstringConcat=inline'
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
// Enables UTF-8 support in Javadoc
|
|
tasks.withType(Javadoc) {
|
|
options.addStringOption("charset", "utf-8")
|
|
options.addStringOption("docencoding", "utf-8")
|
|
options.addStringOption("encoding", "utf-8")
|
|
}
|
|
|
|
// Sign outputs with Developer ID
|
|
tasks.withType(AbstractLinkTask) { task ->
|
|
task.inputs.property "HasDeveloperId", project.hasProperty("developerID")
|
|
|
|
if (project.hasProperty("developerID")) {
|
|
// Don't sign any executables because codesign complains
|
|
// about relative rpath.
|
|
if (!(task instanceof LinkExecutable)) {
|
|
doLast {
|
|
// Get path to binary.
|
|
String path = task.getLinkedFile().getAsFile().get().getAbsolutePath()
|
|
exec {
|
|
workingDir rootDir
|
|
def args = [
|
|
"sh",
|
|
"-c",
|
|
"codesign --force --strict --timestamp --options=runtime " +
|
|
"--verbose -s ${project.findProperty("developerID")} ${path}"
|
|
]
|
|
commandLine args
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
ext.getCurrentArch = {
|
|
return NativePlatforms.desktop
|
|
}
|
|
|
|
wrapper {
|
|
gradleVersion = '8.4'
|
|
}
|