diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..43a6f0c
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+gradlew text eol=lf
+gradlew.bat text eol=crlf
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
new file mode 100644
index 0000000..c2804ed
--- /dev/null
+++ b/.github/workflows/android.yml
@@ -0,0 +1,67 @@
+name: Android
+
+on:
+ pull_request:
+ push:
+ branches: [main]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: android-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ name: Build, unit tests, and lint
+ runs-on: ubuntu-24.04
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+
+ - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
+ with:
+ distribution: temurin
+ java-version: '21'
+
+ - uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4
+ with:
+ cmdline-tools-version: '16111833'
+ packages: 'platform-tools platforms;android-37.0 build-tools;36.0.0'
+ log-accepted-android-sdk-licenses: false
+
+ - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
+ with:
+ cache-provider: basic
+
+ - name: Check metadata, build, test, and lint
+ run: >-
+ ./gradlew --no-daemon --console=plain
+ :app:checkDebugAarMetadata
+ :app:assembleDebug
+ :app:assembleDebugAndroidTest
+ :app:testDebugUnitTest
+ :app:lintDebug
+
+ - name: Upload reports
+ if: always()
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: android-reports
+ path: |
+ app/build/reports/
+ app/build/test-results/
+ if-no-files-found: warn
+ retention-days: 14
+
+ - name: Upload debug APK
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: acetimetracker-debug
+ path: app/build/outputs/apk/debug/app-debug.apk
+ if-no-files-found: error
+ retention-days: 14
diff --git a/.gitignore b/.gitignore
index aa724b7..ebf9c07 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
*.iml
.gradle
+/.kotlin
/local.properties
/.idea/caches
/.idea/libraries
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index ae388c2..2227ea3 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -7,7 +7,7 @@
-
+
-
\ No newline at end of file
+
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index fdf8d99..3595b33 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
-
+
-
\ No newline at end of file
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 268996d..1d14062 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
@@ -13,4 +13,4 @@
-
\ No newline at end of file
+
diff --git a/README.md b/README.md
index 3c85691..0a82bba 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,10 @@ To get started with TimeTracker, follow these steps:
1. Clone the repository to your local machine.
2. Open the project in Android Studio.
-3. Build and run the application on an Android device or emulator.
+3. Follow the [Android development guide](docs/development.md) to configure JDK 21,
+ install the pinned SDK packages, and run the build, tests, and lint checks.
+ Debug builds use a separate demo Firebase configuration; see the guide before
+ testing account or cloud features.
## Usage
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 040e878..f2d236a 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -1,73 +1,77 @@
plugins {
- id("com.android.application")
- id("org.jetbrains.kotlin.android")
- id("com.google.gms.google-services")
+ alias(libs.plugins.android.application)
+ alias(libs.plugins.google.services)
}
android {
namespace = "com.example.acetimetracker"
- compileSdk = 34
+ compileSdk = 37
+ buildToolsVersion = "36.0.0"
defaultConfig {
applicationId = "com.example.acetimetracker"
minSdk = 27
- targetSdk = 34
+ targetSdk = 36
versionCode = 1
versionName = "1.0"
-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
+ debug {
+ applicationIdSuffix = ".debug"
+ versionNameSuffix = "-debug"
+ }
release {
isMinifyEnabled = false
- proguardFiles(
- getDefaultProguardFile("proguard-android-optimize.txt"),
- "proguard-rules.pro"
- )
+ proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
+
compileOptions {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
- }
- kotlinOptions {
- jvmTarget = "1.8"
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
}
+
buildFeatures {
viewBinding = true
}
-}
-
-dependencies {
- implementation("androidx.core:core-ktx:1.9.0")
- implementation("androidx.appcompat:appcompat:1.6.1")
- implementation("com.google.android.material:material:1.12.0")
- implementation("androidx.constraintlayout:constraintlayout:2.1.4")
- implementation("pl.droidsonroids.gif:android-gif-drawable:1.2.28")
- implementation("com.google.firebase:firebase-auth:23.0.0")
- implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
- implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.1")
- implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
- implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
- implementation("androidx.annotation:annotation:1.7.1")
- implementation("com.google.firebase:firebase-database:21.0.0")
- implementation("com.google.firebase:firebase-firestore:25.0.0")
- implementation("com.google.firebase:firebase-storage:21.0.0")
- implementation ("com.github.bumptech.glide:glide:4.16.0")
- implementation ("com.github.PhilJay:MPAndroidChart:v3.1.0")
- implementation ("com.airbnb.android:lottie:5.2.0")
- dependencies {
- implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha13")
- // To use constraintlayout in compose
+ lint {
+ abortOnError = true
+ }
- implementation("androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha13")
+ testOptions {
+ unitTests.isIncludeAndroidResources = true
+ unitTests.all {
+ // Robolectric's API 36 shared-memory setup accesses JDK FileDescriptor internals.
+ it.jvmArgs("--add-opens=java.base/jdk.internal.access=ALL-UNNAMED")
+ }
}
- testImplementation("junit:junit:4.13.2")
- androidTestImplementation("androidx.test.ext:junit:1.1.5")
- androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
+}
+kotlin {
+ compilerOptions {
+ jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
+ }
+}
+dependencies {
+ implementation(libs.androidx.core.ktx)
+ implementation(libs.androidx.appcompat)
+ implementation(libs.material)
+ implementation(libs.androidx.constraintlayout)
+ implementation(libs.gif.drawable)
+ implementation(platform(libs.firebase.bom))
+ implementation(libs.firebase.auth)
+ implementation(libs.firebase.firestore)
+ implementation(libs.firebase.storage)
+ implementation(libs.glide)
+ implementation(libs.mpandroidchart)
+ implementation(libs.lottie)
-}
\ No newline at end of file
+ testImplementation(libs.junit)
+ testImplementation(libs.robolectric)
+ androidTestImplementation(libs.androidx.test.junit)
+ androidTestImplementation(libs.androidx.test.espresso)
+}
diff --git a/app/src/androidTest/java/com/example/acetimetracker/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/acetimetracker/ExampleInstrumentedTest.kt
index 3a1b465..4bd1e62 100644
--- a/app/src/androidTest/java/com/example/acetimetracker/ExampleInstrumentedTest.kt
+++ b/app/src/androidTest/java/com/example/acetimetracker/ExampleInstrumentedTest.kt
@@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
- assertEquals("com.example.acetimetracker", appContext.packageName)
+ assertEquals("com.example.acetimetracker.debug", appContext.packageName)
}
-}
\ No newline at end of file
+}
diff --git a/app/src/debug/google-services.json b/app/src/debug/google-services.json
new file mode 100644
index 0000000..3d06f64
--- /dev/null
+++ b/app/src/debug/google-services.json
@@ -0,0 +1,19 @@
+{
+ "project_info": {
+ "project_number": "123456789012",
+ "project_id": "demo-acetimetracker",
+ "storage_bucket": "demo-acetimetracker.firebasestorage.app"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:123456789012:android:0000000000000000000000",
+ "android_client_info": {
+ "package_name": "com.example.acetimetracker.debug"
+ }
+ },
+ "api_key": [{ "current_key": "debug-placeholder-not-a-production-api-key" }]
+ }
+ ],
+ "configuration_version": "1"
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index dba5b87..a43457f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,7 +1,6 @@
+ xmlns:tools="http://schemas.android.com/tools">
@@ -42,11 +41,6 @@
-
@@ -68,4 +62,4 @@
-
\ No newline at end of file
+
diff --git a/app/src/main/java/com/example/acetimetracker/DrawerBackNavigation.kt b/app/src/main/java/com/example/acetimetracker/DrawerBackNavigation.kt
new file mode 100644
index 0000000..5cc742d
--- /dev/null
+++ b/app/src/main/java/com/example/acetimetracker/DrawerBackNavigation.kt
@@ -0,0 +1,33 @@
+package com.example.acetimetracker
+
+import android.view.View
+import androidx.activity.ComponentActivity
+import androidx.activity.OnBackPressedCallback
+import androidx.core.view.GravityCompat
+import androidx.core.view.doOnLayout
+import androidx.drawerlayout.widget.DrawerLayout
+
+/** Close the navigation drawer on Back; let the activity handle Back when closed. */
+fun ComponentActivity.handleDrawerBack(drawer: DrawerLayout) {
+ val callback = object : OnBackPressedCallback(drawer.isDrawerVisible(GravityCompat.START)) {
+ override fun handleOnBackPressed() {
+ drawer.closeDrawer(GravityCompat.START)
+ }
+ }
+ drawer.addDrawerListener(object : DrawerLayout.SimpleDrawerListener() {
+ override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
+ callback.isEnabled = slideOffset > 0f
+ }
+
+ override fun onDrawerOpened(drawerView: View) {
+ callback.isEnabled = true
+ }
+
+ override fun onDrawerClosed(drawerView: View) {
+ callback.isEnabled = false
+ }
+ })
+ // Restoring an open drawer before its first layout does not notify drawer listeners.
+ drawer.doOnLayout { callback.isEnabled = drawer.isDrawerVisible(GravityCompat.START) }
+ onBackPressedDispatcher.addCallback(this, callback)
+}
diff --git a/app/src/main/java/com/example/acetimetracker/Login.kt b/app/src/main/java/com/example/acetimetracker/Login.kt
index 18b8f77..b302661 100644
--- a/app/src/main/java/com/example/acetimetracker/Login.kt
+++ b/app/src/main/java/com/example/acetimetracker/Login.kt
@@ -11,8 +11,8 @@ import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import com.google.firebase.auth.FirebaseAuth
-import com.google.firebase.auth.ktx.auth
-import com.google.firebase.ktx.Firebase
+import com.google.firebase.auth.auth
+import com.google.firebase.Firebase
class Login : AppCompatActivity() {
@@ -111,4 +111,4 @@ class Login : AppCompatActivity() {
// Create and show the dialog
builder.create().show()
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/com/example/acetimetracker/MainActivity.kt b/app/src/main/java/com/example/acetimetracker/MainActivity.kt
index 1ab0935..5b15594 100644
--- a/app/src/main/java/com/example/acetimetracker/MainActivity.kt
+++ b/app/src/main/java/com/example/acetimetracker/MainActivity.kt
@@ -49,6 +49,7 @@ class MainActivity : AppCompatActivity() {
)
drawerLayout.addDrawerListener(toggle)
toggle.syncState()
+ handleDrawerBack(drawerLayout)
navigationView.setNavigationItemSelectedListener { menuItem ->
when (menuItem.itemId) {
@@ -172,11 +173,4 @@ class MainActivity : AppCompatActivity() {
return super.onOptionsItemSelected(item)
}
- override fun onBackPressed() {
- if (drawerLayout.isDrawerOpen(navigationView)) {
- drawerLayout.closeDrawer(navigationView)
- } else {
- super.onBackPressed()
- }
- }
-}
\ No newline at end of file
+}
diff --git a/app/src/test/java/com/example/acetimetracker/DrawerBackNavigationTest.kt b/app/src/test/java/com/example/acetimetracker/DrawerBackNavigationTest.kt
new file mode 100644
index 0000000..2cff410
--- /dev/null
+++ b/app/src/test/java/com/example/acetimetracker/DrawerBackNavigationTest.kt
@@ -0,0 +1,100 @@
+package com.example.acetimetracker
+
+import android.os.Looper
+import android.os.Parcelable
+import android.util.SparseArray
+import android.view.Gravity
+import android.view.View
+import android.view.ViewGroup.LayoutParams.MATCH_PARENT
+import android.widget.FrameLayout
+import androidx.activity.ComponentActivity
+import androidx.core.view.GravityCompat
+import androidx.drawerlayout.widget.DrawerLayout
+import java.time.Duration
+import org.junit.After
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.robolectric.Robolectric
+import org.robolectric.RobolectricTestRunner
+import org.robolectric.Shadows.shadowOf
+import org.robolectric.android.controller.ActivityController
+import org.robolectric.annotation.Config
+
+/** A real drawer and dispatcher; no Firebase clients or account state are used. */
+@RunWith(RobolectricTestRunner::class)
+@Config(sdk = [36], manifest = Config.NONE)
+class DrawerBackNavigationTest {
+ private lateinit var controller: ActivityController
+ private lateinit var activity: ComponentActivity
+ private lateinit var drawer: DrawerLayout
+
+ @Before
+ fun setUp() {
+ createHost()
+ }
+
+ private fun createHost(savedState: SparseArray? = null) {
+ controller = Robolectric.buildActivity(ComponentActivity::class.java).setup()
+ activity = controller.get()
+ drawer = DrawerLayout(activity).apply {
+ id = R.id.drawer_layout
+ addView(FrameLayout(activity), DrawerLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT))
+ addView(FrameLayout(activity), DrawerLayout.LayoutParams(240, MATCH_PARENT, Gravity.START))
+ }
+ activity.setContentView(drawer)
+ activity.handleDrawerBack(drawer)
+ savedState?.let(drawer::restoreHierarchyState)
+ drawer.measure(
+ View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY),
+ View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY),
+ )
+ drawer.layout(0, 0, 1000, 1000)
+ }
+
+ @After
+ fun tearDown() {
+ controller.pause().stop().destroy()
+ }
+
+ @Test
+ fun backClosesOpenDrawerWithoutFinishingActivity() {
+ drawer.openDrawer(GravityCompat.START, false)
+ assertTrue(drawer.isDrawerOpen(GravityCompat.START))
+
+ activity.onBackPressedDispatcher.onBackPressed()
+ shadowOf(Looper.getMainLooper()).idleFor(Duration.ofSeconds(1))
+ drawer.computeScroll()
+ shadowOf(Looper.getMainLooper()).idle()
+
+ assertFalse(drawer.isDrawerVisible(GravityCompat.START))
+ assertFalse(activity.isFinishing)
+ }
+
+ @Test
+ fun backWithClosedDrawerUsesDefaultNavigation() {
+ activity.onBackPressedDispatcher.onBackPressed()
+
+ assertTrue(activity.isFinishing)
+ }
+
+ @Test
+ fun backClosesDrawerRestoredBeforeFirstLayout() {
+ drawer.openDrawer(GravityCompat.START, false)
+ val savedState = SparseArray()
+ drawer.saveHierarchyState(savedState)
+ controller.pause().stop().destroy()
+ createHost(savedState)
+ assertTrue(drawer.isDrawerOpen(GravityCompat.START))
+
+ activity.onBackPressedDispatcher.onBackPressed()
+ shadowOf(Looper.getMainLooper()).idleFor(Duration.ofSeconds(1))
+ drawer.computeScroll()
+ shadowOf(Looper.getMainLooper()).idle()
+
+ assertFalse(drawer.isDrawerVisible(GravityCompat.START))
+ assertFalse(activity.isFinishing)
+ }
+}
diff --git a/app/src/test/java/com/example/acetimetracker/ExampleUnitTest.kt b/app/src/test/java/com/example/acetimetracker/ExampleUnitTest.kt
deleted file mode 100644
index 12a51cb..0000000
--- a/app/src/test/java/com/example/acetimetracker/ExampleUnitTest.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.example.acetimetracker
-
-import org.junit.Test
-
-import org.junit.Assert.*
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-class ExampleUnitTest {
- @Test
- fun addition_isCorrect() {
- assertEquals(4, 2 + 2)
- }
-}
\ No newline at end of file
diff --git a/app/src/test/java/com/example/acetimetracker/TimeUtilsTest.kt b/app/src/test/java/com/example/acetimetracker/TimeUtilsTest.kt
new file mode 100644
index 0000000..911ae40
--- /dev/null
+++ b/app/src/test/java/com/example/acetimetracker/TimeUtilsTest.kt
@@ -0,0 +1,52 @@
+package com.example.acetimetracker
+
+import java.util.Locale
+import java.util.TimeZone
+import org.junit.After
+import org.junit.Assert.assertEquals
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+/** Characterizes supported same-day formatting; date/overnight changes belong to P8. */
+@RunWith(Parameterized::class)
+class TimeUtilsTest(
+ private val start: String,
+ private val end: String,
+ private val expected: String,
+) {
+ private lateinit var previousLocale: Locale
+ private lateinit var previousTimeZone: TimeZone
+
+ @Before
+ fun useDeterministicLocaleAndTimeZone() {
+ previousLocale = Locale.getDefault()
+ previousTimeZone = TimeZone.getDefault()
+ Locale.setDefault(Locale.US)
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"))
+ }
+
+ @After
+ fun restoreLocaleAndTimeZone() {
+ Locale.setDefault(previousLocale)
+ TimeZone.setDefault(previousTimeZone)
+ }
+
+ @Test
+ fun formatsSameDayDurationWithoutLosingMinutes() {
+ assertEquals(expected, TimeUtils.calculateTimeDifference(start, end))
+ }
+
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(name = "{0} to {1} = {2}")
+ fun durations(): List> = listOf(
+ arrayOf("09:15", "09:45", "00:30"),
+ arrayOf("08:45", "10:00", "01:15"),
+ arrayOf("00:00", "00:01", "00:01"),
+ arrayOf("00:00", "23:59", "23:59"),
+ arrayOf("12:00", "12:00", "00:00"),
+ )
+ }
+}
diff --git a/build.gradle.kts b/build.gradle.kts
index e956539..90098ab 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,11 +1,11 @@
buildscript {
dependencies {
- classpath("com.google.gms:google-services:4.4.1")
+ // Align AGP's built-in Kotlin runtime without applying kotlin-android.
+ classpath(libs.kotlin.gradle.plugin)
}
}
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-plugins {
- id("com.android.application") version "8.1.4" apply false
- id("org.jetbrains.kotlin.android") version "1.9.0" apply false
-}
\ No newline at end of file
+plugins {
+ alias(libs.plugins.android.application) apply false
+ alias(libs.plugins.google.services) apply false
+}
diff --git a/docs/development.md b/docs/development.md
new file mode 100644
index 0000000..0fcb785
--- /dev/null
+++ b/docs/development.md
@@ -0,0 +1,94 @@
+# Android development
+
+## Prerequisites
+
+- JDK 21 to run Gradle (Android Studio's bundled JBR 21 also works).
+- Android SDK command-line tools, platform **37.0**, build tools **36.0.0**, and
+ platform tools. Minimum supported device API is 27; target API is 36.
+- Network access to Google Maven, Maven Central, the Gradle distribution service,
+ and JitPack for MPAndroidChart.
+
+Set `JAVA_HOME` to your JDK installation and `ANDROID_HOME` to your SDK directory.
+Alternatively, select JDK 21 in Android Studio's Gradle settings and set `sdk.dir`
+in an untracked `local.properties`. Never commit machine-specific paths.
+
+Install SDK packages with Android Studio's SDK Manager or the command-line tools:
+
+```sh
+sdkmanager 'platforms;android-37.0' 'build-tools;36.0.0' 'platform-tools'
+```
+
+The SDK repository names API 37's initial platform `android-37.0`, not
+`android-37`. Resolve and accept the SDK license locally when prompted.
+
+## Build and verify
+
+From the repository root:
+
+```sh
+./gradlew --version
+./gradlew --no-daemon --console=plain \
+ :app:checkDebugAarMetadata \
+ :app:assembleDebug \
+ :app:assembleDebugAndroidTest \
+ :app:testDebugUnitTest \
+ :app:lintDebug
+```
+
+`./gradlew clean` clears generated project outputs for a clean rebuild. The wrapper
+pins Gradle 9.5.0 with a SHA-256 checksum. `gradle/libs.versions.toml` pins direct
+dependencies and plugins. AGP uses built-in Kotlin, with KGP 2.4.21 explicitly
+aligned; Java/Kotlin bytecode targets 17 independently of the JDK running Gradle.
+
+The foundation uses AGP 9.3.3 to include the fixes in that patch. Kotlin 2.4.21's
+published fully tested AGP range ends at 9.3.1, so the metadata, compilation, test,
+and lint checks verify this newer patch combination rather than assuming support.
+See [AGP requirements](https://developer.android.com/build/releases/agp-9-3-0-release-notes),
+[built-in Kotlin](https://developer.android.com/build/migrate-to-built-in-kotlin),
+and [Kotlin compatibility](https://kotlinlang.org/docs/gradle-configure-project.html).
+
+Outputs:
+
+- APK: `app/build/outputs/apk/debug/app-debug.apk`
+- Unit tests: `app/build/reports/tests/testDebugUnitTest/index.html`
+- Lint: `app/build/reports/lint-results-debug.html`
+
+GitHub Actions runs these checks for pull requests and pushes to `main`, and
+uploads reports and the debug APK. It requires no repository secrets. Lint errors
+fail the job; legacy warnings remain visible for later modernization stages.
+
+## Firebase boundary
+
+Debug builds install as `com.example.acetimetracker.debug` and use the checked-in
+**demo** Firebase configuration in `app/src/debug/google-services.json`. Its
+placeholder key cannot authenticate to the production project. This variant is
+for build/UI validation; live sign-in and cloud writes need a separately configured
+development project or an explicit emulator integration in a later stage.
+
+The existing `app/google-services.json` remains the release client configuration.
+It contains Firebase client identifiers, not administrative credentials. Do not
+add service-account keys, signing keys, access tokens, or production secrets.
+This foundation does not deploy rules, migrate records, upload images, or execute
+Firebase operations during its JVM tests or CI checks.
+
+## Test scope
+
+The JVM suite exercises existing same-day time formatting with literal fixtures,
+including minute precision and hour boundaries. Robolectric tests run a real
+AndroidX drawer/Back dispatcher on API 36, covering drawer dismissal and default
+Back navigation without initializing Firebase clients. The first run downloads
+Robolectric's Android runtime from Maven Central.
+
+The suite does not claim timer, overnight date handling, migration, or account
+isolation correctness; those require behavior changes and tests in their owning
+stages.
+
+The obsolete manifest entry for the absent `timetracker` activity was removed,
+the drawer uses `OnBackPressedDispatcher` for API 36 gestures, and the GIF library
+was updated to address lint's native 16 KB alignment warning.
+
+CI also compiles the instrumentation APK. Running it requires a connected emulator
+or device (`./gradlew :app:connectedDebugAndroidTest`); compilation alone does not
+count as an on-device test run. Target-SDK behavior, edge-to-edge layouts, storage
+permissions, accessibility, and the deferred functional defects need device
+verification before release. iOS remains deferred.
diff --git a/docs/superpowers/plans/2026-10-19-android-build-ci.md b/docs/superpowers/plans/2026-10-19-android-build-ci.md
new file mode 100644
index 0000000..885261e
--- /dev/null
+++ b/docs/superpowers/plans/2026-10-19-android-build-ci.md
@@ -0,0 +1,66 @@
+# Android build and CI foundation
+
+**Goal:** Make P1 reproducible: Android dependency metadata checks, debug assembly,
+unit tests, and lint pass locally and in GitHub Actions. iOS and Firebase data
+changes are out of scope.
+
+**Design:** Use the existing single app module and Views screens. Pin AGP 9.3.3,
+Gradle 9.5.0, Kotlin 2.4.21, JDK 21, compile SDK 37, target SDK 36, and minimum
+SDK 27. Use built-in Kotlin and Java/Kotlin bytecode 17. Introduce only libraries
+used by existing code; Compose UI and persistence arrive in their owning stages.
+Debug has a distinct application ID and a non-production demo Firebase config.
+
+**Reference:** [Modernization proposal, P1](https://github.com/MphoCodes/AceTimeTracker/blob/codex/android-modernization-spec/docs/superpowers/specs/2026-10-19-android-modernization-design.md).
+
+## Execution
+
+- [x] Reproduce the original build failure and establish local JDK/SDK prerequisites.
+- [x] Pin dependencies in a version catalog, refresh and checksum the wrapper,
+ remove unused/preview dependencies, and isolate debug Firebase configuration.
+- [x] Run metadata checks and assembly; repair only errors needed for this stage.
+- [x] Replace the arithmetic example with focused tests of existing time formatting;
+ keep later timer/date behavior changes out of this PR.
+- [x] Run lint without a blanket baseline or disabling failure on errors; repair
+ blocking findings and document remaining legacy warnings.
+- [x] Add a least-privilege, pinned GitHub Actions workflow using the same commands,
+ with test/lint reports and a debug APK artifact, plus local build documentation.
+- [x] Verify a clean build and workflow syntax, review the final diff, and open a PR.
+
+## Acceptance
+
+`./gradlew :app:checkDebugAarMetadata :app:assembleDebug :app:lintDebug :app:testDebugUnitTest`
+must succeed on JDK 21 with SDK platform 37 and build tools 36.0.0. Debug checks
+need no repository secrets and execute no production Firebase operations. Existing
+release application identity and Firebase data paths remain unchanged. CI remains
+red on compilation, unit-test, or lint errors. Device behavior and the deferred
+product defects are not claimed fixed by this foundation.
+
+## Implementation decisions
+
+- The SDK repository's package is `platforms;android-37.0`; installation commands
+ and CI use that name while AGP compiles API 37.
+- The Firebase BOM requires main-module Kotlin imports; only the two imports in
+ Login change, without changing the reset-password call or any data contract.
+- Target API 36 makes the existing drawer `onBackPressed` override a lint error.
+ Replace it with an AndroidX dispatcher callback and test the real drawer on a
+ simulated API 36 runtime. Other navigation/UI modernization remains deferred.
+- Remove the manifest entry for a class absent from both source and dependencies.
+- Update android-gif-drawable from 1.2.28 to 1.2.32 because lint identifies its
+ old arm64 native library as incompatible with 16 KB memory pages.
+
+## Local verification, 19 October 2026
+
+- Clean full command passed: `./gradlew clean :app:checkDebugAarMetadata
+ :app:assembleDebug :app:assembleDebugAndroidTest :app:testDebugUnitTest
+ :app:lintDebug --no-daemon --console=plain` (92 executed tasks).
+- Eight JVM tests passed: five duration fixtures and three drawer Back cases.
+ The restored-open-drawer case failed before the post-layout synchronization
+ fix, then passed in the full suite. Robolectric's API 36 runtime needs the
+ test-only JDK `jdk.internal.access` opening configured in the build.
+- Lint: zero errors, 194 visible warnings, zero `Aligned16KB` findings.
+- Generated APK metadata and Google Services resources confirm the debug app ID
+ and demo project; the release Firebase config is unchanged.
+- Actionlint 1.7.12 and `git diff --check` passed. Wrapper JAR and distribution
+ hashes match Gradle's published checksums.
+- Instrumentation APK compiled; no emulator/device test run or release-quality
+ claim is made. Hosted CI results are recorded in the pull request.
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
new file mode 100644
index 0000000..0290720
--- /dev/null
+++ b/gradle/libs.versions.toml
@@ -0,0 +1,40 @@
+[versions]
+agp = "9.3.3"
+kotlin = "2.4.21"
+google-services = "4.5.0"
+core = "1.19.1"
+appcompat = "1.8.0"
+material = "1.14.0"
+constraintlayout = "2.2.2"
+gif = "1.2.32"
+firebase-bom = "35.0.2"
+glide = "4.16.0"
+mpandroidchart = "v3.1.0"
+lottie = "5.2.0"
+junit = "4.13.2"
+androidx-test-junit = "1.3.0"
+espresso = "3.7.0"
+robolectric = "4.17"
+
+[libraries]
+kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
+androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "core" }
+androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
+material = { module = "com.google.android.material:material", version.ref = "material" }
+androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
+gif-drawable = { module = "pl.droidsonroids.gif:android-gif-drawable", version.ref = "gif" }
+firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" }
+firebase-auth = { module = "com.google.firebase:firebase-auth" }
+firebase-firestore = { module = "com.google.firebase:firebase-firestore" }
+firebase-storage = { module = "com.google.firebase:firebase-storage" }
+glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
+mpandroidchart = { module = "com.github.PhilJay:MPAndroidChart", version.ref = "mpandroidchart" }
+lottie = { module = "com.airbnb.android:lottie", version.ref = "lottie" }
+junit = { module = "junit:junit", version.ref = "junit" }
+robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
+androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-junit" }
+androidx-test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" }
+
+[plugins]
+android-application = { id = "com.android.application", version.ref = "agp" }
+google-services = { id = "com.google.gms.google-services", version.ref = "google-services" }
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index e708b1c..b1b8ef5 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index d212a79..4b271a6 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,10 @@
-#Wed Apr 24 02:19:33 SAST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
+distributionSha256Sum=553c78f50dafcd54d65b9a444649057857469edf836431389695608536d6b746
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
+networkTimeout=10000
+retries=0
+retryBackOffMs=500
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
index 4f906e0..b9bb139
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
-#!/usr/bin/env sh
+#!/bin/sh
#
-# Copyright 2015 the original author or authors.
+# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,81 +15,114 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
# Attempt to set APP_HOME
+
# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
warn () {
echo "$*"
-}
+} >&2
die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,88 +131,118 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
fi
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
fi
- i=`expr $i + 1`
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
fi
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 107acd3..24c62d5 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -13,19 +13,22 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
-@if "%DEBUG%" == "" @echo off
+@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
+@rem Set local scope for the variables, and ensure extensions are enabled
+setlocal EnableExtensions
set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,15 +43,15 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
+if %ERRORLEVEL% equ 0 goto execute
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
-goto fail
+"%COMSPEC%" /c exit 1
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
@@ -56,34 +59,24 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
-goto fail
+"%COMSPEC%" /c exit 1
:execute
@rem Setup the command line
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
+@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
+@rem which allows us to clear the local environment before executing the java command
+endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
-:omega
+:exitWithErrorLevel
+@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
+"%COMSPEC%" /c exit %ERRORLEVEL%
diff --git a/settings.gradle.kts b/settings.gradle.kts
index c3a8618..4cbceca 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -9,8 +9,10 @@ dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
- maven("https://jitpack.io")
mavenCentral()
+ maven("https://jitpack.io") {
+ content { includeGroup("com.github.PhilJay") }
+ }
}
}