app, bind: separate the app package from gobind

Historically, the app package implemented Go runtime initialization.
This was convoluted, so the package was used both by all-Go apps
(currently based on Android's NativeActivity) and bind-based apps.

With Go 1.5 we have -buildmode=c-shared, which does a lot of the work
of the old app package. That code was removed a while back, but both
all-Go and gobind-based apps still used package app. The intermingled
initialization processes led to some strange states.

This CL separates gobind-based apps completely from the app package.
As part of that users are now expected to use System.loadLibrary
themselves. (A future CL may want to make the loadLibrary call part
of the .aar generated by gomobile bind.)

Delete the libhello example, which has been replaced by gomobile bind,
which could do with its own example at some point. Also delete the
libhellojni example, which now has nothing to do with the x/mobile
repository.

Change-Id: I444397f246dbafe81e5c53532eb482c197d26f70
Reviewed-on: https://go-review.googlesource.com/11654
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
David Crawshaw
2015-06-29 11:40:40 +00:00
parent 20f0df5da5
commit 8144405762
26 changed files with 22 additions and 538 deletions
+7 -4
View File
@@ -14,6 +14,13 @@ import java.util.concurrent.Executors;
// Seq is a sequence of machine-dependent encoded values.
// Used by automatically generated language bindings to talk to Go.
public class Seq {
static {
initSeq();
new Thread("GoSeq") {
public void run() { Seq.receive(); }
}.start();
}
@SuppressWarnings("UnusedDeclaration")
private long memptr; // holds C-allocated pointer
@@ -67,10 +74,6 @@ public class Seq {
return tracker.get(refnum);
}
static {
initSeq();
}
static native void initSeq();
// Informs the Go ref tracker that Java is done with this ref.