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

2788 make a build so that the artifacts jars for android frameworks for ios and their dependencies can be included in another project #2828

Draft
wants to merge 19 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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ on:
pull_request:
jobs:
test:
runs-on: macos-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
cache: gradle
architecture: arm64

- name: Run unit tests
run: sh ./build.sh
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:

- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
env:
USERNAME: ${{ env.GITHUB_ACTOR }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ jobs:
lint:
name: Comments lint result on PR
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: set up JDK
Expand All @@ -14,20 +13,12 @@ jobs:
java-version: 11
cache: gradle
- name: Run detekt
env:
USERNAME: ${{ env.GITHUB_ACTOR }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :app:detekt
continue-on-error: true
- name: Run Android Lint
env:
USERNAME: ${{ env.GITHUB_ACTOR }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :app:lintAnalyticsDebug
- name: Run Android Lint Reporter to report Lint and Detekt result to PR
env:
USERNAME: ${{ env.GITHUB_ACTOR }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
lint:
name: Run Lint
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK
Expand All @@ -18,12 +17,6 @@ jobs:
java-version: 11
cache: gradle
- name: Run Kotlin lint
env:
USERNAME: ${{ env.GITHUB_ACTOR }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :app:detekt
- name: Run Android Lint
env:
USERNAME: ${{ env.GITHUB_ACTOR }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :app:lintAnalyticsDebug
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ We want to give businesses the whitelabel tools they need to develop their ether
1. [Download](https://developer.android.com/studio/) Android Studio.
2. Clone this repository
3. Obtain a free Infura API key and replace the one in build.gradle
4. Build the project in AndroidStudio or Run `./gradlew build` to install tools and dependencies. See [BUILD.md](BUILD.md) for more details.
4. Generate a GitHub [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with `read:packages, read:user` permission
5. Edit `~/.gradle/gradle.properties` add blow properties:
```properties
gpr.user=Your GitHub Email
gpr.key=The GitHub Personal Access Token you created in previous step
```
6. Build the project in AndroidStudio or Run `./gradlew build` to install tools and dependencies. See [BUILD.md](BUILD.md) for more details.

You can also build it from the commandline just like other Android apps. Note that JDK 8 and 11 are the versions supported by Android.

Expand Down
136 changes: 105 additions & 31 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,73 @@ buildscript {
// WARNING WARNING WARNING
// DON'T add any plugins that is Google Play Service or uses Google Play Service
// Search China in this file for the reason
apply plugin: 'com.android.application'
apply plugin: 'com.android.library'
apply plugin: 'realm-android'
apply plugin: 'kotlin-android'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'com.worker8.android_lint_reporter'
apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'com.dicedmelon.gradle.jacoco-android'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'maven-publish'

publishing {
publications {
bar(MavenPublication) {
groupId 'com.alphawallet'
artifactId 'alphawallet-library'
version '3.58.3'
artifact("$buildDir/outputs/aar/app-debug.aar")

//generate .pom file with transitive dependencies
pom.withXml {
final dependenciesNode = asNode().appendNode('dependencies')
ext.addDependency = { Dependency dep, String scope ->
if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
return
final dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dep.group)
dependencyNode.appendNode('artifactId', dep.name)
dependencyNode.appendNode('version', dep.version)
dependencyNode.appendNode('scope', scope)
if (!dep.transitive) {
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
exclusionNode.appendNode('groupId', '*')
exclusionNode.appendNode('artifactId', '*')
} else if (!dep.properties.excludeRules.empty) {
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
dep.properties.excludeRules.each { ExcludeRule rule ->
exclusionNode.appendNode('groupId', rule.group ?: '*')
exclusionNode.appendNode('artifactId', rule.module ?: '*')
}
}
}
configurations.annotationProcessor.getDependencies().each { dep -> addDependency(dep, "annotationProcessor") }
configurations.implementation.getDependencies().each { dep -> addDependency(dep, "runtime") }
}
}
}


repositories {
maven {
name = "GitHubPackages"
/** Configure path of your package repository on Github
** Replace GITHUB_USERID with your/organisation Github userID
** and REPOSITORY with the repository name on GitHub
*/
url = uri("https://maven.pkg.github.com/alphawallet/alpha-wallet-android")
credentials {
/** Create github.properties in root project folder file with
** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN
** Set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/

username = getGitHubUsername()
password = getPAT()
}
}
}
}

jacoco {
toolVersion = "0.8.8"
Expand Down Expand Up @@ -68,7 +128,21 @@ android_lint_reporter {

repositories {
maven {
url 'https://maven.google.com'
name = "trustwallet"
url = uri("https://maven.pkg.github.com/trustwallet/wallet-core")
credentials {
username = getGitHubUsername()
password = getPAT()
}
}

maven {
name = "alphawallet"
url = uri("https://maven.pkg.github.com/alphawallet/alpha-wallet-android")
credentials {
username = getGitHubUsername()
password = getPAT()
}
}
}

Expand All @@ -84,7 +158,7 @@ android {
versionCode 201
versionName "3.58.2"

applicationId "io.stormbird.wallet"
// applicationId "io.stormbird.wallet"
minSdkVersion 23
targetSdkVersion 32
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down Expand Up @@ -118,23 +192,6 @@ android {
}
}
}
flavorDimensions "targetting"

productFlavors {
analytics {
dimension "targetting"

/*
Below code is used to include analytics only when Flavor is "No Analytics"
This is due to China release where Google services should not be included
*/
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
}
noAnalytics {
dimension "targetting"
}
}
signingConfigs {
release {
// Add below 4 properties into ~/.gradle/gradle.properties
Expand Down Expand Up @@ -210,8 +267,26 @@ task printVersionCode {
}
}

gradle.projectsEvaluated({
def username = getGitHubUsername()
def password = getPAT()
if (!username || !password) {
throw new GradleException('Please provide GitHub username and Personal Access Token. Find more here https://github.com/alphaWallet/alpha-wallet-android#getting-started')
}
})

// GitHub Personal Access Token
private String getPAT() {
def encodedToken = project.findProperty("gpr.key")
new String(encodedToken.decodeBase64())
}

private String getGitHubUsername() {
project.findProperty("gpr.user")
}

dependencies {
implementation project(":lib")
implementation 'com.alphawallet:lib:3.58.3'

// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
// WARNING! Don't add dependency on Google Play Services without consulting
Expand Down Expand Up @@ -287,9 +362,10 @@ dependencies {
testImplementation group: 'org.powermock', name: 'powermock-module-junit4-rule-agent', version: '2.0.9'
testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.9'
testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.9'
testImplementation group: 'org.json', name: 'json', version: '20220320'

// Component tests
testImplementation 'org.robolectric:robolectric:4.8.1'
testImplementation 'org.robolectric:robolectric:4.8.2'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'androidx.test.ext:junit:1.1.3'

Expand All @@ -308,13 +384,12 @@ dependencies {
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'

implementation group: 'com.trustwallet', name: 'wallet-core', version: '2.6.3'
//implementation "com.trustwallet:wallet-core:0.12.31"
implementation 'com.trustwallet:wallet-core:2.6.4'

implementation 'com.github.florent37:tutoshowcase:1.0.1'
implementation 'com.github.florent37:TutoShowcase:d8b91be8a2'

// Do not upgrade unless we have migrated to AndroidX
implementation 'com.google.android:flexbox:2.0.1'
implementation 'com.github.google:flexbox-layout:2.0.1'

implementation 'com.github.salomonbrys.kotson:kotson:2.5.0'

Expand All @@ -327,12 +402,11 @@ dependencies {
implementation 'androidx.work:work-runtime:2.7.1'

//Analytics
analyticsImplementation 'com.google.android.play:core:1.10.3'
analyticsImplementation 'com.google.firebase:firebase-analytics:20.1.2'
analyticsImplementation 'com.mixpanel.android:mixpanel-android:5.8.4'
analyticsImplementation 'com.google.firebase:firebase-crashlytics:18.2.9'
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.google.firebase:firebase-analytics:20.1.2'
implementation 'com.mixpanel.android:mixpanel-android:5.8.4'
implementation 'com.google.firebase:firebase-crashlytics:18.2.9'
}

// WARNING WARNING WARNING
// don't add any additional things here without first search "China" in this file

Loading