mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
71 lines
1.9 KiB
Groovy
71 lines
1.9 KiB
Groovy
plugins {
|
|
id 'org.ysb33r.doxygen' version '0.3'
|
|
id 'cpp'
|
|
id 'maven-publish'
|
|
}
|
|
|
|
evaluationDependsOn(':hal')
|
|
|
|
ext.shared = 'shared'
|
|
ext.athena = 'athena'
|
|
ext.simulation = 'sim'
|
|
|
|
def versionClass = """
|
|
/*
|
|
* Autogenerated file! Do not manually edit this file. This version is regenerated
|
|
* any time the publish task is run, or when this file is deleted.
|
|
*/
|
|
|
|
const char* WPILibVersion = "${WPILibVersion.version}";
|
|
""".trim()
|
|
|
|
def wpilibVersionFile = file('shared/src/WPILibVersion.cpp')
|
|
|
|
def willPublish = false
|
|
gradle.taskGraph.addTaskExecutionGraphListener { graph ->
|
|
willPublish = graph.hasTask(publish)
|
|
}
|
|
|
|
task generateCppVersion() {
|
|
description = 'Generates the wpilib version class'
|
|
group = 'WPILib'
|
|
|
|
// We follow a simple set of checks to determine whether we should generate a new version file:
|
|
// 1. If the release type is not development, we generate a new verison file
|
|
// 2. If there is no generated version number, we generate a new version file
|
|
// 3. If there is a generated build number, and the release type is development, then we will
|
|
// only generate if the publish task is run.
|
|
doLast {
|
|
if (!WPILibVersion.releaseType.toString().equalsIgnoreCase('official') && !willPublish && wpilibVersionFile.exists()) {
|
|
return
|
|
}
|
|
println "Writing version ${WPILibVersion.version} to $wpilibVersionFile"
|
|
|
|
if (wpilibVersionFile.exists()) {
|
|
wpilibVersionFile.delete()
|
|
}
|
|
wpilibVersionFile.write(versionClass)
|
|
}
|
|
}
|
|
|
|
clean {
|
|
delete wpilibVersionFile
|
|
}
|
|
|
|
// Attempts to execute the doxygen command. If there is no exception, doxygen exists, so return true. If there's
|
|
// an IOException, it doesn't exist, so return false
|
|
ext.checkDoxygen = {
|
|
try {
|
|
'doxygen'.execute()
|
|
true
|
|
} catch (IOException e) {
|
|
false
|
|
}
|
|
}
|
|
|
|
apply from: 'athena.gradle'
|
|
|
|
if (enableSimulation){
|
|
apply from: 'simulation.gradle'
|
|
}
|