Skip to content

Commit

Permalink
Merge go.mod from packages into go folder. Update Makefile, build fil…
Browse files Browse the repository at this point in the history
…e and scripts paths from packages to top folder.

Signed-off-by: jefft0 <[email protected]>
  • Loading branch information
jefft0 committed Nov 24, 2022
1 parent f6b8a01 commit 1d37d59
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 65 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,34 @@ jobs:
pod setup
- name: Build iOS packages
working-directory: packages
env:
GOMOBILE_IPFS_VERSION: ${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }} # yamllint disable-line rule:line-length
run: make build_bridge.ios

- name: Upload the core archive
uses: actions/upload-artifact@v2
with:
path: packages/build/ios/cocoapods/core/${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}/Gomobile-IPFS-Core-v${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}.pod.zip # yamllint disable-line rule:line-length
path: build/ios/cocoapods/core/${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}/Gomobile-IPFS-Core-v${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}.pod.zip # yamllint disable-line rule:line-length
name: Gomobile-IPFS-Core-v${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}.pod.zip # yamllint disable-line rule:line-length
if-no-files-found: error

- name: Upload the core podspec
uses: actions/upload-artifact@v2
with:
path: packages/build/ios/cocoapods/core/${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}/Gomobile-IPFS-Core.podspec # yamllint disable-line rule:line-length
path: build/ios/cocoapods/core/${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}/Gomobile-IPFS-Core.podspec # yamllint disable-line rule:line-length
name: Gomobile-IPFS-Core.podspec
if-no-files-found: error

- name: Upload the bridge archive
uses: actions/upload-artifact@v2
with:
path: packages/build/ios/cocoapods/bridge/${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}/Gomobile-IPFS-Bridge-v${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}.pod.zip # yamllint disable-line rule:line-length
path: build/ios/cocoapods/bridge/${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}/Gomobile-IPFS-Bridge-v${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}.pod.zip # yamllint disable-line rule:line-length
name: Gomobile-IPFS-Bridge-v${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}.pod.zip # yamllint disable-line rule:line-length
if-no-files-found: error

- name: Upload the bridge podspec
uses: actions/upload-artifact@v2
with:
path: packages/build/ios/cocoapods/bridge/${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}/Gomobile-IPFS-Bridge.podspec # yamllint disable-line rule:line-length
path: build/ios/cocoapods/bridge/${{ steps.constants.outputs.GOMOBILE_IPFS_VERSION }}/Gomobile-IPFS-Bridge.podspec # yamllint disable-line rule:line-length
name: Gomobile-IPFS-Bridge.podspec
if-no-files-found: error
11 changes: 5 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ jobs:

- name: Set TARGET_SDK in env
run: |
pip3 install -r packages/utils/manifest_get/requirements.txt
export GET_BIN=packages/utils/manifest_get/manifest_get.py
pip3 install -r utils/manifest_get/requirements.txt
export GET_BIN=utils/manifest_get/manifest_get.py
export GET_KEY=global.android.target_sdk_version
echo "TARGET_SDK=$($GET_BIN $GET_KEY)" >> $GITHUB_ENV
Expand All @@ -127,7 +127,6 @@ jobs:
java-version: 11

- name: Build Go Core
working-directory: packages
run: make build_core.android GOMOBILE_TARGET=/amd64

- name: Lint Java/Android
Expand Down Expand Up @@ -158,14 +157,14 @@ jobs:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.16
go-version: 1.17

- name: Install GolangCI-Lint
working-directory: go
run: curl -sSfL
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
| sh -s v1.23.7
| sh -s v1.50.1

- name: Lint Golang
working-directory: go
run: ./bin/golangci-lint run -D unused --timeout 5m
run: ./bin/golangci-lint run -D unused --timeout 5m --skip-files deps.go
14 changes: 6 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:

# - name: Set TARGET_SDK in env
# run: |
# pip3 install -r packages/utils/manifest_get/requirements.txt
# export GET_BIN=packages/utils/manifest_get/manifest_get.py
# pip3 install -r utils/manifest_get/requirements.txt
# export GET_BIN=utils/manifest_get/manifest_get.py
# export GET_KEY=global.android.target_sdk_version
# echo "TARGET_SDK=$($GET_BIN $GET_KEY)" >> $GITHUB_ENV

Expand Down Expand Up @@ -155,7 +155,6 @@ jobs:
- name: Build iOS artifacts
if: steps.semantic.outputs.new_release_published == 'true'
working-directory: packages
env:
GOMOBILE_IPFS_VERSION: ${{ steps.semantic.outputs.new_release_version }} # yamllint disable-line rule:line-length
run: make build_bridge.ios
Expand All @@ -166,15 +165,14 @@ jobs:
tag_name: v${{ steps.semantic.outputs.new_release_version }}
# yamllint disable rule:line-length
files: |
packages/build/ios/cocoapods/core/${{ steps.semantic.outputs.new_release_version }}/Gomobile-IPFS-Core-v${{ steps.semantic.outputs.new_release_version }}.pod.zip
packages/build/ios/cocoapods/core/${{ steps.semantic.outputs.new_release_version }}/Gomobile-IPFS-Core.podspec
packages/build/ios/cocoapods/bridge/${{ steps.semantic.outputs.new_release_version }}/Gomobile-IPFS-Bridge-v${{ steps.semantic.outputs.new_release_version }}.pod.zip
packages/build/ios/cocoapods/bridge/${{ steps.semantic.outputs.new_release_version }}/Gomobile-IPFS-Bridge.podspec
build/ios/cocoapods/core/${{ steps.semantic.outputs.new_release_version }}/Gomobile-IPFS-Core-v${{ steps.semantic.outputs.new_release_version }}.pod.zip
build/ios/cocoapods/core/${{ steps.semantic.outputs.new_release_version }}/Gomobile-IPFS-Core.podspec
build/ios/cocoapods/bridge/${{ steps.semantic.outputs.new_release_version }}/Gomobile-IPFS-Bridge-v${{ steps.semantic.outputs.new_release_version }}.pod.zip
build/ios/cocoapods/bridge/${{ steps.semantic.outputs.new_release_version }}/Gomobile-IPFS-Bridge.podspec
# yamllint enable rule:line-length

- name: Publish iOS packages
if: steps.semantic.outputs.new_release_published == 'true'
working-directory: packages
env:
# ANDROID_KEYPASS: ${{ secrets.ANDROID_KEYPASS }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:

- name: Set TARGET_SDK in env
run: |
pip3 install -r packages/utils/manifest_get/requirements.txt
export GET_BIN=packages/utils/manifest_get/manifest_get.py
pip3 install -r utils/manifest_get/requirements.txt
export GET_BIN=utils/manifest_get/manifest_get.py
export GET_KEY=global.android.target_sdk_version
echo "TARGET_SDK=$($GET_BIN $GET_KEY)" >> $GITHUB_ENV
Expand All @@ -76,7 +76,7 @@ jobs:
uses: actions/upload-artifact@v1
with:
name: build-${{ github.run_id }}
path: packages/build
path: build

android_bridge:
name: Test Android Bridge
Expand All @@ -94,12 +94,12 @@ jobs:
uses: actions/download-artifact@v1
with:
name: build-${{ github.run_id }}
path: packages/build
path: build

- name: Set TARGET_SDK in env
run: |
pip3 install -r packages/utils/manifest_get/requirements.txt
export GET_BIN=packages/utils/manifest_get/manifest_get.py
pip3 install -r utils/manifest_get/requirements.txt
export GET_BIN=utils/manifest_get/manifest_get.py
export GET_KEY=global.android.target_sdk_version
echo "TARGET_SDK=$($GET_BIN $GET_KEY)" >> $GITHUB_ENV
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
uses: actions/download-artifact@v1
with:
name: build-${{ github.run_id }}
path: packages/build
path: build

- name: Set simulator destination in env
working-directory: ios/Bridge
Expand Down Expand Up @@ -178,7 +178,6 @@ jobs:
-destination "platform=iOS Simulator,id=$DESTINATION"

- name: Build iOS Bridge
working-directory: packages
run:
xcodebuild
-project ../ios/Bridge/GomobileIPFS.xcodeproj
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.dll
*.so
*.dylib
build

# Test binary, build with `go test -c`
*.test
Expand Down
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Ubuntu:
In a terminal, enter:

git clone https://github.com/ipfs-shipyard/gomobile-ipfs
cd gomobile-ipfs/packages
cd gomobile-ipfs

To build the core, enter:

Expand All @@ -125,7 +125,7 @@ terminal, or put the commands in ~/.bash_profile.)
In a terminal, enter:

git clone https://github.com/ipfs-shipyard/gomobile-ipfs
cd gomobile-ipfs/packages
cd gomobile-ipfs

To build the core, enter:

Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ANDROID_MINIMUM_VERSION := $(call MANIFEST_GET_FUNC,android.min_sdk_version)
IOS_CORE_PACKAGE := $(call MANIFEST_GET_FUNC,go_core.ios.package)
IOS_APP_FILENAME := $(call MANIFEST_GET_FUNC,ios_demo_app.filename)

GO_DIR = $(MAKEFILE_DIR)/../go
GO_DIR = $(MAKEFILE_DIR)/go
GO_SRC = $(shell find $(GO_DIR) -name \*.go)
GO_MOD_FILES = $(GO_DIR)/go.mod $(GO_DIR)/go.sum

Expand All @@ -47,7 +47,7 @@ GOMOBILE_TARGET ?=
GOMOBILE_ANDROID_TARGET ?= android
GOMOBILE_IOS_TARGET ?= ios

ANDROID_DIR = $(MAKEFILE_DIR)/../android
ANDROID_DIR = $(MAKEFILE_DIR)/android
ANDROID_SRC = $(shell git ls-files $(ANDROID_DIR) | grep -v '.gitignore')
ANDROID_BUILD_DIR = $(BUILD_DIR)/android
ANDROID_BUILD_DIR_INT = $(ANDROID_BUILD_DIR)/intermediates
Expand All @@ -60,7 +60,7 @@ ANDROID_OUTPUT_APK = $(ANDROID_DIR)/app/build/outputs/apk/release/app-release.ap
ANDROID_BUILD_DIR_APP = $(ANDROID_BUILD_DIR)/app/$(VERSION)
ANDROID_BUILD_DIR_APP_APK = $(ANDROID_BUILD_DIR_APP)/$(ANDROID_APP_FILENAME)-$(VERSION).apk

IOS_DIR = $(MAKEFILE_DIR)/../ios
IOS_DIR = $(MAKEFILE_DIR)/ios
IOS_SRC = $(shell git ls-files $(IOS_DIR) | grep -v '.gitignore')
IOS_BUILD_DIR = $(BUILD_DIR)/ios
IOS_BUILD_DIR_INT = $(IOS_BUILD_DIR)/intermediates
Expand All @@ -79,7 +79,7 @@ IOS_BUILD_DIR_INT_APP_IPA_OUTPUT = $(IOS_BUILD_DIR_INT_APP_IPA)/Example.ipa
IOS_BUILD_DIR_INT_APP_ARCHIVE = $(IOS_BUILD_DIR_INT_APP)/archive
IOS_BUILD_DIR_INT_APP_ARCHIVE_OUTPUT = $(IOS_BUILD_DIR_INT_APP_ARCHIVE)/app-release.xcarchive

DOC_DIR = $(MAKEFILE_DIR)/../docs
DOC_DIR = $(MAKEFILE_DIR)/docs
ANDROID_DOC_DIR = $(DOC_DIR)/android
IOS_DOC_DIR = $(DOC_DIR)/ios

Expand Down Expand Up @@ -113,18 +113,18 @@ $(ANDROID_CORE): $(ANDROID_BUILD_DIR_INT_CORE) $(GO_SRC) $(GO_MOD_FILES)
@echo '------------------------------------'
@echo ' Android Core: Gomobile binding '
@echo '------------------------------------'
go mod download
go run golang.org/x/mobile/cmd/gomobile init
cd $(GO_DIR) && go mod download
cd $(GO_DIR) && go run golang.org/x/mobile/cmd/gomobile init
mkdir -p $(ANDROID_GOMOBILE_CACHE) android/libs
GO111MODULE=on go run golang.org/x/mobile/cmd/gomobile bind \
GO111MODULE=on cd $(GO_DIR) && go run golang.org/x/mobile/cmd/gomobile bind \
-o $(ANDROID_CORE) \
-v $(GOMOBILE_OPT) \
-cache $(ANDROID_GOMOBILE_CACHE) \
-target=$(GOMOBILE_ANDROID_TARGET)$(GOMOBILE_TARGET) \
-androidapi $(ANDROID_MINIMUM_VERSION) \
$(CORE_PACKAGE) $(EXT_PACKAGE)
touch $@
go mod tidy
cd $(GO_DIR) && go mod tidy
@echo 'Done!'

$(ANDROID_BUILD_DIR_INT_CORE):
Expand All @@ -150,18 +150,18 @@ $(IOS_CORE): $(IOS_BUILD_DIR_INT_CORE) $(GO_SRC) $(GO_MOD_FILES)
@echo '------------------------------------'
@echo ' iOS Core: Gomobile binding '
@echo '------------------------------------'
go mod download
go install golang.org/x/mobile/cmd/gobind
go run golang.org/x/mobile/cmd/gomobile init
cd $(GO_DIR) && go mod download
cd $(GO_DIR) && go install golang.org/x/mobile/cmd/gobind
cd $(GO_DIR) && go run golang.org/x/mobile/cmd/gomobile init
mkdir -p $(IOS_GOMOBILE_CACHE) ios/Frameworks
go run golang.org/x/mobile/cmd/gomobile bind \
cd $(GO_DIR) && go run golang.org/x/mobile/cmd/gomobile bind \
-o $(IOS_CORE) \
$(GOMOBILE_OPT) \
-cache $(IOS_GOMOBILE_CACHE) \
-target=$(GOMOBILE_IOS_TARGET)$(GOMOBILE_TARGET) \
$(CORE_PACKAGE) $(EXT_PACKAGE)
touch $@
go mod tidy
cd $(GO_DIR) && go mod tidy
@echo 'Done!'

$(IOS_BUILD_DIR_INT_CORE):
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}

task importManifest {
def ManifestFile = new File("${rootDir.getPath()}/../packages/Manifest.yml")
def ManifestFile = new File("${rootDir.getPath()}/../Manifest.yml")
def EnvVersion = System.env['GOMOBILE_IPFS_VERSION']

rootProject.ext {
Expand All @@ -25,7 +25,7 @@ task setupAllProjectsRepos(dependsOn: 'importManifest') {
google()
jcenter()
// If gomobile-ipfs core is available locally, use it
maven { url "${rootDir.getPath()}/../packages/build/android/maven" }
maven { url "${rootDir.getPath()}/../build/android/maven" }
// If not available locally, download it from Bintray repo
maven { url rootProject.ext.manifest.global.android.bintray_url }
}
Expand Down
13 changes: 10 additions & 3 deletions go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ require (
github.com/multiformats/go-multiaddr-fmt v0.1.0
github.com/pkg/errors v0.9.1
go.uber.org/zap v1.19.1
golang.org/x/mobile v0.0.0-20220112015953-858099ff7816
)

require github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1 // indirect

require (
bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.0 // indirect
Expand Down Expand Up @@ -171,7 +174,7 @@ require (
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/miekg/dns v1.1.43 // indirect
Expand Down Expand Up @@ -221,7 +224,7 @@ require (
go.uber.org/multierr v1.7.0 // indirect
go4.org v0.0.0-20200411211856-f5505b9728dd // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
Expand All @@ -239,4 +242,8 @@ require (
lukechampine.com/blake3 v1.1.6 // indirect
)

replace github.com/multiformats/go-multiaddr => github.com/berty/go-multiaddr v0.4.2-0.20220126184027-53e56f02fb68 // tmp, required for Android SDK30
replace (
github.com/lucas-clemente/quic-go => github.com/lucas-clemente/quic-go v0.25.0
github.com/multiformats/go-multiaddr => github.com/berty/go-multiaddr v0.4.2-0.20220126184027-53e56f02fb68 // tmp, required for Android SDK30
golang.org/x/mobile => github.com/berty/mobile v0.0.9 // temporary, see https://github.com/golang/mobile/pull/58 and https://github.com/golang/mobile/pull/82
)
Loading

0 comments on commit 1d37d59

Please sign in to comment.