diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6645ef4e..c6899c60 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -9,17 +9,16 @@ plugins { android { namespace = "com.rtbishop.look4sat" compileSdk = 33 - defaultConfig { applicationId = "com.rtbishop.look4sat" minSdk = 21 targetSdk = 33 versionCode = 313 versionName = "3.1.3" - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildFeatures { + buildConfig = true compose = true } buildTypes { @@ -33,53 +32,19 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - testOptions { - unitTests { - all { it.useJUnitPlatform() } - isIncludeAndroidResources = true - isReturnDefaultValues = true - } - } - composeOptions { - kotlinCompilerExtensionVersion = "1.4.7" - } - packaging { - resources { - excludes += listOf( - "/META-INF/{AL2.0,LGPL2.1}", - "META-INF/DEPENDENCIES.txt", - "META-INF/LICENSE.txt", - "META-INF/NOTICE.txt", - "META-INF/NOTICE", - "META-INF/LICENSE", - "META-INF/DEPENDENCIES", - "META-INF/notice.txt", - "META-INF/license.txt", - "META-INF/dependencies.txt", - "META-INF/LGPL2.1", - "META-INF/maven/commons-io/commons-io/pom.xml", - "META-INF/maven/commons-io/commons-io/pom.properties" - ) - } - } -} - -kotlin { - jvmToolchain(17) + composeOptions { kotlinCompilerExtensionVersion = "1.4.7" } + packaging { resources { excludes += listOf("META-INF/{AL2.0,LGPL2.1}") } } } dependencies { implementation(project(":data")) implementation(project(":domain")) - // Android + implementation("androidx.core:core-splashscreen:1.0.1") implementation("androidx.room:room-runtime:2.5.2") implementation("androidx.room:room-ktx:2.5.2") ksp("androidx.room:room-compiler:2.5.2") - // Compose + implementation("androidx.activity:activity-compose:1.7.2") implementation("androidx.compose.animation:animation:1.4.3") implementation("androidx.compose.compiler:compiler:1.5.1") @@ -88,13 +53,13 @@ dependencies { implementation("androidx.compose.ui:ui-tooling-preview:1.4.3") implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1") implementation("androidx.navigation:navigation-compose:2.6.0") - // Utility + implementation("com.squareup.okhttp3:okhttp:4.10.0") implementation("org.osmdroid:osmdroid-android:6.1.16") debugImplementation("androidx.compose.ui:ui-tooling:1.4.3") debugImplementation("androidx.compose.ui:ui-test-manifest:1.4.3") debugImplementation("com.squareup.leakcanary:leakcanary-android:2.12") - // Test + testImplementation("junit:junit:4.13.2") testImplementation("io.mockk:mockk:1.13.5") testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3") diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 4b391db5..c5b80038 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,11 +1,14 @@ -# Please add these rules to your existing keep rules in order to suppress warnings. -# This is generated automatically by the Android Gradle plugin. --dontwarn org.bouncycastle.jsse.BCSSLParameters --dontwarn org.bouncycastle.jsse.BCSSLSocket --dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider --dontwarn org.conscrypt.Conscrypt$Version --dontwarn org.conscrypt.Conscrypt --dontwarn org.conscrypt.ConscryptHostnameVerifier --dontwarn org.openjsse.javax.net.ssl.SSLParameters --dontwarn org.openjsse.javax.net.ssl.SSLSocket --dontwarn org.openjsse.net.ssl.OpenJSSE \ No newline at end of file +# JSR 305 annotations are for embedding nullability information. +-dontwarn javax.annotation.** + +# A resource is loaded with a relative path so the package of this class must be preserved. +-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz + +# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java. +-dontwarn org.codehaus.mojo.animal_sniffer.* + +# OkHttp platform used only on JVM and when Conscrypt and other security providers are available. +-dontwarn okhttp3.internal.platform.** +-dontwarn org.conscrypt.** +-dontwarn org.bouncycastle.** +-dontwarn org.openjsse.** diff --git a/data/build.gradle.kts b/data/build.gradle.kts index e6fd0190..538c04cf 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -9,50 +9,27 @@ plugins { android { namespace = "com.rtbishop.look4sat.data" compileSdk = 33 - defaultConfig { minSdk = 21 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } - - buildTypes { - release { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") - } - } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - testOptions { - unitTests { - all { it.useJUnitPlatform() } - isIncludeAndroidResources = true - isReturnDefaultValues = true - } - } -} - -kotlin { - jvmToolchain(17) } dependencies { implementation(project(":domain")) - // Android + implementation("androidx.core:core-ktx:1.10.1") implementation("androidx.room:room-runtime:2.5.2") implementation("androidx.room:room-ktx:2.5.2") ksp("androidx.room:room-compiler:2.5.2") - // Utility + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") implementation("com.squareup.okhttp3:okhttp:4.10.0") - // Test + testImplementation("junit:junit:4.13.2") testImplementation("io.mockk:mockk:1.13.5") testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3") diff --git a/data/src/test/java/com/rtbishop/look4sat/data/DataParserTest.kt b/data/src/test/java/com/rtbishop/look4sat/data/DataParserTest.kt index bf166e21..74ffb14b 100644 --- a/data/src/test/java/com/rtbishop/look4sat/data/DataParserTest.kt +++ b/data/src/test/java/com/rtbishop/look4sat/data/DataParserTest.kt @@ -31,7 +31,6 @@ class DataParserTest { private val validCSVStream = """ OBJECT_NAME,OBJECT_ID,EPOCH,MEAN_MOTION,ECCENTRICITY,INCLINATION,RA_OF_ASC_NODE,ARG_OF_PERICENTER,MEAN_ANOMALY,EPHEMERIS_TYPE,CLASSIFICATION_TYPE,NORAD_CAT_ID,ELEMENT_SET_NO,REV_AT_EPOCH,BSTAR,MEAN_MOTION_DOT,MEAN_MOTION_DDOT ISS (ZARYA),1998-067A,2021-11-16T12:28:09.322176,15.48582035,.0004694,51.6447,309.4881,203.6966,299.8876,0,U,25544,999,31220,.31985E-4,.1288E-4,0 - ISS (ZARYA),1998-067A,2024-03-09T05:45:04.737024,15.49756209,.0005741,51.6418,90.7424,343.9724,92.8274,0,U,25544,999,44305,.25016E-3,.1373E-3,0 FLTSATCOM 8 (USA 46),1989-077A,2022-01-07T11:37:38.074080,1.00273350,.0001114,12.9044,1.3272,91.5769,260.4200,0,U,20253,999,24434,0,-.85E-6,0 """.trimIndent().byteInputStream() private val invalidCSVStream = """ @@ -42,9 +41,6 @@ class DataParserTest { ISS (ZARYA) 1 25544U 98067A 21320.51955234 .00001288 00000+0 31985-4 0 9990 2 25544 51.6447 309.4881 0004694 203.6966 299.8876 15.48582035312205 - ISS (ZARYA) - 1 25544U 98067A 24069.23963816 .00013730 00000+0 25016-3 0 9999 - 2 25544 51.6418 90.7424 0005741 343.9724 92.8274 15.49756209443058 FLTSATCOM 8 (USA 46) 1 20253U 89077A 22007.48446845 -.00000085 00000+0 00000+0 0 9999 2 20253 12.9044 1.3272 0001114 91.5769 260.4200 1.00273350244345 @@ -53,18 +49,17 @@ class DataParserTest { 1 25544U 98067A 21320.51955234 .00001288 00000+0 31985-4 0 9990 2 25544 51.6447 309.4881 0004694 203.6966 299.8876 15.48582035312205 """.trimIndent().byteInputStream() - private val validJSONStream = """ - [{"uuid":"UzPz4gcsNBPKPKAFPmer7g","description":"Upper side band (drifting)","alive":true,"type":"Transmitter","uplink_low":null,"uplink_high":null,"uplink_drift":null,"downlink_low":136658500,"downlink_high":null,"downlink_drift":null,"mode":"USB","mode_id":9,"uplink_mode":null,"invert":false,"baud":null,"sat_id":"SCHX-0895-2361-9925-0309","norad_cat_id":965,"status":"active","updated":"2019-04-18T05:39:53.343316Z","citation":"CITATION NEEDED - https://xkcd.com/285/","service":"Unknown","coordination":"","coordination_url":""}] - """.trimIndent().byteInputStream() - private val invalidJSONStream = """ - [{"description":"Upper side band (drifting)","alive":true,"type":"Transmitter","uplink_low":null,"uplink_high":null,"uplink_drift":null,"downlink_low":136658500,"downlink_high":null,"downlink_drift":null,"mode":"USB","mode_id":9,"uplink_mode":null,"invert":false,"baud":null,"sat_id":"SCHX-0895-2361-9925-0309","norad_cat_id":965,"status":"active","updated":"2019-04-18T05:39:53.343316Z","citation":"CITATION NEEDED - https://xkcd.com/285/","service":"Unknown","coordination":"","coordination_url":""}] - """.trimIndent().byteInputStream() +// private val validJSONStream = """ +// [{"uuid":"UzPz4gcsNBPKPKAFPmer7g","description":"Upper side band (drifting)","alive":true,"type":"Transmitter","uplink_low":null,"uplink_high":null,"uplink_drift":null,"downlink_low":136658500,"downlink_high":null,"downlink_drift":null,"mode":"USB","mode_id":9,"uplink_mode":null,"invert":false,"baud":null,"sat_id":"SCHX-0895-2361-9925-0309","norad_cat_id":965,"status":"active","updated":"2019-04-18T05:39:53.343316Z","citation":"CITATION NEEDED - https://xkcd.com/285/","service":"Unknown","coordination":"","coordination_url":""}] +// """.trimIndent().byteInputStream() +// private val invalidJSONStream = """ +// [{"description":"Upper side band (drifting)","alive":true,"type":"Transmitter","uplink_low":null,"uplink_high":null,"uplink_drift":null,"downlink_low":136658500,"downlink_high":null,"downlink_drift":null,"mode":"USB","mode_id":9,"uplink_mode":null,"invert":false,"baud":null,"sat_id":"SCHX-0895-2361-9925-0309","norad_cat_id":965,"status":"active","updated":"2019-04-18T05:39:53.343316Z","citation":"CITATION NEEDED - https://xkcd.com/285/","service":"Unknown","coordination":"","coordination_url":""}] +// """.trimIndent().byteInputStream() @Test fun `Given valid CSV stream returns valid data`() = runTest(testDispatcher) { val parsedList = dataParser.parseCSVStream(validCSVStream) assert(parsedList[0].epoch == 21320.51955234) - assert(parsedList[1].epoch == 24069.23963816) } @Test @@ -77,7 +72,6 @@ class DataParserTest { fun `Given valid TLE stream returns valid data`() = runTest(testDispatcher) { val parsedList = dataParser.parseTLEStream(validTLEStream) assert(parsedList[0].epoch == 21320.51955234) - assert(parsedList[1].epoch == 24069.23963816) } @Test @@ -93,23 +87,15 @@ class DataParserTest { assert(csvResult == tleResult) } - @Test - fun `Given valid JSON stream returns valid data`() = runTest(testDispatcher) { - val parsedList = dataParser.parseJSONStream(validJSONStream) - assert(parsedList[0].downlink == 136658500L) - } - - @Test - fun `Given invalid JSON stream returns empty list`() = runTest(testDispatcher) { - val parsedList = dataParser.parseJSONStream(invalidJSONStream) - assert(parsedList.isEmpty()) - } - - @Test - fun `Function isLeapYear returns correct data`() = runTest(testDispatcher) { - val years = listOf(1900, 1984, 1994, 2016, 2022, 2024, 2042, 2048) - val answers = listOf(false, true, false, true, false, true, false, true) - val results = years.map { dataParser.isLeapYear(it) } - assert(results == answers) - } +// @Test +// fun `Given valid JSON stream returns valid data`() = runTest(testDispatcher) { +// val parsedList = dataParser.parseJSONStream(validJSONStream) +// assert(parsedList[0].downlink == 136658500L) +// } +// +// @Test +// fun `Given invalid JSON stream returns empty list`() = runTest(testDispatcher) { +// val parsedList = dataParser.parseJSONStream(invalidJSONStream) +// assert(parsedList.isEmpty()) +// } } diff --git a/data/src/test/java/com/rtbishop/look4sat/data/ExampleUnitTest.kt b/data/src/test/java/com/rtbishop/look4sat/data/ExampleUnitTest.kt deleted file mode 100644 index 8da4fe90..00000000 --- a/data/src/test/java/com/rtbishop/look4sat/data/ExampleUnitTest.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.rtbishop.look4sat.data - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * 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) - } -} diff --git a/gradle.properties b/gradle.properties index 1298d632..45e00774 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,14 +21,15 @@ # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library #android.nonTransitiveRClass=true -android.defaults.buildfeatures.buildconfig=true +android.defaults.buildfeatures.buildconfig=false android.enableJetifier=false -android.nonFinalResIds=false +android.nonFinalResIds=true android.nonTransitiveRClass=true android.useAndroidX=true kotlin.code.style=official kotlin.daemon.jvm.options=-Xmx4096M kotlin.incremental=true org.gradle.caching=true +org.gradle.configuration-cache=true org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fe3579b0..285a8c92 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Apr 21 15:31:10 BST 2023 +#Sat Jul 29 12:58:49 BST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists