Files
allwpilib/wpilibj/build.gradle
Fred Silberberg e5e1a1a4d1 Moved version generation to the WPILib versioning plugin. (#277)
* Moved version generation to the WPILib versioning plugin. This also moves ntcore and wpilib to the latest available version.

* Fixed description string.

* Gave full path for ignored files.
2016-10-20 23:54:04 -07:00

83 lines
2.4 KiB
Groovy

apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'net.ltgt.errorprone'
configurations.errorprone {
resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.9'
}
def versionClass = """
package edu.wpi.first.wpilibj.util;
/*
* 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.
*/
public final class WPILibVersion {
public static final String Version = "${WPILibVersion.version}";
}
""".trim()
def wpilibVersionFile = file('src/shared/java/edu/wpi/first/wpilibj/util/WPILibVersion.java')
def willPublish = false
gradle.taskGraph.addTaskExecutionGraphListener { graph ->
willPublish = graph.hasTask(publish)
}
task generateJavaVersion() {
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
}
sourceSets {
shared
}
compileSharedJava.dependsOn generateJavaVersion
dependencies {
sharedCompile 'edu.wpi.first.wpilib.networktables.java:NetworkTables:+:arm'
sharedRuntime 'edu.wpi.first.wpilib.networktables.java:NetworkTables:+:arm'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'junit:junit:4.12'
testCompile 'edu.wpi.first.wpilib.networktables.java:NetworkTables:+:desktop'
testCompile 'com.google.guava:guava:19.0'
testCompile sourceSets.shared.output
}
apply from: 'athena.gradle'
if (project.hasProperty('makeSim')) {
apply from: 'simulation.gradle'
}
test {
testLogging {
events "failed"
exceptionFormat "full"
}
}