Skip to content

Commit

Permalink
Publish android lib to GPR (#99)
Browse files Browse the repository at this point in the history
* Add gradlew publish and remove app folder
* move to android folder
* Add build:android
* address review comments
  • Loading branch information
hewigovens authored Sep 16, 2020
1 parent b062d70 commit fd24cd4
Show file tree
Hide file tree
Showing 49 changed files with 134 additions and 1,207 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
dist/trust-min.js filter=lfs diff=lfs merge=lfs -text
dist/trust-min.js.map filter=lfs diff=lfs merge=lfs -text
38 changes: 38 additions & 0 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Android Release

on:
release:
types:
- created

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Build and test
run: |
npm install
npm run build:android
npm test
working-directory: src

- name: Publish
run: |
./gradlew assemble
./gradlew publish
working-directory: android
env:
TAG_NAME: ${{ github.event.release.tag_name }}
GPR_USER: ${{ github.actor }}
GPR_API_KEY: ${{ secrets.GITHUB_TOKEN }}
13 changes: 8 additions & 5 deletions .github/workflows/nodejs.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Node CI

on: [push]
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
Expand All @@ -9,19 +13,18 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x]
node-version: [14.x, 12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: npm install, build, and test
run: |
pushd src
npm ci
npm run build --if-present
npm test
env:
CI: true
working-directory: src
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ app/release
fastlane/report.xml

# Local configuration file (sdk path, etc)
/local.properties
local.properties

# Proguard folder generated by Eclipse
proguard/
Expand All @@ -101,5 +101,5 @@ coverage.json
*.swp
*.swo
*~
.vscode/
android/lib/src/main/res/raw/

10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018 hewigovens <[email protected]>
Copyright (c) 2017-2020 Trust Wallet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,16 @@
[![Platform](https://img.shields.io/cocoapods/p/TrustWeb3Provider.svg?style=flat)](http://cocoapods.org/pods/TrustWeb3Provider)
[![Platform](https://img.shields.io/badge/platform-android-lightgrey.svg)](https://jitpack.io/#TrustWallet/trust-web3-provider/0.2.1)

TrustWeb3Provider currently bundles [web3 0.20.x](https://github.com/TrustWallet/trust-web3-provider/blob/master/src/package.json#L21).
TrustWeb3Provider currently bundles [web3 0.20.x](https://github.com/trustwallet/trust-web3-provider/blob/master/src/package.json#L22), we will follow MetaMask proposal: [No Longer Injecting web3.js](https://medium.com/metamask/no-longer-injecting-web3-js-4a899ad6e59e).

## How to Identify Trust Provider

If trust provider injected properly `isTrust` will be `true`

```javascript
web3.currentProvider.isTrust
window.ethereum.isTrust
```

## Projects [probably] using TrustWeb3Provider

- [Trust Wallet](https://trustwallet.com/)
- [TokenPocket](https://tokenpocket.jp/)
- [DappGo](https://www.cmcmbc.com/en-us/)
- [Vault](https://vault.io)
- [Kcash](https://www.kcash.com/)
- [WeiWallet](https://github.com/popshootjapan/WeiWallet-iOS/)
- [Alice Wallet](https://github.com/alicedapp/AliceX)
- Add your app here

## Installation

### iOS
Expand All @@ -38,9 +27,15 @@ it, simply add the following line to your Podfile:
pod 'TrustWeb3Provider'
```

Here is an example project located at `ios/TrustWeb3Provider.xcworkspace` to demonstrate how to use this provider.

### Android

TrustWeb3Provider is available through [Jitpack](https://jitpack.io). To install it:
TrustWeb3Provider is available through [Jitpack](https://jitpack.io) and [GitHub Packages](https://github.com/trustwallet/trust-web3-provider/packages), new version will only be available in GitHub.

#### Jitpack

To install it:

Step 1. Add jitpack in your root build.gradle at the end of repositories:

Expand All @@ -56,16 +51,19 @@ Step 2. Add the dependency

```groovy
dependencies {
implementation 'com.github.TrustWallet:trust-web3-provider:0.2.1'
implementation 'com.github.TrustWallet:trust-web3-provider:0.3.9'
}
```

#### GitHub Packages

[Configuring Gradle for use with GitHub Packages](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-gradle-for-use-with-github-packages)

## Authors

[vikmeup](https://github.com/vikmeup)
[hewigovens](https://github.com/hewigovens)
[madcake](https://github.com/madcake)
[Mish Ochu](https://github.com/mishfit)
[vikmeup](https://github.com/vikmeup)
[hewigovens](https://github.com/hewigovens)
[madcake](https://github.com/madcake)

## License

Expand Down
2 changes: 1 addition & 1 deletion build.gradle → android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

// NOTE: Do not place your application dependencies here; they belong
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 01 10:35:48 GMT+07:00 2018
#Tue Sep 15 09:48:52 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
File renamed without changes.
56 changes: 56 additions & 0 deletions android/lib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven-publish'

group='com.trustwallet'

def getArtificatId = { ->
return "web3-provider"
}
def getVersionName = { ->
return System.getenv('TAG_NAME') ?: "0.3.9"
}

android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
project.archivesBaseName = getArtificatId()
versionName getVersionName()
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {}

publishing {
publications {
web3provider(MavenPublication) {
groupId group
artifactId getArtificatId()
version getVersionName()
artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar")
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/trustwallet/trust-web3-provider")
credentials {
username = System.getenv("GPR_USER")
password = System.getenv("GPR_API_KEY")
}
}
}
}
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':lib'
1 change: 0 additions & 1 deletion app/.gitignore

This file was deleted.

25 changes: 0 additions & 25 deletions app/build.gradle

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions app/src/main/AndroidManifest.xml

This file was deleted.

28 changes: 0 additions & 28 deletions app/src/main/java/trust/web3provider/MainActivity.java

This file was deleted.

Loading

0 comments on commit fd24cd4

Please sign in to comment.