Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | plugins { |
| 2 | id 'org.ysb33r.doxygen' version '0.3' |
| 3 | id 'cpp' |
| 4 | id 'maven-publish' |
| 5 | } |
| 6 | |
| 7 | evaluationDependsOn(':hal') |
| 8 | |
| 9 | ext.shared = 'shared' |
| 10 | ext.athena = 'athena' |
| 11 | ext.simulation = 'sim' |
| 12 | |
| 13 | def 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 | |
| 19 | const char* WPILibVersion = "${WPILibVersion.version}"; |
| 20 | """.trim() |
| 21 | |
| 22 | def wpilibVersionFile = file('shared/src/WPILibVersion.cpp') |
| 23 | |
| 24 | def willPublish = false |
| 25 | gradle.taskGraph.addTaskExecutionGraphListener { graph -> |
| 26 | willPublish = graph.hasTask(publish) |
| 27 | } |
| 28 | |
| 29 | task 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 | |
| 51 | clean { |
| 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 |
| 57 | ext.checkDoxygen = { |
| 58 | try { |
| 59 | 'doxygen'.execute() |
| 60 | true |
| 61 | } catch (IOException e) { |
| 62 | false |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | apply from: 'athena.gradle' |
| 67 | |
| 68 | if (enableSimulation){ |
| 69 | apply from: 'simulation.gradle' |
| 70 | } |