Skip to content

Commit

Permalink
Merge pull request #103 from flamingchickens1540/2019-updates
Browse files Browse the repository at this point in the history
2019 updates
  • Loading branch information
RobinsonZ authored Jan 8, 2019
2 parents 1e7575e + dfb3df6 commit 758f97e
Show file tree
Hide file tree
Showing 94 changed files with 544 additions and 496 deletions.
6 changes: 4 additions & 2 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
language: java
jdk:
- openjdk11
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/4.4/fileHashes/fileHashes.bin
- rm -f $HOME/.gradle/caches/4.4/fileHashes/fileHashes.lock
- rm -f $HOME/.gradle/caches/5.0/fileHashes/fileHashes.bin
- rm -f $HOME/.gradle/caches/5.0/fileHashes/fileHashes.lock
cache:
directories:
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
- "$HOME/.gradle/permwrapper/"
- "$HOME/.gradle/gradlerio/"
notifications:
slack:
Expand All @@ -19,7 +22,7 @@ env:
before_deploy: travis-scripts/name-release-files.sh
deploy:
- provider: pages # Javadoc deployment to Github Pages
local-dir: lib/build/docs/javadoc/
local-dir: build/docs/javadoc/
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: true
Expand All @@ -28,7 +31,7 @@ deploy:
- provider: releases # Automatic JAR file deployment whenever a release is created
api_key: $GITHUB_TOKEN
file-glob: true
file: lib/build/libs/*
file: build/libs/*
skip-cleanup: true
on:
tags: true
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ dependencies {
}
```

Additionally, you should be using the latest version of GradleRIO with CTRE Phoenix, Kauai Labs NavX, and Pathfinder v1 vendor libraries installed.

We use [JitPack](https://jitpack.io) as a Gradle/Maven repository. This means that if you add the project using Gradle it will be automatically updated with the latest changes to the `master` branch, as well as source code and documentation .jar files.

Using `master-SNAPSHOT` as a version number is good for projects you're actively developing, but after you've finished it's better to anchor it to a specific version (simply change "`master-SNAPSHOT`" to the version number) to avoid possible backwards-compatibility issues.
Expand All @@ -111,7 +113,7 @@ _Note: If you need to use changes that have just been pushed to master, you may

### Project Structure

ROOSTER is made up of two separate Gradle projects, `lib` (the actual ROOSTER library) and `test` (self-contained robot classes to test library components). Anything in `lib` gets packaged into the distribution JARs, while `test` is only for testing the components from `lib` (and as such includes GradleRIO etc. for deploying to a robot).
ROOSTER's code is divided into two segments: `main` (in `src/main`), containing main library code which is packed into distribution JARs and given to anyone who adds the library as a dependency, and `testbots` (in `src/testbots`), containing robot classes etc. for testing the components in `main`.

### Building

Expand Down
157 changes: 136 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,152 @@
buildscript {
ext.kotlin_version = '1.3.0'
import edu.wpi.first.gradlerio.GradleRIOPlugin

repositories {
mavenCentral()
plugins {
id "java"
id "maven"
id "edu.wpi.first.GradleRIO" version "2019.1.1"
id "org.jetbrains.kotlin.jvm" version "1.3.0"
}


// Maven/Jitpack configuration
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}

javadoc {
options {
header '<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'
links 'http://first.wpi.edu/FRC/roborio/release/docs/java/'
linksOffline('https://docs.oracle.com/javase/8/docs/api/', 'https://docs.oracle.com/javase/8/docs/api/')
}
options.addStringOption("doctitle", "ROOSTER API")
options.addStringOption("windowtitle", "ROOSTER API")
options.addBooleanOption("-allow-script-in-comments", true)
options.addBooleanOption('Xdoclint:all,-missing', true)
}

// Dependencies

repositories {
mavenCentral()
maven {
name "JitPack"
url "https://jitpack.io/"
}
}

dependencies {
// FRC dependencies
compile wpi.deps.wpilib()
compile wpi.deps.vendor.java()
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)

// Non-FRC dependencies
compile 'org.jetbrains:annotations:16.0.3'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.0"

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
compile "com.google.guava:guava:27.0-jre"
compile "org.apache.commons:commons-math3:3.6.1"
// Last release was in 2014, so we're just pinning it to this commit instead
compile "com.github.oxo42:stateless4j:3dd512049f"
}

// deployment and GradleRIO

// define the testbots source set
sourceSets {
testbots {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = "https://services.gradle.org/distributions/gradle-4.4-all.zip"
configurations {
testbotsCompile.extendsFrom compile
testbotsRuntimeOnly.extendsFrom runtimeOnly
}

subprojects {
apply plugin: "java"
apply plugin: "kotlin"
// task to create robotclass.txt
task createRobotclassTxt {
inputs.property("robotClass", project.hasProperty("robotClass") ? project.robotClass : "")
outputs.files("$buildDir/robotclass.txt")
doLast {
if (!project.hasProperty("robotClass")) {
throw new GradleException("Robot class not set. Pass a value in on the command line by adding -ProbotClass=<your robot class>.")
} else {
System.out.println("Using robot class " + project.robotClass)
new File("$buildDir/robotclass.txt").text = project.robotClass
}
}
}

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
deploy {
targets {
roboRIO("roborio") {
team = frc.getTeamOrDefault(1540)
}
}
artifacts {
frcJavaArtifact('frcJava') {
targets << "roborio"
/*
IMPORTANT: With the "deploy-debug" property set (i.e. -Pdeploy-debug is on the
command line), the robot code will not start until you connect your debugger to the
robot. Connect by running the "Remote Robot Debug" run configuration which should be
shared through version control. Alternatively, remove this line and redeploy.
*/
debug = project.hasProperty("deploy-debug")
}
// This is a file (generated by the task above) that contains the name of the robot class we want to deploy.
// The file then gets read by TestbotLoaderMain and it instantiates the class using
// reflection.
// TODO: Maybe a build-time check that said class file actually exists somewhere in the project?
fileArtifact('robotclassTxt') {
targets << "roborio"

file = file("$buildDir/robotclass.txt")
directory = "/home/lvuser/"

repositories {
mavenCentral()
maven {url "https://jitpack.io/"}
dependsOn(createRobotclassTxt)
}
}
}

dependencies {
compile 'org.jetbrains:annotations:16.0.3'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
jar.dependsOn(compileTestbotsJava)

jar {
inputs.files(compileTestbotsJava.outputs.files)
gradle.taskGraph.whenReady {
if (gradle.taskGraph.hasTask(":deployFrcJava") || gradle.taskGraph.hasTask(":simulateJava") || gradle.taskGraph.hasTask(":simulateExternalJava")) {
// fully qualified task name is needed
System.out.println("Deployment or simulation detected.")
from((configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}) + sourceSets.testbots.output)
manifest GradleRIOPlugin.javaManifest("org.team1540.rooster.testing.TestbotLoaderMain")
}
}
}

simulateJava.dependsOn.removeAll()
simulateJava.dependsOn(extractTestJNI)
simulateJava.dependsOn(jar)

// wrapper

wrapper {
gradleVersion = '5.0'
distributionType = Wrapper.DistributionType.ALL
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 3 additions & 4 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Nov 30 17:46:10 PST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
zipStorePath=permwrapper/dists
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
51 changes: 0 additions & 51 deletions lib/build.gradle

This file was deleted.

Empty file removed lib/settings.gradle
Empty file.
3 changes: 0 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
rootProject.name = 'ROOSTER'

include 'lib'
include 'test'
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public double getCurrent() {
double sum = 0;
for (ChickenController motor : motors.keySet()) {
if (motor instanceof ChickenTalon) {
sum += motor.getOutputCurrent();
sum += ((ChickenTalon) motor).getOutputCurrent();
}
}
return sum;
Expand Down
Loading

0 comments on commit 758f97e

Please sign in to comment.