mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
91 lines
2.4 KiB
Groovy
91 lines
2.4 KiB
Groovy
apply plugin: 'java'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'net.ltgt.errorprone'
|
|
apply plugin: 'pmd'
|
|
|
|
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
|
|
}
|
|
|
|
pmd {
|
|
consoleOutput = true
|
|
reportsDir = file("$project.buildDir/reports/pmd")
|
|
ruleSetFiles = files(new File(rootDir, "styleguide/pmd-ruleset.xml"))
|
|
ruleSets = []
|
|
}
|
|
|
|
sourceSets {
|
|
shared
|
|
}
|
|
|
|
compileSharedJava.dependsOn generateJavaVersion
|
|
|
|
dependencies {
|
|
sharedCompile ntcoreDep('java', 'arm')
|
|
sharedRuntime ntcoreDep('java', 'arm')
|
|
testCompile 'org.hamcrest:hamcrest-all:1.3'
|
|
testCompile 'junit:junit:4.12'
|
|
testCompile ntcoreDep('java', 'desktop')
|
|
testCompile 'com.google.guava:guava:19.0'
|
|
testCompile sourceSets.shared.output
|
|
}
|
|
|
|
apply from: 'athena.gradle'
|
|
|
|
if (enableSimulation) {
|
|
apply from: 'simulation.gradle'
|
|
}
|
|
|
|
test {
|
|
testLogging {
|
|
events "failed"
|
|
exceptionFormat "full"
|
|
}
|
|
}
|