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

wip: fix gomobile ipfs deploy #73

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
*.so
*.dylib

# build folder
build
repo
target

# pom file
pom.xml.versionsBackup

# Test binary, build with `go test -c`
*.test

Expand Down
78 changes: 78 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
GOMOBILE ?= go run golang.org/x/mobile/cmd/gomobile

ANDROID_VERSION ?= 0.0.42-dev

ANDROID_BRIDGE_REPO = $(ANDROID_REPO)/ipfs/gomobile/bridge

ANDROID_LIBS = ./android/libs/gomobile
ANDROID_CORE_AAR = $(ANDROID_LIBS)/core.aar

# ANDROID_CORE_REPO = $(ANDROID_REPO)/ipfs/gomobile/core/$(ANDROID_VERSION)
# ANDROID_CORE_JAR = $(ANDROID_BUILD_DIR_INT)/core-sources.jar

CORE_PACKAGE = github.com/ipfs-shipyard/gomobile-ipfs/go/bind/core
MAVEN_URL ?= https://maven.pkg.github.com/ipfs-shipyard/gomobile-ipfs

go_src = $(shell find go -name '*.go')

all: android.build

# should be run first once
configure:
go version || echo 'WARN: golang is needed to build the project'
javac -version || echo 'WARN: java is needed to build the project'

go mod download
$(GOMOBILE) init -v

build.ios: $(IOS_CORE)
android.build: android.gomobile.build android.core.repo

android.gomobile.build: $(ANDROID_CORE_AAR)
$(ANDROID_CORE_AAR): $(go_src) go.mod go.sum
mkdir -p $(ANDROID_LIBS)
$(GOMOBILE) bind -v $(GOMOBILE_OPT) -target=android -o $(ANDROID_CORE_AAR) $(CORE_PACKAGE)

# android core
# javadoc generate javadoc in a jar file
android.core.javadoc: $(ANDROID_CORE_JAVADOC)
$(ANDROID_CORE_JAVADOC): $(ANDROID_CORE_AAR) $(ANDROID_CORE_JAR)
mvn javadoc:jar

# repo deploy on a local directory
android.core.repo: $(ANDROID_CORE_REPO)
$(ANDROID_CORE_REPO): $(ANDROID_CORE_AAR) $(ANDROID_CORE_JAVADOC)
MAVEN_URL=file://$(ANDROID_REPO) make android.core.deploy
@touch $@

# deploy on a remote repository
android.core.deploy: $(ANDROID_CORE_AAR) $(ANDROID_CORE_JAVADOC)
mvn org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \
-Dversion=$(ANDROID_VERSION) \
-Djavadoc=$(ANDROID_CORE_JAVADOC) \
-Durl=$(MAVEN_URL) \
-DrepositoryId=ipfs.gomobile \
-Dfile=$(ANDROID_CORE_AAR) \
-Dpackaging=aar \
-DpomFile=pom.xml \
-Dfiles=$(ANDROID_CORE_JAR) \
-Dclassifiers=sources \
-DrepositoryId=github \
-Dtypes=jar

# android bridge ipfs
# publish inside local repository
android.bridge.repo: $(ANDROID_BRIDGE_REPO)
$(ANDROID_BRIDGE_REPO): $(ANDROID_CORE_REPO)
GOMOBILE_IPFS_VERSION=$(ANDROID_VERSION) ./android/gradlew -p android --info 'publishToLocalRepository'

android.bridge.deploy: $(ANDROID_BRIDGE_REPO)
GOMOBILE_IPFS_VERSION=$(ANDROID_VERSION) ./android/gradlew -p android --info 'publishToRemoteRepository'

# set-version override the current pom version
# @DEPRECATED(gfanton): do we need this ?
android.core.set-version:
mvn versions:set -DnewVersion=$(ANDROID_VERSION)

clean:
rm -rf $(ANDROID_LIBS)
14 changes: 3 additions & 11 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ release/
# Gradle files
.gradle/
build/
libs/gomobile

# Local configuration file (sdk path, etc)
local.properties
Expand All @@ -46,17 +47,7 @@ captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
.idea

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
Expand Down Expand Up @@ -218,3 +209,4 @@ fabric.properties
!/gradle/wrapper/gradle-wrapper.jar

# End of https://www.gitignore.io/api/java,android,androidstudio

113 changes: 0 additions & 113 deletions android/.idea/codeStyles/Project.xml

This file was deleted.

12 changes: 0 additions & 12 deletions android/.idea/runConfigurations.xml

This file was deleted.

5 changes: 1 addition & 4 deletions android/bridge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
plugins {
id 'com.android.library'
id 'maven-publish'
id 'com.jfrog.bintray' version '1.8.4'
}

def manifest = rootProject.ext.manifest
Expand Down Expand Up @@ -35,12 +33,11 @@ android {
}

dependencies {
implementation "$manifest.global.group_id:$manifest.go_core.android.artifact_id:$rootProject.ext.version"
implementation fileTree(dir: "${rootDir}/libs/gomobile", include: ['*.aar', '*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'commons-io:commons-io:2.6'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

apply from: 'publish.gradle'
Loading