Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Java libs via Travis #702

Merged
merged 63 commits into from
Apr 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
f36b6eb
Update the README
peternewman Mar 23, 2015
e98cdb5
Minor tidying
peternewman Apr 2, 2015
2eab71f
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Apr 2, 2015
b40ecfd
Build the E1.33 code and the Java Libs on Travis
peternewman Apr 4, 2015
42593a6
Actually build the RDM tests, Ja Rule and Java via Travis
peternewman Apr 4, 2015
f01e5bf
Report the status of Ja Rule in the configure output
peternewman Apr 4, 2015
40a3c3f
Fix the RDM test server makedist config
peternewman Apr 4, 2015
c70c05c
Really fix the RDM test server makedist config
peternewman Apr 4, 2015
ccf9c43
Really really fix the RDM test server makedist config
peternewman Apr 4, 2015
2a220fe
Make the missing directory
peternewman Apr 4, 2015
863cf0c
Fix the whitespace in the Makefile
peternewman Apr 4, 2015
1b1e913
Try and get the Java build working via make distcheck
peternewman Apr 4, 2015
d4047b3
Try and fix the Java build via make distcheck
peternewman Apr 4, 2015
29bf728
Fix some paths and add some more debugging
peternewman Apr 4, 2015
68b6058
Try and fix the cd syntax
peternewman Apr 4, 2015
c139e49
More maven debugging
peternewman Apr 4, 2015
c6525cd
Try and fix the Maven build using a configure generated pom.xml
peternewman Apr 4, 2015
8bc9c6f
More debugging
peternewman Apr 4, 2015
1d532bc
Even more debugging
peternewman Apr 5, 2015
c01f268
Yet more debugging
peternewman Apr 5, 2015
2d9d797
Build Maven in the correct directory
peternewman Apr 5, 2015
9de1c13
Revert "Try and fix the Maven build using a configure generated pom.xml"
peternewman Apr 5, 2015
25cc1d9
Tidy up and remove some debugging
peternewman Apr 5, 2015
844afc0
Add the debugging back in
peternewman Apr 5, 2015
b14089d
More debugging
peternewman Apr 5, 2015
bf20481
Resync wih trunk
peternewman May 20, 2015
ed047a0
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman May 22, 2015
639b05d
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman May 23, 2015
419671b
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman May 26, 2015
843b574
Resync with trunk
peternewman May 26, 2015
f671f8c
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman May 27, 2015
005b640
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman May 28, 2015
52862bc
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Jun 3, 2015
6f3e0ff
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Jun 17, 2015
72cecea
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Jun 19, 2015
3608a34
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Jul 10, 2015
356d418
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Jul 30, 2015
d64ef42
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Oct 26, 2015
ac127c5
Source the pom correctly
peternewman Oct 26, 2015
73b0ed0
Add a build dir variable
peternewman Oct 26, 2015
64ae0bc
Use the new variable
peternewman Oct 26, 2015
e780913
Add the extra source dir
peternewman Oct 27, 2015
b57f544
Use the new variable
peternewman Oct 27, 2015
957f0c0
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Oct 28, 2015
5aab193
Clean the extra files
peternewman Oct 28, 2015
3eac722
Merge branch 'e1.37-2' of https://github.com/peternewman/ola into e1.…
peternewman Oct 28, 2015
f9e75a2
Try and clean the Java files properly
peternewman Oct 28, 2015
3e0060a
Merge branch 'master' into e1.37-2
peternewman Aug 30, 2016
fe7c5d5
Merge branch 'master' into e1.37-2
peternewman Apr 14, 2017
0e6bbc4
Remove the exclusion of the tests!
peternewman Apr 14, 2017
0d11714
Add profiles to control which tests we run
peternewman Apr 16, 2017
c2ca980
Don't run the tests that require Olad by default
peternewman Apr 16, 2017
b832371
Merge branch 'master' into e1.37-2
peternewman Apr 19, 2017
ffc4621
Downgrade the version of protobuf we're installing on OS X
peternewman Apr 21, 2017
63e2561
Skip another warning that occurs on Mac with Protobuf 2.6.0
peternewman Apr 21, 2017
310ab54
Move the generated Java protobuf code into a seperate folder. Then it…
peternewman Apr 23, 2017
2b51623
Ignore some more files
peternewman Apr 23, 2017
d85c0ad
Ignore more Java stuff
peternewman Apr 23, 2017
21ebe0c
Add some basic tests of the Java code that don't require olad to be r…
peternewman Apr 23, 2017
3669d03
Add the missing file
peternewman Apr 23, 2017
a1236cc
Change to static so the tests work and fix some formatting
peternewman Apr 23, 2017
d7c8a39
Remove an unused import
peternewman Apr 24, 2017
6250b8e
Add more cleanfiles
peternewman Apr 24, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ include/ola/base/Version.h
include/ola/plugin_id.h
include/ola/rdm/RDMResponseCodes.h
include/ola/timecode/TimeCodeEnums.h
java/src/main/java/ola/rpc/Rpc.java
java/classes/
java/generated-src/main/java/ola/proto/Ola.java
java/generated-src/main/java/ola/rpc/Rpc.java
java/maven-archiver/
java/ola-java-client-*.*.*.jar
java/surefire-reports/
java/test-classes/
javascript/compiler.jar
javascript/trunk/
libs/acn/e131_loadtest
Expand Down
2 changes: 1 addition & 1 deletion .travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ elif [[ $TASK = 'pychecker-wip' ]]; then
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST $(find ./ -name "*.py" -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" \) | xargs)
else
# Otherwise compile and check as normal
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-ja-rule --enable-e133'
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-java-libs --enable-ja-rule --enable-e133'
autoreconf -i;
./configure $DISTCHECK_CONFIGURE_FLAGS;
make distcheck;
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
#Fix a broken homebrew libtool install
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew reinstall -s libtool; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache cppunit bison flex protobuf@3.1 libftdi libftdi0 libusb liblo libmicrohttpd; fi # ossp-uuid, homebrew/python/numpy already present
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link -f protobuf@3.1; export PKG_CONFIG_PATH=/usr/local/opt/protobuf@3.1/lib/pkgconfig; brew install --build-from-source --ignore-dependencies --env=std protobuf-c; fi # While protobuf is not on the latest release
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache cppunit bison flex protobuf@2.6 libftdi libftdi0 libusb liblo libmicrohttpd; fi # ossp-uuid, homebrew/python/numpy already present
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link -f protobuf@2.6; export PKG_CONFIG_PATH=/usr/local/opt/protobuf@2.6/lib/pkgconfig; brew install --build-from-source --ignore-dependencies --env=std protobuf-c; fi # While protobuf is not on the latest release
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p ${HOME}/Library/Python/2.7/lib/python/site-packages; echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> ${HOME}/Library/Python/2.7/lib/python/site-packages/homebrew.pth; fi
#Coverity doesn't work with g++ 5 or 6, so only upgrade to g++ 4.9 for that
- if [ "$TRAVIS_OS_NAME" == "linux" -a \( "$TASK" = "compile" -o "$TASK" = "coverage" -o "$TASK" = "doxygen" \) -a "$CXX" = "g++" ]; then export CXX="ccache g++-6" CC="ccache gcc-6"; fi
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ if FATAL_WARNINGS
COMMON_CXXFLAGS += -Werror
COMMON_PROTOBUF_CXXFLAGS += -Werror -Wno-error=unused-parameter \
-Wno-error=deprecated-declarations \
-Wno-error=sign-compare
-Wno-error=sign-compare \
-Wno-error=ignored-qualifiers
COMMON_TESTING_FLAGS += -Werror
COMMON_TESTING_PROTOBUF_FLAGS += -Werror -Wno-error=unused-parameter \
-Wno-error=deprecated-declarations
Expand Down
29 changes: 20 additions & 9 deletions java/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@ EXTRA_DIST = pom.xml \
src/main/java/ola/OlaClient.java \
src/main/java/ola/rpc/SimpleRpcController.java \
src/main/java/ola/rpc/StreamRpcChannel.java \
src/test/java/ola/OlaClientTest.java
src/test/java/ola/OlaClientTest.java \
src/test/java/ola/OlaClientUtilsTest.java

src/main/java/ola/proto/Ola.java: ${top_srcdir}/common/protocol/Ola.proto
$(PROTOC) --java_out=src/main/java --proto_path=${top_srcdir}/common/protocol ${top_srcdir}/common/protocol/Ola.proto
generated-src/main/java/ola/proto/Ola.java: ${top_srcdir}/common/protocol/Ola.proto
mkdir -p $(top_builddir)/java/generated-src/main/java
$(PROTOC) --java_out=$(top_builddir)/java/generated-src/main/java --proto_path=${top_srcdir}/common/protocol ${top_srcdir}/common/protocol/Ola.proto

src/main/java/ola/rpc/Rpc.java: ${top_srcdir}/common/rpc/Rpc.proto
$(PROTOC) --java_out=src/main/java --proto_path=${top_srcdir}/common/rpc ${top_srcdir}/common/rpc/Rpc.proto
generated-src/main/java/ola/rpc/Rpc.java: ${top_srcdir}/common/rpc/Rpc.proto
mkdir -p $(top_builddir)/java/generated-src/main/java
$(PROTOC) --java_out=$(top_builddir)/java/generated-src/main/java --proto_path=${top_srcdir}/common/rpc ${top_srcdir}/common/rpc/Rpc.proto

ola.jar: src/main/java/ola/proto/Ola.java src/main/java/ola/rpc/Rpc.java
mvn package
ola.jar: generated-src/main/java/ola/proto/Ola.java generated-src/main/java/ola/rpc/Rpc.java
cd ${top_builddir}/java && mvn --file ${top_srcdir}/java/pom.xml -DbuildDir=${abs_top_builddir}/java -DprotobufGeneratedSource=$(abs_top_builddir)/java/generated-src/main/java package

CLEANFILES = src/main/java/ola/proto/Ola.java \
src/main/java/ola/rpc/Rpc.java
CLEANFILES = generated-src/main/java/ola/proto/Ola.java \
generated-src/main/java/ola/rpc/Rpc.java \
classes/ola/proto/*.class \
classes/ola/rpc/*.class \
classes/ola/*.class \
test-classes/ola/*.class \
maven-archiver/pom.properties \
surefire-reports/ola.*.txt \
surefire-reports/TEST-*.xml \
ola-java-client-0.0.1.jar

if BUILD_JAVA_LIBS
# .jars aren't really data, but it sure ain't a program.
Expand Down
67 changes: 62 additions & 5 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,33 @@
<artifactId>ola-java-client</artifactId>
<version>0.0.1</version>
<description>Java implementation of OLA RPC</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<buildDir>${user.dir}</buildDir>
<protobufGeneratedSource>${user.dir}</protobufGeneratedSource>
</properties>
<build>
<directory>${buildDir}</directory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${protobufGeneratedSource}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -19,14 +44,46 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<excludes>
<exclude>**/OlaClientTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>normal</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/OlaClientTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>oladServerAvailable</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes combine.children="append">
<include>**/OlaClientTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
Expand Down
4 changes: 2 additions & 2 deletions java/src/main/java/ola/OlaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public void streamDmx(int universe, short[] values) {
/**
* Convert short array to bytestring
*/
public ByteString convertToUnsigned(short[] values) {
public static ByteString convertToUnsigned(short[] values) {
byte[] unsigned = new byte[values.length];
for (int i = 0; i < values.length; i++) {
unsigned[i] = (byte) values[i];
Expand All @@ -419,7 +419,7 @@ public ByteString convertToUnsigned(short[] values) {
/**
* Convert bytestring to short array.
*/
public short[] convertFromUnsigned(ByteString data) {
public static short[] convertFromUnsigned(ByteString data) {
byte[] values = data.toByteArray();
short[] signed = new short[values.length];
for (int i = 0; i < values.length; i++) {
Expand Down
41 changes: 41 additions & 0 deletions java/src/test/java/ola/OlaClientUtilsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package ola;

import static org.junit.Assert.assertArrayEquals;
import com.google.protobuf.ByteString;
import ola.OlaClient;

import org.junit.Test;

/**
* Test standalone OlaClient code.
* Does not require an ola daemon to be running.
*/
public class OlaClientUtilsTest {

@Test
public void testConvertToUnsigned() {
assertArrayEquals(
OlaClient.convertToUnsigned(
new short[]{0, 1, 2}).toByteArray(),
ByteString.copyFrom(new byte[]{0, 1, 2}).toByteArray());

assertArrayEquals(
OlaClient.convertToUnsigned(
new short[]{0xff, 128, 0}).toByteArray(),
ByteString.copyFrom(
new byte[]{(byte)0xff, (byte)128, 0}).toByteArray());
}

@Test
public void testConvertFromUnsigned() {
assertArrayEquals(
OlaClient.convertFromUnsigned(
ByteString.copyFrom(new byte[]{0, 1, 2})),
new short[]{0, 1, 2});

assertArrayEquals(
OlaClient.convertFromUnsigned(
ByteString.copyFrom(new byte[]{(byte)0xff, (byte)128, 0})),
new short[]{0xff, 128, 0});
}
}