blob: 4ebbcc98e8890a0809e726abb785dc6be73ff000 [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001plugins {
2 id 'org.ysb33r.doxygen' version '0.3'
3 id 'cpp'
4 id 'maven-publish'
5}
6
7evaluationDependsOn(':hal')
8
9ext.shared = 'shared'
10ext.athena = 'athena'
11ext.simulation = 'sim'
12
13def versionClass = """
14/*
15 * Autogenerated file! Do not manually edit this file. This version is regenerated
16 * any time the publish task is run, or when this file is deleted.
17 */
18
19const char* WPILibVersion = "${WPILibVersion.version}";
20""".trim()
21
22def wpilibVersionFile = file('shared/src/WPILibVersion.cpp')
23
24def willPublish = false
25gradle.taskGraph.addTaskExecutionGraphListener { graph ->
26 willPublish = graph.hasTask(publish)
27}
28
29task generateCppVersion() {
30 description = 'Generates the wpilib version class'
31 group = 'WPILib'
32
33 // We follow a simple set of checks to determine whether we should generate a new version file:
34 // 1. If the release type is not development, we generate a new verison file
35 // 2. If there is no generated version number, we generate a new version file
36 // 3. If there is a generated build number, and the release type is development, then we will
37 // only generate if the publish task is run.
38 doLast {
39 if (!WPILibVersion.releaseType.toString().equalsIgnoreCase('official') && !willPublish && wpilibVersionFile.exists()) {
40 return
41 }
42 println "Writing version ${WPILibVersion.version} to $wpilibVersionFile"
43
44 if (wpilibVersionFile.exists()) {
45 wpilibVersionFile.delete()
46 }
47 wpilibVersionFile.write(versionClass)
48 }
49}
50
51clean {
52 delete wpilibVersionFile
53}
54
55// Attempts to execute the doxygen command. If there is no exception, doxygen exists, so return true. If there's
56// an IOException, it doesn't exist, so return false
57ext.checkDoxygen = {
58 try {
59 'doxygen'.execute()
60 true
61 } catch (IOException e) {
62 false
63 }
64}
65
66apply from: 'athena.gradle'
67
68if (enableSimulation){
69 apply from: 'simulation.gradle'
70}