From 35b28a4e957be263447c432d6ab28924d0ef245c Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 8 May 2020 13:40:34 -0300 Subject: [wallet] prevent download of wallet-core with every build --- wallet/.gitignore | 2 +- wallet/build.gradle | 12 +++++++----- .../java/net/taler/wallet/backend/WalletBackendService.kt | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/wallet/.gitignore b/wallet/.gitignore index 85d7ef4..094515c 100644 --- a/wallet/.gitignore +++ b/wallet/.gitignore @@ -1,2 +1,2 @@ /build -/src/main/assets/taler-wallet-android.js +/src/main/assets/taler-wallet-android-*.js diff --git a/wallet/build.gradle b/wallet/build.gradle index b25fa95..c96696c 100644 --- a/wallet/build.gradle +++ b/wallet/build.gradle @@ -37,6 +37,7 @@ android { versionCode 6 versionName "0.7.1.dev.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + buildConfigField "String", "WALLET_CORE_VERSION", "\"$walletCoreVersion\"" } buildTypes { release { @@ -90,10 +91,10 @@ dependencies { implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1' // Markdown rendering - final def markwon_version = '4.3.1' - implementation "io.noties.markwon:core:$markwon_version" - implementation "io.noties.markwon:ext-tables:$markwon_version" - implementation "io.noties.markwon:recycler:$markwon_version" + final def markwon_version = '4.3.1' + implementation "io.noties.markwon:core:$markwon_version" + implementation "io.noties.markwon:ext-tables:$markwon_version" + implementation "io.noties.markwon:recycler:$markwon_version" // JSON parsing and serialization implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.10.2' @@ -106,8 +107,9 @@ dependencies { def walletLibraryDir = "src/main/assets" task downloadWalletLibrary(type: Download) { src "https://git.taler.net/wallet-core.git/plain/${walletCoreVersion}/taler-wallet-android.js?h=prebuilt" - dest "${walletLibraryDir}/taler-wallet-android.js" + dest "${walletLibraryDir}/taler-wallet-android-${walletCoreVersion}.js" onlyIfModified true + overwrite false doFirst { new File(walletLibraryDir).mkdirs() } diff --git a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt index c0f7e9c..c810054 100644 --- a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt +++ b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt @@ -26,6 +26,7 @@ import android.os.Message import android.os.Messenger import android.os.RemoteException import android.util.Log +import net.taler.wallet.BuildConfig.WALLET_CORE_VERSION import net.taler.wallet.HostCardEmulatorService import org.json.JSONObject import java.lang.ref.WeakReference @@ -55,7 +56,7 @@ class WalletBackendService : Service() { private val subscribers = LinkedList() override fun onCreate() { - val talerWalletAndroidCode = assets.open("taler-wallet-android.js").use { + val talerWalletAndroidCode = assets.open("taler-wallet-android-$WALLET_CORE_VERSION.js").use { it.readBytes().toString(Charsets.UTF_8) } -- cgit v1.2.3