Skip to content

Commit

Permalink
Merge commit '3c7196f74c896770961329ca936a57506fddc773' into feature/…
Browse files Browse the repository at this point in the history
…MOB-257-weekly-dates
  • Loading branch information
johnqh committed Apr 5, 2024
2 parents 6c7fe84 + 3c7196f commit d83325d
Show file tree
Hide file tree
Showing 165 changed files with 133,779 additions and 66,389 deletions.
23 changes: 2 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,9 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/dictionaries
/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea/deploymentTargetDropDown.xml
/.idea
.DS_Store
**/build/*.compiler.options
**/build/.transforms
**/build/generated
**/build/intermediates
**/build/kotlin
**/build/kotlinToolingMetadata/
**/build/outputs
**/build/spotless
**/build/test-results
**/build/tmp
**/build/reports/*
!**/build/reports/lint-results-debug.txt
build/
captures
.externalNativeBuild
.cxx
Expand Down
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,50 @@
# Background
<div align="center">
<img src='https://github.com/dydxprotocol/v4-native-android/blob/develop/meta/icon_512.png' alt='icon' style="width:180px;height:180px;"> />
</div>
<h1 align="center">v4-native-android</h1>

This is the native Android app for dYdX
<div align="center">
<a href='https://github.com/dydxprotocol/v4-native-android/blob/main/LICENSE'>
<img src='https://img.shields.io/badge/License-AGPL_v3-blue.svg' alt='License' />
</a>
</div>

# Quick Setup
This is the native Android app for dYdX v4.

> cd scripts
# Quick Setup

> ./bootstrap.sh
```zsh
cd scripts
./bootstrap.sh
```

This will set up Android Studio project along with all dependencies.

# Main Repo

```zsh
git clone [email protected]:dydxprotocol/v4-native-android.git
```

# Repo Dependencies

### v4-abacus and cartera-android

This project requires the latest packages from v4-abacus and cartera-android.

To access v4-abacus and cartera-android, create a personal access token on Github and add it to the repo [link](https://docs.github.com/en/[email protected]/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). Create a classic token that has read permission to packages.

Add your github user name and token as shell env vars:
```zsh
export github_username=[GITHUB_USERNAME]
export github_token=[GITHUB_TOKEN]
```

<img width="807" alt="281211719-e0af477e-f84c-466f-93ac-32d0236bb84b" src="https://github.com/dydxprotocol/v4-native-android/assets/102453770/46b7b613-b194-4f5f-8b5a-aadff548f234">


### v4-localization and v4-web

This project requires v4-localization

https://github.com/dydxprotocol/v4-localization
Expand All @@ -35,13 +64,16 @@ Add the `secrets/` folder to the `v4-native-android/scripts` folder.

Copy the content of `secrets.zip` to `v4-native-android/scripts/secrets` and run

```zsh
cd v4-native-android/scripts
./set_secrets.sh
```

This will apply the secrets to the source code.

# Build Android App

```zsh
cd v4-native-android
./gradlew build
./gradlew :v4:app:installDebug
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
ext.ktlintVersion = '0.48.0'
ext.kotlinVersion = '1.9.20'
ext.androidApplicationVersion = '8.2.2'
ext.androidApplicationVersion = '8.3.1'

repositories {
google()
Expand Down
12 changes: 5 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

org.gradle.parallel=true
org.gradle.caching=true

# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Manually configure analysis per project
dependency.analysis.autoapply=false
systemProp.dependency.analysis.test.analysis=false


android.enableR8.fullMode = false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Jan 30 10:45:32 PST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
216 changes: 216 additions & 0 deletions meta/bitrise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
---
format_version: '11'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
workflows:
_buildApp:
description: Build Android app (v4)
steps:
- set-java-version@1:
inputs:
- set_java_version: '17'
- git-clone@8: {}
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
# write your script here
echo "Pulling Configs!"
cd ..
git clone [email protected]:dydxprotocol/v4-localization.git
git clone [email protected]:dydxprotocol/v4-web.git
# or run a script from your repository, like:
# bash ./path/to/script.sh
# not just bash, e.g.:
# ruby ./path/to/script.rb
title: Script (Pulling Configs)
- script@1:
title: Script (Set Secrets)
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
# Check if required environment variables are set
if [ -z "$google_services_debug" ]; then
echo "Error: google_services_debug environment variable not set."
exit 1
fi
if [ -z "$google_services_release" ]; then
echo "Error: google_services_release environment variable not set."
exit 1
fi
if [ -z "$strings_xml" ]; then
echo "Error: strings_xml environment variable not set."
exit 1
fi
FOLDER=v4/app/src/debug
# if folder doesn't exist, create it
if [ ! -d "$FOLDER" ]; then
mkdir -p $FOLDER
fi
echo "$google_services_debug" > v4/app/src/debug/google-services.json
FOLDER=v4/app/src/release
# if folder doesn't exist, create it
if [ ! -d "$FOLDER" ]; then
mkdir -p $FOLDER
fi
echo "$google_services_release" > v4/app/src/release/google-services.json
FOLDER=v4/common/src/main/res/values/
# if folder doesn't exist, create it
if [ ! -d "$FOLDER" ]; then
mkdir -p $FOLDER
fi
echo "$strings_xml" > v4/common/src/main/res/values/strings.xml
- cache-pull@2: {}
- install-missing-android-tools@3:
inputs:
- gradlew_path: "$PROJECT_LOCATION/gradlew"
- change-android-applicationid@1:
inputs:
- build_gradle_path: "$BITRISE_SOURCE_DIR/v4/app/build.gradle"
- new_application_id: "$APPLICATION_ID"
- android-unit-test@1:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: "$MODULE"
- variant: "$VARIANT"
- change-android-versioncode-and-versionname@1:
inputs:
- build_gradle_path: "$BITRISE_SOURCE_DIR/v4/app/build.gradle"
- android-build@1:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: "$MODULE"
- app_path_pattern: |-
*/v4/app/build/outputs/apk/*.apk
*/v4/app/build/outputs/bundle/*.aab
- variant: "$VARIANT"
- cache-push@2: {}
_withSsh:
description: Set up Auth and Env Vars
steps:
- activate-ssh-key@4: {}
- script@1:
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
envman add --key=DYDX_DATE_MM_DD --value="$(date +"%m-%d")"
envs:
- ABACUS_GIT_REPO_URL: [email protected]:dydxprotocol/abacus.git
opts:
is_expand: false
build:
description: 'Run CI / release build. Triggers based on build/* branches. Artifacts
are discarded.
'
envs:
- VARIANT: release
opts:
is_expand: false
before_run:
- _withSsh
- _buildApp
primary:
description: |
Run on every PR.
Next steps:
- Check out [Getting started with Android apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-android-apps.html).
steps:
- deploy-to-bitrise-io@2: {}
envs:
- VARIANT: release
opts:
is_expand: false
before_run:
- _withSsh
- _buildApp
release:
description: 'Official Release Workflow (protected by PR)
'
envs:
- VARIANT: release
opts:
is_expand: false
before_run:
- build
steps:
- sign-apk@1:
inputs:
- output_name: dydx_${ANDROID_VERSION_NAME}_${BITRISE_TRIGGERED_WORKFLOW_TITLE}_${BITRISE_BUILD_NUMBER}
- use_apk_signer: 'true'
- deploy-to-bitrise-io@2: {}
- google-play-deploy@3:
inputs:
- package_name: "$APPLICATION_ID"
- track: internal
- status: draft
- service_account_json_key_path: "$BITRISEIO_Google_Play_service_account_json_URL"
title: Google Play Deploy (internal)
- git-tag@1:
inputs:
- tag_message: |-
$BITRISE_PUBLIC_INSTALL_PAGE_URL_MAP
$BITRISE_PERMANENT_DOWNLOAD_URL_MAP
- tag: v${ANDROID_VERSION_NAME}(${BITRISE_BUILD_NUMBER})
meta:
bitrise.io:
stack: linux-docker-android-20.04
machine_type_id: standard
app:
envs:
- PROJECT_LOCATION: "."
opts:
is_expand: false
- opts:
is_expand: false
MODULE: v4:app
- opts:
is_expand: false
MODULE_PATH: v4/app
- opts:
is_expand: false
APPLICATION_ID: exchange.dydx.trading
trigger_map:
- push_branch: releases/*
workflow: release
- push_branch: build/*
workflow: build
- push_branch: main
workflow: release
- pull_request_target_branch: develop
workflow: primary
Binary file added meta/feature_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d83325d

Please sign in to comment.