2025-12-13 21:44:00 -08:00
|
|
|
import org.wpilib.toolchain.*
|
2019-06-28 14:09:10 -07:00
|
|
|
|
2021-09-17 00:10:29 -07:00
|
|
|
buildscript {
|
|
|
|
|
repositories {
|
2022-05-08 13:59:58 -07:00
|
|
|
maven {
|
|
|
|
|
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
|
|
|
|
|
}
|
2021-09-17 00:10:29 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-20 23:54:04 -07:00
|
|
|
plugins {
|
2018-07-18 12:26:29 -07:00
|
|
|
id 'base'
|
2017-11-06 11:57:53 +08:00
|
|
|
id 'idea'
|
2018-11-17 23:16:35 -08:00
|
|
|
id 'visual-studio'
|
2026-02-20 18:31:33 -05:00
|
|
|
|
|
|
|
|
alias(libs.plugins.wpilib.versioning)
|
|
|
|
|
alias(libs.plugins.wpilib.repositories)
|
|
|
|
|
// NativeUtils and GradleVsCode are on the classpath for buildSrc, which doesn't carry version information.
|
|
|
|
|
// We're forced to use the string-based syntax here instead.
|
|
|
|
|
id 'org.wpilib.NativeUtils' apply false
|
|
|
|
|
id 'org.wpilib.GradleVsCode' apply false
|
|
|
|
|
// alias(libs.plugins.wpilib.native.utils) apply false
|
|
|
|
|
// alias(libs.plugins.wpilib.gradle.vscode)
|
|
|
|
|
alias(libs.plugins.wpilib.gradle.jni)
|
|
|
|
|
|
|
|
|
|
alias(libs.plugins.build.shadow) apply false
|
|
|
|
|
alias(libs.plugins.lint.errorprone) apply false
|
|
|
|
|
alias(libs.plugins.lint.spotbugs) apply false
|
|
|
|
|
alias(libs.plugins.lint.spotless) apply false
|
2016-05-20 13:48:41 -04:00
|
|
|
}
|
|
|
|
|
|
2020-12-30 22:40:38 -08:00
|
|
|
wpilibVersioning.buildServerMode = project.hasProperty('buildServer')
|
|
|
|
|
wpilibVersioning.releaseMode = project.hasProperty('releaseMode')
|
2019-08-22 21:48:43 -07:00
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
|
repositories {
|
2022-05-08 13:59:58 -07:00
|
|
|
maven {
|
|
|
|
|
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
|
|
|
|
|
}
|
2019-08-22 21:48:43 -07:00
|
|
|
}
|
2024-11-30 18:04:00 +00:00
|
|
|
wpilibRepositories.use2027Repos()
|
2019-08-22 21:48:43 -07:00
|
|
|
if (project.hasProperty('releaseMode')) {
|
|
|
|
|
wpilibRepositories.addAllReleaseRepositories(it)
|
|
|
|
|
} else {
|
|
|
|
|
wpilibRepositories.addAllDevelopmentRepositories(it)
|
|
|
|
|
}
|
2025-12-13 21:44:00 -08:00
|
|
|
tasks.withType(AbstractTestTask).configureEach {
|
|
|
|
|
failOnNoDiscoveredTests = false
|
|
|
|
|
}
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
|
2025-09-20 20:30:05 -07:00
|
|
|
develocity {
|
|
|
|
|
buildScan {
|
|
|
|
|
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
|
|
|
|
|
termsOfUseAgree = "yes"
|
|
|
|
|
}
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
|
2023-12-09 15:34:29 -08:00
|
|
|
import com.github.spotbugs.snom.Effort
|
|
|
|
|
ext.spotbugsEffort = Effort.MAX
|
|
|
|
|
|
2020-03-15 07:18:33 +02:00
|
|
|
ext.licenseFile = files("$rootDir/LICENSE.md", "$rootDir/ThirdPartyNotices.txt")
|
2016-11-25 00:51:01 -05:00
|
|
|
|
2017-09-07 21:07:01 -07:00
|
|
|
if (project.hasProperty("publishVersion")) {
|
2019-08-22 21:48:43 -07:00
|
|
|
wpilibVersioning.version.set(project.publishVersion)
|
2017-09-07 21:07:01 -07:00
|
|
|
}
|
|
|
|
|
|
2019-08-22 21:48:43 -07:00
|
|
|
wpilibVersioning.version.finalizeValue()
|
|
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
def outputsFolder = file("$buildDir/allOutputs")
|
2017-09-07 21:07:01 -07:00
|
|
|
|
|
|
|
|
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 {
|
2019-08-22 21:48:43 -07:00
|
|
|
versionFile.write wpilibVersioning.version.get()
|
2017-09-07 21:07:01 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
task libraryBuild() {}
|
|
|
|
|
|
2017-09-07 21:07:01 -07:00
|
|
|
build.dependsOn outputVersions
|
|
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
task copyAllOutputs(type: Copy) {
|
2025-08-08 08:08:34 -07:00
|
|
|
destinationDir = outputsFolder
|
2018-04-29 13:29:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build.dependsOn copyAllOutputs
|
|
|
|
|
copyAllOutputs.dependsOn outputVersions
|
|
|
|
|
|
2022-06-06 17:25:02 -07:00
|
|
|
def copyReleaseOnly = project.hasProperty('ciReleaseOnly')
|
|
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
ext.addTaskToCopyAllOutputs = { task ->
|
2022-06-06 17:25:02 -07:00
|
|
|
if (copyReleaseOnly && task.name.contains('debug')) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2018-04-29 13:29:07 -07:00
|
|
|
copyAllOutputs.dependsOn task
|
2023-05-12 21:27:31 -07:00
|
|
|
copyAllOutputs.inputs.file task.archiveFile
|
|
|
|
|
copyAllOutputs.from task.archiveFile
|
2018-04-29 13:29:07 -07:00
|
|
|
}
|
|
|
|
|
|
Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.
Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.
Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.
Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-05 09:54:14 -04:00
|
|
|
subprojects {
|
|
|
|
|
apply plugin: 'eclipse'
|
|
|
|
|
apply plugin: 'idea'
|
2018-06-03 10:00:53 -07:00
|
|
|
|
2018-10-27 00:19:38 -07:00
|
|
|
def subproj = it
|
|
|
|
|
|
|
|
|
|
plugins.withType(NativeComponentPlugin) {
|
|
|
|
|
subproj.apply plugin: MultiBuilds
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-14 19:39:54 -07:00
|
|
|
plugins.withType(JavaPlugin) {
|
2023-10-04 19:31:25 -07:00
|
|
|
java {
|
2025-07-26 06:45:40 +08:00
|
|
|
sourceCompatibility = 21
|
|
|
|
|
targetCompatibility = 21
|
2023-10-04 19:31:25 -07:00
|
|
|
}
|
2022-10-14 19:39:54 -07:00
|
|
|
}
|
|
|
|
|
|
2018-06-03 10:00:53 -07:00
|
|
|
apply from: "${rootDir}/shared/java/javastyle.gradle"
|
2016-05-20 12:07:40 -04:00
|
|
|
|
Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.
Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.
Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.
Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-05 09:54:14 -04:00
|
|
|
// Disables doclint in java 8.
|
|
|
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
2015-09-24 20:26:49 -04:00
|
|
|
tasks.withType(Javadoc) {
|
2019-11-11 21:38:04 -08:00
|
|
|
if (project.name != "docs") {
|
|
|
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
|
|
|
}
|
Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.
Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.
Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.
Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-05 09:54:14 -04:00
|
|
|
}
|
|
|
|
|
}
|
2020-10-25 22:41:45 -04:00
|
|
|
|
2022-10-20 17:20:36 -07:00
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
|
options.compilerArgs.add '-XDstringConcat=inline'
|
2023-08-24 00:03:38 -07:00
|
|
|
options.encoding = 'UTF-8'
|
2022-10-20 17:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
2021-07-29 22:42:43 -07:00
|
|
|
// Enables UTF-8 support in Javadoc
|
|
|
|
|
tasks.withType(Javadoc) {
|
|
|
|
|
options.addStringOption("charset", "utf-8")
|
|
|
|
|
options.addStringOption("docencoding", "utf-8")
|
|
|
|
|
options.addStringOption("encoding", "utf-8")
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-25 22:41:45 -04:00
|
|
|
// Sign outputs with Developer ID
|
2022-11-14 19:23:13 -08:00
|
|
|
tasks.withType(AbstractLinkTask) { task ->
|
|
|
|
|
task.inputs.property "HasDeveloperId", project.hasProperty("developerID")
|
|
|
|
|
|
|
|
|
|
if (project.hasProperty("developerID")) {
|
2020-10-25 22:41:45 -04:00
|
|
|
// 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()
|
2026-01-02 09:47:25 -07:00
|
|
|
providers.exec {
|
|
|
|
|
setWorkingDir(rootDir)
|
2020-12-30 16:17:20 -08:00
|
|
|
def args = [
|
|
|
|
|
"sh",
|
|
|
|
|
"-c",
|
|
|
|
|
"codesign --force --strict --timestamp --options=runtime " +
|
|
|
|
|
"--verbose -s ${project.findProperty("developerID")} ${path}"
|
|
|
|
|
]
|
2026-01-02 09:47:25 -07:00
|
|
|
commandLine(args)
|
|
|
|
|
}.result.get()
|
2020-10-25 22:41:45 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-02 09:47:10 -07:00
|
|
|
|
|
|
|
|
tasks.withType(AbstractArchiveTask).configureEach {
|
|
|
|
|
// Use file timestamps from the file system
|
|
|
|
|
preserveFileTimestamps = true
|
|
|
|
|
// Use permissions from the file system
|
|
|
|
|
useFileSystemPermissions()
|
|
|
|
|
}
|
Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.
Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.
Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.
Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-05 09:54:14 -04:00
|
|
|
}
|
|
|
|
|
|
2019-06-28 14:09:10 -07:00
|
|
|
ext.getCurrentArch = {
|
|
|
|
|
return NativePlatforms.desktop
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-27 23:00:03 -07:00
|
|
|
wrapper {
|
2025-12-13 21:44:00 -08:00
|
|
|
gradleVersion = '9.2.0'
|
2016-07-02 16:32:14 -07:00
|
|
|
}
|