Skip to content

Commit

Permalink
Remove Measurement Kit dependency (#806)
Browse files Browse the repository at this point in the history
Part of #776
  • Loading branch information
bassosimone authored Jul 15, 2020
1 parent 09a4bfc commit f86f382
Show file tree
Hide file tree
Showing 27 changed files with 38 additions and 991 deletions.
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/routine-sprint-releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ assignees: bassosimone
- [ ] Update internal/httpheader/useragent.go
- [ ] Update version/version.go
- [ ] Update internal/resources/assets.go
- [ ] Update measurementkit/mkcgo/mkcgo.go
- [ ] Update .github/workflows/mk.yml
- [ ] Tag a new version of ooni/probe-engine
- [ ] Create release at GitHub
- [ ] Update ooni/probe-engine mobile-staging branch
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v2
- run: go test -tags nomk,shaping -v -coverprofile=probe-engine.cov -coverpkg=./... ./...
- run: go test -tags shaping -v -coverprofile=probe-engine.cov -coverpkg=./... ./...
- uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: probe-engine.cov
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/mk.sh

This file was deleted.

8 changes: 0 additions & 8 deletions .github/workflows/mk.yml

This file was deleted.

43 changes: 25 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,26 @@ miniooni CLI will be stable over time.
## Integrating ooni/probe-engine

This software uses [Go modules](https://github.com/golang/go/wiki/Modules)
and requires Go v1.14+. We also depend on [Measurement Kit](
https://github.com/measurement-kit/measurement-kit), a C++14 library
implementing many OONI tests, a.k.a. MK.
and requires Go v1.14+. You can pull the latest version as a dependency from
your modules aware project by using

Note that passing the `-tags nomk` flag to Go will disable linking
Measurement Kit into the resulting Go binaries. You may want that in
cases where you only want to use experiments written in Go.

We plan on gradually rewriting all OONI tests in Go, therefore the
dependency on Measurement Kit will eventually be removed. A future version
of this document will provide platform specific instructions for
installing Measurement Kit and linking to it.
```bash
go get -v github.com/ooni/probe-engine
```

## Building miniooni

```
go build -v -tags nomk ./cmd/miniooni/
```bash
go build -v ./cmd/miniooni/
```

Omit `-tags nomk` to link with MK.

## Building Android bindings

```
```bash
./build-android.bash
```

When building Android bindings, we automatically omit linking with MK. We
automatically build Android bindings whenever commits are pushed to the
We automatically build Android bindings whenever commits are pushed to the
`mobile-staging` branch. Such builds could be integrated by using:

```Groovy
Expand All @@ -68,6 +59,22 @@ implementation "org.ooni:oonimkall:VERSION"
Where VERSION is like `2020.03.30-231914` corresponding to the moment in
time in which the version has been built.

## Building iOS bindings

```bash
./build-ios.bash
```

We automatically build iOS bindings whenever commits are pushed to the
`mobile-staging` branch. Such builds could be integrated by using:

```ruby
pod 'oonimkall', :podspec => 'https://dl.bintray.com/ooni/ios/oonimkall-VERSION.podspec'
```

Where VERSION is like `2020.03.30-231914` corresponding to the moment in
time in which the version has been built.

## Release procedure

1. make sure that dependencies are up to date
Expand Down
2 changes: 1 addition & 1 deletion build-android.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ output=MOBILE/dist/oonimkall.aar
go get -u golang.org/x/mobile/cmd/gomobile
gomobile init
export GO111MODULE=on
gomobile bind -target=android -o $output -tags nomk -ldflags="-s -w" ./oonimkall
gomobile bind -target=android -o $output -ldflags="-s -w" ./oonimkall
14 changes: 6 additions & 8 deletions build-cli.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#!/bin/sh
set -ex
case $1 in
_linux)
apk add gcc musl-dev
go build -tags "netgo nomk" -ldflags='-s -w -extldflags "-static"' \
-o ./CLI/linux/amd64/miniooni ./cmd/miniooni;;
darwin)
go build -tags nomk -o ./CLI/darwin/amd64 ./cmd/miniooni;;
export GOOS=darwin GOARCH=amd64
go build -o ./CLI/darwin/amd64 -ldflags="-s -w" ./cmd/miniooni;;
linux)
docker run -v`pwd`:/ooni -w/ooni golang:alpine ./build-cli.sh _linux;;
export GOOS=linux GOARCH=amd64
go build -o ./CLI/linux/amd64 -ldflags="-s -w" ./cmd/miniooni;;
windows)
export CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64
go build -tags nomk -o ./CLI/windows/amd64 ./cmd/miniooni;;
export GOOS=windows GOARCH=amd64
go build -o ./CLI/windows/amd64 -ldflags="-s -w" ./cmd/miniooni;;
*)
echo "usage: $0 darwin|linux|windows" 1>&2
exit 1
Expand Down
2 changes: 1 addition & 1 deletion build-ios.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ output=MOBILE/dist/oonimkall.framework
go get -u golang.org/x/mobile/cmd/gomobile
gomobile init
export GO111MODULE=on
gomobile bind -target=ios -o $output -tags nomk -ldflags="-s -w" ./oonimkall
gomobile bind -target=ios -o $output -ldflags="-s -w" ./oonimkall
# See https://github.com/ooni/probe-engine/issues/668
for header in $output/Headers/*.objc.h; do
cat $header | sed 's|^@import Foundation;|#import <Foundation/Foundation.h>|g' > $header.new
Expand Down
8 changes: 4 additions & 4 deletions experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/ooni/probe-engine/experiment/telegram"
"github.com/ooni/probe-engine/experiment/tor"
"github.com/ooni/probe-engine/experiment/urlgetter"
"github.com/ooni/probe-engine/experiment/web_connectivity"
"github.com/ooni/probe-engine/experiment/webconnectivity"
"github.com/ooni/probe-engine/experiment/whatsapp"
"github.com/ooni/probe-engine/internal/platform"
"github.com/ooni/probe-engine/internal/resources"
Expand Down Expand Up @@ -649,11 +649,11 @@ var experimentsByName = map[string]func(*Session) *ExperimentBuilder{
"web_connectivity": func(session *Session) *ExperimentBuilder {
return &ExperimentBuilder{
build: func(config interface{}) *Experiment {
return NewExperiment(session, web_connectivity.NewExperimentMeasurer(
*config.(*web_connectivity.Config),
return NewExperiment(session, webconnectivity.NewExperimentMeasurer(
*config.(*webconnectivity.Config),
))
},
config: &web_connectivity.Config{},
config: &webconnectivity.Config{},
inputPolicy: InputRequired,
}
},
Expand Down
75 changes: 0 additions & 75 deletions experiment/mkevent/mkevent.go

This file was deleted.

104 changes: 0 additions & 104 deletions experiment/mkevent/mkevent_test.go

This file was deleted.

33 changes: 0 additions & 33 deletions experiment/mkhelper/mkhelper.go

This file was deleted.

Loading

0 comments on commit f86f382

Please sign in to comment.