|
1 | 1 | plugins { |
| 2 | + id "java" |
| 3 | + id "org.jetbrains.kotlin.jvm" version "1.3.61" |
| 4 | + id "edu.wpi.first.GradleRIO" version "2020.1.2" |
| 5 | +} |
2 | 6 |
|
3 | | - id "org.jetbrains.kotlin.jvm" version "1.3.40" |
4 | | - id "idea" |
| 7 | +sourceCompatibility = JavaVersion.VERSION_11 |
| 8 | +targetCompatibility = JavaVersion.VERSION_11 |
| 9 | + |
| 10 | +def ROBOT_MAIN_CLASS = "org.strykeforce.thirdcoast.DummyMain" |
| 11 | + |
| 12 | +// Define my targets (RoboRIO) and artifacts (deployable files) |
| 13 | +// This is added by GradleRIO's backing project EmbeddedTools. |
| 14 | +deploy { |
| 15 | + targets { |
| 16 | + roboRIO("roborio") { |
| 17 | + // Team number is loaded either from the .wpilib/wpilib_preferences.json |
| 18 | + // or from command line. If not found an exception will be thrown. |
| 19 | + // You can use getTeamOrDefault(team) instead of getTeamNumber if you |
| 20 | + // want to store a team number in this file. |
| 21 | + team = frc.getTeamNumber() |
| 22 | + } |
| 23 | + } |
| 24 | + artifacts { |
| 25 | + frcJavaArtifact('frcJava') { |
| 26 | + targets << "roborio" |
| 27 | + // Debug can be overridden by command line, for use with VSCode |
| 28 | + debug = frc.getDebugOrDefault(false) |
| 29 | + } |
| 30 | + // Built in artifact to deploy arbitrary files to the roboRIO. |
| 31 | + fileTreeArtifact('frcStaticFileDeploy') { |
| 32 | + // The directory below is the local directory to deploy |
| 33 | + files = fileTree(dir: 'src/main/deploy') |
| 34 | + // Deploy to RoboRIO target, into /home/lvuser/deploy |
| 35 | + targets << "roborio" |
| 36 | + directory = '/home/lvuser/deploy' |
| 37 | + } |
| 38 | + } |
5 | 39 | } |
6 | 40 |
|
7 | | -version = "19.4.1" |
| 41 | +// Set this to true to enable desktop support. |
| 42 | +def includeDesktopSupport = false |
8 | 43 |
|
9 | 44 | repositories { |
10 | 45 | jcenter() |
11 | | - maven { url = "http://devsite.ctr-electronics.com/maven/release/" } |
12 | 46 | maven { url = "http://first.wpi.edu/FRC/roborio/maven/release" } |
13 | | - mavenLocal() |
14 | 47 | } |
15 | | - |
| 48 | +// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. |
| 49 | +// Also defines JUnit 4. |
16 | 50 | dependencies { |
17 | | - // FRC libs |
18 | | - compile "edu.wpi.first.wpilibj:wpilibj-java:${wpi_version}" |
19 | | - compile "edu.wpi.first.ntcore:ntcore-java:${wpi_version}" |
20 | | - compile "edu.wpi.first.cscore:cscore-java:${wpi_version}" |
21 | | - compile "edu.wpi.first.thirdparty.frc2019.opencv:opencv-java:3.4.4-4" |
| 51 | + implementation wpi.deps.wpilib() |
| 52 | + nativeZip wpi.deps.wpilibJni(wpi.platforms.roborio) |
| 53 | + nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) |
| 54 | + |
22 | 55 |
|
23 | | - // Vendor libs |
24 | | - compile "com.ctre.phoenix:api-java:5.12.1" |
25 | | - compile "com.ctre.phoenix:wpiapi-java:5.12.1" |
| 56 | + implementation wpi.deps.vendor.java() |
| 57 | + nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio) |
| 58 | + nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) |
26 | 59 |
|
27 | | - // Kotlin |
28 | | - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}" |
| 60 | + // We need to add the Kotlin stdlib in order to use most Kotlin language features. |
| 61 | + implementation "org.jetbrains.kotlin:kotlin-stdlib" |
29 | 62 |
|
30 | 63 | // App |
31 | | - compile "org.jline:jline:3.9.0" |
32 | | - compile 'net.consensys.cava:cava-toml:0.5.0' |
33 | | - compile "org.strykeforce.thirdcoast:telemetry:${thirdcoast_version}" |
34 | | - compile "org.strykeforce.thirdcoast:swerve:${thirdcoast_version}" |
| 64 | + implementation "org.jline:jline:3.9.0" |
| 65 | + implementation 'net.consensys.cava:cava-toml:0.5.0' |
| 66 | + |
| 67 | + implementation "org.strykeforce.thirdcoast:telemetry:19.5.1" |
| 68 | + implementation "org.strykeforce.thirdcoast:swerve:19.5.1" |
35 | 69 |
|
36 | 70 | // Logging |
37 | | - compile 'io.github.microutils:kotlin-logging:1.6.10' |
38 | | - compile 'ch.qos.logback:logback-classic:1.2.3' |
| 71 | + implementation 'io.github.microutils:kotlin-logging:1.6.10' |
| 72 | + implementation 'ch.qos.logback:logback-classic:1.2.3' |
39 | 73 |
|
40 | 74 | // Koin |
41 | | - compile "org.koin:koin-core:$koin_version" |
42 | | - compile "org.koin:koin-logger-slf4j:${koin_version}" |
43 | | - testCompile "org.koin:koin-test:${koin_version}" |
| 75 | + implementation "org.koin:koin-core:1.0.2" |
| 76 | + implementation "org.koin:koin-logger-slf4j:1.0.2" |
| 77 | + testImplementation "org.koin:koin-test:1.0.2" |
44 | 78 |
|
45 | 79 | // Testing |
46 | | - testCompile "org.junit.jupiter:junit-jupiter-api:${junit_version}" |
47 | | - testCompile "org.junit.jupiter:junit-jupiter-params:${junit_version}" |
48 | | - testRuntime "org.junit.jupiter:junit-jupiter-engine:${junit_version}" |
49 | | - testCompile "org.assertj:assertj-core:3.11.1" |
50 | | - testCompile "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0" |
51 | | - |
52 | | -} |
53 | | - |
54 | | -compileKotlin { |
55 | | - kotlinOptions { |
56 | | - jvmTarget = "1.8" |
57 | | - freeCompilerArgs = ["-progressive"] |
58 | | - } |
59 | | -} |
60 | | - |
61 | | -compileTestKotlin { |
62 | | - kotlinOptions { |
63 | | - jvmTarget = "1.8" |
64 | | - freeCompilerArgs = ["-progressive"] |
65 | | - } |
66 | | -} |
67 | | - |
68 | | -test { |
69 | | - useJUnitPlatform() |
70 | | - |
71 | | - testLogging { |
72 | | - events "passed", "skipped", "failed" |
73 | | - } |
74 | | - |
75 | | - reports { |
76 | | - html.enabled = true |
77 | | - } |
78 | | -} |
79 | | - |
80 | | -def robotManifest = { |
81 | | - attributes 'Main-Class': 'org.strykeforce.thirdcoast.MainKt', |
82 | | - 'Robot-Class': 'org.strykeforce.thirdcoast.Robot', |
83 | | - 'Specification-Title': 'Third Coast Telemetry', |
84 | | - 'Specification-Version': "${thirdcoast_version}", |
85 | | - 'Implementation-Title': 'Third Coast Telemetry Utility (tct)', |
86 | | - 'Implementation-Version': version |
| 80 | + testImplementation "org.junit.jupiter:junit-jupiter-api:5.5.2" |
| 81 | + testImplementation "org.junit.jupiter:junit-jupiter-params:5.5.2" |
| 82 | + testRuntime "org.junit.jupiter:junit-jupiter-engine:5.5.2" |
| 83 | + testImplementation "org.assertj:assertj-core:3.11.1" |
| 84 | + testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0" |
| 85 | + |
| 86 | + // Enable simulation gui support. Must check the box in vscode to enable support |
| 87 | + // upon debugging |
| 88 | + simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) |
87 | 89 | } |
88 | 90 |
|
| 91 | +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') |
| 92 | +// in order to make them all available at runtime. Also adding the manifest so WPILib |
| 93 | +// knows where to look for our Robot Class. |
89 | 94 | jar { |
90 | | - from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } |
91 | | - manifest robotManifest |
92 | | -} |
93 | | - |
94 | | -idea { |
95 | | - module { |
96 | | - downloadJavadoc = true |
97 | | - downloadSources = true |
98 | | - } |
| 95 | + from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } |
| 96 | + manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) |
99 | 97 | } |
0 commit comments