Bimba.git

commit 7551d7bcc5022b43f6517f0c30a4476e6968c990

Author: Adam Evyčędo <git@apiote.xyz>

use kotlin build scripts and cache

%!v(PANIC=String method: strings: negative Repeat count)


diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index 3a3a2355b4f3fd3ae0f7a7f826c94e101701ae5f..0000000000000000000000000000000000000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,114 +0,0 @@
-// SPDX-FileCopyrightText: Adam Evyčędo
-//
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-import com.android.tools.profgen.ArtProfileKt
-import com.android.tools.profgen.ArtProfileSerializer
-import com.android.tools.profgen.DexFile
-
-plugins {
-    id 'com.android.application'
-    id 'org.jetbrains.kotlin.android'
-    id "org.jetbrains.kotlin.plugin.parcelize"
-    id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.22'
-    id 'com.mermake.locale-resource-generator' version '0.1'
-    id "com.google.protobuf" version "0.9.4"
-}
-
-android {
-    compileSdk 34  // https://gitlab.com/fdroid/fdroiddata/-/issues/3299#note_1989808414
-
-    defaultConfig {
-        applicationId "xyz.apiote.bimba.czwek"
-        minSdk 21
-        targetSdk 35
-        versionCode 29
-        versionName "3.5.0"
-
-        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-        resourceConfigurations += ["en", "pl", "it", "de", "fr", "en-rUS"]
-    }
-
-    applicationVariants.configureEach { variant ->
-        variant.resValue "string", "versionName", variant.versionName
-        variant.resValue "string", "applicationId", variant.applicationId
-    }
-
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
-        }
-    }
-    compileOptions {
-        sourceCompatibility = 17
-        targetCompatibility = 17
-        coreLibraryDesugaringEnabled true
-    }
-    buildFeatures {
-        viewBinding true
-    }
-    namespace 'xyz.apiote.bimba.czwek'
-    buildToolsVersion = '34.0.0'  // https://gitlab.com/fdroid/fdroiddata/-/issues/3299#note_1989808414
-}
-
-dependencies {
-    implementation 'androidx.core:core-ktx:1.13.1'
-    implementation 'androidx.appcompat:appcompat:1.7.0'
-    implementation 'com.google.android.material:material:1.12.0'
-    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
-    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.3'
-    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.3'
-    implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
-    implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
-    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
-    implementation 'androidx.core:core-splashscreen:1.0.1'
-    implementation 'com.google.openlocationcode:openlocationcode:1.0.4'
-    implementation 'org.osmdroid:osmdroid-android:6.1.18'
-    implementation 'org.yaml:snakeyaml:2.2'
-    implementation 'androidx.activity:activity-ktx:1.9.0'
-    implementation 'com.google.openlocationcode:openlocationcode:1.0.4'
-    implementation 'com.otaliastudios:zoomlayout:1.9.0'
-    implementation 'dev.bandb.graphview:graphview:0.8.1'
-    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3'
-    implementation 'com.github.jershell:kbson:0.5.0'
-    implementation 'androidx.preference:preference-ktx:1.2.1'
-    implementation 'androidx.work:work-runtime-ktx:2.9.0'
-    implementation 'com.github.doyaaaaaken:kotlin-csv-jvm:1.9.3'
-    implementation 'commons-io:commons-io:2.16.1'
-
-
-    implementation project(path: ':fruchtfleisch')
-
-    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
-
-    testImplementation 'junit:junit:4.13.2'
-    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
-    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
-}
-
-// NOTE fixes reproducible builds
-project.afterEvaluate {
-    tasks.each { task ->
-        if (task.name.startsWith("compile") && task.name.endsWith("ReleaseArtProfile")) {
-            task.doLast {
-                outputs.files.each { file ->
-                    if (file.name.endsWith(".profm")) {
-                        println("Sorting ${file} ...")
-                        def version = ArtProfileSerializer.valueOf("METADATA_0_0_2")
-                        def profile = ArtProfileKt.ArtProfile(file)
-                        def keys = new ArrayList(profile.profileData.keySet())
-                        def sortedData = new LinkedHashMap()
-                        Collections.sort keys, new DexFile.Companion()
-                        keys.each { key -> sortedData[key] = profile.profileData[key] }
-                        new FileOutputStream(file).with {
-                            write(version.magicBytes$profgen)
-                            write(version.versionBytes$profgen)
-                            version.write$profgen(it, sortedData, "")
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
\ No newline at end of file




diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..110065dbc9a8ee8a7cee69f67f3d7a0ddd3c736c
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,85 @@
+// SPDX-FileCopyrightText: Adam Evyčędo
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+plugins {
+	id("com.android.application")
+	kotlin("android")
+	id("org.jetbrains.kotlin.plugin.parcelize")
+	id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22"
+	id("com.mermake.locale-resource-generator") version "0.1"
+	id("com.google.protobuf") version "0.9.4"
+}
+
+android {
+	namespace = "xyz.apiote.bimba.czwek"
+	compileSdk = 34  // https://gitlab.com/fdroid/fdroiddata/-/issues/3299#note_1989808414
+	buildToolsVersion =
+		"34.0.0"  // https://gitlab.com/fdroid/fdroiddata/-/issues/3299#note_1989808414
+
+	defaultConfig {
+		applicationId = "xyz.apiote.bimba.czwek"
+		minSdk = 21
+		targetSdk = 35
+		versionCode = 29
+		versionName = "3.5.0"
+
+		testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+		resourceConfigurations += listOf("en", "pl", "it", "de", "fr", "en-rUS")
+	}
+
+	buildTypes {
+		getByName("release") {
+			isMinifyEnabled = false
+			proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
+		}
+	}
+
+	applicationVariants.configureEach {
+		resValue("string", "versionName", versionName)
+		resValue("string", "applicationId", applicationId)
+	}
+
+	compileOptions {
+		sourceCompatibility = JavaVersion.VERSION_17
+		targetCompatibility = JavaVersion.VERSION_17
+		isCoreLibraryDesugaringEnabled = true
+	}
+
+	buildFeatures {
+		viewBinding = true
+	}
+}
+
+dependencies {
+	implementation("androidx.core:core-ktx:1.13.1")
+	implementation("androidx.appcompat:appcompat:1.7.0")
+	implementation("com.google.android.material:material:1.12.0")
+	implementation("androidx.constraintlayout:constraintlayout:2.1.4")
+	implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.4")
+	implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4")
+	implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
+	implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
+	implementation("androidx.legacy:legacy-support-v4:1.0.0")
+	implementation("androidx.core:core-splashscreen:1.0.1")
+	implementation("com.google.openlocationcode:openlocationcode:1.0.4")
+	implementation("org.osmdroid:osmdroid-android:6.1.18")
+	implementation("org.yaml:snakeyaml:2.2")
+	implementation("androidx.activity:activity-ktx:1.9.1")
+	implementation("com.google.openlocationcode:openlocationcode:1.0.4")
+	implementation("com.otaliastudios:zoomlayout:1.9.0")
+	implementation("dev.bandb.graphview:graphview:0.8.1")
+	implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3")
+	implementation("com.github.jershell:kbson:0.5.0")
+	implementation("androidx.preference:preference-ktx:1.2.1")
+	implementation("androidx.work:work-runtime-ktx:2.9.0")
+	implementation("com.github.doyaaaaaken:kotlin-csv-jvm:1.9.3")
+	implementation("commons-io:commons-io:2.16.1")
+	implementation(project(":fruchtfleisch"))
+
+	coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
+
+	testImplementation("junit:junit:4.13.2")
+	androidTestImplementation("androidx.test.ext:junit:1.2.1")
+	androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
+}
\ No newline at end of file




diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 37c7d0b38a0ab9297ade9fd023db967079196459..801f6aa0c4a4c11225ecb6988dbef3b67ce57f2c 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later
 
 # Add project specific ProGuard rules here.
 # You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
+# proguardFiles setting in build.gradle.kts.
 #
 # For more details, see
 #   http://developer.android.com/guide/developing/tools/proguard.html




diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/map/MapViewModel.kt b/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/map/MapViewModel.kt
index 324169dea1b496d9daa3162b5c04dc6281fd1909..054385b6785da668fc461fee763808be6f371166 100644
--- a/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/map/MapViewModel.kt
+++ b/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/map/MapViewModel.kt
@@ -81,7 +81,6 @@ 			content.findViewById(R.id.rt_icon).visibility = View.GONE
 			// TODO vehicle accessible
 			content.findViewById<ImageView>(R.id.wheelchair_icon).visibility = View.GONE
 
-			Log.i("unit", "${vehicle.Speed.mps}")
 			UnitSystem.getSelected(requireContext()).let { us ->
 				content.findViewById<TextView>(R.id.speed_text).apply {
 					text =




diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 279f2c1cfcf841d408996f85e4d1efb1ffa12ef0..0000000000000000000000000000000000000000
--- a/build.gradle
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-FileCopyrightText: Adam Evyčędo
-//
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-plugins {
-    id 'com.android.application' version '8.3.2' apply false
-    id 'com.android.library' version '8.3.2' apply false
-    id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
-    id 'org.jetbrains.kotlin.jvm' version '1.7.20' apply false
-    id "org.jetbrains.kotlin.plugin.parcelize" version "1.8.20" apply false
-    id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.22' apply false
-}




diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..e8ce8c75f4060f8c19f074727d2ef4a8ee87618c
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,13 @@
+// SPDX-FileCopyrightText: Adam Evyčędo
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+    id("com.android.application") version "8.5.0" apply false
+    id("com.android.library") version "8.5.0" apply false
+    id("org.jetbrains.kotlin.android") version "1.7.10" apply false
+    id("org.jetbrains.kotlin.jvm") version "1.7.20" apply false
+    id("org.jetbrains.kotlin.plugin.parcelize") version "1.8.20" apply false
+    id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22" apply false
+}




diff --git a/fruchtfleisch/build.gradle b/fruchtfleisch/build.gradle
deleted file mode 100644
index 85c32f76546645efcd429747057f155ce9b51955..0000000000000000000000000000000000000000
--- a/fruchtfleisch/build.gradle
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-FileCopyrightText: Adam Evyčędo
-//
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-plugins {
-    id 'java-library'
-    id 'org.jetbrains.kotlin.jvm'
-}
-
-dependencies {
-    testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
-    testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
-
-    //implementation 'org.jetbrains.kotlin:kotlin-reflect:1.8.10'
-}
-java {
-    sourceCompatibility = JavaVersion.VERSION_17
-    targetCompatibility = JavaVersion.VERSION_17
-}
-test {
-    useJUnitPlatform()
-}
\ No newline at end of file




diff --git a/fruchtfleisch/build.gradle.kts b/fruchtfleisch/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..c75a2f1bae17a8e70807c69c0619d320767b1646
--- /dev/null
+++ b/fruchtfleisch/build.gradle.kts
@@ -0,0 +1,24 @@
+// SPDX-FileCopyrightText: Adam Evyčędo
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+plugins {
+    id("java-library")
+    id("org.jetbrains.kotlin.jvm")
+}
+
+dependencies {
+    testImplementation("org.junit.jupiter:junit-jupiter:5.10.3")
+    testImplementation("org.junit.jupiter:junit-jupiter:5.10.3")
+
+    //implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.10")
+}
+
+java {
+    sourceCompatibility = JavaVersion.VERSION_17
+    targetCompatibility = JavaVersion.VERSION_17
+}
+
+tasks.withType<Test> {
+    useJUnitPlatform()
+}
\ No newline at end of file




diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 92dd17cf105d5e62e6c0ad89238ee13f72fcea5a..e6b146979591f464343c7a948c2493b91598885d 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later
 
 #Tue Aug 09 15:48:25 CEST 2022
 distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
 distributionPath=wrapper/dists
 zipStorePath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME




diff --git a/gradle.properties b/gradle.properties
index 414ce984ef231e8254ae7fe6d233b446195ee574..2540962b6fd2fcdfbeea18da64677febf2d800ec 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -27,3 +27,4 @@ # thereby reducing the size of the R class for that library
 android.nonTransitiveRClass=true
 android.nonFinalResIds=true
 org.gradle.unsafe.configuration-cache=true
+org.gradle.caching=true




diff --git a/settings.gradle b/settings.gradle
deleted file mode 100644
index 4f933d18b9fa89ddb028f9dbfdaabc5f5fcc3c47..0000000000000000000000000000000000000000
--- a/settings.gradle
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-FileCopyrightText: Adam Evyčędo
-//
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-pluginManagement {
-    repositories {
-        gradlePluginPortal()
-        google()
-        mavenCentral()
-    }
-}
-dependencyResolutionManagement {
-    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
-    repositories {
-        google()
-        mavenCentral()
-        maven { url "https://jitpack.io" }
-    }
-}
-rootProject.name = "Bimba"
-include ':app'
-include ':fruchtfleisch'




diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..2085d26600350fa10f16897f55dd9ae80d75e73e
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,35 @@
+// SPDX-FileCopyrightText: Adam Evyčędo
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+pluginManagement {
+    repositories {
+        gradlePluginPortal()
+        google()
+        mavenCentral()
+    }
+}
+val cacheUser: String by settings
+val cachePass: String by settings
+buildCache {
+    remote<HttpBuildCache> {
+        url = uri("https://cranberry.apiote.xyz")
+        isPush = true
+        credentials {
+            username = cacheUser
+            password = cachePass
+        }
+        // on command line add -PcacheUser=user -PcachePassword=password or in ~/.gradle/gradle.properies
+    }
+}
+dependencyResolutionManagement {
+    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+    repositories {
+        google()
+        mavenCentral()
+        maven { url = uri("https://jitpack.io") }
+    }
+}
+rootProject.name = "Bimba"
+include(":app")
+include(":fruchtfleisch")
\ No newline at end of file