Skip to content

Commit

Permalink
doc(buildtool): explain ANDROID_NDK_HOME for android gomobile
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Jan 27, 2023
1 parent 42050fe commit 9c5fc06
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 3 deletions.
7 changes: 7 additions & 0 deletions internal/cmd/buildtool/android.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ func androidBuildGomobile(deps buildtoolmodel.Dependencies) {

envp := &shellx.Envp{}
envp.Append("ANDROID_HOME", androidHome)

// From the gomobile repository:
//
// Try the ANDROID_NDK_HOME variable. This approach is deprecated, but it has
// the highest priority because it represents an explicit user choice.
//
// See https://github.com/golang/mobile/blob/8578da983/cmd/gomobile/env.go#L394
envp.Append("ANDROID_NDK_HOME", ndkDir)

config := &gomobileConfig{
Expand Down
5 changes: 5 additions & 0 deletions internal/cmd/buildtool/builddeps.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package main

//
// Allows unit testing build rules by abstracting
// specific activities through an interface.
//

import (
"io/fs"

Expand Down
1 change: 1 addition & 0 deletions internal/cmd/buildtool/cdepslibevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package main
//
// Adapted from https://github.com/guardianproject/tor-android
// SPDX-License-Identifier: BSD-3-Clause
//

import (
"path/filepath"
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/buildtool/cdepsopenssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package main
//
// Adapted from https://github.com/guardianproject/tor-android
// SPDX-License-Identifier: BSD-3-Clause
//

import (
"os"
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/buildtool/cdepstor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package main
//
// Adapted from https://github.com/guardianproject/tor-android
// SPDX-License-Identifier: BSD-3-Clause
//

import (
"path/filepath"
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/buildtool/cdepszlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package main
//
// Adapted from https://github.com/guardianproject/tor-android
// SPDX-License-Identifier: BSD-3-Clause
//

import (
"path/filepath"
Expand Down
4 changes: 4 additions & 0 deletions internal/cmd/buildtool/linuxdocker.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package main

//
// Building for linux-static using docker and alpine.
//

import (
"fmt"
"os"
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/buildtool/linuxstatic.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package main

//
// Builds for Linux assuming static linking makes sense.
// Builds for Linux assuming static linking makes sense and
// also assuming we're in a docker container.
//

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/cmd/buildtool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ func main() {
Use: "buildtool",
Short: "Tool for building ooniprobe, miniooni, etc.",
}

root.AddCommand(androidSubcommand())
root.AddCommand(darwinSubcommand())
root.AddCommand(genericSubcommand())
root.AddCommand(iosSubcommand())
root.AddCommand(linuxSubcommand())
root.AddCommand(windowsSubcommand())

logHandler := logx.NewHandlerWithDefaultSettings()
logHandler.Emoji = true
log.Log = &log.Logger{Level: log.InfoLevel, Handler: logHandler}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/buildtool/product.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

//
// Defines the products we can build
// Defines the CLI products we can build
//

import (
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/buildtool/windows.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

//
// Windows build
// Windows cross build using mingw-w64
//

import (
Expand Down

0 comments on commit 9c5fc06

Please sign in to comment.