mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
This does a major cleanup on our gradle files, primarily converting all instances of manual dependency downloading to use the correct configuration-based method, which has the advantage of being both less code and more safe.
83 lines
2.2 KiB
Groovy
83 lines
2.2 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 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"
|
|
}
|
|
}
|