mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
Merge pull request #164 from bzz/ci-remove-tip
ci: remove go tip and move default to 1.10
This commit is contained in:
commit
ccb6264699
19
.travis.yml
19
.travis.yml
@ -1,8 +1,9 @@
|
||||
language: go
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
language: go
|
||||
go:
|
||||
- 1.9.x
|
||||
- tip
|
||||
- '1.10.x'
|
||||
|
||||
addons:
|
||||
apt:
|
||||
@ -10,11 +11,12 @@ addons:
|
||||
- libonig-dev
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
||||
fast_finish: true
|
||||
|
||||
env:
|
||||
global:
|
||||
- GO_VERSION='1.10.x'
|
||||
matrix:
|
||||
- ONIGURUMA=0
|
||||
- ONIGURUMA=1
|
||||
|
||||
@ -53,7 +55,9 @@ jobs:
|
||||
jdk: oraclejdk8
|
||||
|
||||
install:
|
||||
- GIMME_OUTPUT=$(gimme 1.9 | tee -a $HOME/.bashrc) && eval "$GIMME_OUTPUT"
|
||||
- gimme version
|
||||
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION bash)"
|
||||
- go version
|
||||
- export GOPATH=$HOME/gopath
|
||||
- mkdir -p $GOPATH/src/gopkg.in/src-d/enry.v1
|
||||
- rsync -az ${TRAVIS_BUILD_DIR}/ $GOPATH/src/gopkg.in/src-d/enry.v1
|
||||
@ -121,7 +125,8 @@ jobs:
|
||||
jdk: oraclejdk8
|
||||
|
||||
install:
|
||||
- GIMME_OUTPUT=$(gimme 1.9 | tee -a $HOME/.bashrc) && eval "$GIMME_OUTPUT"
|
||||
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION bash)"
|
||||
- go version
|
||||
- export GOPATH=$HOME/gopath
|
||||
- mkdir -p $GOPATH/src/gopkg.in/src-d/enry.v1
|
||||
- rsync -az ${TRAVIS_BUILD_DIR}/ $GOPATH/src/gopkg.in/src-d/enry.v1
|
||||
|
@ -18,6 +18,8 @@ $(JAR): $(RESOURCES_DIR) $(JNAERATOR_JAR)
|
||||
-package tech.sourced.enry.nativelib \
|
||||
-library enry \
|
||||
$(HEADER_FILE) \
|
||||
-I/usr/lib/gcc/x86_64-linux-gnu/4.8/include \
|
||||
-D__GNUC__=4 \
|
||||
-o $(JARS_DIR) \
|
||||
-mode StandaloneJar \
|
||||
-runtime JNA;
|
||||
|
@ -35,6 +35,7 @@ pgpSecretRing := baseDirectory.value / "project" / ".gnupg" / "secring.gpg"
|
||||
pgpPublicRing := baseDirectory.value / "project" / ".gnupg" / "pubring.gpg"
|
||||
pgpPassphrase := Some(SONATYPE_PASSPHRASE.toArray)
|
||||
|
||||
libraryDependencies += "com.nativelibs4java" % "jnaerator-runtime" % "0.12"
|
||||
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test
|
||||
|
||||
unmanagedBase := baseDirectory.value / "lib"
|
||||
|
@ -3,13 +3,14 @@ package tech.sourced.enry;
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Pointer;
|
||||
import tech.sourced.enry.nativelib.GoSlice;
|
||||
import tech.sourced.enry.nativelib.GoString;
|
||||
import tech.sourced.enry.nativelib._GoString_;
|
||||
import com.ochafik.lang.jnaerator.runtime.NativeSize;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
class GoUtils {
|
||||
|
||||
static GoString.ByValue toGoString(String str) {
|
||||
static _GoString_.ByValue toGoString(String str) {
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = str.getBytes("utf-8");
|
||||
@ -26,19 +27,19 @@ class GoUtils {
|
||||
ptr = ptrFromBytes(bytes);
|
||||
}
|
||||
|
||||
GoString.ByValue val = new GoString.ByValue();
|
||||
val.n = length;
|
||||
_GoString_.ByValue val = new _GoString_.ByValue();
|
||||
val.n = new NativeSize(length);
|
||||
val.p = ptr;
|
||||
return val;
|
||||
}
|
||||
|
||||
static String toJavaString(GoString str) {
|
||||
if (str.n == 0) {
|
||||
static String toJavaString(_GoString_ str) {
|
||||
if (str.n.intValue() == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[(int) str.n];
|
||||
str.p.read(0, bytes, 0, (int) str.n);
|
||||
byte[] bytes = new byte[(int) str.n.intValue()];
|
||||
str.p.read(0, bytes, 0, (int) str.n.intValue());
|
||||
try {
|
||||
return new String(bytes, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user