Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove mobile stuff #324

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,6 @@ A utility is provided to run _clean, build, and test_ in sequence with:
mage cbt
```

Mobile targets can be built with:

```bash
// Creates both Android and iOS packages
mage mobile

// Outputs an .xcframework for the crypto, cryptosuite, did packages
mage ios

// Outputs a .jar and .aar for the crypto, cryptosuite, did packages
mage android
```

# Versioning

For information on versioning refer to our [versioning guide](doc/VERSIONING.md).
Expand Down
71 changes: 3 additions & 68 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,20 @@ import (
)

const (
Go = "go"
gomobile = "gomobile"
Go = "go"
)

// Build builds the library.
func Build() error {

fmt.Println("Building...")
println("Building...")
if err := sh.Run(Go, "build", "-tags", "jwx_es256k", "./..."); err != nil {
return err
}
return BuildWasm()
}

func BuildWasm() error {

fmt.Println("Building wasm...")
println("Building wasm...")
env := map[string]string{
"GOOS": "js",
"GOARCH": "wasm",
Expand Down Expand Up @@ -307,68 +304,6 @@ func runCITests(extraTestArgs ...string) error {
return err
}

func installGoMobileIfNotPresent() error {
return installIfNotPresent(gomobile, "golang.org/x/mobile/cmd/gomobile@latest")
}

// Mobile runs gomobile commands on specified packages for both Android and iOS
func Mobile() {
pkgs := []string{"crypto", "did", "cryptosuite"}
if err := IOS(pkgs...); err != nil {
logrus.WithError(err).Error("Error building iOS")
return
}
if err := Android(pkgs...); err != nil {
logrus.WithError(err).Error("Error building Android")
return
}
}

// IOS Generates the iOS packages
// Note: this command also installs "gomobile" if not present
func IOS(pkgs ...string) error {
if err := installGoMobileIfNotPresent(); err != nil {
logrus.WithError(err).Fatal("Error installing gomobile")
return err
}

fmt.Println("Building iOS...")
bindIOS := sh.RunCmd(gomobile, "bind", "-target", "ios")

for _, pkg := range pkgs {
fmt.Printf("Building [%s] package...\n", pkg)
if err := bindIOS(pkg); err != nil {
logrus.WithError(err).Fatalf("Error building iOS pkg: %s", pkg)
return err
}
}

return nil
}

// Android Generates the Android packages
// Note: this command also installs "gomobile" if not present
func Android(pkgs ...string) error {
if err := installGoMobileIfNotPresent(); err != nil {
logrus.WithError(err).Fatal("Error installing gomobile")
return err
}

apiLevel := "23"
println("Building Android - API Level: " + apiLevel + "...")
bindAndroid := sh.RunCmd("gomobile", "bind", "-target", "android", "-androidapi", "23")

for _, pkg := range pkgs {
fmt.Printf("Building [%s] package...\n", pkg)
if err := bindAndroid(pkg); err != nil {
logrus.WithError(err).Fatalf("Error building iOS pkg: %s", pkg)
return err
}
}

return nil
}

// Vuln downloads and runs govulncheck https://go.dev/blog/vuln
func Vuln() error {
println("Vulnerability checks...")
Expand Down