Skip to content

Commit

Permalink
Merge branch 'main' into ui_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rodvar authored Nov 11, 2024
2 parents c892ce3 + 9b702b3 commit de0431e
Show file tree
Hide file tree
Showing 173 changed files with 43,951 additions and 275 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: BisqApps

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
name: Project Build & Test

strategy:
matrix:
os: [ubuntu-latest]
# os: [ubuntu-latest, macos-14, macos-latest]
# platform: [androidNode, androidClient, iosClient]
# TODO build fails on macos - might be an issue with the Pods compiled in MacOS 15 pushed to the repo (support for XCode 15 is still under dev for KMP)


runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17 (Azul Zulu)
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: gradle

# Cache Gradle dependencies
- name: Cache Gradle dependencies
uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
working-directory: ./bisqapps
run: |
chmod +x gradlew
# Android setup
- name: Set up Android SDK
uses: android-actions/setup-android@v2
with:
api-level: 33
build-tools: 33.0.0

# MacOS setup
# needed for macos terminal build to not hang doing linkDebugFrameworkxxxxArm64 related tasks
- name: Set up Xcode
if: startsWith(matrix.os, 'macos')
run: |
sudo xcode-select -s /Applications/Xcode_14.3.app
xcodebuild -version
# sudo xcode-select -s /Applications/Xcode_15.0.app

# TODO: restore androidNode once dependant bisq2 jars get published in a public maven repo
- name: Build project
working-directory: ./bisqapps
run: ./gradlew clean build -x androidNode:build --info

- name: Run all project tests
working-directory: ./bisqapps
run: ./gradlew test -x androidNode:test

- name: Run androidClient Tests
working-directory: ./bisqapps
run: ./gradlew androidClient:testDebugUnitTest androidClient:connectedDebugAndroidTest

# TODO: restore androidNode once dependant bisq2 jars get published in a public maven repo
# - name: Run androidNode Tests
# working-directory: ./bisqapps
# run: ./gradlew androidNode:testDebugUnitTest androidNode:connectedDebugAndroidTest

# TODO ios specific and run on emulator if needed
- name: Run iOS Tests
working-directory: ./bisqapps
if: startsWith(matrix.os, 'macos')
run: ./gradlew shared:presentation:iosSimulatorArm64Test
18 changes: 18 additions & 0 deletions bisqapps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ If you are a mobile enthusiast and feel driven by Bisq goals, please reach out!

Alternatively, you could run `./gradlew clean build` (1) first from terminal and then open with your IDE of preference.

### `Getting started for Android Node`

Addicionally, for the `androidNode` module to build you need to have its dependent Bisq2 jars in your local maven2 repository ('~/.m2/repository`). Here are the steps to do that

1. download [Bisq2](https://github.com/bisq-network/bisq2) if you don't have it already
2. follow Bisq2 root `README.md` steps to build the project
3. run `./gradlew publishAll` // this will install all the jars you need in your m2 repo

Done! Alternatively if you are interested only in contributing for the `xClients` you can just build them individually instead of building the whole project.

### UI Designs
androidNode + xClient screens are designed in Figma.
Yet to differentiate between which screens goes into which.

Figma link: https://www.figma.com/design/IPnuicxGKIZXq28gybxOgp/Xchange?node-id=7-759&t=LV9Gx9XgJRvXu5YQ-1

Though the figma design captures most of the functionality, it's an evolving document. It will be updated with new screens, flow updates, based on discussions happening in GH issues / matrix.

### Configuring dev env: known issues

- Some Apple M chips have trouble with cocoapods, follow [this guide](https://stackoverflow.com/questions/64901180/how-to-run-cocoapods-on-apple-silicon-m1/66556339#66556339) to fix it
Expand Down
14 changes: 11 additions & 3 deletions bisqapps/androidClient/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ plugins {
alias(libs.plugins.compose.compiler)
}

version = project.findProperty("client.android.version") as String
val sharedVersion = project.findProperty("shared.version") as String

kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
Expand Down Expand Up @@ -43,15 +46,17 @@ kotlin {
}

android {
namespace = "network.bisq.mobile"
namespace = "network.bisq.mobile.client"
compileSdk = libs.versions.android.compileSdk.get().toInt()

defaultConfig {
applicationId = "network.bisq.mobile.android"
applicationId = "network.bisq.mobile.client"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "0.0.1"
versionName = version.toString()
buildConfigField("String", "APP_VERSION", "\"${version}\"")
buildConfigField("String", "SHARED_VERSION", "\"${sharedVersion}\"")
}
packaging {
resources {
Expand All @@ -63,6 +68,9 @@ android {
isMinifyEnabled = false
}
}
buildFeatures {
buildConfig = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Expand Down
2 changes: 1 addition & 1 deletion bisqapps/androidClient/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<activity
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
android:name="network.bisq.mobile.MainActivity">
android:name="network.bisq.mobile.client.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.bisq.mobile
package network.bisq.mobile.client

import android.os.Bundle
import androidx.activity.ComponentActivity
Expand Down
109 changes: 105 additions & 4 deletions bisqapps/androidNode/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import com.google.protobuf.gradle.*
import org.apache.tools.ant.taskdefs.condition.Os

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.protobuf)
}

version = project.findProperty("node.android.version") as String
val sharedVersion = project.findProperty("shared.version") as String

kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
Expand All @@ -21,39 +27,134 @@ kotlin {
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
}
val androidMain by getting {
androidMain.dependencies {
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
}
kotlin.srcDirs(
"src/androidMain/kotlin",
"${layout.buildDirectory}/generated/source/proto/debug/java",
"${layout.buildDirectory}/generated/source/proto/release/java"
)
}
}
}

android {
namespace = "network.bisq.mobile.android.node"
namespace = "network.bisq.mobile.node"
compileSdk = libs.versions.android.compileSdk.get().toInt()

sourceSets {
getByName("main") {
proto {
srcDir("src/androidMain/proto")
}
java.srcDirs(
"src/layout.buildDirectory/kotlin",
"${layout.buildDirectory}/generated/source/proto/debug/java",
"${layout.buildDirectory}/generated/source/proto/release/java"
)
}
}

defaultConfig {
applicationId = "network.bisq.mobile.android.node"
applicationId = "network.bisq.mobile.node"
minSdk = libs.versions.android.node.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "0.0.1"
versionName = project.version.toString()
buildConfigField("String", "APP_VERSION", "\"${version}\"")
buildConfigField("String", "SHARED_VERSION", "\"${sharedVersion}\"")
}

// We don't want to use the protobuf coming in bisq2 core dependencies as we use protobuf-lite for mobile
configurations.all {
exclude(group = "com.google.protobuf", module = "protobuf-java")
}

packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
// the following exclude are needed to avoid protobuf hanging build when merging release resources for java
// Exclude the conflicting META-INF files
excludes.add("META-INF/versions/9/OSGI-INF/MANIFEST.MF")
excludes.add("META-INF/DEPENDENCIES")
pickFirsts.add("**/protobuf/**/*.class")
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
buildFeatures {
buildConfig = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

// Compatible with macOS on Apple Silicon
val archSuffix = if (Os.isFamily(Os.FAMILY_MAC)) ":osx-x86_64" else ""

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:4.28.2$archSuffix"
}
plugins {
create("javalite") {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0$archSuffix"
}
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
create("java") {
option("lite")
}
}
}
}
}
dependencies {
implementation(project(":shared:presentation"))
implementation(project(":shared:domain"))
debugImplementation(compose.uiTooling)
}

// bisq2 core dependencies
implementation(libs.bisq.core.common) {
exclude(group = "com.google.protobuf", module = "protobuf-java")
}
implementation(libs.bisq.core.i18n)
implementation(libs.bisq.core.persistence)
implementation(libs.bisq.core.security)
// # bisq:core:network#
implementation(libs.bisq.core.network.network)
implementation(libs.bisq.core.network.network.identity)
implementation(libs.bisq.core.network.socks5.socket.channel)
implementation(libs.bisq.core.network.i2p)
implementation(libs.chimp.jsocks)
implementation(libs.failsafe)
implementation(libs.apache.httpcomponents.httpclient)
// ##### network ######
implementation(libs.bisq.core.identity)
implementation(libs.bisq.core.account)
implementation(libs.bisq.core.settings)
implementation(libs.bisq.core.bonded.roles)
implementation(libs.bisq.core.user)
implementation(libs.bisq.core.contract)
implementation(libs.bisq.core.offer)
implementation(libs.bisq.core.trade)
implementation(libs.bisq.core.support)
implementation(libs.bisq.core.application)
implementation(libs.bisq.core.chat)
implementation(libs.bisq.core.presentation)

// protobuf
implementation(libs.protobuf.lite)
implementation(libs.protobuf.gradle.plugin)
implementation(libs.protoc)
}
Loading

0 comments on commit de0431e

Please sign in to comment.