Skip to content

Commit

Permalink
Merge branch 'master' into docs/contributing
Browse files Browse the repository at this point in the history
  • Loading branch information
JLLeitschuh committed Apr 6, 2016
2 parents b2eea29 + fdf35cb commit a5ed9af
Show file tree
Hide file tree
Showing 269 changed files with 10,617 additions and 2,797 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ node_modules
bower_components

#Generated files should be ignored as the are regenerated as a build step
*/src/generated
**/generated
*/generated_tests
/bin/
2 changes: 1 addition & 1 deletion .travis-scripts/before-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
ls -R build/distributions | awk '
ls -R ui/build/distributions | awk '
/:$/&&f{s=$0;f=0}
/:$/&&!f{sub(/:$/,"");s=$0;f=1;next}
NF&&f{ print s"/"$0 }'
3 changes: 3 additions & 0 deletions .travis-scripts/push-javadoc-to-gh-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Source of file: http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/
if [ "$TRAVIS_REPO_SLUG" == "WPIRoboticsProjects/GRIP" ] && [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then

echo -e "Generating javadoc...\n"
./gradlew aggregateJavadocs

echo -e "Publishing javadoc...\n"

cp -R build/docs/javadoc $HOME/javadoc-latest
Expand Down
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ before_install:
- sh -e /etc/init.d/xvfb start
- pip install --user codecov

install: ./gradlew :ui:assemble --stacktrace
# Only do an assemble when we aren't building a pull request
install:
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./gradlew :ui:assemble --stacktrace || ./gradlew --stacktrace '

after_failure: #Run again with debug info enabled
- ./gradlew check --stacktrace -PprintTestResults
script:
- ./gradlew check --stacktrace -PprintTestResults

after_success:
- codecov
- ./gradlew aggregateJavadocs
- .travis-scripts/push-javadoc-to-gh-pages.sh
- .travis-scripts/before-deploy.sh

Expand Down
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

[![Join the chat at https://gitter.im/WPIRoboticsProjects/GRIP](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/WPIRoboticsProjects/GRIP?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/WPIRoboticsProjects/GRIP.svg?branch=master)](https://travis-ci.org/WPIRoboticsProjects/GRIP)
[![Build status](https://ci.appveyor.com/api/projects/status/9xl8pggec4l75pqb/branch/master?svg=true)](https://ci.appveyor.com/project/ThomasJClark/grip/branch/master)
[![Build status](https://ci.appveyor.com/api/projects/status/sbrd2nhpiktlhf58/branch/master?svg=true)](https://ci.appveyor.com/project/JLLeitschuh/grip/branch/master)
[![codecov.io](http://codecov.io/github/WPIRoboticsProjects/GRIP/coverage.svg?branch=master)](http://codecov.io/github/WPIRoboticsProjects/GRIP?branch=master)
[![Dependency Status](https://www.versioneye.com/user/projects/56aaaac57e03c7003ba40ab6/badge.svg?style=plastic)](https://www.versioneye.com/user/projects/56aaaac57e03c7003ba40ab6)
[![Github Releases](https://img.shields.io/github/downloads/WPIRoboticsProjects/GRIP/total.svg)](https://github.com/WPIRoboticsProjects/GRIP/releases/latest)

# GRIP Computer Vision Engine

GRIP (the Graphically Represented Image Processing engine) is a program for rapidly prototyping and deploying computer
vision algorithms, primarily for robotics applications. **It is currently in an early state of development**,
should be ready in time for the 2016 FIRST Robotics Competition.
vision algorithms, primarily for robotics applications. It has been released with features designed for the
2016 FIRST Robotics Competition Season.

## Getting Started

Expand All @@ -22,6 +23,21 @@ Check out the release notes and [the wiki](https://github.com/WPIRoboticsProject

## Building GRIP From Source

To build and run, use the included Gradle wrapper script.
To build and run, use the included Gradle wrapper script on a Unix System:

./gradlew :ui:run

On Windows:

gradlew.bat :ui:run

If you don't have an internet connection you can build using the `--offline` flag if you have built GRIP once before.

## Contributing

See the guide on [setting up build tools](https://github.com/WPIRoboticsProjects/GRIP/wiki/Setting-up-build-tools) in the wiki.

## Thanks

Thanks to [TravisCI](https://travis-ci.org/) and [AppVeyor](https://www.appveyor.com/) for providing their continuous integration
servers to open source projects for free.
6 changes: 2 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ install:
- choco install -y InnoSetup

build_script:
- gradlew.bat :ui:assemble --stacktrace
- gradlew.bat :ui:assemble --stacktrace -PprintTestResults

# to run your custom scripts instead of automatic tests
test_script:
Expand All @@ -11,12 +11,10 @@ test_script:
platform:
- x64

after_build:
- dir build /s

artifacts:
- path: ui\build\distributions\*.exe


deploy:
provider: GitHub
description: ''
Expand Down
130 changes: 121 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
buildscript {
repositories { jcenter() }
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
classpath 'com.netflix.nebula:gradle-aggregate-javadocs-plugin:2.2.+'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.8'
}
}
plugins {
Expand All @@ -15,10 +21,78 @@ plugins {
}
apply plugin: 'nebula-aggregate-javadocs'

def getGitCommit = { ->
String HEAD_REF = new File(rootDir, '.git/HEAD').text.replace("ref: ", "").replace("\n", "")
String COMMIT_HASH = new File(rootDir, ".git/${HEAD_REF}").text.substring(0, 7)
return COMMIT_HASH
}

idea.project {
ipr.withXml { provider ->
def node = provider.asNode()
def compilerConfig = node.component.find { it.'@name' == 'CompilerConfiguration'}
compilerConfig.annotationProcessing[0].'@enabled' = 'true'
// def ccfg = node.component.find { it.@name == 'CompilerConfiguration' }
// ccfg.remove(ccfg.annotationProcessing)
// ccfg.append(new NodeBuilder().annotationProcessing() {
// profile(default: true, name: 'Default', enabled: true) {
// processorPath(useClasspath: true)
// }
// })
}
}

/*
* Gets the version name from the latest Git tag
* http://ryanharter.com/blog/2013/07/30/automatic-versioning-with-git-and-gradle/
*/
def getVersionName = { ->
if (project.hasProperty("vers")) return vers
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim().substring(1)
} catch (org.gradle.process.internal.ExecException e) {
if (!new File(rootDir, '.git/HEAD').exists()) {
println("WARN: Could not fetch Git Tag for build version. No Git HEAD available. Substituting version 0.0.0")
return "0.0.0"
}
println("WARN: Could not fetch Git Tag for build version. Please install Git and add it to your PATH. For now, the Git commit hash has been substituted.")
return getGitCommit()
}
}

def getVersionSimple = { ->
if (project.hasProperty("vers")) return vers
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--abbrev=0'
standardOutput = stdout
}
return stdout.toString().trim().substring(1)
} catch (org.gradle.process.internal.ExecException e) {
if (!new File(rootDir, '.git/HEAD').exists()) {
println("WARN: Could not fetch Git Tag for build version. No Git HEAD available. Substituting version 0.0.0")
return "0.0.0"
}
println("WARN: Could not fetch Git Tag for build version. Please install Git and add it to your PATH. For now, the Git commit hash has been substituted.")
return getGitCommit()
}
}

allprojects {
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'jacoco'
apply plugin: 'net.ltgt.errorprone'

configurations.errorprone {
resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.8'
}


repositories {
Expand All @@ -34,9 +108,11 @@ allprojects {
testCompile group: 'net.jodah', name: 'concurrentunit', version: '0.4.2'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'com.google.truth', name: 'truth', version: '0.28'
testCompile group: 'com.google.guava', name: 'guava-testlib', version: '19.0'
}

version = '0.3.0'
version = getVersionName()

compileJava {
options.compilerArgs << "-g"
Expand Down Expand Up @@ -76,7 +152,8 @@ allprojects {
}
}

def os = osdetector.classifier.replace("osx", "macosx").replace("windows-x86_32", "windows-x86")
def os = osdetector.classifier.replace("osx", "macosx").replace("x86_32", "x86")
def arch = osdetector.arch.replace("x86_64", "x64")

project(":core") {
apply plugin: 'java'
Expand All @@ -91,10 +168,17 @@ project(":core") {
repositories {
flatDir {
dirs 'libs'
maven {
url = "http://first.wpi.edu/FRC/roborio/maven/development"
}
maven {
url = "https://github.com/WPIRoboticsProjects/rosjava_mvn_repo/raw/master"
}
}
}

dependencies {
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
compile group: 'org.bytedeco', name: 'javacv', version: '1.1'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.0.0-1.1'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.0.0-1.1', classifier: os
Expand All @@ -103,9 +187,19 @@ project(":core") {
compile group: 'org.python', name: 'jython', version: '2.7.0'
compile group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.8'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
compile group: 'com.google.guava', name: 'guava', version: '18.0'
compile group: 'com.google.inject', name: 'guice', version: '4.0'
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile group: 'com.google.auto.value', name: 'auto-value', version: '1.1'
// We use the no_aop version of Guice because the aop isn't avaiable in arm java
// http://stackoverflow.com/a/15235190/3708426
// https://github.com/google/guice/wiki/OptionalAOP
compile group: 'com.google.inject', name: 'guice', version: '4.0', classifier: 'no_aop'
compile group: 'com.google.inject.extensions', name: 'guice-assistedinject', version: '4.0'

// Network publishing dependencies
compile group: 'org.ros.rosjava_core', name: 'rosjava', version: '[0.2,0.3)'
compile group: 'org.ros.rosjava_messages', name: 'grip_msgs', version: '0.0.1'
compile group: 'edu.wpi.first.wpilib.networktables.java', name: 'NetworkTables', version: '3.0.0-SNAPSHOT', classifier: 'desktop'
compile group: 'edu.wpi.first.wpilib.networktables.java', name: 'NetworkTables', version: '3.0.0-SNAPSHOT', classifier: 'arm'
}

mainClassName = 'edu.wpi.grip.core.Main'
Expand Down Expand Up @@ -172,8 +266,8 @@ project(":core") {

idea.module {
sourceDirs += sourceSets.generated.java.srcDirs
sourceDirs += file('generated')
}
// End IDE setup
}

project(":ui") {
Expand All @@ -191,9 +285,7 @@ project(":ui") {
compile project(path: ':core', configuration: 'shadow')
ideProvider project(path: ':core', configuration: 'compile')
compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.10'
compile group: 'org.apache.ant', name: 'ant-jsch', version: '1.8.1'
compile group: 'com.jcabi', name: 'jcabi-ssh', version: '1.5'
compile group: 'org.jdeferred', name: 'jdeferred-core', version: '1.2.4'
compile group: 'com.hierynomus', name: 'sshj', version: '0.15.0'
testCompile files(project(':core').sourceSets.test.output.classesDir)
testCompile files(project(':core').sourceSets.test.output.resourcesDir)
testCompile group: 'org.testfx', name: 'testfx-core', version: '4.0.+'
Expand All @@ -208,9 +300,19 @@ project(":ui") {
}

javafx {
profiles {
linux {
category = 'Development'
bundleArguments = [
// for DEB bundles
'email': '[email protected]', // This is the email used for the deb maintainer field.
]
}
}
appID = 'GRIP'
appName = 'GRIP'
mainClass = "edu.wpi.grip.ui.Main"
version = getVersionSimple()

// This prevents the JIT from eating stack traces that get thrown a lot
// This is slower but means we actually get the stack traces instead of
Expand All @@ -220,6 +322,16 @@ project(":ui") {
jvmArgs = ["-XX:-OmitStackTraceInFastThrow"]
}
mainClassName = javafx.mainClass

// The JavaFX plugin does not provide a way to change the installer artifact's name without changing the appName or appID,
// so instead, we simply rename the artifact to append the architecture (x86 or x64)
jfxDeploy.doLast {
def filet = fileTree(dir: 'build/distributions', include: "${javafx.appName}-${getVersionSimple()}.*")
filet.each { File f ->
def f2 = new File(f.getParentFile(), "${f.getName().replace("${getVersionSimple()}", "${getVersionSimple()}-${arch}")}")
f.renameTo(f2)
}
}
}

/*
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ configurations {
dependencies {
compile gradleApi()
compile localGroovy()
compile group: 'com.google.guava', name: 'guava', version: '18.0'
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile group: 'com.github.javaparser', name: 'javaparser-core', version: '2.2.2'
source group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.0.0-1.1', classifier: 'sources'
testCompile group: 'junit', name: 'junit', version: '4.11'
Expand Down
6 changes: 4 additions & 2 deletions buildSrc/src/main/java/edu/wpi/gripgenerator/FileParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class FileParser {
*/
private static InputStream preProcessStream(InputStream stream) {
//FIXME: This is a hack around. This should be removed once the above noted issue is resolved.
java.util.Scanner s = new java.util.Scanner(stream).useDelimiter("\\A");
java.util.Scanner s = new java.util.Scanner(stream, StandardCharsets.UTF_8.name()).useDelimiter("\\A");
String input = s.hasNext() ? s.next() : "";
input = input.replaceAll(methodReorderPattern, methodNewOrder);
return new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8));
Expand Down Expand Up @@ -241,7 +241,9 @@ public static Map<String, CompilationUnit> parseOpenCVCore(CompilationUnit coreD
new DefinedMethod("min", false, "Mat", "Mat")
.addDescription("Calculate the per-element minimum of two images."),
new DefinedMethod("extractChannel", false, "Mat", "Mat")
.addDescription("Extract a single channel from a image.")
.addDescription("Extract a single channel from a image."),
new DefinedMethod("transpose", false, "Mat", "Mat")
.addDescription("Calculate the transpose of an image.")
// new DefinedMethod("sqrt", false, "Mat", "Mat"),
// new DefinedMethod("pow", false,
// new DefinedParamType("Mat"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,28 @@ public PrimitiveDefaultValue(PrimitiveType type) {
);
break;
case Int:
this.viewValue = "SPINNER";
this.viewValue = "TEXT";
this.domainValue = createDomainValueExpression(
new IntegerLiteralExpr("Integer.MIN_VALUE"),
new IntegerLiteralExpr("Integer.MAX_VALUE")
);
break;
case Float:
this.viewValue = "SPINNER";
this.viewValue = "TEXT";
this.domainValue = createDomainValueExpression(
new DoubleLiteralExpr("-Float.MAX_VALUE"),
new DoubleLiteralExpr("Float.MAX_VALUE")
);
break;
case Double:
this.viewValue = "SPINNER";
this.viewValue = "TEXT";
this.domainValue = createDomainValueExpression(
new DoubleLiteralExpr("-Double.MAX_VALUE"),
new DoubleLiteralExpr("Double.MAX_VALUE")
);
break;
case Char:
this.viewValue = "SPINNER";
this.viewValue = "TEXT";
this.domainValue = createDomainValueExpression(
new CharLiteralExpr(Character.toString(Character.MIN_VALUE)),
new CharLiteralExpr(Character.toString(Character.MAX_VALUE))
Expand Down
Loading

0 comments on commit a5ed9af

Please sign in to comment.