From f6075848e7da031f0d7021c07eee9150bc644d6f Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Wed, 20 Jul 2022 16:06:50 -0300 Subject: [PATCH] Move libraries into their own folder and remove sharedTest symlink hack. The shared tests are now a proper gradle module to avoid issues with using the same source files in different modules. --- .gitlab-ci.yml | 14 +- README.md | 5 +- app/build.gradle | 4 +- download/README.md | 40 ---- index/LICENSE | 202 ------------------ index/README.md | 41 ---- {download => libs}/LICENSE | 0 libs/README.md | 98 +++++++++ {database => libs/database}/.gitignore | 0 {database => libs/database}/build.gradle | 12 +- .../database}/consumer-rules.pro | 0 .../database}/proguard-rules.pro | 0 .../1.json | 0 .../java/org/fdroid/database/AppDaoTest.kt | 0 .../org/fdroid/database/AppListItemsTest.kt | 0 .../fdroid/database/AppOverviewItemsTest.kt | 0 .../java/org/fdroid/database/AppTest.kt | 0 .../dbTest/java/org/fdroid/database/DbTest.kt | 0 .../fdroid/database/DbUpdateCheckerTest.kt | 0 .../org/fdroid/database/IndexV1InsertTest.kt | 0 .../org/fdroid/database/IndexV2DiffTest.kt | 0 .../org/fdroid/database/IndexV2InsertTest.kt | 0 .../org/fdroid/database/RepositoryDaoTest.kt | 0 .../org/fdroid/database/RepositoryDiffTest.kt | 0 .../java/org/fdroid/database/TestUtils.kt | 0 .../java/org/fdroid/database/VersionTest.kt | 0 .../org/fdroid/index/v1/IndexV1UpdaterTest.kt | 0 .../org/fdroid/index/v2/IndexV2UpdaterTest.kt | 0 .../database}/src/main/AndroidManifest.xml | 0 .../src/main/java/org/fdroid/database/App.kt | 0 .../main/java/org/fdroid/database/AppDao.kt | 0 .../main/java/org/fdroid/database/AppPrefs.kt | 0 .../java/org/fdroid/database/AppPrefsDao.kt | 0 .../java/org/fdroid/database/Converters.kt | 0 .../java/org/fdroid/database/DbDiffUtils.kt | 0 .../org/fdroid/database/DbUpdateChecker.kt | 0 .../org/fdroid/database/DbV1StreamReceiver.kt | 0 .../fdroid/database/DbV2DiffStreamReceiver.kt | 0 .../org/fdroid/database/DbV2StreamReceiver.kt | 0 .../org/fdroid/database/FDroidDatabase.kt | 0 .../fdroid/database/FDroidDatabaseHolder.kt | 0 .../java/org/fdroid/database/Repository.kt | 0 .../java/org/fdroid/database/RepositoryDao.kt | 0 .../main/java/org/fdroid/database/Version.kt | 0 .../java/org/fdroid/database/VersionDao.kt | 0 .../org/fdroid/download/DownloaderFactory.kt | 0 .../java/org/fdroid/index/IndexUpdater.kt | 0 .../main/java/org/fdroid/index/RepoUpdater.kt | 0 .../org/fdroid/index/v1/IndexV1Updater.kt | 0 .../org/fdroid/index/v2/IndexV2Updater.kt | 0 {database => libs/database}/src/sharedTest | 0 .../java/org/fdroid/database/AppPrefsTest.kt | 0 .../org/fdroid/database/ConvertersTest.kt | 0 {download => libs/download}/.gitignore | 0 {download => libs/download}/build.gradle | 1 - {download => libs/download}/gradle.properties | 0 {download => libs/download}/lint.xml | 2 - .../HttpManagerInstrumentationTest.kt | 0 .../src/androidMain/AndroidManifest.xml | 0 .../kotlin/org/fdroid/download/Downloader.kt | 0 .../org/fdroid/download/HttpDownloader.kt | 0 .../kotlin/org/fdroid/download/HttpManager.kt | 0 .../kotlin/org/fdroid/download/HttpPoster.kt | 0 .../download/glide/DownloadRequestLoader.kt | 0 .../org/fdroid/download/glide/HttpFetcher.kt | 0 .../download/glide/HttpGlideUrlLoader.kt | 0 .../kotlin/org/fdroid/fdroid/HashUtils.kt | 0 .../org/fdroid/download/HttpDownloaderTest.kt | 0 .../org/fdroid/download/HttpPosterTest.kt | 0 .../org/fdroid/download/DownloadRequest.kt | 0 .../kotlin/org/fdroid/download/HeadInfo.kt | 0 .../kotlin/org/fdroid/download/HttpManager.kt | 0 .../kotlin/org/fdroid/download/Mirror.kt | 0 .../org/fdroid/download/MirrorChooser.kt | 0 .../kotlin/org/fdroid/download/Proxy.kt | 0 .../org/fdroid/fdroid/ProgressListener.kt | 0 .../commonTest/kotlin/org/fdroid/TestUtils.kt | 0 .../download/HttpManagerIntegrationTest.kt | 0 .../org/fdroid/download/HttpManagerTest.kt | 0 .../org/fdroid/download/MirrorChooserTest.kt | 0 .../kotlin/org/fdroid/download/MirrorTest.kt | 0 .../kotlin/org/fdroid/download/HttpManager.kt | 0 .../kotlin/org/fdroid/download/HttpManager.kt | 0 {index => libs/index}/.gitignore | 0 {index => libs/index}/build.gradle | 8 +- {index => libs/index}/consumer-rules.pro | 0 {index => libs/index}/gradle.properties | 0 .../kotlin/org/fdroid/BestLocaleTest.kt | 0 .../org/fdroid/index/v1/IndexV1CreatorTest.kt | 0 .../src/androidMain/AndroidManifest.xml | 0 .../kotlin/org/fdroid/CompatibilityChecker.kt | 0 .../kotlin/org/fdroid/LocaleChooser.kt | 0 .../kotlin/org/fdroid/UpdateChecker.kt | 0 .../kotlin/org/fdroid/index/IndexCreator.kt | 0 .../kotlin/org/fdroid/index/IndexParser.kt | 0 .../kotlin/org/fdroid/index/IndexUtils.kt | 0 .../org/fdroid/index/JarIndexVerifier.kt | 0 .../org/fdroid/index/v1/IndexV1Creator.kt | 0 .../fdroid/index/v1/IndexV1StreamProcessor.kt | 0 .../org/fdroid/index/v1/IndexV1Verifier.kt | 0 .../org/fdroid/index/v2/EntryVerifier.kt | 0 .../index/v2/IndexV2DiffStreamProcessor.kt | 0 .../index/v2/IndexV2FullStreamProcessor.kt | 0 .../fdroid/index/v2/IndexV2StreamProcessor.kt | 0 .../org/fdroid/index/v2/ReflectionDiffer.kt | 0 .../org/fdroid/CompatibilityCheckerTest.kt | 0 .../kotlin/org/fdroid/UpdateCheckerTest.kt | 0 .../index/v1/IndexV1StreamProcessorTest.kt | 17 +- .../fdroid/index/v1/IndexV1VerifierTest.kt | 0 .../org/fdroid/index/v2/EntryVerifierTest.kt | 0 .../v2/IndexV2FullStreamProcessorTest.kt | 13 +- .../fdroid/index/v2/ReflectionDifferTest.kt | 37 ++-- .../kotlin/org/fdroid/index/IndexConverter.kt | 0 .../kotlin/org/fdroid/index/IndexParser.kt | 0 .../kotlin/org/fdroid/index/v1/AppV1.kt | 0 .../kotlin/org/fdroid/index/v1/IndexV1.kt | 0 .../fdroid/index/v1/IndexV1StreamReceiver.kt | 0 .../kotlin/org/fdroid/index/v1/PackageV1.kt | 0 .../kotlin/org/fdroid/index/v2/IndexV2.kt | 0 .../index/v2/IndexV2DiffStreamReceiver.kt | 0 .../fdroid/index/v2/IndexV2StreamReceiver.kt | 0 .../kotlin/org/fdroid/index/v2/PackageV2.kt | 0 .../org/fdroid/index/IndexConverterTest.kt | 14 +- .../kotlin/org/fdroid/index/v1/IndexV1Test.kt | 9 +- .../kotlin/org/fdroid/index/v2/EntryTest.kt | 13 +- .../v2/IndexV2DiffStreamProcessorTest.kt | 13 +- .../kotlin/org/fdroid/index/v2/IndexV2Test.kt | 12 +- .../invalid-MD5-MD5withRSA-v1.jar | Bin .../invalid-MD5-MD5withRSA-v2.jar | Bin .../invalid-MD5-SHA1withRSA-v1.jar | Bin .../invalid-MD5-SHA1withRSA-v2.jar | Bin .../invalid-SHA1-SHA1withRSA-v2.jar | Bin .../resources/verification/invalid-v1.jar | Bin .../resources/verification/invalid-v2.jar | Bin .../verification/invalid-wrong-entry-v1.jar | Bin .../resources/verification/unsigned.jar | Bin .../verification/valid-apksigner-v2.jar | Bin .../resources/verification/valid-v1.jar | Bin .../resources/verification/valid-v2.jar | Bin libs/sharedTest/.gitignore | 1 + libs/sharedTest/build.gradle | 27 +++ libs/sharedTest/src/main/AndroidManifest.xml | 2 + .../src/main/assets}/diff-empty-max/1337.json | 0 .../src/main/assets}/diff-empty-max/23.json | 0 .../src/main/assets}/diff-empty-max/42.json | 0 .../src/main/assets}/diff-empty-max/entry.jar | Bin .../main/assets}/diff-empty-max/entry.json | 0 .../src/main/assets}/diff-empty-mid/23.json | 0 .../src/main/assets}/diff-empty-mid/42.json | 0 .../src/main/assets}/diff-empty-mid/entry.jar | Bin .../main/assets}/diff-empty-mid/entry.json | 0 .../src/main/assets}/diff-empty-min/23.json | 0 .../src/main/assets}/diff-empty-min/entry.jar | Bin .../main/assets}/diff-empty-min/entry.json | 0 .../src/main/assets}/entry-empty-v2.json | 0 .../src/main/assets}/index-empty-v1.json | 0 .../src/main/assets}/index-empty-v2.json | 0 .../src/main/assets}/index-max-v1.json | 0 .../src/main/assets}/index-max-v2.json | 0 .../src/main/assets}/index-mid-v1.json | 0 .../src/main/assets}/index-mid-v2.json | 0 .../main/assets}/index-min-reordered-v2.json | 0 .../src/main/assets}/index-min-v1.json | 0 .../src/main/assets}/index-min-v2.json | 0 ...r.at_corrupt_app_package_name_index-v1.jar | Bin ...at.or.at_corrupt_package_name_index-v1.jar | Bin .../main/assets}/testy.at.or.at_index-v1.jar | Bin .../testy.at.or.at_no-.RSA_index-v1.jar | Bin .../testy.at.or.at_no-.SF_index-v1.jar | Bin ...testy.at.or.at_no-MANIFEST.MF_index-v1.jar | Bin .../testy.at.or.at_no-signature_index-v1.jar | Bin .../main}/kotlin/org/fdroid/test/DiffUtils.kt | 18 +- .../kotlin/org/fdroid/test/TestAppUtils.kt | 10 +- .../kotlin/org/fdroid/test/TestDataEntryV2.kt | 10 +- .../kotlin/org/fdroid/test/TestDataV1.kt | 8 +- .../kotlin/org/fdroid/test/TestDataV2.kt | 20 +- .../kotlin/org/fdroid/test/TestRepoUtils.kt | 12 +- .../main}/kotlin/org/fdroid/test/TestUtils.kt | 18 +- .../org/fdroid/test/TestVersionUtils.kt | 2 +- .../org/fdroid/test/VerifierConstants.kt | 8 +- settings.gradle | 7 +- 181 files changed, 265 insertions(+), 433 deletions(-) delete mode 100644 download/README.md delete mode 100644 index/LICENSE delete mode 100644 index/README.md rename {download => libs}/LICENSE (100%) create mode 100644 libs/README.md rename {database => libs/database}/.gitignore (100%) rename {database => libs/database}/build.gradle (91%) rename {database => libs/database}/consumer-rules.pro (100%) rename {database => libs/database}/proguard-rules.pro (100%) rename {database => libs/database}/schemas/org.fdroid.database.FDroidDatabaseInt/1.json (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/AppDaoTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/AppListItemsTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/AppOverviewItemsTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/AppTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/DbTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/DbUpdateCheckerTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/IndexV1InsertTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/IndexV2DiffTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/IndexV2InsertTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/RepositoryDaoTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/RepositoryDiffTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/TestUtils.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/database/VersionTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/index/v1/IndexV1UpdaterTest.kt (100%) rename {database => libs/database}/src/dbTest/java/org/fdroid/index/v2/IndexV2UpdaterTest.kt (100%) rename {database => libs/database}/src/main/AndroidManifest.xml (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/App.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/AppDao.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/AppPrefs.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/AppPrefsDao.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/Converters.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/DbDiffUtils.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/DbUpdateChecker.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/DbV1StreamReceiver.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/DbV2DiffStreamReceiver.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/DbV2StreamReceiver.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/FDroidDatabase.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/FDroidDatabaseHolder.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/Repository.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/RepositoryDao.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/Version.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/database/VersionDao.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/download/DownloaderFactory.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/index/IndexUpdater.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/index/RepoUpdater.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/index/v1/IndexV1Updater.kt (100%) rename {database => libs/database}/src/main/java/org/fdroid/index/v2/IndexV2Updater.kt (100%) rename {database => libs/database}/src/sharedTest (100%) rename {database => libs/database}/src/test/java/org/fdroid/database/AppPrefsTest.kt (100%) rename {database => libs/database}/src/test/java/org/fdroid/database/ConvertersTest.kt (100%) rename {download => libs/download}/.gitignore (100%) rename {download => libs/download}/build.gradle (99%) rename {download => libs/download}/gradle.properties (100%) rename {download => libs/download}/lint.xml (52%) rename {download => libs/download}/src/androidAndroidTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt (100%) rename {download => libs/download}/src/androidMain/AndroidManifest.xml (100%) rename {download => libs/download}/src/androidMain/kotlin/org/fdroid/download/Downloader.kt (100%) rename {download => libs/download}/src/androidMain/kotlin/org/fdroid/download/HttpDownloader.kt (100%) rename {download => libs/download}/src/androidMain/kotlin/org/fdroid/download/HttpManager.kt (100%) rename {download => libs/download}/src/androidMain/kotlin/org/fdroid/download/HttpPoster.kt (100%) rename {download => libs/download}/src/androidMain/kotlin/org/fdroid/download/glide/DownloadRequestLoader.kt (100%) rename {download => libs/download}/src/androidMain/kotlin/org/fdroid/download/glide/HttpFetcher.kt (100%) rename {download => libs/download}/src/androidMain/kotlin/org/fdroid/download/glide/HttpGlideUrlLoader.kt (100%) rename {download => libs/download}/src/androidMain/kotlin/org/fdroid/fdroid/HashUtils.kt (100%) rename {download => libs/download}/src/androidTest/kotlin/org/fdroid/download/HttpDownloaderTest.kt (100%) rename {download => libs/download}/src/androidTest/kotlin/org/fdroid/download/HttpPosterTest.kt (100%) rename {download => libs/download}/src/commonMain/kotlin/org/fdroid/download/DownloadRequest.kt (100%) rename {download => libs/download}/src/commonMain/kotlin/org/fdroid/download/HeadInfo.kt (100%) rename {download => libs/download}/src/commonMain/kotlin/org/fdroid/download/HttpManager.kt (100%) rename {download => libs/download}/src/commonMain/kotlin/org/fdroid/download/Mirror.kt (100%) rename {download => libs/download}/src/commonMain/kotlin/org/fdroid/download/MirrorChooser.kt (100%) rename {download => libs/download}/src/commonMain/kotlin/org/fdroid/download/Proxy.kt (100%) rename {download => libs/download}/src/commonMain/kotlin/org/fdroid/fdroid/ProgressListener.kt (100%) rename {download => libs/download}/src/commonTest/kotlin/org/fdroid/TestUtils.kt (100%) rename {download => libs/download}/src/commonTest/kotlin/org/fdroid/download/HttpManagerIntegrationTest.kt (100%) rename {download => libs/download}/src/commonTest/kotlin/org/fdroid/download/HttpManagerTest.kt (100%) rename {download => libs/download}/src/commonTest/kotlin/org/fdroid/download/MirrorChooserTest.kt (100%) rename {download => libs/download}/src/commonTest/kotlin/org/fdroid/download/MirrorTest.kt (100%) rename {download => libs/download}/src/jvmMain/kotlin/org/fdroid/download/HttpManager.kt (100%) rename {download => libs/download}/src/nativeMain/kotlin/org/fdroid/download/HttpManager.kt (100%) rename {index => libs/index}/.gitignore (100%) rename {index => libs/index}/build.gradle (96%) rename {index => libs/index}/consumer-rules.pro (100%) rename {index => libs/index}/gradle.properties (100%) rename {index => libs/index}/src/androidAndroidTest/kotlin/org/fdroid/BestLocaleTest.kt (100%) rename {index => libs/index}/src/androidAndroidTest/kotlin/org/fdroid/index/v1/IndexV1CreatorTest.kt (100%) rename {index => libs/index}/src/androidMain/AndroidManifest.xml (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/CompatibilityChecker.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/LocaleChooser.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/UpdateChecker.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/IndexCreator.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/IndexParser.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/IndexUtils.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/JarIndexVerifier.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Creator.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1StreamProcessor.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Verifier.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/v2/EntryVerifier.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessor.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessor.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2StreamProcessor.kt (100%) rename {index => libs/index}/src/androidMain/kotlin/org/fdroid/index/v2/ReflectionDiffer.kt (100%) rename {index => libs/index}/src/androidTest/kotlin/org/fdroid/CompatibilityCheckerTest.kt (100%) rename {index => libs/index}/src/androidTest/kotlin/org/fdroid/UpdateCheckerTest.kt (100%) rename {index => libs/index}/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1StreamProcessorTest.kt (90%) rename {index => libs/index}/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1VerifierTest.kt (100%) rename {index => libs/index}/src/androidTest/kotlin/org/fdroid/index/v2/EntryVerifierTest.kt (100%) rename {index => libs/index}/src/androidTest/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessorTest.kt (90%) rename {index => libs/index}/src/androidTest/kotlin/org/fdroid/index/v2/ReflectionDifferTest.kt (83%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/IndexConverter.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/IndexParser.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/v1/AppV1.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1StreamReceiver.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/v1/PackageV1.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamReceiver.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2StreamReceiver.kt (100%) rename {index => libs/index}/src/commonMain/kotlin/org/fdroid/index/v2/PackageV2.kt (100%) rename {index => libs/index}/src/commonTest/kotlin/org/fdroid/index/IndexConverterTest.kt (67%) rename {index => libs/index}/src/commonTest/kotlin/org/fdroid/index/v1/IndexV1Test.kt (90%) rename {index => libs/index}/src/commonTest/kotlin/org/fdroid/index/v2/EntryTest.kt (86%) rename {index => libs/index}/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessorTest.kt (86%) rename {index => libs/index}/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2Test.kt (82%) rename {index => libs/index}/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v1.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v2.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v1.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v2.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/invalid-SHA1-SHA1withRSA-v2.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/invalid-v1.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/invalid-v2.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/invalid-wrong-entry-v1.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/unsigned.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/valid-apksigner-v2.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/valid-v1.jar (100%) rename {index => libs/index}/src/commonTest/resources/verification/valid-v2.jar (100%) create mode 100644 libs/sharedTest/.gitignore create mode 100644 libs/sharedTest/build.gradle create mode 100644 libs/sharedTest/src/main/AndroidManifest.xml rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-max/1337.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-max/23.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-max/42.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-max/entry.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-max/entry.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-mid/23.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-mid/42.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-mid/entry.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-mid/entry.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-min/23.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-min/entry.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/diff-empty-min/entry.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/entry-empty-v2.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-empty-v1.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-empty-v2.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-max-v1.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-max-v2.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-mid-v1.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-mid-v2.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-min-reordered-v2.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-min-v1.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/index-min-v2.json (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/testy.at.or.at_corrupt_app_package_name_index-v1.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/testy.at.or.at_corrupt_package_name_index-v1.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/testy.at.or.at_index-v1.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/testy.at.or.at_no-.RSA_index-v1.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/testy.at.or.at_no-.SF_index-v1.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/testy.at.or.at_no-MANIFEST.MF_index-v1.jar (100%) rename {index/src/sharedTest/resources => libs/sharedTest/src/main/assets}/testy.at.or.at_no-signature_index-v1.jar (100%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/DiffUtils.kt (83%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/TestAppUtils.kt (91%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/TestDataEntryV2.kt (93%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/TestDataV1.kt (99%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/TestDataV2.kt (99%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/TestRepoUtils.kt (84%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/TestUtils.kt (82%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/TestVersionUtils.kt (98%) rename {index/src/sharedTest => libs/sharedTest/src/main}/kotlin/org/fdroid/test/VerifierConstants.kt (90%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 21ee23063..7d7594f4d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -148,12 +148,12 @@ pages: only: - master script: - - ./gradlew :download:dokkaHtml :index:dokkaHtml :database:dokkaHtml - - mkdir public - - touch public/index.html - - cp -r download/build/dokka/html public/download - - cp -r index/build/dokka/html public/index - - cp -r database/build/dokka/html public/database + - ./gradlew :libs:download:dokkaHtml :libs:index:dokkaHtml :libs:database:dokkaHtml + - mkdir -p public/libs + - touch public/index.html public/libs/index.html + - cp -r libs/download/build/dokka/html public/libs/download + - cp -r libs/index/build/dokka/html public/libs/index + - cp -r libs/database/build/dokka/html public/libs/database artifacts: paths: - public @@ -174,7 +174,7 @@ deploy_nightly: - echo "${CI_PROJECT_PATH}-nightly" >> app/src/main/res/values/default_repos.xml - echo "${CI_PROJECT_URL}-nightly/raw/master/fdroid/repo" >> app/src/main/res/values/default_repos.xml - cat config/nightly-repo/repo.xml >> app/src/main/res/values/default_repos.xml - - export DB=`sed -n 's,.*version *= *\([0-9][0-9]*\).*,\1,p' database/src/main/java/org/fdroid/database/FDroidDatabase.kt` + - export DB=`sed -n 's,.*version *= *\([0-9][0-9]*\).*,\1,p' libs/database/src/main/java/org/fdroid/database/FDroidDatabase.kt` - export versionCode=`printf '%d%05d' $DB $(date '+%s'| cut -b1-8)` - sed -i "s,^\(\s*versionCode\) *[0-9].*,\1 $versionCode," app/build.gradle # build the APKs! diff --git a/README.md b/README.md index 0ba489fb7..500bb87d8 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,7 @@ from our site or [browse it in the repo](https://f-droid.org/app/org.fdroid.fdro Core F-Droid functionality is split into re-usable libraries to make using F-Droid technology in your own projects as easy as possible. -Note that all libraries are still in alpha stage. -While they work, their public APIs are still subject to change. - -* [download](download) library for handling (multi-platform) HTTP download of repository indexes and APKs +[More information about libraries](libs/README.md) ## Contributing diff --git a/app/build.gradle b/app/build.gradle index b9b0f6053..47eb3af07 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -142,7 +142,9 @@ android { } dependencies { - implementation project(":download") + implementation project(":libs:download") + implementation project(":libs:index") + implementation project(":libs:database") implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.gridlayout:gridlayout:1.0.0' diff --git a/download/README.md b/download/README.md deleted file mode 100644 index 37b51a47a..000000000 --- a/download/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# F-Droid multi-platform download library - -Note that advanced security and privacy features are only available for Android: - - * Rejection of TLS 1.1 and older as well as rejection of weak ciphers - * No DNS requests when using Tor as a proxy - * short TLS session timeout to prevent tracking and key re-use - -Other platforms besides Android have not been tested and might need additional work. - -## How to include in your project - -Add this to your `build.gradle` file -and replace `[version]` with the [latest version](gradle.properties): - - implementation 'org.fdroid:download:[version]' - -## Development - -You can list available gradle tasks by running the following command in the project root. - - ./gradlew :download:tasks - -### Making releases - -Bump version number in [`gradle.properties`](gradle.properties), ensure you didn't break a public API and run: - - ./gradlew :download:check :download:connectedCheck - ./gradlew :download:publish - ./gradlew closeAndReleaseRepository - -See https://github.com/vanniktech/gradle-maven-publish-plugin#gradle-maven-publish-plugin for more information. - -## License - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 diff --git a/index/LICENSE b/index/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/index/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/index/README.md b/index/README.md deleted file mode 100644 index 130a7817a..000000000 --- a/index/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# F-Droid multi-platform index library - -Note that some features are only available for Android: - - * index signature verification (`JarFile` is JVM only) - * index stream processing (`InputStream` is JVM only) - * index V2 diffing (reflection is JVM only) - * app device compatibility checking (requires Android) - -Other platforms besides Android have not been tested and might need additional work. - -## How to include in your project - -Add this to your `build.gradle` file -and replace `[version]` with the [latest version](gradle.properties): - - implementation 'org.fdroid:index:[version]' - -## Development - -You can list available gradle tasks by running the following command in the project root. - - ./gradlew :index:tasks - -### Making releases - -Bump version number in [`gradle.properties`](gradle.properties), ensure you didn't break a public API and run: - - ./gradlew :index:check :index:connectedCheck - ./gradlew :index:publish - ./gradlew closeAndReleaseRepository - -See https://github.com/vanniktech/gradle-maven-publish-plugin#gradle-maven-publish-plugin for more information. - -## License - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 diff --git a/download/LICENSE b/libs/LICENSE similarity index 100% rename from download/LICENSE rename to libs/LICENSE diff --git a/libs/README.md b/libs/README.md new file mode 100644 index 000000000..e9759399e --- /dev/null +++ b/libs/README.md @@ -0,0 +1,98 @@ +# F-Droid libraries + +Core F-Droid functionality is split into re-usable libraries +to make using F-Droid technology in your own projects as easy as possible. + +Note that all libraries are still in alpha stage. +While they work, their public APIs are still subject to change. + +* [download](libs/download) library for handling (multi-platform) HTTP download + of repository indexes and APKs +* [index](libs/index) library for parsing/verifying/creating repository indexes +* [database](libs/database) library to store and query F-Droid related information + in a Room-based database on Android + +## F-Droid multi-platform download library + +[API docs](https://fdroid.gitlab.io/fdroidclient/libs/download/) + +Note that advanced security and privacy features are only available for Android: + +* Rejection of TLS 1.1 and older as well as rejection of weak ciphers +* No DNS requests when using Tor as a proxy +* short TLS session timeout to prevent tracking and key re-use + +Other platforms besides Android have not been tested and might need additional work. + +### How to include in your project + +Add this to your `build.gradle` file +and replace `[version]` with the [latest version](download/index/gradle.properties): + + implementation 'org.fdroid:download:[version]' + +## F-Droid multi-platform index library + +[API docs](https://fdroid.gitlab.io/fdroidclient/libs/index/) + +Note that some features are only available for Android: + + * index signature verification (`JarFile` is JVM only) + * index stream processing (`InputStream` is JVM only) + * index V2 diffing (reflection is JVM only) + * app device compatibility checking (requires Android) + +Other platforms besides Android have not been tested and might need additional work. + +### How to include in your project + +Add this to your `build.gradle` file +and replace `[version]` with the [latest version](libs/index/gradle.properties): + + implementation 'org.fdroid:index:[version]' + +## F-Droid Android database library + +[API docs](https://fdroid.gitlab.io/fdroidclient/libs/database/) + +An Android-only database library to store and query F-Droid related information +such as repositories, apps and their versions. +This library should bring everything you need to build your own F-Droid client +that persists information. + +### How to include in your project + +Add this to your `build.gradle` file +and replace `[version]` with the [latest version](libs/database/gradle.properties): + + implementation 'org.fdroid:database:[version]' + +# Development + +You can list available gradle tasks by running the following command in the project root. + + ./gradlew :download:tasks + +Replace `download` with the name of the library you want to view tasks for. + +# Making releases + +Bump version number in the library's [`gradle.properties`](gradle.properties), +ensure you didn't break a public API and run: + + ./gradlew :download:check :index:connectedCheck + ./gradlew :download:publish + ./gradlew closeAndReleaseRepository + +Replace `download` with the name of the library you want to publish. + +See https://github.com/vanniktech/gradle-maven-publish-plugin#gradle-maven-publish-plugin +for more information. + +# License + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 diff --git a/database/.gitignore b/libs/database/.gitignore similarity index 100% rename from database/.gitignore rename to libs/database/.gitignore diff --git a/database/build.gradle b/libs/database/build.gradle similarity index 91% rename from database/build.gradle rename to libs/database/build.gradle index 5ecc75239..05f42c5e3 100644 --- a/database/build.gradle +++ b/libs/database/build.gradle @@ -10,7 +10,7 @@ android { compileSdkVersion 31 defaultConfig { - minSdkVersion 22 + minSdkVersion 21 consumerProguardFiles "consumer-rules.pro" javaCompileOptions { @@ -31,13 +31,9 @@ android { sourceSets { androidTest { java.srcDirs += "src/dbTest/java" - java.srcDirs += "src/sharedTest/kotlin" - assets.srcDirs += "src/sharedTest/resources" } test { java.srcDirs += "src/dbTest/java" - java.srcDirs += "src/sharedTest/kotlin" - assets.srcDirs += "src/sharedTest/resources" } } compileOptions { @@ -65,8 +61,8 @@ android { } dependencies { - implementation project(":download") - implementation project(":index") + implementation project(":libs:download") + implementation project(":libs:index") implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' @@ -81,6 +77,7 @@ dependencies { implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2" + testImplementation project(":libs:sharedTest") testImplementation 'junit:junit:4.13.2' testImplementation 'io.mockk:mockk:1.12.4' testImplementation 'org.jetbrains.kotlin:kotlin-test' @@ -90,6 +87,7 @@ dependencies { testImplementation 'org.robolectric:robolectric:4.8.1' testImplementation 'commons-io:commons-io:2.6' + androidTestImplementation project(":libs:sharedTest") androidTestImplementation 'io.mockk:mockk-android:1.12.3' // 1.12.4 has strange error androidTestImplementation 'org.jetbrains.kotlin:kotlin-test' androidTestImplementation 'androidx.test.ext:junit:1.1.3' diff --git a/database/consumer-rules.pro b/libs/database/consumer-rules.pro similarity index 100% rename from database/consumer-rules.pro rename to libs/database/consumer-rules.pro diff --git a/database/proguard-rules.pro b/libs/database/proguard-rules.pro similarity index 100% rename from database/proguard-rules.pro rename to libs/database/proguard-rules.pro diff --git a/database/schemas/org.fdroid.database.FDroidDatabaseInt/1.json b/libs/database/schemas/org.fdroid.database.FDroidDatabaseInt/1.json similarity index 100% rename from database/schemas/org.fdroid.database.FDroidDatabaseInt/1.json rename to libs/database/schemas/org.fdroid.database.FDroidDatabaseInt/1.json diff --git a/database/src/dbTest/java/org/fdroid/database/AppDaoTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/AppDaoTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/AppDaoTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/AppDaoTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/AppListItemsTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/AppListItemsTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/AppListItemsTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/AppListItemsTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/AppOverviewItemsTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/AppOverviewItemsTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/AppOverviewItemsTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/AppOverviewItemsTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/AppTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/AppTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/AppTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/AppTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/DbTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/DbTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/DbTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/DbTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/DbUpdateCheckerTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/DbUpdateCheckerTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/DbUpdateCheckerTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/DbUpdateCheckerTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/IndexV1InsertTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/IndexV1InsertTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/IndexV1InsertTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/IndexV1InsertTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/IndexV2DiffTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/IndexV2DiffTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/IndexV2DiffTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/IndexV2DiffTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/IndexV2InsertTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/IndexV2InsertTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/IndexV2InsertTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/IndexV2InsertTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/RepositoryDaoTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/RepositoryDaoTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/RepositoryDaoTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/RepositoryDaoTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/RepositoryDiffTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/RepositoryDiffTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/RepositoryDiffTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/RepositoryDiffTest.kt diff --git a/database/src/dbTest/java/org/fdroid/database/TestUtils.kt b/libs/database/src/dbTest/java/org/fdroid/database/TestUtils.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/TestUtils.kt rename to libs/database/src/dbTest/java/org/fdroid/database/TestUtils.kt diff --git a/database/src/dbTest/java/org/fdroid/database/VersionTest.kt b/libs/database/src/dbTest/java/org/fdroid/database/VersionTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/database/VersionTest.kt rename to libs/database/src/dbTest/java/org/fdroid/database/VersionTest.kt diff --git a/database/src/dbTest/java/org/fdroid/index/v1/IndexV1UpdaterTest.kt b/libs/database/src/dbTest/java/org/fdroid/index/v1/IndexV1UpdaterTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/index/v1/IndexV1UpdaterTest.kt rename to libs/database/src/dbTest/java/org/fdroid/index/v1/IndexV1UpdaterTest.kt diff --git a/database/src/dbTest/java/org/fdroid/index/v2/IndexV2UpdaterTest.kt b/libs/database/src/dbTest/java/org/fdroid/index/v2/IndexV2UpdaterTest.kt similarity index 100% rename from database/src/dbTest/java/org/fdroid/index/v2/IndexV2UpdaterTest.kt rename to libs/database/src/dbTest/java/org/fdroid/index/v2/IndexV2UpdaterTest.kt diff --git a/database/src/main/AndroidManifest.xml b/libs/database/src/main/AndroidManifest.xml similarity index 100% rename from database/src/main/AndroidManifest.xml rename to libs/database/src/main/AndroidManifest.xml diff --git a/database/src/main/java/org/fdroid/database/App.kt b/libs/database/src/main/java/org/fdroid/database/App.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/App.kt rename to libs/database/src/main/java/org/fdroid/database/App.kt diff --git a/database/src/main/java/org/fdroid/database/AppDao.kt b/libs/database/src/main/java/org/fdroid/database/AppDao.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/AppDao.kt rename to libs/database/src/main/java/org/fdroid/database/AppDao.kt diff --git a/database/src/main/java/org/fdroid/database/AppPrefs.kt b/libs/database/src/main/java/org/fdroid/database/AppPrefs.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/AppPrefs.kt rename to libs/database/src/main/java/org/fdroid/database/AppPrefs.kt diff --git a/database/src/main/java/org/fdroid/database/AppPrefsDao.kt b/libs/database/src/main/java/org/fdroid/database/AppPrefsDao.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/AppPrefsDao.kt rename to libs/database/src/main/java/org/fdroid/database/AppPrefsDao.kt diff --git a/database/src/main/java/org/fdroid/database/Converters.kt b/libs/database/src/main/java/org/fdroid/database/Converters.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/Converters.kt rename to libs/database/src/main/java/org/fdroid/database/Converters.kt diff --git a/database/src/main/java/org/fdroid/database/DbDiffUtils.kt b/libs/database/src/main/java/org/fdroid/database/DbDiffUtils.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/DbDiffUtils.kt rename to libs/database/src/main/java/org/fdroid/database/DbDiffUtils.kt diff --git a/database/src/main/java/org/fdroid/database/DbUpdateChecker.kt b/libs/database/src/main/java/org/fdroid/database/DbUpdateChecker.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/DbUpdateChecker.kt rename to libs/database/src/main/java/org/fdroid/database/DbUpdateChecker.kt diff --git a/database/src/main/java/org/fdroid/database/DbV1StreamReceiver.kt b/libs/database/src/main/java/org/fdroid/database/DbV1StreamReceiver.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/DbV1StreamReceiver.kt rename to libs/database/src/main/java/org/fdroid/database/DbV1StreamReceiver.kt diff --git a/database/src/main/java/org/fdroid/database/DbV2DiffStreamReceiver.kt b/libs/database/src/main/java/org/fdroid/database/DbV2DiffStreamReceiver.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/DbV2DiffStreamReceiver.kt rename to libs/database/src/main/java/org/fdroid/database/DbV2DiffStreamReceiver.kt diff --git a/database/src/main/java/org/fdroid/database/DbV2StreamReceiver.kt b/libs/database/src/main/java/org/fdroid/database/DbV2StreamReceiver.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/DbV2StreamReceiver.kt rename to libs/database/src/main/java/org/fdroid/database/DbV2StreamReceiver.kt diff --git a/database/src/main/java/org/fdroid/database/FDroidDatabase.kt b/libs/database/src/main/java/org/fdroid/database/FDroidDatabase.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/FDroidDatabase.kt rename to libs/database/src/main/java/org/fdroid/database/FDroidDatabase.kt diff --git a/database/src/main/java/org/fdroid/database/FDroidDatabaseHolder.kt b/libs/database/src/main/java/org/fdroid/database/FDroidDatabaseHolder.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/FDroidDatabaseHolder.kt rename to libs/database/src/main/java/org/fdroid/database/FDroidDatabaseHolder.kt diff --git a/database/src/main/java/org/fdroid/database/Repository.kt b/libs/database/src/main/java/org/fdroid/database/Repository.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/Repository.kt rename to libs/database/src/main/java/org/fdroid/database/Repository.kt diff --git a/database/src/main/java/org/fdroid/database/RepositoryDao.kt b/libs/database/src/main/java/org/fdroid/database/RepositoryDao.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/RepositoryDao.kt rename to libs/database/src/main/java/org/fdroid/database/RepositoryDao.kt diff --git a/database/src/main/java/org/fdroid/database/Version.kt b/libs/database/src/main/java/org/fdroid/database/Version.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/Version.kt rename to libs/database/src/main/java/org/fdroid/database/Version.kt diff --git a/database/src/main/java/org/fdroid/database/VersionDao.kt b/libs/database/src/main/java/org/fdroid/database/VersionDao.kt similarity index 100% rename from database/src/main/java/org/fdroid/database/VersionDao.kt rename to libs/database/src/main/java/org/fdroid/database/VersionDao.kt diff --git a/database/src/main/java/org/fdroid/download/DownloaderFactory.kt b/libs/database/src/main/java/org/fdroid/download/DownloaderFactory.kt similarity index 100% rename from database/src/main/java/org/fdroid/download/DownloaderFactory.kt rename to libs/database/src/main/java/org/fdroid/download/DownloaderFactory.kt diff --git a/database/src/main/java/org/fdroid/index/IndexUpdater.kt b/libs/database/src/main/java/org/fdroid/index/IndexUpdater.kt similarity index 100% rename from database/src/main/java/org/fdroid/index/IndexUpdater.kt rename to libs/database/src/main/java/org/fdroid/index/IndexUpdater.kt diff --git a/database/src/main/java/org/fdroid/index/RepoUpdater.kt b/libs/database/src/main/java/org/fdroid/index/RepoUpdater.kt similarity index 100% rename from database/src/main/java/org/fdroid/index/RepoUpdater.kt rename to libs/database/src/main/java/org/fdroid/index/RepoUpdater.kt diff --git a/database/src/main/java/org/fdroid/index/v1/IndexV1Updater.kt b/libs/database/src/main/java/org/fdroid/index/v1/IndexV1Updater.kt similarity index 100% rename from database/src/main/java/org/fdroid/index/v1/IndexV1Updater.kt rename to libs/database/src/main/java/org/fdroid/index/v1/IndexV1Updater.kt diff --git a/database/src/main/java/org/fdroid/index/v2/IndexV2Updater.kt b/libs/database/src/main/java/org/fdroid/index/v2/IndexV2Updater.kt similarity index 100% rename from database/src/main/java/org/fdroid/index/v2/IndexV2Updater.kt rename to libs/database/src/main/java/org/fdroid/index/v2/IndexV2Updater.kt diff --git a/database/src/sharedTest b/libs/database/src/sharedTest similarity index 100% rename from database/src/sharedTest rename to libs/database/src/sharedTest diff --git a/database/src/test/java/org/fdroid/database/AppPrefsTest.kt b/libs/database/src/test/java/org/fdroid/database/AppPrefsTest.kt similarity index 100% rename from database/src/test/java/org/fdroid/database/AppPrefsTest.kt rename to libs/database/src/test/java/org/fdroid/database/AppPrefsTest.kt diff --git a/database/src/test/java/org/fdroid/database/ConvertersTest.kt b/libs/database/src/test/java/org/fdroid/database/ConvertersTest.kt similarity index 100% rename from database/src/test/java/org/fdroid/database/ConvertersTest.kt rename to libs/database/src/test/java/org/fdroid/database/ConvertersTest.kt diff --git a/download/.gitignore b/libs/download/.gitignore similarity index 100% rename from download/.gitignore rename to libs/download/.gitignore diff --git a/download/build.gradle b/libs/download/build.gradle similarity index 99% rename from download/build.gradle rename to libs/download/build.gradle index 9fbceb6e0..d8ddeb5cd 100644 --- a/download/build.gradle +++ b/libs/download/build.gradle @@ -99,7 +99,6 @@ android { } defaultConfig { minSdkVersion 21 - targetSdkVersion 25 testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' testInstrumentationRunnerArguments disableAnalytics: 'true' } diff --git a/download/gradle.properties b/libs/download/gradle.properties similarity index 100% rename from download/gradle.properties rename to libs/download/gradle.properties diff --git a/download/lint.xml b/libs/download/lint.xml similarity index 52% rename from download/lint.xml rename to libs/download/lint.xml index ce5cc7387..f8ca69ebc 100644 --- a/download/lint.xml +++ b/libs/download/lint.xml @@ -1,7 +1,5 @@ - - \ No newline at end of file diff --git a/download/src/androidAndroidTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt b/libs/download/src/androidAndroidTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt similarity index 100% rename from download/src/androidAndroidTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt rename to libs/download/src/androidAndroidTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt diff --git a/download/src/androidMain/AndroidManifest.xml b/libs/download/src/androidMain/AndroidManifest.xml similarity index 100% rename from download/src/androidMain/AndroidManifest.xml rename to libs/download/src/androidMain/AndroidManifest.xml diff --git a/download/src/androidMain/kotlin/org/fdroid/download/Downloader.kt b/libs/download/src/androidMain/kotlin/org/fdroid/download/Downloader.kt similarity index 100% rename from download/src/androidMain/kotlin/org/fdroid/download/Downloader.kt rename to libs/download/src/androidMain/kotlin/org/fdroid/download/Downloader.kt diff --git a/download/src/androidMain/kotlin/org/fdroid/download/HttpDownloader.kt b/libs/download/src/androidMain/kotlin/org/fdroid/download/HttpDownloader.kt similarity index 100% rename from download/src/androidMain/kotlin/org/fdroid/download/HttpDownloader.kt rename to libs/download/src/androidMain/kotlin/org/fdroid/download/HttpDownloader.kt diff --git a/download/src/androidMain/kotlin/org/fdroid/download/HttpManager.kt b/libs/download/src/androidMain/kotlin/org/fdroid/download/HttpManager.kt similarity index 100% rename from download/src/androidMain/kotlin/org/fdroid/download/HttpManager.kt rename to libs/download/src/androidMain/kotlin/org/fdroid/download/HttpManager.kt diff --git a/download/src/androidMain/kotlin/org/fdroid/download/HttpPoster.kt b/libs/download/src/androidMain/kotlin/org/fdroid/download/HttpPoster.kt similarity index 100% rename from download/src/androidMain/kotlin/org/fdroid/download/HttpPoster.kt rename to libs/download/src/androidMain/kotlin/org/fdroid/download/HttpPoster.kt diff --git a/download/src/androidMain/kotlin/org/fdroid/download/glide/DownloadRequestLoader.kt b/libs/download/src/androidMain/kotlin/org/fdroid/download/glide/DownloadRequestLoader.kt similarity index 100% rename from download/src/androidMain/kotlin/org/fdroid/download/glide/DownloadRequestLoader.kt rename to libs/download/src/androidMain/kotlin/org/fdroid/download/glide/DownloadRequestLoader.kt diff --git a/download/src/androidMain/kotlin/org/fdroid/download/glide/HttpFetcher.kt b/libs/download/src/androidMain/kotlin/org/fdroid/download/glide/HttpFetcher.kt similarity index 100% rename from download/src/androidMain/kotlin/org/fdroid/download/glide/HttpFetcher.kt rename to libs/download/src/androidMain/kotlin/org/fdroid/download/glide/HttpFetcher.kt diff --git a/download/src/androidMain/kotlin/org/fdroid/download/glide/HttpGlideUrlLoader.kt b/libs/download/src/androidMain/kotlin/org/fdroid/download/glide/HttpGlideUrlLoader.kt similarity index 100% rename from download/src/androidMain/kotlin/org/fdroid/download/glide/HttpGlideUrlLoader.kt rename to libs/download/src/androidMain/kotlin/org/fdroid/download/glide/HttpGlideUrlLoader.kt diff --git a/download/src/androidMain/kotlin/org/fdroid/fdroid/HashUtils.kt b/libs/download/src/androidMain/kotlin/org/fdroid/fdroid/HashUtils.kt similarity index 100% rename from download/src/androidMain/kotlin/org/fdroid/fdroid/HashUtils.kt rename to libs/download/src/androidMain/kotlin/org/fdroid/fdroid/HashUtils.kt diff --git a/download/src/androidTest/kotlin/org/fdroid/download/HttpDownloaderTest.kt b/libs/download/src/androidTest/kotlin/org/fdroid/download/HttpDownloaderTest.kt similarity index 100% rename from download/src/androidTest/kotlin/org/fdroid/download/HttpDownloaderTest.kt rename to libs/download/src/androidTest/kotlin/org/fdroid/download/HttpDownloaderTest.kt diff --git a/download/src/androidTest/kotlin/org/fdroid/download/HttpPosterTest.kt b/libs/download/src/androidTest/kotlin/org/fdroid/download/HttpPosterTest.kt similarity index 100% rename from download/src/androidTest/kotlin/org/fdroid/download/HttpPosterTest.kt rename to libs/download/src/androidTest/kotlin/org/fdroid/download/HttpPosterTest.kt diff --git a/download/src/commonMain/kotlin/org/fdroid/download/DownloadRequest.kt b/libs/download/src/commonMain/kotlin/org/fdroid/download/DownloadRequest.kt similarity index 100% rename from download/src/commonMain/kotlin/org/fdroid/download/DownloadRequest.kt rename to libs/download/src/commonMain/kotlin/org/fdroid/download/DownloadRequest.kt diff --git a/download/src/commonMain/kotlin/org/fdroid/download/HeadInfo.kt b/libs/download/src/commonMain/kotlin/org/fdroid/download/HeadInfo.kt similarity index 100% rename from download/src/commonMain/kotlin/org/fdroid/download/HeadInfo.kt rename to libs/download/src/commonMain/kotlin/org/fdroid/download/HeadInfo.kt diff --git a/download/src/commonMain/kotlin/org/fdroid/download/HttpManager.kt b/libs/download/src/commonMain/kotlin/org/fdroid/download/HttpManager.kt similarity index 100% rename from download/src/commonMain/kotlin/org/fdroid/download/HttpManager.kt rename to libs/download/src/commonMain/kotlin/org/fdroid/download/HttpManager.kt diff --git a/download/src/commonMain/kotlin/org/fdroid/download/Mirror.kt b/libs/download/src/commonMain/kotlin/org/fdroid/download/Mirror.kt similarity index 100% rename from download/src/commonMain/kotlin/org/fdroid/download/Mirror.kt rename to libs/download/src/commonMain/kotlin/org/fdroid/download/Mirror.kt diff --git a/download/src/commonMain/kotlin/org/fdroid/download/MirrorChooser.kt b/libs/download/src/commonMain/kotlin/org/fdroid/download/MirrorChooser.kt similarity index 100% rename from download/src/commonMain/kotlin/org/fdroid/download/MirrorChooser.kt rename to libs/download/src/commonMain/kotlin/org/fdroid/download/MirrorChooser.kt diff --git a/download/src/commonMain/kotlin/org/fdroid/download/Proxy.kt b/libs/download/src/commonMain/kotlin/org/fdroid/download/Proxy.kt similarity index 100% rename from download/src/commonMain/kotlin/org/fdroid/download/Proxy.kt rename to libs/download/src/commonMain/kotlin/org/fdroid/download/Proxy.kt diff --git a/download/src/commonMain/kotlin/org/fdroid/fdroid/ProgressListener.kt b/libs/download/src/commonMain/kotlin/org/fdroid/fdroid/ProgressListener.kt similarity index 100% rename from download/src/commonMain/kotlin/org/fdroid/fdroid/ProgressListener.kt rename to libs/download/src/commonMain/kotlin/org/fdroid/fdroid/ProgressListener.kt diff --git a/download/src/commonTest/kotlin/org/fdroid/TestUtils.kt b/libs/download/src/commonTest/kotlin/org/fdroid/TestUtils.kt similarity index 100% rename from download/src/commonTest/kotlin/org/fdroid/TestUtils.kt rename to libs/download/src/commonTest/kotlin/org/fdroid/TestUtils.kt diff --git a/download/src/commonTest/kotlin/org/fdroid/download/HttpManagerIntegrationTest.kt b/libs/download/src/commonTest/kotlin/org/fdroid/download/HttpManagerIntegrationTest.kt similarity index 100% rename from download/src/commonTest/kotlin/org/fdroid/download/HttpManagerIntegrationTest.kt rename to libs/download/src/commonTest/kotlin/org/fdroid/download/HttpManagerIntegrationTest.kt diff --git a/download/src/commonTest/kotlin/org/fdroid/download/HttpManagerTest.kt b/libs/download/src/commonTest/kotlin/org/fdroid/download/HttpManagerTest.kt similarity index 100% rename from download/src/commonTest/kotlin/org/fdroid/download/HttpManagerTest.kt rename to libs/download/src/commonTest/kotlin/org/fdroid/download/HttpManagerTest.kt diff --git a/download/src/commonTest/kotlin/org/fdroid/download/MirrorChooserTest.kt b/libs/download/src/commonTest/kotlin/org/fdroid/download/MirrorChooserTest.kt similarity index 100% rename from download/src/commonTest/kotlin/org/fdroid/download/MirrorChooserTest.kt rename to libs/download/src/commonTest/kotlin/org/fdroid/download/MirrorChooserTest.kt diff --git a/download/src/commonTest/kotlin/org/fdroid/download/MirrorTest.kt b/libs/download/src/commonTest/kotlin/org/fdroid/download/MirrorTest.kt similarity index 100% rename from download/src/commonTest/kotlin/org/fdroid/download/MirrorTest.kt rename to libs/download/src/commonTest/kotlin/org/fdroid/download/MirrorTest.kt diff --git a/download/src/jvmMain/kotlin/org/fdroid/download/HttpManager.kt b/libs/download/src/jvmMain/kotlin/org/fdroid/download/HttpManager.kt similarity index 100% rename from download/src/jvmMain/kotlin/org/fdroid/download/HttpManager.kt rename to libs/download/src/jvmMain/kotlin/org/fdroid/download/HttpManager.kt diff --git a/download/src/nativeMain/kotlin/org/fdroid/download/HttpManager.kt b/libs/download/src/nativeMain/kotlin/org/fdroid/download/HttpManager.kt similarity index 100% rename from download/src/nativeMain/kotlin/org/fdroid/download/HttpManager.kt rename to libs/download/src/nativeMain/kotlin/org/fdroid/download/HttpManager.kt diff --git a/index/.gitignore b/libs/index/.gitignore similarity index 100% rename from index/.gitignore rename to libs/index/.gitignore diff --git a/index/build.gradle b/libs/index/build.gradle similarity index 96% rename from index/build.gradle rename to libs/index/build.gradle index 37d40e84a..34353d10a 100644 --- a/index/build.gradle +++ b/libs/index/build.gradle @@ -39,19 +39,17 @@ kotlin { implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2" implementation 'io.github.microutils:kotlin-logging:2.1.21' - implementation project(":download") + implementation project(":libs:download") implementation "io.ktor:ktor-io:2.0.0" } } - sharedTest { + commonTest { dependencies { + implementation project(":libs:sharedTest") implementation kotlin('test') implementation "com.goncalossilva:resources:0.2.1" } } - commonTest { - dependsOn(sharedTest) - } // JVM is disabled for now, because Android app is including it instead of Android library jvmMain { dependencies { diff --git a/index/consumer-rules.pro b/libs/index/consumer-rules.pro similarity index 100% rename from index/consumer-rules.pro rename to libs/index/consumer-rules.pro diff --git a/index/gradle.properties b/libs/index/gradle.properties similarity index 100% rename from index/gradle.properties rename to libs/index/gradle.properties diff --git a/index/src/androidAndroidTest/kotlin/org/fdroid/BestLocaleTest.kt b/libs/index/src/androidAndroidTest/kotlin/org/fdroid/BestLocaleTest.kt similarity index 100% rename from index/src/androidAndroidTest/kotlin/org/fdroid/BestLocaleTest.kt rename to libs/index/src/androidAndroidTest/kotlin/org/fdroid/BestLocaleTest.kt diff --git a/index/src/androidAndroidTest/kotlin/org/fdroid/index/v1/IndexV1CreatorTest.kt b/libs/index/src/androidAndroidTest/kotlin/org/fdroid/index/v1/IndexV1CreatorTest.kt similarity index 100% rename from index/src/androidAndroidTest/kotlin/org/fdroid/index/v1/IndexV1CreatorTest.kt rename to libs/index/src/androidAndroidTest/kotlin/org/fdroid/index/v1/IndexV1CreatorTest.kt diff --git a/index/src/androidMain/AndroidManifest.xml b/libs/index/src/androidMain/AndroidManifest.xml similarity index 100% rename from index/src/androidMain/AndroidManifest.xml rename to libs/index/src/androidMain/AndroidManifest.xml diff --git a/index/src/androidMain/kotlin/org/fdroid/CompatibilityChecker.kt b/libs/index/src/androidMain/kotlin/org/fdroid/CompatibilityChecker.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/CompatibilityChecker.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/CompatibilityChecker.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/LocaleChooser.kt b/libs/index/src/androidMain/kotlin/org/fdroid/LocaleChooser.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/LocaleChooser.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/LocaleChooser.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/UpdateChecker.kt b/libs/index/src/androidMain/kotlin/org/fdroid/UpdateChecker.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/UpdateChecker.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/UpdateChecker.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/IndexCreator.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/IndexCreator.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/IndexCreator.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/IndexCreator.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/IndexParser.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/IndexParser.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/IndexParser.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/IndexParser.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/IndexUtils.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/IndexUtils.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/IndexUtils.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/IndexUtils.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/JarIndexVerifier.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/JarIndexVerifier.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/JarIndexVerifier.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/JarIndexVerifier.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Creator.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Creator.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Creator.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Creator.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1StreamProcessor.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1StreamProcessor.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1StreamProcessor.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1StreamProcessor.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Verifier.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Verifier.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Verifier.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/v1/IndexV1Verifier.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/v2/EntryVerifier.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/v2/EntryVerifier.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/v2/EntryVerifier.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/v2/EntryVerifier.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessor.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessor.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessor.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessor.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessor.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessor.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessor.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessor.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2StreamProcessor.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2StreamProcessor.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2StreamProcessor.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/v2/IndexV2StreamProcessor.kt diff --git a/index/src/androidMain/kotlin/org/fdroid/index/v2/ReflectionDiffer.kt b/libs/index/src/androidMain/kotlin/org/fdroid/index/v2/ReflectionDiffer.kt similarity index 100% rename from index/src/androidMain/kotlin/org/fdroid/index/v2/ReflectionDiffer.kt rename to libs/index/src/androidMain/kotlin/org/fdroid/index/v2/ReflectionDiffer.kt diff --git a/index/src/androidTest/kotlin/org/fdroid/CompatibilityCheckerTest.kt b/libs/index/src/androidTest/kotlin/org/fdroid/CompatibilityCheckerTest.kt similarity index 100% rename from index/src/androidTest/kotlin/org/fdroid/CompatibilityCheckerTest.kt rename to libs/index/src/androidTest/kotlin/org/fdroid/CompatibilityCheckerTest.kt diff --git a/index/src/androidTest/kotlin/org/fdroid/UpdateCheckerTest.kt b/libs/index/src/androidTest/kotlin/org/fdroid/UpdateCheckerTest.kt similarity index 100% rename from index/src/androidTest/kotlin/org/fdroid/UpdateCheckerTest.kt rename to libs/index/src/androidTest/kotlin/org/fdroid/UpdateCheckerTest.kt diff --git a/index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1StreamProcessorTest.kt b/libs/index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1StreamProcessorTest.kt similarity index 90% rename from index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1StreamProcessorTest.kt rename to libs/index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1StreamProcessorTest.kt index 143da029c..1240762b1 100644 --- a/index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1StreamProcessorTest.kt +++ b/libs/index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1StreamProcessorTest.kt @@ -1,6 +1,7 @@ package org.fdroid.index.v1 import kotlinx.serialization.SerializationException +import org.fdroid.index.assetPath import org.fdroid.index.v2.AntiFeatureV2 import org.fdroid.index.v2.CategoryV2 import org.fdroid.index.v2.IndexV2 @@ -28,38 +29,34 @@ internal class IndexV1StreamProcessorTest { @Test fun testEmpty() { - testStreamProcessing("src/sharedTest/resources/index-empty-v1.json", - TestDataEmptyV2.index.v1compat()) + testStreamProcessing("$assetPath/index-empty-v1.json", TestDataEmptyV2.index.v1compat()) } @Test(expected = OldIndexException::class) fun testEmptyEqualTimestamp() { - testStreamProcessing("src/sharedTest/resources/index-empty-v1.json", + testStreamProcessing("$assetPath/index-empty-v1.json", TestDataEmptyV2.index.v1compat(), TestDataEmptyV2.index.repo.timestamp) } @Test(expected = OldIndexException::class) fun testEmptyHigherTimestamp() { - testStreamProcessing("src/sharedTest/resources/index-empty-v1.json", + testStreamProcessing("$assetPath/index-empty-v1.json", TestDataEmptyV2.index.v1compat(), TestDataEmptyV2.index.repo.timestamp + 1) } @Test fun testMin() { - testStreamProcessing("src/sharedTest/resources/index-min-v1.json", - TestDataMinV2.index.v1compat()) + testStreamProcessing("$assetPath/index-min-v1.json", TestDataMinV2.index.v1compat()) } @Test fun testMid() { - testStreamProcessing("src/sharedTest/resources/index-mid-v1.json", - TestDataMidV2.indexCompat) + testStreamProcessing("$assetPath/index-mid-v1.json", TestDataMidV2.indexCompat) } @Test fun testMax() { - testStreamProcessing("src/sharedTest/resources/index-max-v1.json", - TestDataMaxV2.indexCompat) + testStreamProcessing("$assetPath/index-max-v1.json", TestDataMaxV2.indexCompat) } @Test diff --git a/index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1VerifierTest.kt b/libs/index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1VerifierTest.kt similarity index 100% rename from index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1VerifierTest.kt rename to libs/index/src/androidTest/kotlin/org/fdroid/index/v1/IndexV1VerifierTest.kt diff --git a/index/src/androidTest/kotlin/org/fdroid/index/v2/EntryVerifierTest.kt b/libs/index/src/androidTest/kotlin/org/fdroid/index/v2/EntryVerifierTest.kt similarity index 100% rename from index/src/androidTest/kotlin/org/fdroid/index/v2/EntryVerifierTest.kt rename to libs/index/src/androidTest/kotlin/org/fdroid/index/v2/EntryVerifierTest.kt diff --git a/index/src/androidTest/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessorTest.kt b/libs/index/src/androidTest/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessorTest.kt similarity index 90% rename from index/src/androidTest/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessorTest.kt rename to libs/index/src/androidTest/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessorTest.kt index fcc7c3df2..5ddb65f86 100644 --- a/index/src/androidTest/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessorTest.kt +++ b/libs/index/src/androidTest/kotlin/org/fdroid/index/v2/IndexV2FullStreamProcessorTest.kt @@ -2,6 +2,7 @@ package org.fdroid.index.v2 import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.SerializationException +import org.fdroid.index.assetPath import org.fdroid.test.TestDataEmptyV2 import org.fdroid.test.TestDataMaxV2 import org.fdroid.test.TestDataMidV2 @@ -27,29 +28,27 @@ internal class IndexV2FullStreamProcessorTest { @Test fun testEmpty() { - testStreamProcessing("src/sharedTest/resources/index-empty-v2.json", - TestDataEmptyV2.index, 0) + testStreamProcessing("$assetPath/index-empty-v2.json", TestDataEmptyV2.index, 0) } @Test fun testMin() { - testStreamProcessing("src/sharedTest/resources/index-min-v2.json", TestDataMinV2.index, 1) + testStreamProcessing("$assetPath/index-min-v2.json", TestDataMinV2.index, 1) } @Test fun testMinReordered() { - testStreamProcessing("src/sharedTest/resources/index-min-reordered-v2.json", - TestDataMinV2.index, 1) + testStreamProcessing("$assetPath/index-min-reordered-v2.json", TestDataMinV2.index, 1) } @Test fun testMid() { - testStreamProcessing("src/sharedTest/resources/index-mid-v2.json", TestDataMidV2.index, 2) + testStreamProcessing("$assetPath/index-mid-v2.json", TestDataMidV2.index, 2) } @Test fun testMax() { - testStreamProcessing("src/sharedTest/resources/index-max-v2.json", TestDataMaxV2.index, 3) + testStreamProcessing("$assetPath/index-max-v2.json", TestDataMaxV2.index, 3) } @Test diff --git a/index/src/androidTest/kotlin/org/fdroid/index/v2/ReflectionDifferTest.kt b/libs/index/src/androidTest/kotlin/org/fdroid/index/v2/ReflectionDifferTest.kt similarity index 83% rename from index/src/androidTest/kotlin/org/fdroid/index/v2/ReflectionDifferTest.kt rename to libs/index/src/androidTest/kotlin/org/fdroid/index/v2/ReflectionDifferTest.kt index fe55f2219..735302ebb 100644 --- a/index/src/androidTest/kotlin/org/fdroid/index/v2/ReflectionDifferTest.kt +++ b/libs/index/src/androidTest/kotlin/org/fdroid/index/v2/ReflectionDifferTest.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.jsonObject import org.fdroid.index.IndexParser import org.fdroid.index.IndexParser.json +import org.fdroid.index.assetPath import org.fdroid.index.parseV2 import org.fdroid.test.DiffUtils.clean import org.fdroid.test.DiffUtils.cleanMetadata @@ -25,44 +26,44 @@ internal class ReflectionDifferTest { @Test fun testEmptyToMin() = testDiff( - diffPath = "src/sharedTest/resources/diff-empty-min/23.json", - startPath = "src/sharedTest/resources/index-empty-v2.json", - endPath = "src/sharedTest/resources/index-min-v2.json", + diffPath = "$assetPath/diff-empty-min/23.json", + startPath = "$assetPath/index-empty-v2.json", + endPath = "$assetPath/index-min-v2.json", ) @Test fun testEmptyToMid() = testDiff( - diffPath = "src/sharedTest/resources/diff-empty-mid/23.json", - startPath = "src/sharedTest/resources/index-empty-v2.json", - endPath = "src/sharedTest/resources/index-mid-v2.json", + diffPath = "$assetPath/diff-empty-mid/23.json", + startPath = "$assetPath/index-empty-v2.json", + endPath = "$assetPath/index-mid-v2.json", ) @Test fun testEmptyToMax() = testDiff( - diffPath = "src/sharedTest/resources/diff-empty-max/23.json", - startPath = "src/sharedTest/resources/index-empty-v2.json", - endPath = "src/sharedTest/resources/index-max-v2.json", + diffPath = "$assetPath/diff-empty-max/23.json", + startPath = "$assetPath/index-empty-v2.json", + endPath = "$assetPath/index-max-v2.json", ) @Test fun testMinToMid() = testDiff( - diffPath = "src/sharedTest/resources/diff-empty-mid/42.json", - startPath = "src/sharedTest/resources/index-min-v2.json", - endPath = "src/sharedTest/resources/index-mid-v2.json", + diffPath = "$assetPath/diff-empty-mid/42.json", + startPath = "$assetPath/index-min-v2.json", + endPath = "$assetPath/index-mid-v2.json", ) @Test fun testMinToMax() = testDiff( - diffPath = "src/sharedTest/resources/diff-empty-max/42.json", - startPath = "src/sharedTest/resources/index-min-v2.json", - endPath = "src/sharedTest/resources/index-max-v2.json", + diffPath = "$assetPath/diff-empty-max/42.json", + startPath = "$assetPath/index-min-v2.json", + endPath = "$assetPath/index-max-v2.json", ) @Test fun testMidToMax() = testDiff( - diffPath = "src/sharedTest/resources/diff-empty-max/1337.json", - startPath = "src/sharedTest/resources/index-mid-v2.json", - endPath = "src/sharedTest/resources/index-max-v2.json", + diffPath = "$assetPath/diff-empty-max/1337.json", + startPath = "$assetPath/index-mid-v2.json", + endPath = "$assetPath/index-max-v2.json", ) @Test diff --git a/index/src/commonMain/kotlin/org/fdroid/index/IndexConverter.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/IndexConverter.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/IndexConverter.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/IndexConverter.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/IndexParser.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/IndexParser.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/IndexParser.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/IndexParser.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/v1/AppV1.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/v1/AppV1.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/v1/AppV1.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/v1/AppV1.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1StreamReceiver.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1StreamReceiver.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1StreamReceiver.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/v1/IndexV1StreamReceiver.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/v1/PackageV1.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/v1/PackageV1.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/v1/PackageV1.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/v1/PackageV1.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamReceiver.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamReceiver.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamReceiver.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2DiffStreamReceiver.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2StreamReceiver.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2StreamReceiver.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2StreamReceiver.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/v2/IndexV2StreamReceiver.kt diff --git a/index/src/commonMain/kotlin/org/fdroid/index/v2/PackageV2.kt b/libs/index/src/commonMain/kotlin/org/fdroid/index/v2/PackageV2.kt similarity index 100% rename from index/src/commonMain/kotlin/org/fdroid/index/v2/PackageV2.kt rename to libs/index/src/commonMain/kotlin/org/fdroid/index/v2/PackageV2.kt diff --git a/index/src/commonTest/kotlin/org/fdroid/index/IndexConverterTest.kt b/libs/index/src/commonTest/kotlin/org/fdroid/index/IndexConverterTest.kt similarity index 67% rename from index/src/commonTest/kotlin/org/fdroid/index/IndexConverterTest.kt rename to libs/index/src/commonTest/kotlin/org/fdroid/index/IndexConverterTest.kt index b3cf9d28e..6a5133d6a 100644 --- a/index/src/commonTest/kotlin/org/fdroid/index/IndexConverterTest.kt +++ b/libs/index/src/commonTest/kotlin/org/fdroid/index/IndexConverterTest.kt @@ -12,30 +12,28 @@ import org.fdroid.test.v1compat import kotlin.test.Test import kotlin.test.assertEquals +internal const val assetPath = "../sharedTest/src/main/assets" + internal class IndexConverterTest { @Test fun testEmpty() { - testConversation("src/sharedTest/resources/index-empty-v1.json", - TestDataEmptyV2.index.v1compat()) + testConversation("$assetPath/index-empty-v1.json", TestDataEmptyV2.index.v1compat()) } @Test fun testMin() { - testConversation("src/sharedTest/resources/index-min-v1.json", - TestDataMinV2.index.v1compat()) + testConversation("$assetPath/index-min-v1.json", TestDataMinV2.index.v1compat()) } @Test fun testMid() { - testConversation("src/sharedTest/resources/index-mid-v1.json", - TestDataMidV2.indexCompat) + testConversation("$assetPath/index-mid-v1.json", TestDataMidV2.indexCompat) } @Test fun testMax() { - testConversation("src/sharedTest/resources/index-max-v1.json", - TestDataMaxV2.indexCompat) + testConversation("$assetPath/index-max-v1.json", TestDataMaxV2.indexCompat) } private fun testConversation(file: String, expectedIndex: IndexV2) { diff --git a/index/src/commonTest/kotlin/org/fdroid/index/v1/IndexV1Test.kt b/libs/index/src/commonTest/kotlin/org/fdroid/index/v1/IndexV1Test.kt similarity index 90% rename from index/src/commonTest/kotlin/org/fdroid/index/v1/IndexV1Test.kt rename to libs/index/src/commonTest/kotlin/org/fdroid/index/v1/IndexV1Test.kt index 2d7710c5c..b8aa10e7b 100644 --- a/index/src/commonTest/kotlin/org/fdroid/index/v1/IndexV1Test.kt +++ b/libs/index/src/commonTest/kotlin/org/fdroid/index/v1/IndexV1Test.kt @@ -3,6 +3,7 @@ package org.fdroid.index.v1 import com.goncalossilva.resources.Resource import kotlinx.serialization.SerializationException import org.fdroid.index.IndexParser.parseV1 +import org.fdroid.index.assetPath import org.fdroid.test.TestDataEmptyV1 import org.fdroid.test.TestDataMaxV1 import org.fdroid.test.TestDataMidV1 @@ -16,7 +17,7 @@ internal class IndexV1Test { @Test fun testIndexEmptyV1() { - val indexRes = Resource("src/sharedTest/resources/index-empty-v1.json") + val indexRes = Resource("$assetPath/index-empty-v1.json") val indexStr = indexRes.readText() val index = parseV1(indexStr) assertEquals(TestDataEmptyV1.index, index) @@ -24,7 +25,7 @@ internal class IndexV1Test { @Test fun testIndexMinV1() { - val indexRes = Resource("src/sharedTest/resources/index-min-v1.json") + val indexRes = Resource("$assetPath/index-min-v1.json") val indexStr = indexRes.readText() val index = parseV1(indexStr) assertEquals(TestDataMinV1.index, index) @@ -32,7 +33,7 @@ internal class IndexV1Test { @Test fun testIndexMidV1() { - val indexRes = Resource("src/sharedTest/resources/index-mid-v1.json") + val indexRes = Resource("$assetPath/index-mid-v1.json") val indexStr = indexRes.readText() val index = parseV1(indexStr) assertEquals(TestDataMidV1.index, index) @@ -40,7 +41,7 @@ internal class IndexV1Test { @Test fun testIndexMaxV1() { - val indexRes = Resource("src/sharedTest/resources/index-max-v1.json") + val indexRes = Resource("$assetPath/index-max-v1.json") val indexStr = indexRes.readText() val index = parseV1(indexStr) assertEquals(TestDataMaxV1.index, index) diff --git a/index/src/commonTest/kotlin/org/fdroid/index/v2/EntryTest.kt b/libs/index/src/commonTest/kotlin/org/fdroid/index/v2/EntryTest.kt similarity index 86% rename from index/src/commonTest/kotlin/org/fdroid/index/v2/EntryTest.kt rename to libs/index/src/commonTest/kotlin/org/fdroid/index/v2/EntryTest.kt index db078b6b2..af1b24c1a 100644 --- a/index/src/commonTest/kotlin/org/fdroid/index/v2/EntryTest.kt +++ b/libs/index/src/commonTest/kotlin/org/fdroid/index/v2/EntryTest.kt @@ -3,6 +3,7 @@ package org.fdroid.index.v2 import com.goncalossilva.resources.Resource import kotlinx.serialization.SerializationException import org.fdroid.index.IndexParser +import org.fdroid.index.assetPath import org.fdroid.test.TestDataEntryV2 import org.junit.Test import kotlin.test.assertContains @@ -13,26 +14,22 @@ internal class EntryTest { @Test fun testEmpty() { - testEntryEquality("src/sharedTest/resources/entry-empty-v2.json", - TestDataEntryV2.empty) + testEntryEquality("$assetPath/entry-empty-v2.json", TestDataEntryV2.empty) } @Test fun testEmptyToMin() { - testEntryEquality("src/sharedTest/resources/diff-empty-min/entry.json", - TestDataEntryV2.emptyToMin) + testEntryEquality("$assetPath/diff-empty-min/entry.json", TestDataEntryV2.emptyToMin) } @Test fun testEmptyToMid() { - testEntryEquality("src/sharedTest/resources/diff-empty-mid/entry.json", - TestDataEntryV2.emptyToMid) + testEntryEquality("$assetPath/diff-empty-mid/entry.json", TestDataEntryV2.emptyToMid) } @Test fun testEmptyToMax() { - testEntryEquality("src/sharedTest/resources/diff-empty-max/entry.json", - TestDataEntryV2.emptyToMax) + testEntryEquality("$assetPath/diff-empty-max/entry.json", TestDataEntryV2.emptyToMax) } @Test diff --git a/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessorTest.kt b/libs/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessorTest.kt similarity index 86% rename from index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessorTest.kt rename to libs/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessorTest.kt index 28cd60753..1f146e417 100644 --- a/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessorTest.kt +++ b/libs/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2DiffStreamProcessorTest.kt @@ -5,6 +5,7 @@ import kotlinx.serialization.json.JsonNull import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.jsonObject import org.fdroid.index.IndexParser +import org.fdroid.index.assetPath import org.junit.Test import java.io.ByteArrayInputStream import java.io.File @@ -16,22 +17,22 @@ import kotlin.test.fail internal class IndexV2DiffStreamProcessorTest { @Test - fun testEmptyToMin() = testDiff("src/sharedTest/resources/diff-empty-min/23.json", 1) + fun testEmptyToMin() = testDiff("$assetPath/diff-empty-min/23.json", 1) @Test - fun testEmptyToMid() = testDiff("src/sharedTest/resources/diff-empty-mid/23.json", 2) + fun testEmptyToMid() = testDiff("$assetPath/diff-empty-mid/23.json", 2) @Test - fun testEmptyToMax() = testDiff("src/sharedTest/resources/diff-empty-max/23.json", 3) + fun testEmptyToMax() = testDiff("$assetPath/diff-empty-max/23.json", 3) @Test - fun testMinToMid() = testDiff("src/sharedTest/resources/diff-empty-mid/42.json", 2) + fun testMinToMid() = testDiff("$assetPath/diff-empty-mid/42.json", 2) @Test - fun testMinToMax() = testDiff("src/sharedTest/resources/diff-empty-max/42.json", 3) + fun testMinToMax() = testDiff("$assetPath/diff-empty-max/42.json", 3) @Test - fun testMidToMax() = testDiff("src/sharedTest/resources/diff-empty-max/1337.json", 2) + fun testMidToMax() = testDiff("$assetPath/diff-empty-max/1337.json", 2) @Test fun testRemovePackage() { diff --git a/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2Test.kt b/libs/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2Test.kt similarity index 82% rename from index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2Test.kt rename to libs/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2Test.kt index ae161840e..06bfd7601 100644 --- a/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2Test.kt +++ b/libs/index/src/commonTest/kotlin/org/fdroid/index/v2/IndexV2Test.kt @@ -3,6 +3,7 @@ package org.fdroid.index.v2 import com.goncalossilva.resources.Resource import kotlinx.serialization.SerializationException import org.fdroid.index.IndexParser.parseV2 +import org.fdroid.index.assetPath import org.fdroid.test.TestDataEmptyV2 import org.fdroid.test.TestDataMaxV2 import org.fdroid.test.TestDataMidV2 @@ -16,28 +17,27 @@ internal class IndexV2Test { @Test fun testEmpty() { - testIndexEquality("src/sharedTest/resources/index-empty-v2.json", TestDataEmptyV2.index) + testIndexEquality("$assetPath/index-empty-v2.json", TestDataEmptyV2.index) } @Test fun testMin() { - testIndexEquality("src/sharedTest/resources/index-min-v2.json", TestDataMinV2.index) + testIndexEquality("$assetPath/index-min-v2.json", TestDataMinV2.index) } @Test fun testMinReordered() { - testIndexEquality("src/sharedTest/resources/index-min-reordered-v2.json", - TestDataMinV2.index) + testIndexEquality("$assetPath/index-min-reordered-v2.json", TestDataMinV2.index) } @Test fun testMid() { - testIndexEquality("src/sharedTest/resources/index-mid-v2.json", TestDataMidV2.index) + testIndexEquality("$assetPath/index-mid-v2.json", TestDataMidV2.index) } @Test fun testMax() { - testIndexEquality("src/sharedTest/resources/index-max-v2.json", TestDataMaxV2.index) + testIndexEquality("$assetPath/index-max-v2.json", TestDataMaxV2.index) } @Test diff --git a/index/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v1.jar b/libs/index/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v1.jar similarity index 100% rename from index/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v1.jar rename to libs/index/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v1.jar diff --git a/index/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v2.jar b/libs/index/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v2.jar similarity index 100% rename from index/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v2.jar rename to libs/index/src/commonTest/resources/verification/invalid-MD5-MD5withRSA-v2.jar diff --git a/index/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v1.jar b/libs/index/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v1.jar similarity index 100% rename from index/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v1.jar rename to libs/index/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v1.jar diff --git a/index/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v2.jar b/libs/index/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v2.jar similarity index 100% rename from index/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v2.jar rename to libs/index/src/commonTest/resources/verification/invalid-MD5-SHA1withRSA-v2.jar diff --git a/index/src/commonTest/resources/verification/invalid-SHA1-SHA1withRSA-v2.jar b/libs/index/src/commonTest/resources/verification/invalid-SHA1-SHA1withRSA-v2.jar similarity index 100% rename from index/src/commonTest/resources/verification/invalid-SHA1-SHA1withRSA-v2.jar rename to libs/index/src/commonTest/resources/verification/invalid-SHA1-SHA1withRSA-v2.jar diff --git a/index/src/commonTest/resources/verification/invalid-v1.jar b/libs/index/src/commonTest/resources/verification/invalid-v1.jar similarity index 100% rename from index/src/commonTest/resources/verification/invalid-v1.jar rename to libs/index/src/commonTest/resources/verification/invalid-v1.jar diff --git a/index/src/commonTest/resources/verification/invalid-v2.jar b/libs/index/src/commonTest/resources/verification/invalid-v2.jar similarity index 100% rename from index/src/commonTest/resources/verification/invalid-v2.jar rename to libs/index/src/commonTest/resources/verification/invalid-v2.jar diff --git a/index/src/commonTest/resources/verification/invalid-wrong-entry-v1.jar b/libs/index/src/commonTest/resources/verification/invalid-wrong-entry-v1.jar similarity index 100% rename from index/src/commonTest/resources/verification/invalid-wrong-entry-v1.jar rename to libs/index/src/commonTest/resources/verification/invalid-wrong-entry-v1.jar diff --git a/index/src/commonTest/resources/verification/unsigned.jar b/libs/index/src/commonTest/resources/verification/unsigned.jar similarity index 100% rename from index/src/commonTest/resources/verification/unsigned.jar rename to libs/index/src/commonTest/resources/verification/unsigned.jar diff --git a/index/src/commonTest/resources/verification/valid-apksigner-v2.jar b/libs/index/src/commonTest/resources/verification/valid-apksigner-v2.jar similarity index 100% rename from index/src/commonTest/resources/verification/valid-apksigner-v2.jar rename to libs/index/src/commonTest/resources/verification/valid-apksigner-v2.jar diff --git a/index/src/commonTest/resources/verification/valid-v1.jar b/libs/index/src/commonTest/resources/verification/valid-v1.jar similarity index 100% rename from index/src/commonTest/resources/verification/valid-v1.jar rename to libs/index/src/commonTest/resources/verification/valid-v1.jar diff --git a/index/src/commonTest/resources/verification/valid-v2.jar b/libs/index/src/commonTest/resources/verification/valid-v2.jar similarity index 100% rename from index/src/commonTest/resources/verification/valid-v2.jar rename to libs/index/src/commonTest/resources/verification/valid-v2.jar diff --git a/libs/sharedTest/.gitignore b/libs/sharedTest/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/libs/sharedTest/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/libs/sharedTest/build.gradle b/libs/sharedTest/build.gradle new file mode 100644 index 000000000..25be3d328 --- /dev/null +++ b/libs/sharedTest/build.gradle @@ -0,0 +1,27 @@ +plugins { + id 'kotlin-android' + id 'com.android.library' + id "org.jlleitschuh.gradle.ktlint" version "10.2.1" +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +// not really an Android library, but index is not publishing for JVM at the moment +android { + compileSdkVersion 31 + defaultConfig { + minSdkVersion 21 + } +} + +dependencies { + implementation project(":libs:index") + + implementation 'org.jetbrains.kotlin:kotlin-test' + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2" +} + +apply from: "${rootProject.rootDir}/gradle/ktlint.gradle" diff --git a/libs/sharedTest/src/main/AndroidManifest.xml b/libs/sharedTest/src/main/AndroidManifest.xml new file mode 100644 index 000000000..0955a1977 --- /dev/null +++ b/libs/sharedTest/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/index/src/sharedTest/resources/diff-empty-max/1337.json b/libs/sharedTest/src/main/assets/diff-empty-max/1337.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-max/1337.json rename to libs/sharedTest/src/main/assets/diff-empty-max/1337.json diff --git a/index/src/sharedTest/resources/diff-empty-max/23.json b/libs/sharedTest/src/main/assets/diff-empty-max/23.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-max/23.json rename to libs/sharedTest/src/main/assets/diff-empty-max/23.json diff --git a/index/src/sharedTest/resources/diff-empty-max/42.json b/libs/sharedTest/src/main/assets/diff-empty-max/42.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-max/42.json rename to libs/sharedTest/src/main/assets/diff-empty-max/42.json diff --git a/index/src/sharedTest/resources/diff-empty-max/entry.jar b/libs/sharedTest/src/main/assets/diff-empty-max/entry.jar similarity index 100% rename from index/src/sharedTest/resources/diff-empty-max/entry.jar rename to libs/sharedTest/src/main/assets/diff-empty-max/entry.jar diff --git a/index/src/sharedTest/resources/diff-empty-max/entry.json b/libs/sharedTest/src/main/assets/diff-empty-max/entry.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-max/entry.json rename to libs/sharedTest/src/main/assets/diff-empty-max/entry.json diff --git a/index/src/sharedTest/resources/diff-empty-mid/23.json b/libs/sharedTest/src/main/assets/diff-empty-mid/23.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-mid/23.json rename to libs/sharedTest/src/main/assets/diff-empty-mid/23.json diff --git a/index/src/sharedTest/resources/diff-empty-mid/42.json b/libs/sharedTest/src/main/assets/diff-empty-mid/42.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-mid/42.json rename to libs/sharedTest/src/main/assets/diff-empty-mid/42.json diff --git a/index/src/sharedTest/resources/diff-empty-mid/entry.jar b/libs/sharedTest/src/main/assets/diff-empty-mid/entry.jar similarity index 100% rename from index/src/sharedTest/resources/diff-empty-mid/entry.jar rename to libs/sharedTest/src/main/assets/diff-empty-mid/entry.jar diff --git a/index/src/sharedTest/resources/diff-empty-mid/entry.json b/libs/sharedTest/src/main/assets/diff-empty-mid/entry.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-mid/entry.json rename to libs/sharedTest/src/main/assets/diff-empty-mid/entry.json diff --git a/index/src/sharedTest/resources/diff-empty-min/23.json b/libs/sharedTest/src/main/assets/diff-empty-min/23.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-min/23.json rename to libs/sharedTest/src/main/assets/diff-empty-min/23.json diff --git a/index/src/sharedTest/resources/diff-empty-min/entry.jar b/libs/sharedTest/src/main/assets/diff-empty-min/entry.jar similarity index 100% rename from index/src/sharedTest/resources/diff-empty-min/entry.jar rename to libs/sharedTest/src/main/assets/diff-empty-min/entry.jar diff --git a/index/src/sharedTest/resources/diff-empty-min/entry.json b/libs/sharedTest/src/main/assets/diff-empty-min/entry.json similarity index 100% rename from index/src/sharedTest/resources/diff-empty-min/entry.json rename to libs/sharedTest/src/main/assets/diff-empty-min/entry.json diff --git a/index/src/sharedTest/resources/entry-empty-v2.json b/libs/sharedTest/src/main/assets/entry-empty-v2.json similarity index 100% rename from index/src/sharedTest/resources/entry-empty-v2.json rename to libs/sharedTest/src/main/assets/entry-empty-v2.json diff --git a/index/src/sharedTest/resources/index-empty-v1.json b/libs/sharedTest/src/main/assets/index-empty-v1.json similarity index 100% rename from index/src/sharedTest/resources/index-empty-v1.json rename to libs/sharedTest/src/main/assets/index-empty-v1.json diff --git a/index/src/sharedTest/resources/index-empty-v2.json b/libs/sharedTest/src/main/assets/index-empty-v2.json similarity index 100% rename from index/src/sharedTest/resources/index-empty-v2.json rename to libs/sharedTest/src/main/assets/index-empty-v2.json diff --git a/index/src/sharedTest/resources/index-max-v1.json b/libs/sharedTest/src/main/assets/index-max-v1.json similarity index 100% rename from index/src/sharedTest/resources/index-max-v1.json rename to libs/sharedTest/src/main/assets/index-max-v1.json diff --git a/index/src/sharedTest/resources/index-max-v2.json b/libs/sharedTest/src/main/assets/index-max-v2.json similarity index 100% rename from index/src/sharedTest/resources/index-max-v2.json rename to libs/sharedTest/src/main/assets/index-max-v2.json diff --git a/index/src/sharedTest/resources/index-mid-v1.json b/libs/sharedTest/src/main/assets/index-mid-v1.json similarity index 100% rename from index/src/sharedTest/resources/index-mid-v1.json rename to libs/sharedTest/src/main/assets/index-mid-v1.json diff --git a/index/src/sharedTest/resources/index-mid-v2.json b/libs/sharedTest/src/main/assets/index-mid-v2.json similarity index 100% rename from index/src/sharedTest/resources/index-mid-v2.json rename to libs/sharedTest/src/main/assets/index-mid-v2.json diff --git a/index/src/sharedTest/resources/index-min-reordered-v2.json b/libs/sharedTest/src/main/assets/index-min-reordered-v2.json similarity index 100% rename from index/src/sharedTest/resources/index-min-reordered-v2.json rename to libs/sharedTest/src/main/assets/index-min-reordered-v2.json diff --git a/index/src/sharedTest/resources/index-min-v1.json b/libs/sharedTest/src/main/assets/index-min-v1.json similarity index 100% rename from index/src/sharedTest/resources/index-min-v1.json rename to libs/sharedTest/src/main/assets/index-min-v1.json diff --git a/index/src/sharedTest/resources/index-min-v2.json b/libs/sharedTest/src/main/assets/index-min-v2.json similarity index 100% rename from index/src/sharedTest/resources/index-min-v2.json rename to libs/sharedTest/src/main/assets/index-min-v2.json diff --git a/index/src/sharedTest/resources/testy.at.or.at_corrupt_app_package_name_index-v1.jar b/libs/sharedTest/src/main/assets/testy.at.or.at_corrupt_app_package_name_index-v1.jar similarity index 100% rename from index/src/sharedTest/resources/testy.at.or.at_corrupt_app_package_name_index-v1.jar rename to libs/sharedTest/src/main/assets/testy.at.or.at_corrupt_app_package_name_index-v1.jar diff --git a/index/src/sharedTest/resources/testy.at.or.at_corrupt_package_name_index-v1.jar b/libs/sharedTest/src/main/assets/testy.at.or.at_corrupt_package_name_index-v1.jar similarity index 100% rename from index/src/sharedTest/resources/testy.at.or.at_corrupt_package_name_index-v1.jar rename to libs/sharedTest/src/main/assets/testy.at.or.at_corrupt_package_name_index-v1.jar diff --git a/index/src/sharedTest/resources/testy.at.or.at_index-v1.jar b/libs/sharedTest/src/main/assets/testy.at.or.at_index-v1.jar similarity index 100% rename from index/src/sharedTest/resources/testy.at.or.at_index-v1.jar rename to libs/sharedTest/src/main/assets/testy.at.or.at_index-v1.jar diff --git a/index/src/sharedTest/resources/testy.at.or.at_no-.RSA_index-v1.jar b/libs/sharedTest/src/main/assets/testy.at.or.at_no-.RSA_index-v1.jar similarity index 100% rename from index/src/sharedTest/resources/testy.at.or.at_no-.RSA_index-v1.jar rename to libs/sharedTest/src/main/assets/testy.at.or.at_no-.RSA_index-v1.jar diff --git a/index/src/sharedTest/resources/testy.at.or.at_no-.SF_index-v1.jar b/libs/sharedTest/src/main/assets/testy.at.or.at_no-.SF_index-v1.jar similarity index 100% rename from index/src/sharedTest/resources/testy.at.or.at_no-.SF_index-v1.jar rename to libs/sharedTest/src/main/assets/testy.at.or.at_no-.SF_index-v1.jar diff --git a/index/src/sharedTest/resources/testy.at.or.at_no-MANIFEST.MF_index-v1.jar b/libs/sharedTest/src/main/assets/testy.at.or.at_no-MANIFEST.MF_index-v1.jar similarity index 100% rename from index/src/sharedTest/resources/testy.at.or.at_no-MANIFEST.MF_index-v1.jar rename to libs/sharedTest/src/main/assets/testy.at.or.at_no-MANIFEST.MF_index-v1.jar diff --git a/index/src/sharedTest/resources/testy.at.or.at_no-signature_index-v1.jar b/libs/sharedTest/src/main/assets/testy.at.or.at_no-signature_index-v1.jar similarity index 100% rename from index/src/sharedTest/resources/testy.at.or.at_no-signature_index-v1.jar rename to libs/sharedTest/src/main/assets/testy.at.or.at_no-signature_index-v1.jar diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/DiffUtils.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/DiffUtils.kt similarity index 83% rename from index/src/sharedTest/kotlin/org/fdroid/test/DiffUtils.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/DiffUtils.kt index c84c2afb8..8fa84a34f 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/DiffUtils.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/DiffUtils.kt @@ -7,12 +7,12 @@ import org.fdroid.index.v2.PackageVersionV2 import org.fdroid.index.v2.RepoV2 import kotlin.random.Random -public object DiffUtils { +object DiffUtils { /** * Create a map diff by adding or removing keys. Note that this does not change keys. */ - public fun Map.randomDiff(factory: () -> T): Map = buildMap { + fun Map.randomDiff(factory: () -> T): Map = buildMap { if (this@randomDiff.isNotEmpty()) { // remove random keys while (Random.nextBoolean()) put(this@randomDiff.keys.random(), null) @@ -25,13 +25,13 @@ public object DiffUtils { /** * Removes keys from a JSON object representing a [RepoV2] which need special handling. */ - internal fun JsonObject.cleanRepo(): JsonObject { + fun JsonObject.cleanRepo(): JsonObject { val keysToFilter = listOf("mirrors", "antiFeatures", "categories", "releaseChannels") val newMap = filterKeys { it !in keysToFilter } return JsonObject(newMap) } - internal fun RepoV2.clean() = copy( + fun RepoV2.clean() = copy( mirrors = emptyList(), antiFeatures = emptyMap(), categories = emptyMap(), @@ -41,14 +41,14 @@ public object DiffUtils { /** * Removes keys from a JSON object representing a [MetadataV2] which need special handling. */ - internal fun JsonObject.cleanMetadata(): JsonObject { + fun JsonObject.cleanMetadata(): JsonObject { val keysToFilter = listOf("icon", "featureGraphic", "promoGraphic", "tvBanner", "screenshots") val newMap = filterKeys { it !in keysToFilter } return JsonObject(newMap) } - internal fun MetadataV2.clean() = copy( + fun MetadataV2.clean() = copy( icon = null, featureGraphic = null, promoGraphic = null, @@ -59,7 +59,7 @@ public object DiffUtils { /** * Removes keys from a JSON object representing a [PackageVersionV2] which need special handling. */ - internal fun JsonObject.cleanVersion(): JsonObject { + fun JsonObject.cleanVersion(): JsonObject { if (!containsKey("manifest")) return this val keysToFilter = listOf("features", "usesPermission", "usesPermissionSdk23") val newMap = toMutableMap() @@ -68,7 +68,7 @@ public object DiffUtils { return JsonObject(newMap) } - internal fun PackageVersionV2.clean() = copy( + fun PackageVersionV2.clean() = copy( manifest = manifest.copy( features = emptyList(), usesPermission = emptyList(), @@ -76,7 +76,7 @@ public object DiffUtils { ), ) - public fun Map.applyDiff(diff: Map): Map = + fun Map.applyDiff(diff: Map): Map = toMutableMap().apply { diff.entries.forEach { (key, value) -> if (value == null) remove(key) diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/TestAppUtils.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestAppUtils.kt similarity index 91% rename from index/src/sharedTest/kotlin/org/fdroid/test/TestAppUtils.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/TestAppUtils.kt index 29cf469db..4d7ee9830 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/TestAppUtils.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestAppUtils.kt @@ -13,9 +13,9 @@ import org.fdroid.test.TestUtils.orNull import kotlin.random.Random import kotlin.test.assertEquals -public object TestAppUtils { +object TestAppUtils { - public fun getRandomMetadataV2(): MetadataV2 = MetadataV2( + fun getRandomMetadataV2(): MetadataV2 = MetadataV2( added = Random.nextLong(), lastUpdated = Random.nextLong(), name = getRandomLocalizedTextV2().orNull(), @@ -49,7 +49,7 @@ public object TestAppUtils { screenshots = getRandomScreenshots().orNull(), ) - public fun getRandomScreenshots(): Screenshots? = Screenshots( + fun getRandomScreenshots(): Screenshots? = Screenshots( phone = getRandomLocalizedFileListV2().orNull(), sevenInch = getRandomLocalizedFileListV2().orNull(), tenInch = getRandomLocalizedFileListV2().orNull(), @@ -57,7 +57,7 @@ public object TestAppUtils { tv = getRandomLocalizedFileListV2().orNull(), ).takeIf { !it.isNull } - public fun getRandomLocalizedFileListV2(): Map> = + fun getRandomLocalizedFileListV2(): Map> = TestUtils.getRandomMap(Random.nextInt(1, 3)) { getRandomString() to getRandomList(Random.nextInt(1, 7)) { getRandomFileV2() @@ -68,7 +68,7 @@ public object TestAppUtils { * [Screenshots] include lists which can be ordered differently, * so we need to ignore order when comparing them. */ - public fun assertScreenshotsEqual(s1: Screenshots?, s2: Screenshots?) { + fun assertScreenshotsEqual(s1: Screenshots?, s2: Screenshots?) { if (s1 != null && s2 != null) { assertLocalizedFileListV2Equal(s1.phone, s2.phone) assertLocalizedFileListV2Equal(s1.sevenInch, s2.sevenInch) diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/TestDataEntryV2.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataEntryV2.kt similarity index 93% rename from index/src/sharedTest/kotlin/org/fdroid/test/TestDataEntryV2.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataEntryV2.kt index 3bda91a92..d209b65ee 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/TestDataEntryV2.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataEntryV2.kt @@ -3,9 +3,9 @@ package org.fdroid.test import org.fdroid.index.v2.EntryFileV2 import org.fdroid.index.v2.EntryV2 -internal object TestDataEntryV2 { +object TestDataEntryV2 { - internal val empty = EntryV2( + val empty = EntryV2( timestamp = 23, version = 20001, index = EntryFileV2( @@ -16,7 +16,7 @@ internal object TestDataEntryV2 { ), ) - internal val emptyToMin = EntryV2( + val emptyToMin = EntryV2( timestamp = 42, version = 20001, maxAge = 7, @@ -36,7 +36,7 @@ internal object TestDataEntryV2 { ), ) - internal val emptyToMid = EntryV2( + val emptyToMid = EntryV2( timestamp = 1337, version = 20001, index = EntryFileV2( @@ -61,7 +61,7 @@ internal object TestDataEntryV2 { ), ) - internal val emptyToMax = EntryV2( + val emptyToMax = EntryV2( timestamp = Long.MAX_VALUE, version = Long.MAX_VALUE, maxAge = Int.MAX_VALUE, diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/TestDataV1.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataV1.kt similarity index 99% rename from index/src/sharedTest/kotlin/org/fdroid/test/TestDataV1.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataV1.kt index 2c2109cc2..9d4e88cd1 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/TestDataV1.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataV1.kt @@ -8,7 +8,7 @@ import org.fdroid.index.v1.PermissionV1 import org.fdroid.index.v1.RepoV1 import org.fdroid.index.v1.Requests -internal object TestDataEmptyV1 { +object TestDataEmptyV1 { val repo = RepoV1( timestamp = 23, version = 23, @@ -22,7 +22,7 @@ internal object TestDataEmptyV1 { ) } -internal object TestDataMinV1 { +object TestDataMinV1 { val repo = RepoV1( timestamp = 42, @@ -61,7 +61,7 @@ internal object TestDataMinV1 { ) } -internal object TestDataMidV1 { +object TestDataMidV1 { val repo = RepoV1( timestamp = 1337, @@ -408,7 +408,7 @@ internal object TestDataMidV1 { } -internal object TestDataMaxV1 { +object TestDataMaxV1 { val repo = RepoV1( timestamp = Long.MAX_VALUE, diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/TestDataV2.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataV2.kt similarity index 99% rename from index/src/sharedTest/kotlin/org/fdroid/test/TestDataV2.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataV2.kt index a7d6f3495..0fc40ec79 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/TestDataV2.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestDataV2.kt @@ -20,13 +20,13 @@ import org.fdroid.index.v2.Screenshots import org.fdroid.index.v2.SignerV2 import org.fdroid.index.v2.UsesSdkV2 -internal const val LOCALE = "en-US" +const val LOCALE = "en-US" -internal fun IndexV2.v1compat() = copy( +fun IndexV2.v1compat() = copy( repo = repo.v1compat(), ) -internal fun RepoV2.v1compat() = copy( +fun RepoV2.v1compat() = copy( name = name.filterKeys { it == LOCALE }, description = description.filterKeys { it == LOCALE }, icon = icon.filterKeys { it == LOCALE }.mapValues { it.value.v1compat() }, @@ -37,7 +37,7 @@ internal fun RepoV2.v1compat() = copy( antiFeatures = antiFeatures.mapValues { AntiFeatureV2(name = mapOf(LOCALE to it.key)) }, ) -internal fun PackageV2.v1compat(overrideLocale: Boolean = false) = copy( +fun PackageV2.v1compat(overrideLocale: Boolean = false) = copy( metadata = metadata.copy( name = if (overrideLocale) metadata.name?.filterKeys { it == LOCALE } else metadata.name, summary = if (overrideLocale) metadata.summary?.filterKeys { it == LOCALE } @@ -68,7 +68,7 @@ internal fun PackageV2.v1compat(overrideLocale: Boolean = false) = copy( ) ) -internal fun PackageVersionV2.v1compat() = copy( +fun PackageVersionV2.v1compat() = copy( src = src?.v1compat(), manifest = manifest.copy( signer = if (manifest.signer?.sha256?.size ?: 0 <= 1) manifest.signer else { @@ -79,12 +79,12 @@ internal fun PackageVersionV2.v1compat() = copy( antiFeatures = antiFeatures.mapValues { emptyMap() } ) -internal fun FileV2.v1compat() = copy( +fun FileV2.v1compat() = copy( sha256 = null, size = null, ) -internal object TestDataEmptyV2 { +object TestDataEmptyV2 { val repo = RepoV2( timestamp = 23, @@ -110,7 +110,7 @@ internal object TestDataEmptyV2 { ) } -internal object TestDataMinV2 { +object TestDataMinV2 { val repo = RepoV2( timestamp = 42, @@ -158,7 +158,7 @@ internal object TestDataMinV2 { ) } -internal object TestDataMidV2 { +object TestDataMidV2 { val repo = RepoV2( timestamp = 1337, @@ -699,7 +699,7 @@ internal object TestDataMidV2 { ) } -internal object TestDataMaxV2 { +object TestDataMaxV2 { val repo = RepoV2( timestamp = Long.MAX_VALUE, diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/TestRepoUtils.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestRepoUtils.kt similarity index 84% rename from index/src/sharedTest/kotlin/org/fdroid/test/TestRepoUtils.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/TestRepoUtils.kt index d4d275870..e4726d8ea 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/TestRepoUtils.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestRepoUtils.kt @@ -12,32 +12,32 @@ import org.fdroid.test.TestUtils.getRandomString import org.fdroid.test.TestUtils.orNull import kotlin.random.Random -public object TestRepoUtils { +object TestRepoUtils { - public fun getRandomMirror(): MirrorV2 = MirrorV2( + fun getRandomMirror(): MirrorV2 = MirrorV2( url = getRandomString(), location = getRandomString().orNull() ) - public fun getRandomLocalizedTextV2(size: Int = Random.nextInt(0, 23)): LocalizedTextV2 = + fun getRandomLocalizedTextV2(size: Int = Random.nextInt(0, 23)): LocalizedTextV2 = buildMap { repeat(size) { put(getRandomString(4), getRandomString()) } } - public fun getRandomFileV2(sha256Nullable: Boolean = true): FileV2 = FileV2( + fun getRandomFileV2(sha256Nullable: Boolean = true): FileV2 = FileV2( name = getRandomString(), sha256 = getRandomString(64).also { if (sha256Nullable) orNull() }, size = Random.nextLong(-1, Long.MAX_VALUE) ) - public fun getRandomLocalizedFileV2(): Map = + fun getRandomLocalizedFileV2(): Map = TestUtils.getRandomMap(Random.nextInt(1, 8)) { getRandomString(4) to getRandomFileV2() } - public fun getRandomRepo(): RepoV2 = RepoV2( + fun getRandomRepo(): RepoV2 = RepoV2( name = getRandomLocalizedTextV2(), icon = getRandomLocalizedFileV2(), address = getRandomString(), diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/TestUtils.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestUtils.kt similarity index 82% rename from index/src/sharedTest/kotlin/org/fdroid/test/TestUtils.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/TestUtils.kt index eca7685d0..af79d6d8c 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/TestUtils.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestUtils.kt @@ -6,16 +6,16 @@ import org.fdroid.index.v2.MetadataV2 import org.fdroid.index.v2.Screenshots import kotlin.random.Random -public object TestUtils { +object TestUtils { private val charPool: List = ('a'..'z') + ('A'..'Z') + ('0'..'9') - public fun getRandomString(length: Int = Random.nextInt(1, 128)): String = (1..length) + fun getRandomString(length: Int = Random.nextInt(1, 128)): String = (1..length) .map { Random.nextInt(0, charPool.size) } .map(charPool::get) .joinToString("") - public fun getRandomList( + fun getRandomList( size: Int = Random.nextInt(0, 23), factory: () -> T, ): List = if (size == 0) emptyList() else buildList { @@ -24,7 +24,7 @@ public object TestUtils { } } - public fun getRandomMap( + fun getRandomMap( size: Int = Random.nextInt(0, 23), factory: () -> Pair, ): Map = if (size == 0) emptyMap() else buildMap { @@ -34,11 +34,11 @@ public object TestUtils { } } - public fun T.orNull(): T? { + fun T.orNull(): T? { return if (Random.nextBoolean()) null else this } - public fun IndexV2.sorted(): IndexV2 = copy( + fun IndexV2.sorted(): IndexV2 = copy( packages = packages.toSortedMap().mapValues { entry -> entry.value.copy( metadata = entry.value.metadata.sort(), @@ -57,7 +57,7 @@ public object TestUtils { } ) - public fun MetadataV2.sort(): MetadataV2 = copy( + fun MetadataV2.sort(): MetadataV2 = copy( name = name?.toSortedMap(), summary = summary?.toSortedMap(), description = description?.toSortedMap(), @@ -65,7 +65,7 @@ public object TestUtils { screenshots = screenshots?.sort(), ) - public fun Screenshots.sort(): Screenshots = copy( + fun Screenshots.sort(): Screenshots = copy( phone = phone?.sort(), sevenInch = sevenInch?.sort(), tenInch = tenInch?.sort(), @@ -73,7 +73,7 @@ public object TestUtils { tv = tv?.sort(), ) - public fun LocalizedFileListV2.sort(): LocalizedFileListV2 { + fun LocalizedFileListV2.sort(): LocalizedFileListV2 { return toSortedMap().mapValues { entry -> entry.value.sortedBy { it.name } } } diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/TestVersionUtils.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestVersionUtils.kt similarity index 98% rename from index/src/sharedTest/kotlin/org/fdroid/test/TestVersionUtils.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/TestVersionUtils.kt index 063bb7ff4..2416c72f2 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/TestVersionUtils.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/TestVersionUtils.kt @@ -15,7 +15,7 @@ import org.fdroid.test.TestUtils.getRandomString import org.fdroid.test.TestUtils.orNull import kotlin.random.Random -internal object TestVersionUtils { +object TestVersionUtils { fun getRandomPackageVersionV2( versionCode: Long = Random.nextLong(1, Long.MAX_VALUE), diff --git a/index/src/sharedTest/kotlin/org/fdroid/test/VerifierConstants.kt b/libs/sharedTest/src/main/kotlin/org/fdroid/test/VerifierConstants.kt similarity index 90% rename from index/src/sharedTest/kotlin/org/fdroid/test/VerifierConstants.kt rename to libs/sharedTest/src/main/kotlin/org/fdroid/test/VerifierConstants.kt index 388c26cfe..273e9dcb0 100644 --- a/index/src/sharedTest/kotlin/org/fdroid/test/VerifierConstants.kt +++ b/libs/sharedTest/src/main/kotlin/org/fdroid/test/VerifierConstants.kt @@ -1,9 +1,9 @@ package org.fdroid.test -public object VerifierConstants { +object VerifierConstants { - public const val VERIFICATION_DIR: String = "src/commonTest/resources/verification/" - public const val CERTIFICATE: String = + const val VERIFICATION_DIR: String = "src/commonTest/resources/verification/" + const val CERTIFICATE: String = "308202cf308201b7a0030201020204410b599a300d06092a864886f70d01010b" + "05003018311630140603550403130d546f727374656e2047726f7465301e170d" + "3134303631363139303332305a170d3431313130313139303332305a30183116" + @@ -27,7 +27,7 @@ public object VerifierConstants { "b93eff762c4b3b4fb05f8b26256570607a1400cddad2ebd4762bcf4efe703248" + "fa5b9ab455e3a5c98cb46f10adb6979aed8f96a688fd1d2a3beab380308e2ebe" + "0a4a880615567aafc0bfe344c5d7ef677e060f" - public const val FINGERPRINT: String = + const val FINGERPRINT: String = "28e14fb3b280bce8ff1e0f8e82726ff46923662cecff2a0689108ce19e8b347c" } diff --git a/settings.gradle b/settings.gradle index 4110cba70..85eab6ce8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,5 @@ include ':app' -include ':download' -include ':index' -include ':database' +include ':libs:sharedTest' +include ':libs:download' +include ':libs:index' +include ':libs:database'