From 99b28c1d9557e58ef12cb9d8c05578981318d8f9 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Wed, 3 Feb 2021 10:51:14 +0100 Subject: [PATCH] refactor: start building an Android package (#205) * refactor: start building an Android package Part of https://github.com/ooni/probe/issues/1335. This seems also a good moment to move some packages out of the engine, e.g., oonimkall. This package, for example, is a consumer of the engine, so it makes sense it's not _inside_ it. * fix: committed some stuff I didn't need to commit * fix: oonimkall needs to be public to build The side effect is that we will probably need to bump the major version number every time we change one of these APIs. (We can also of course choose to violate the basic guidelines of Go software, but I believe this is bad form.) I have no problem in bumping the major quite frequently and in any case this monorepo solution is convinving me more than continuing to keep a split between engine and cli. The need to embed assets to make the probe more reliable trumps the negative effects of having to ~frequently bump major because we expose a public API. * fix: let's not forget about libooniffi Honestly, I don't know what to do with this library. I added it to provide a drop in replacement for MK but I have no idea whether it's used and useful. I would not feel comfortable exposing it, unlike oonimkall, since we're not using it. It may be that the right thing to do here is just to delete the package and reduce the amount of code we're maintaining? * woops, we're still missing the publish android script * fix(publish-android.bash): add proper API key * ouch fix another place where the name changed --- .../engine/.github => .github}/workflows/android.yml | 2 +- {internal/engine/MOBILE => MOBILE}/README.md | 0 MOBILE/android/.gitignore | 2 ++ {internal/engine/MOBILE/android => MOBILE/ios}/.gitignore | 0 {internal/engine/MOBILE => MOBILE}/template.podspec | 0 {internal/engine/MOBILE => MOBILE}/template.pom | 0 internal/engine/build-android.bash => build-android.bash | 2 +- internal/engine/MOBILE/ios/.gitignore | 1 - internal/engine/cmd/jafar/iptables/iptables.go | 2 +- internal/engine/cmd/jafar/iptables/iptables_linux.go | 2 +- internal/engine/cmd/jafar/main.go | 2 +- internal/engine/cmd/jafar/uncensored/uncensored.go | 2 +- internal/engine/cmd/oohelper/internal/client.go | 2 +- internal/engine/cmd/oohelper/oohelper.go | 2 +- internal/engine/experiment/dnscheck/dnscheck.go | 2 +- internal/engine/experiment/tlstool/tlstool.go | 2 +- internal/engine/experiment/tor/tor.go | 2 +- internal/engine/experiment/urlgetter/runner.go | 2 +- internal/engine/experiment/webconnectivity/endpoints.go | 2 +- internal/engine/experiment/whatsapp/whatsapp.go | 2 +- internal/engine/geolocate/geolocate.go | 2 +- internal/engine/internal/mockable/mockable.go | 2 +- .../engine/internal/sessionresolver/sessionresolver.go | 2 +- internal/engine/legacy/netx/handlers/handlers.go | 2 +- internal/engine/legacy/oonitemplates/oonitemplates.go | 2 +- internal/engine/netx/netx.go | 2 +- internal/engine/netx/resolver/bogon.go | 2 +- internal/engine/{internal => }/runtimex/runtimex.go | 0 internal/engine/{internal => }/runtimex/runtimex_test.go | 2 +- internal/{engine => }/libooniffi/.gitignore | 0 internal/{engine => }/libooniffi/README.md | 0 internal/{engine => }/libooniffi/buildtest.bash | 0 internal/{engine => }/libooniffi/ooniffi.c | 0 internal/{engine => }/libooniffi/ooniffi.def | 0 internal/{engine => }/libooniffi/ooniffi.go | 2 +- internal/{engine => }/libooniffi/ooniffi.h | 0 internal/{engine => }/libooniffi/ooniffi_test.go | 0 internal/{engine => }/libooniffi/testdata/ffirun.cpp | 0 .../{engine => }/libooniffi/testdata/webconnectivity.json | 0 {internal/engine => pkg}/oonimkall/README.md | 2 +- {internal/engine => pkg}/oonimkall/session.go | 2 +- .../engine => pkg}/oonimkall/session_integration_test.go | 2 +- {internal/engine => pkg}/oonimkall/session_test.go | 0 {internal/engine => pkg}/oonimkall/sessioncontext.go | 0 {internal/engine => pkg}/oonimkall/sessioncontext_test.go | 0 {internal/engine => pkg}/oonimkall/sessionlogger.go | 0 {internal/engine => pkg}/oonimkall/sessionlogger_test.go | 0 {internal/engine => pkg}/oonimkall/task.go | 4 ++-- .../engine => pkg}/oonimkall/task_integration_test.go | 4 ++-- {internal/engine => pkg}/oonimkall/task_internal_test.go | 0 {internal/engine => pkg}/oonimkall/tasks/chanlogger.go | 0 {internal/engine => pkg}/oonimkall/tasks/event.go | 0 {internal/engine => pkg}/oonimkall/tasks/eventemitter.go | 0 .../engine => pkg}/oonimkall/tasks/eventemitter_test.go | 2 +- {internal/engine => pkg}/oonimkall/tasks/runner.go | 2 +- .../oonimkall/tasks/runner_integration_test.go | 2 +- .../oonimkall/tasks/runner_internal_test.go | 0 {internal/engine => pkg}/oonimkall/tasks/settings.go | 0 {internal/engine => pkg}/oonimkall/uuid.go | 0 {internal/engine => pkg}/oonimkall/uuid_test.go | 2 +- .../engine/publish-android.bash => publish-android.bash | 8 ++++---- 61 files changed, 40 insertions(+), 39 deletions(-) rename {internal/engine/.github => .github}/workflows/android.yml (88%) rename {internal/engine/MOBILE => MOBILE}/README.md (100%) create mode 100644 MOBILE/android/.gitignore rename {internal/engine/MOBILE/android => MOBILE/ios}/.gitignore (100%) rename {internal/engine/MOBILE => MOBILE}/template.podspec (100%) rename {internal/engine/MOBILE => MOBILE}/template.pom (100%) rename internal/engine/build-android.bash => build-android.bash (95%) delete mode 100644 internal/engine/MOBILE/ios/.gitignore rename internal/engine/{internal => }/runtimex/runtimex.go (100%) rename internal/engine/{internal => }/runtimex/runtimex_test.go (86%) rename internal/{engine => }/libooniffi/.gitignore (100%) rename internal/{engine => }/libooniffi/README.md (100%) rename internal/{engine => }/libooniffi/buildtest.bash (100%) rename internal/{engine => }/libooniffi/ooniffi.c (100%) rename internal/{engine => }/libooniffi/ooniffi.def (100%) rename internal/{engine => }/libooniffi/ooniffi.go (97%) rename internal/{engine => }/libooniffi/ooniffi.h (100%) rename internal/{engine => }/libooniffi/ooniffi_test.go (100%) rename internal/{engine => }/libooniffi/testdata/ffirun.cpp (100%) rename internal/{engine => }/libooniffi/testdata/webconnectivity.json (100%) rename {internal/engine => pkg}/oonimkall/README.md (94%) rename {internal/engine => pkg}/oonimkall/session.go (99%) rename {internal/engine => pkg}/oonimkall/session_integration_test.go (99%) rename {internal/engine => pkg}/oonimkall/session_test.go (100%) rename {internal/engine => pkg}/oonimkall/sessioncontext.go (100%) rename {internal/engine => pkg}/oonimkall/sessioncontext_test.go (100%) rename {internal/engine => pkg}/oonimkall/sessionlogger.go (100%) rename {internal/engine => pkg}/oonimkall/sessionlogger_test.go (100%) rename {internal/engine => pkg}/oonimkall/task.go (96%) rename {internal/engine => pkg}/oonimkall/task_integration_test.go (99%) rename {internal/engine => pkg}/oonimkall/task_internal_test.go (100%) rename {internal/engine => pkg}/oonimkall/tasks/chanlogger.go (100%) rename {internal/engine => pkg}/oonimkall/tasks/event.go (100%) rename {internal/engine => pkg}/oonimkall/tasks/eventemitter.go (100%) rename {internal/engine => pkg}/oonimkall/tasks/eventemitter_test.go (95%) rename {internal/engine => pkg}/oonimkall/tasks/runner.go (99%) rename {internal/engine => pkg}/oonimkall/tasks/runner_integration_test.go (99%) rename {internal/engine => pkg}/oonimkall/tasks/runner_internal_test.go (100%) rename {internal/engine => pkg}/oonimkall/tasks/settings.go (100%) rename {internal/engine => pkg}/oonimkall/uuid.go (100%) rename {internal/engine => pkg}/oonimkall/uuid_test.go (75%) rename internal/engine/publish-android.bash => publish-android.bash (77%) diff --git a/internal/engine/.github/workflows/android.yml b/.github/workflows/android.yml similarity index 88% rename from internal/engine/.github/workflows/android.yml rename to .github/workflows/android.yml index 9ccfda9..8551d1e 100644 --- a/internal/engine/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -20,4 +20,4 @@ jobs: ANDROID_HOME: /usr/local/Caskroom/android-sdk/4333796 - run: ./publish-android.bash env: - BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }} + MOBILE_BINTRAY_API_KEY: ${{ secrets.MOBILE_BINTRAY_API_KEY }} diff --git a/internal/engine/MOBILE/README.md b/MOBILE/README.md similarity index 100% rename from internal/engine/MOBILE/README.md rename to MOBILE/README.md diff --git a/MOBILE/android/.gitignore b/MOBILE/android/.gitignore new file mode 100644 index 0000000..48e4fd1 --- /dev/null +++ b/MOBILE/android/.gitignore @@ -0,0 +1,2 @@ +/oonimkall-sources.jar +/oonimkall.aar diff --git a/internal/engine/MOBILE/android/.gitignore b/MOBILE/ios/.gitignore similarity index 100% rename from internal/engine/MOBILE/android/.gitignore rename to MOBILE/ios/.gitignore diff --git a/internal/engine/MOBILE/template.podspec b/MOBILE/template.podspec similarity index 100% rename from internal/engine/MOBILE/template.podspec rename to MOBILE/template.podspec diff --git a/internal/engine/MOBILE/template.pom b/MOBILE/template.pom similarity index 100% rename from internal/engine/MOBILE/template.pom rename to MOBILE/template.pom diff --git a/internal/engine/build-android.bash b/build-android.bash similarity index 95% rename from internal/engine/build-android.bash rename to build-android.bash index f62be25..4951e0a 100755 --- a/internal/engine/build-android.bash +++ b/build-android.bash @@ -52,4 +52,4 @@ go get -u golang.org/x/mobile/cmd/gomobile gomobile init export GO111MODULE=on output=MOBILE/android/oonimkall.aar -gomobile bind -target=android -o $output -ldflags="-s -w" ./oonimkall +gomobile bind -target=android -o $output -ldflags="-s -w" ./pkg/oonimkall diff --git a/internal/engine/MOBILE/ios/.gitignore b/internal/engine/MOBILE/ios/.gitignore deleted file mode 100644 index 8b13789..0000000 --- a/internal/engine/MOBILE/ios/.gitignore +++ /dev/null @@ -1 +0,0 @@ - diff --git a/internal/engine/cmd/jafar/iptables/iptables.go b/internal/engine/cmd/jafar/iptables/iptables.go index 1184489..7743eea 100644 --- a/internal/engine/cmd/jafar/iptables/iptables.go +++ b/internal/engine/cmd/jafar/iptables/iptables.go @@ -4,7 +4,7 @@ package iptables import ( - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" ) type shell interface { diff --git a/internal/engine/cmd/jafar/iptables/iptables_linux.go b/internal/engine/cmd/jafar/iptables/iptables_linux.go index 01917b8..7f53f3b 100644 --- a/internal/engine/cmd/jafar/iptables/iptables_linux.go +++ b/internal/engine/cmd/jafar/iptables/iptables_linux.go @@ -4,7 +4,7 @@ package iptables import ( "github.com/ooni/probe-cli/v3/internal/engine/cmd/jafar/shellx" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" ) type linuxShell struct{} diff --git a/internal/engine/cmd/jafar/main.go b/internal/engine/cmd/jafar/main.go index 44f106e..a1404bc 100644 --- a/internal/engine/cmd/jafar/main.go +++ b/internal/engine/cmd/jafar/main.go @@ -26,7 +26,7 @@ import ( "github.com/ooni/probe-cli/v3/internal/engine/cmd/jafar/shellx" "github.com/ooni/probe-cli/v3/internal/engine/cmd/jafar/tlsproxy" "github.com/ooni/probe-cli/v3/internal/engine/cmd/jafar/uncensored" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" ) var ( diff --git a/internal/engine/cmd/jafar/uncensored/uncensored.go b/internal/engine/cmd/jafar/uncensored/uncensored.go index aa9e378..6e4d36d 100644 --- a/internal/engine/cmd/jafar/uncensored/uncensored.go +++ b/internal/engine/cmd/jafar/uncensored/uncensored.go @@ -9,7 +9,7 @@ import ( "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/netx" ) diff --git a/internal/engine/cmd/oohelper/internal/client.go b/internal/engine/cmd/oohelper/internal/client.go index 2ba2d49..10160f8 100644 --- a/internal/engine/cmd/oohelper/internal/client.go +++ b/internal/engine/cmd/oohelper/internal/client.go @@ -14,7 +14,7 @@ import ( "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/engine/experiment/webconnectivity" "github.com/ooni/probe-cli/v3/internal/engine/internal/httpheader" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/netx" "github.com/ooni/probe-cli/v3/internal/engine/version" ) diff --git a/internal/engine/cmd/oohelper/oohelper.go b/internal/engine/cmd/oohelper/oohelper.go index 1d73bd2..38376c6 100644 --- a/internal/engine/cmd/oohelper/oohelper.go +++ b/internal/engine/cmd/oohelper/oohelper.go @@ -11,7 +11,7 @@ import ( "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/engine/cmd/oohelper/internal" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/netx" ) diff --git a/internal/engine/experiment/dnscheck/dnscheck.go b/internal/engine/experiment/dnscheck/dnscheck.go index f4df2ca..417bd70 100644 --- a/internal/engine/experiment/dnscheck/dnscheck.go +++ b/internal/engine/experiment/dnscheck/dnscheck.go @@ -15,7 +15,7 @@ import ( "time" "github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/model" "github.com/ooni/probe-cli/v3/internal/engine/netx" "github.com/ooni/probe-cli/v3/internal/engine/netx/archival" diff --git a/internal/engine/experiment/tlstool/tlstool.go b/internal/engine/experiment/tlstool/tlstool.go index 24d549d..66ccc53 100644 --- a/internal/engine/experiment/tlstool/tlstool.go +++ b/internal/engine/experiment/tlstool/tlstool.go @@ -16,7 +16,7 @@ import ( "time" "github.com/ooni/probe-cli/v3/internal/engine/experiment/tlstool/internal" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/model" "github.com/ooni/probe-cli/v3/internal/engine/netx" "github.com/ooni/probe-cli/v3/internal/engine/netx/archival" diff --git a/internal/engine/experiment/tor/tor.go b/internal/engine/experiment/tor/tor.go index f32e651..eab83d9 100644 --- a/internal/engine/experiment/tor/tor.go +++ b/internal/engine/experiment/tor/tor.go @@ -14,7 +14,7 @@ import ( "github.com/ooni/probe-cli/v3/internal/engine/atomicx" "github.com/ooni/probe-cli/v3/internal/engine/internal/httpheader" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/legacy/netxlogger" "github.com/ooni/probe-cli/v3/internal/engine/legacy/oonidatamodel" "github.com/ooni/probe-cli/v3/internal/engine/legacy/oonitemplates" diff --git a/internal/engine/experiment/urlgetter/runner.go b/internal/engine/experiment/urlgetter/runner.go index 07f3573..15b09c1 100644 --- a/internal/engine/experiment/urlgetter/runner.go +++ b/internal/engine/experiment/urlgetter/runner.go @@ -11,7 +11,7 @@ import ( "net/url" "github.com/ooni/probe-cli/v3/internal/engine/internal/httpheader" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/netx" "github.com/ooni/probe-cli/v3/internal/engine/netx/errorx" ) diff --git a/internal/engine/experiment/webconnectivity/endpoints.go b/internal/engine/experiment/webconnectivity/endpoints.go index ce39326..a228798 100644 --- a/internal/engine/experiment/webconnectivity/endpoints.go +++ b/internal/engine/experiment/webconnectivity/endpoints.go @@ -4,7 +4,7 @@ import ( "net" "net/url" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" ) // EndpointInfo describes a TCP/TLS endpoint. diff --git a/internal/engine/experiment/whatsapp/whatsapp.go b/internal/engine/experiment/whatsapp/whatsapp.go index 035f2fc..e8d085d 100644 --- a/internal/engine/experiment/whatsapp/whatsapp.go +++ b/internal/engine/experiment/whatsapp/whatsapp.go @@ -14,7 +14,7 @@ import ( "github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter" "github.com/ooni/probe-cli/v3/internal/engine/internal/httpfailure" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/model" ) diff --git a/internal/engine/geolocate/geolocate.go b/internal/engine/geolocate/geolocate.go index b1f84db..3b29d73 100644 --- a/internal/engine/geolocate/geolocate.go +++ b/internal/engine/geolocate/geolocate.go @@ -7,7 +7,7 @@ import ( "fmt" "net/http" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/model" "github.com/ooni/probe-cli/v3/internal/engine/version" ) diff --git a/internal/engine/internal/mockable/mockable.go b/internal/engine/internal/mockable/mockable.go index 5d023e4..57e6796 100644 --- a/internal/engine/internal/mockable/mockable.go +++ b/internal/engine/internal/mockable/mockable.go @@ -8,7 +8,7 @@ import ( "github.com/ooni/probe-cli/v3/internal/engine/internal/kvstore" "github.com/ooni/probe-cli/v3/internal/engine/internal/psiphonx" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/internal/torx" "github.com/ooni/probe-cli/v3/internal/engine/internal/tunnel" "github.com/ooni/probe-cli/v3/internal/engine/model" diff --git a/internal/engine/internal/sessionresolver/sessionresolver.go b/internal/engine/internal/sessionresolver/sessionresolver.go index 162ea97..8dec4a8 100644 --- a/internal/engine/internal/sessionresolver/sessionresolver.go +++ b/internal/engine/internal/sessionresolver/sessionresolver.go @@ -9,7 +9,7 @@ import ( "time" "github.com/ooni/probe-cli/v3/internal/engine/atomicx" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/netx" ) diff --git a/internal/engine/legacy/netx/handlers/handlers.go b/internal/engine/legacy/netx/handlers/handlers.go index 9bb8153..e401dc7 100644 --- a/internal/engine/legacy/netx/handlers/handlers.go +++ b/internal/engine/legacy/netx/handlers/handlers.go @@ -6,7 +6,7 @@ import ( "fmt" "sync" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/legacy/netx/modelx" ) diff --git a/internal/engine/legacy/oonitemplates/oonitemplates.go b/internal/engine/legacy/oonitemplates/oonitemplates.go index 2a6c7e9..496f45e 100644 --- a/internal/engine/legacy/oonitemplates/oonitemplates.go +++ b/internal/engine/legacy/oonitemplates/oonitemplates.go @@ -21,7 +21,7 @@ import ( goptlib "git.torproject.org/pluggable-transports/goptlib.git" "github.com/ooni/probe-cli/v3/internal/engine/atomicx" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/legacy/netx" "github.com/ooni/probe-cli/v3/internal/engine/legacy/netx/handlers" "github.com/ooni/probe-cli/v3/internal/engine/legacy/netx/modelx" diff --git a/internal/engine/netx/netx.go b/internal/engine/netx/netx.go index 4fb96a2..e56698a 100644 --- a/internal/engine/netx/netx.go +++ b/internal/engine/netx/netx.go @@ -31,7 +31,7 @@ import ( "net/url" "github.com/lucas-clemente/quic-go" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/netx/bytecounter" "github.com/ooni/probe-cli/v3/internal/engine/netx/dialer" "github.com/ooni/probe-cli/v3/internal/engine/netx/gocertifi" diff --git a/internal/engine/netx/resolver/bogon.go b/internal/engine/netx/resolver/bogon.go index 7dddf32..3748325 100644 --- a/internal/engine/netx/resolver/bogon.go +++ b/internal/engine/netx/resolver/bogon.go @@ -4,7 +4,7 @@ import ( "context" "net" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/netx/errorx" ) diff --git a/internal/engine/internal/runtimex/runtimex.go b/internal/engine/runtimex/runtimex.go similarity index 100% rename from internal/engine/internal/runtimex/runtimex.go rename to internal/engine/runtimex/runtimex.go diff --git a/internal/engine/internal/runtimex/runtimex_test.go b/internal/engine/runtimex/runtimex_test.go similarity index 86% rename from internal/engine/internal/runtimex/runtimex_test.go rename to internal/engine/runtimex/runtimex_test.go index 7353645..19a29c4 100644 --- a/internal/engine/internal/runtimex/runtimex_test.go +++ b/internal/engine/runtimex/runtimex_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" ) func TestGood(t *testing.T) { diff --git a/internal/engine/libooniffi/.gitignore b/internal/libooniffi/.gitignore similarity index 100% rename from internal/engine/libooniffi/.gitignore rename to internal/libooniffi/.gitignore diff --git a/internal/engine/libooniffi/README.md b/internal/libooniffi/README.md similarity index 100% rename from internal/engine/libooniffi/README.md rename to internal/libooniffi/README.md diff --git a/internal/engine/libooniffi/buildtest.bash b/internal/libooniffi/buildtest.bash similarity index 100% rename from internal/engine/libooniffi/buildtest.bash rename to internal/libooniffi/buildtest.bash diff --git a/internal/engine/libooniffi/ooniffi.c b/internal/libooniffi/ooniffi.c similarity index 100% rename from internal/engine/libooniffi/ooniffi.c rename to internal/libooniffi/ooniffi.c diff --git a/internal/engine/libooniffi/ooniffi.def b/internal/libooniffi/ooniffi.def similarity index 100% rename from internal/engine/libooniffi/ooniffi.def rename to internal/libooniffi/ooniffi.def diff --git a/internal/engine/libooniffi/ooniffi.go b/internal/libooniffi/ooniffi.go similarity index 97% rename from internal/engine/libooniffi/ooniffi.go rename to internal/libooniffi/ooniffi.go index 025c7cf..05d81c7 100644 --- a/internal/engine/libooniffi/ooniffi.go +++ b/internal/libooniffi/ooniffi.go @@ -17,7 +17,7 @@ import ( "sync" "unsafe" - "github.com/ooni/probe-cli/v3/internal/engine/oonimkall" + "github.com/ooni/probe-cli/v3/pkg/oonimkall" ) var ( diff --git a/internal/engine/libooniffi/ooniffi.h b/internal/libooniffi/ooniffi.h similarity index 100% rename from internal/engine/libooniffi/ooniffi.h rename to internal/libooniffi/ooniffi.h diff --git a/internal/engine/libooniffi/ooniffi_test.go b/internal/libooniffi/ooniffi_test.go similarity index 100% rename from internal/engine/libooniffi/ooniffi_test.go rename to internal/libooniffi/ooniffi_test.go diff --git a/internal/engine/libooniffi/testdata/ffirun.cpp b/internal/libooniffi/testdata/ffirun.cpp similarity index 100% rename from internal/engine/libooniffi/testdata/ffirun.cpp rename to internal/libooniffi/testdata/ffirun.cpp diff --git a/internal/engine/libooniffi/testdata/webconnectivity.json b/internal/libooniffi/testdata/webconnectivity.json similarity index 100% rename from internal/engine/libooniffi/testdata/webconnectivity.json rename to internal/libooniffi/testdata/webconnectivity.json diff --git a/internal/engine/oonimkall/README.md b/pkg/oonimkall/README.md similarity index 94% rename from internal/engine/oonimkall/README.md rename to pkg/oonimkall/README.md index 5e09efb..9834c98 100644 --- a/internal/engine/oonimkall/README.md +++ b/pkg/oonimkall/README.md @@ -1,4 +1,4 @@ -# Package github.com/ooni/probe-engine/oonimkall +# Package github.com/ooni/probe-cli/pkg/oonimkall Package oonimkall implements APIs used by OONI mobile apps. We expose these APIs to mobile apps using gomobile. diff --git a/internal/engine/oonimkall/session.go b/pkg/oonimkall/session.go similarity index 99% rename from internal/engine/oonimkall/session.go rename to pkg/oonimkall/session.go index 01ab65e..2972b41 100644 --- a/internal/engine/oonimkall/session.go +++ b/pkg/oonimkall/session.go @@ -10,7 +10,7 @@ import ( engine "github.com/ooni/probe-cli/v3/internal/engine" "github.com/ooni/probe-cli/v3/internal/engine/atomicx" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/model" "github.com/ooni/probe-cli/v3/internal/engine/probeservices" ) diff --git a/internal/engine/oonimkall/session_integration_test.go b/pkg/oonimkall/session_integration_test.go similarity index 99% rename from internal/engine/oonimkall/session_integration_test.go rename to pkg/oonimkall/session_integration_test.go index 04dc1b7..8cd8750 100644 --- a/internal/engine/oonimkall/session_integration_test.go +++ b/pkg/oonimkall/session_integration_test.go @@ -15,7 +15,7 @@ import ( engine "github.com/ooni/probe-cli/v3/internal/engine" "github.com/ooni/probe-cli/v3/internal/engine/geolocate" "github.com/ooni/probe-cli/v3/internal/engine/model" - "github.com/ooni/probe-cli/v3/internal/engine/oonimkall" + "github.com/ooni/probe-cli/v3/pkg/oonimkall" ) func NewSessionWithAssetsDir(assetsDir string) (*oonimkall.Session, error) { diff --git a/internal/engine/oonimkall/session_test.go b/pkg/oonimkall/session_test.go similarity index 100% rename from internal/engine/oonimkall/session_test.go rename to pkg/oonimkall/session_test.go diff --git a/internal/engine/oonimkall/sessioncontext.go b/pkg/oonimkall/sessioncontext.go similarity index 100% rename from internal/engine/oonimkall/sessioncontext.go rename to pkg/oonimkall/sessioncontext.go diff --git a/internal/engine/oonimkall/sessioncontext_test.go b/pkg/oonimkall/sessioncontext_test.go similarity index 100% rename from internal/engine/oonimkall/sessioncontext_test.go rename to pkg/oonimkall/sessioncontext_test.go diff --git a/internal/engine/oonimkall/sessionlogger.go b/pkg/oonimkall/sessionlogger.go similarity index 100% rename from internal/engine/oonimkall/sessionlogger.go rename to pkg/oonimkall/sessionlogger.go diff --git a/internal/engine/oonimkall/sessionlogger_test.go b/pkg/oonimkall/sessionlogger_test.go similarity index 100% rename from internal/engine/oonimkall/sessionlogger_test.go rename to pkg/oonimkall/sessionlogger_test.go diff --git a/internal/engine/oonimkall/task.go b/pkg/oonimkall/task.go similarity index 96% rename from internal/engine/oonimkall/task.go rename to pkg/oonimkall/task.go index c256467..3e68e95 100644 --- a/internal/engine/oonimkall/task.go +++ b/pkg/oonimkall/task.go @@ -44,8 +44,8 @@ import ( "encoding/json" "github.com/ooni/probe-cli/v3/internal/engine/atomicx" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" - "github.com/ooni/probe-cli/v3/internal/engine/oonimkall/tasks" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" + "github.com/ooni/probe-cli/v3/pkg/oonimkall/tasks" ) // Task is an asynchronous task running an experiment. It mimics the diff --git a/internal/engine/oonimkall/task_integration_test.go b/pkg/oonimkall/task_integration_test.go similarity index 99% rename from internal/engine/oonimkall/task_integration_test.go rename to pkg/oonimkall/task_integration_test.go index 7415778..4e9282c 100644 --- a/internal/engine/oonimkall/task_integration_test.go +++ b/pkg/oonimkall/task_integration_test.go @@ -9,8 +9,8 @@ import ( "github.com/google/go-cmp/cmp" "github.com/ooni/probe-cli/v3/internal/engine/model" - "github.com/ooni/probe-cli/v3/internal/engine/oonimkall" - "github.com/ooni/probe-cli/v3/internal/engine/oonimkall/tasks" + "github.com/ooni/probe-cli/v3/pkg/oonimkall" + "github.com/ooni/probe-cli/v3/pkg/oonimkall/tasks" ) type eventlike struct { diff --git a/internal/engine/oonimkall/task_internal_test.go b/pkg/oonimkall/task_internal_test.go similarity index 100% rename from internal/engine/oonimkall/task_internal_test.go rename to pkg/oonimkall/task_internal_test.go diff --git a/internal/engine/oonimkall/tasks/chanlogger.go b/pkg/oonimkall/tasks/chanlogger.go similarity index 100% rename from internal/engine/oonimkall/tasks/chanlogger.go rename to pkg/oonimkall/tasks/chanlogger.go diff --git a/internal/engine/oonimkall/tasks/event.go b/pkg/oonimkall/tasks/event.go similarity index 100% rename from internal/engine/oonimkall/tasks/event.go rename to pkg/oonimkall/tasks/event.go diff --git a/internal/engine/oonimkall/tasks/eventemitter.go b/pkg/oonimkall/tasks/eventemitter.go similarity index 100% rename from internal/engine/oonimkall/tasks/eventemitter.go rename to pkg/oonimkall/tasks/eventemitter.go diff --git a/internal/engine/oonimkall/tasks/eventemitter_test.go b/pkg/oonimkall/tasks/eventemitter_test.go similarity index 95% rename from internal/engine/oonimkall/tasks/eventemitter_test.go rename to pkg/oonimkall/tasks/eventemitter_test.go index ab24f7c..308d8ba 100644 --- a/internal/engine/oonimkall/tasks/eventemitter_test.go +++ b/pkg/oonimkall/tasks/eventemitter_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/ooni/probe-cli/v3/internal/engine/oonimkall/tasks" + "github.com/ooni/probe-cli/v3/pkg/oonimkall/tasks" ) func TestDisabledEvents(t *testing.T) { diff --git a/internal/engine/oonimkall/tasks/runner.go b/pkg/oonimkall/tasks/runner.go similarity index 99% rename from internal/engine/oonimkall/tasks/runner.go rename to pkg/oonimkall/tasks/runner.go index ffd1ec2..531d135 100644 --- a/internal/engine/oonimkall/tasks/runner.go +++ b/pkg/oonimkall/tasks/runner.go @@ -8,7 +8,7 @@ import ( "time" engine "github.com/ooni/probe-cli/v3/internal/engine" - "github.com/ooni/probe-cli/v3/internal/engine/internal/runtimex" + "github.com/ooni/probe-cli/v3/internal/engine/runtimex" "github.com/ooni/probe-cli/v3/internal/engine/model" ) diff --git a/internal/engine/oonimkall/tasks/runner_integration_test.go b/pkg/oonimkall/tasks/runner_integration_test.go similarity index 99% rename from internal/engine/oonimkall/tasks/runner_integration_test.go rename to pkg/oonimkall/tasks/runner_integration_test.go index 31c88fa..e8514b6 100644 --- a/internal/engine/oonimkall/tasks/runner_integration_test.go +++ b/pkg/oonimkall/tasks/runner_integration_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/ooni/probe-cli/v3/internal/engine/oonimkall/tasks" + "github.com/ooni/probe-cli/v3/pkg/oonimkall/tasks" ) func TestRunnerMaybeLookupBackendsFailure(t *testing.T) { diff --git a/internal/engine/oonimkall/tasks/runner_internal_test.go b/pkg/oonimkall/tasks/runner_internal_test.go similarity index 100% rename from internal/engine/oonimkall/tasks/runner_internal_test.go rename to pkg/oonimkall/tasks/runner_internal_test.go diff --git a/internal/engine/oonimkall/tasks/settings.go b/pkg/oonimkall/tasks/settings.go similarity index 100% rename from internal/engine/oonimkall/tasks/settings.go rename to pkg/oonimkall/tasks/settings.go diff --git a/internal/engine/oonimkall/uuid.go b/pkg/oonimkall/uuid.go similarity index 100% rename from internal/engine/oonimkall/uuid.go rename to pkg/oonimkall/uuid.go diff --git a/internal/engine/oonimkall/uuid_test.go b/pkg/oonimkall/uuid_test.go similarity index 75% rename from internal/engine/oonimkall/uuid_test.go rename to pkg/oonimkall/uuid_test.go index 02c8bf1..60ae94d 100644 --- a/internal/engine/oonimkall/uuid_test.go +++ b/pkg/oonimkall/uuid_test.go @@ -3,7 +3,7 @@ package oonimkall_test import ( "testing" - "github.com/ooni/probe-cli/v3/internal/engine/oonimkall" + "github.com/ooni/probe-cli/v3/pkg/oonimkall" ) func TestNewUUID4(t *testing.T) { diff --git a/internal/engine/publish-android.bash b/publish-android.bash similarity index 77% rename from internal/engine/publish-android.bash rename to publish-android.bash index c2090e8..a11722d 100755 --- a/internal/engine/publish-android.bash +++ b/publish-android.bash @@ -13,16 +13,16 @@ pomfile=./MOBILE/android/$pkgname-$version.pom pomtemplate=./MOBILE/template.pom user=bassosimone cat $pomtemplate|sed "s/@VERSION@/$version/g" > $pomfile -if [ -z $BINTRAY_API_KEY ]; then - echo "FATAL: missing BINTRAY_API_KEY variable" 1>&2 +if [ -z $MOBILE_BINTRAY_API_KEY ]; then + echo "FATAL: missing MOBILE_BINTRAY_API_KEY variable" 1>&2 exit 1 fi # We currently publish the mobile-staging branch. To cleanup we can fetch all the versions using -# the +# the # query, which returns a list of versions. From such list, we can delete the versions we # don't need using . for filename in $aarfile_version $sourcesfile_version $pomfile; do basefilename=$(basename $filename) - curl -sT $filename -u $user:$BINTRAY_API_KEY $baseurl/$basefilename?publish=1 >/dev/null + curl -sT $filename -u $user:$MOBILE_BINTRAY_API_KEY $baseurl/$basefilename?publish=1 >/dev/null done echo "implementation 'org.ooni:oonimkall:$version'"