diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index d86675c17..000000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-name: build
-
-on:
- pull_request:
- push:
- branches: master
-
-jobs:
- test:
- name: Run Tests
- # TODO: Ubuntu currently broken.
- runs-on: windows-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v2
-
- - uses: ./.github/actions/checkout_submodules
-
- - name: Setup Java
- uses: actions/setup-java@v2
- with:
- distribution: 'zulu'
- java-version: '17'
-
- # TODO: This is currently broken due to SqlDelight.
- # - name: Run check
- # run: bash ./gradlew check
-
- - name: Run tests
- run: bash ./gradlew test
-
- - name: Run lint
- run: bash ./gradlew ktlintCheck
-
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v1
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
new file mode 100644
index 000000000..53cbdfa83
--- /dev/null
+++ b/.github/workflows/check.yml
@@ -0,0 +1,37 @@
+name: Execute checks
+
+on:
+ pull_request:
+ push:
+ branches: master
+
+jobs:
+ test:
+ name: Run Checks
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - uses: ./.github/actions/checkout_submodules
+
+ - name: Setup Java
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'zulu'
+ java-version: '17'
+
+ # TODO: Without this step, the Gradle check task fails with the following error:
+ # Execution failed for task ':common:verifyDebugDatabaseMigration'.
+ # > A failure occurred while executing app.cash.sqldelight.gradle.VerifyMigrationTask$VerifyMigrationAction
+ # > No suitable driver found for jdbc:sqlite:
+ - name: Run verifyDebugDatabase
+ run: bash ./gradlew verifyDebugDatabaseMigration
+
+ - name: Run check
+ run: bash ./gradlew check
+
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v1
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
diff --git a/README.md b/README.md
index 33cfa6b9f..8569048d4 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,65 @@
This repository contains a collection of Android apps built on top of [IPv8](https://github.com/MattSkala/kotlin-ipv8) (our P2P networking stack) and [TrustChain](https://github.com/Tribler/kotlin-ipv8/blob/master/doc/TrustChainCommunity.md) (a scalable, distributed, pair-wise ledger). All applications are built into a single APK, following the concept of [super apps](https://home.kpmg/xx/en/home/insights/2019/06/super-app-or-super-disruption.html) – an emerging trend that allows to provide an ecosystem for multiple services within a single all-in-one app experience.
+## Build Instructions
+
+If you want to build an APK, run the following command:
+
+```
+./gradlew :app:buildDebug
+```
+
+The resulting APK will be stored in `app/build/outputs/apk/debug/app-debug.apk`.
+
+### Install
+
+You can also build and automatically install the app on all connected Android devices with a single command:
+
+```
+./gradlew :app:installDebug
+```
+
+*Note: It is required to have an Android device connected with USB debugging enabled before running this command.*
+
+### Check
+Run the Gradle check task to verify that the project is correctly set up and that tests pass:
+
+```
+./gradlew check
+```
+
+*Note: this task is also run on the CI, so ensure that it passes before making a PR.*
+
+### Tests
+
+Run unit tests:
+```
+./gradlew test
+```
+
+Run instrumented tests:
+```
+./gradlew connectedAndroidTest
+```
+
+### Code style
+
+[Ktlint](https://ktlint.github.io/) is used to enforce a consistent code style across the whole project. It is recommended to install the [ktlint plugin](https://plugins.jetbrains.com/plugin/15057-ktlint) for your IDE to get real-time feedback.
+
+
+Check code style:
+```
+./gradlew ktlintCheck
+```
+
+Run code formatter:
+```
+./gradlew ktlintFormat
+```
+
+## Adding Your Own App
+If you want to add your own app to the TrustChain Super App, you can follow the tutorial in the [AppTutorial.md](doc/AppTutorial.md) document.
+
## Apps
### On-Chain Democracy
@@ -104,54 +163,3 @@ A user can publish a Release (which is an album/EP/single/...), after which the
Video 1: Load example. This uses a default magnet link for an album that has a decent amount of peers. The user submits the metadata and the block gets proposed and signed. Then playback.
Video 2: Share track. Note: as a fresh magnet link is generated in this video, there is only 1 peer. For this reason it will be difficult to obtain the metadata of the magnet link (cold start issue, write about this in thesis) so the video stops there.
-
-### Do you want to add your own app?
-
-- [Adding your own app to the TrustChain Super App](doc/AppTutorial.md)
-
-## Build
-
-If you want to build an APK, run the following command:
-
-```
-./gradlew :app:buildDebug
-```
-
-The resulting APK will be stored in `app/build/outputs/apk/debug/app-debug.apk`.
-
-## Install
-
-You can also build and automatically install the app on all connected Android devices with a single command:
-
-```
-./gradlew :app:installDebug
-```
-
-*Note: It is required to have an Android device connected with USB debugging enabled before running this command.*
-
-## Tests
-
-Run unit tests:
-```
-./gradlew test
-```
-*Note: Currently tests fail on Linux, but pass on Windows and Mac. This is due to the tests relying on a native jlibtorrent binary, of which the linux version cannot be bundled with android builds. We are working on a solution to this problem.*
-
-Run instrumented tests:
-```
-./gradlew connectedAndroidTest
-```
-
-## Code style
-
-[Ktlint](https://ktlint.github.io/) is used to enforce a consistent code style across the whole project. It is recommended to install the [ktlint plugin](https://plugins.jetbrains.com/plugin/15057-ktlint) for your IDE to get real-time feedback.
-
-Check code style:
-```
-./gradlew ktlintCheck
-```
-
-Run code formatter:
-```
-./gradlew ktlintFormat
-```
diff --git a/app/build.gradle b/app/build.gradle
index 46b1543a7..7362f7afd 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -58,8 +58,6 @@ android {
sourceSets {
main {
- // TODO: Find a way to exclude linux .so
- // TODO: Reintroduce the jlibtorrent library for linux.
jniLibs.srcDirs = ['../common/libs']
}
}
@@ -164,7 +162,7 @@ dependencies {
// Logging
implementation 'io.github.microutils:kotlin-logging:1.7.7'
- implementation('net.java.dev.jna:jna:5.8.0@aar')
+ implementation('net.java.dev.jna:jna:5.12.1@aar')
implementation('com.github.tony19:logback-android:2.0.0')
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
diff --git a/build.gradle b/build.gradle
index 8a48b34ae..378d74979 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@
buildscript {
ext.kotlin_version = '1.9.22'
- ext.coroutines_version = '1.6.4'
+ ext.coroutines_version = '1.8.0'
ext.ktlint_version = '1.1.1'
ext.ktlint_gradle_version = '12.1.0'
ext.sqldelight_version = '2.0.1'
@@ -29,10 +29,6 @@ buildscript {
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath 'com.google.gms:google-services:4.3.14'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
-
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
diff --git a/common/build.gradle b/common/build.gradle
index 70c91471d..f0c853c02 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -98,6 +98,7 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
+ implementation 'androidx.databinding:viewbinding:8.2.2'
// QR
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
@@ -107,8 +108,8 @@ dependencies {
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
// Logging
@@ -126,13 +127,12 @@ dependencies {
implementation files('libs/jlibtorrent-android-arm-' + jlibtorrent_version + '.jar')
implementation files('libs/jlibtorrent-android-x86-' + jlibtorrent_version + '.jar')
implementation files('libs/jlibtorrent-android-x86_64-' + jlibtorrent_version + '.jar')
- implementation 'androidx.databinding:viewbinding:8.2.2'
// Testing
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
- testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.3'
+ testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
testImplementation "io.mockk:mockk:$mockk_version"
testImplementation 'org.json:json:20190722'
testImplementation "app.cash.sqldelight:sqlite-driver:$sqldelight_version"
@@ -143,6 +143,6 @@ dependencies {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.freeCompilerArgs += [
- "-opt-in=kotlin.RequiresOptIn"
+ "-opt-in=kotlin.RequiresOptIn"
]
}
diff --git a/common/libs/jlibtorrent-linux-1.2.17.0.jar b/common/libs/jlibtorrent-linux-1.2.17.0.jar
deleted file mode 100644
index 89397c3d1..000000000
Binary files a/common/libs/jlibtorrent-linux-1.2.17.0.jar and /dev/null differ
diff --git a/common/libs/jlibtorrent-1.2.17.0.dll b/common/native_libs/jlibtorrent-1.2.17.0.dll
similarity index 100%
rename from common/libs/jlibtorrent-1.2.17.0.dll
rename to common/native_libs/jlibtorrent-1.2.17.0.dll
diff --git a/common/native_libs/libjlibtorrent-1.2.17.0.so b/common/native_libs/libjlibtorrent-1.2.17.0.so
new file mode 100755
index 000000000..4b8abb0cb
Binary files /dev/null and b/common/native_libs/libjlibtorrent-1.2.17.0.so differ
diff --git a/common/libs/libjlibtorrent.arm64.dylib b/common/native_libs/libjlibtorrent.arm64.dylib
similarity index 100%
rename from common/libs/libjlibtorrent.arm64.dylib
rename to common/native_libs/libjlibtorrent.arm64.dylib
diff --git a/common/libs/libjlibtorrent.x86_64.dylib b/common/native_libs/libjlibtorrent.x86_64.dylib
similarity index 100%
rename from common/libs/libjlibtorrent.x86_64.dylib
rename to common/native_libs/libjlibtorrent.x86_64.dylib
diff --git a/common/src/main/java/nl/tudelft/trustchain/common/eurotoken/TransactionRepository.kt b/common/src/main/java/nl/tudelft/trustchain/common/eurotoken/TransactionRepository.kt
index cd7bc32d8..ebbff187d 100644
--- a/common/src/main/java/nl/tudelft/trustchain/common/eurotoken/TransactionRepository.kt
+++ b/common/src/main/java/nl/tudelft/trustchain/common/eurotoken/TransactionRepository.kt
@@ -246,7 +246,11 @@ class TransactionRepository(
return initialBalance
}
Log.d("getMyBalance", "latest block found")
- val myBalance = getBalanceForBlock(latestBlock, trustChainCommunity.database)!!
+ val myBalance = getBalanceForBlock(latestBlock, trustChainCommunity.database)
+ if (myBalance == null) {
+ Log.d("getMyBalance", "no balance found, defaulting to initial balance")
+ return initialBalance
+ }
Log.d("getMyBalance", "balance = $myBalance")
return myBalance
}
diff --git a/currencyii/build.gradle b/currencyii/build.gradle
index 6cf6a97b9..de354b0cc 100644
--- a/currencyii/build.gradle
+++ b/currencyii/build.gradle
@@ -73,8 +73,8 @@ dependencies {
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'androidx.preference:preference:1.1.1'
diff --git a/eurotoken/build.gradle b/eurotoken/build.gradle
index 7fbefdc89..02588ddd8 100644
--- a/eurotoken/build.gradle
+++ b/eurotoken/build.gradle
@@ -86,12 +86,10 @@ dependencies {
// Logging
implementation 'io.github.microutils:kotlin-logging:1.7.7'
+ // Testing
testImplementation 'junit:junit:4.12'
-
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
-
annotationProcessor "androidx.room:room-compiler:$room_version"
-
}
diff --git a/freedomOfComputing/build.gradle b/freedomOfComputing/build.gradle
index 3760fadd1..d9f4158ca 100644
--- a/freedomOfComputing/build.gradle
+++ b/freedomOfComputing/build.gradle
@@ -72,8 +72,8 @@ dependencies {
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
@@ -84,5 +84,5 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
}
tasks.withType(Test) {
- systemProperty "java.library.path", "../common/libs"
+ systemProperty "java.library.path", "../common/native_libs"
}
diff --git a/peerai/consumer-rules.pro b/peerai/consumer-rules.pro
new file mode 100644
index 000000000..e69de29bb
diff --git a/valuetransfer/src/main/sqldelight/1.sqm b/valuetransfer/src/main/sqldelight/migrations/1.sqm
similarity index 100%
rename from valuetransfer/src/main/sqldelight/1.sqm
rename to valuetransfer/src/main/sqldelight/migrations/1.sqm
diff --git a/valuetransfer/src/main/sqldelight/2.sqm b/valuetransfer/src/main/sqldelight/migrations/2.sqm
similarity index 100%
rename from valuetransfer/src/main/sqldelight/2.sqm
rename to valuetransfer/src/main/sqldelight/migrations/2.sqm
diff --git a/valuetransfer/src/main/sqldelight/3.sqm b/valuetransfer/src/main/sqldelight/migrations/3.sqm
similarity index 100%
rename from valuetransfer/src/main/sqldelight/3.sqm
rename to valuetransfer/src/main/sqldelight/migrations/3.sqm
diff --git a/valuetransfer/src/main/sqldelight/4.sqm b/valuetransfer/src/main/sqldelight/migrations/4.sqm
similarity index 100%
rename from valuetransfer/src/main/sqldelight/4.sqm
rename to valuetransfer/src/main/sqldelight/migrations/4.sqm
diff --git a/valuetransfer/src/main/sqldelight/5.sqm b/valuetransfer/src/main/sqldelight/migrations/5.sqm
similarity index 100%
rename from valuetransfer/src/main/sqldelight/5.sqm
rename to valuetransfer/src/main/sqldelight/migrations/5.sqm
diff --git a/valuetransfer/src/main/sqldelight/6.sqm b/valuetransfer/src/main/sqldelight/migrations/6.sqm
similarity index 100%
rename from valuetransfer/src/main/sqldelight/6.sqm
rename to valuetransfer/src/main/sqldelight/migrations/6.sqm