diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /mobile/android/android-components/plugins/dependencies/src/main | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/android-components/plugins/dependencies/src/main')
6 files changed, 922 insertions, 0 deletions
diff --git a/mobile/android/android-components/plugins/dependencies/src/main/java/ApplicationServices.kt b/mobile/android/android-components/plugins/dependencies/src/main/java/ApplicationServices.kt new file mode 100644 index 0000000000..5476c263fe --- /dev/null +++ b/mobile/android/android-components/plugins/dependencies/src/main/java/ApplicationServices.kt @@ -0,0 +1,35 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// These lines are generated by android-components/automation/application-services-nightly-bump.py +val VERSION = "126.0" +val CHANNEL = ApplicationServicesChannel.RELEASE + +object ApplicationServicesConfig { + val version = VERSION + val channel = CHANNEL + val groupId = when (channel) { + ApplicationServicesChannel.RELEASE -> "org.mozilla.appservices" + ApplicationServicesChannel.STAGING -> "org.mozilla.appservices" + // Nightly channels use a different group id to keep the the packages separate + ApplicationServicesChannel.NIGHTLY -> "org.mozilla.appservices.nightly" + ApplicationServicesChannel.NIGHTLY_STAGING -> "org.mozilla.appservices.nightly" + } +} + +/** + * Enum for GeckoView release channels. + * + * This determines which Maven Repository. Each channel is uploaded to a separate Maven repository. + */ +enum class ApplicationServicesChannel { + // Used for official, non-nightly, releases + RELEASE, + // Used for nightly releases + NIGHTLY, + // Used for preview releases for PRs + STAGING, + // Used for nightly releases + NIGHTLY_STAGING, +} diff --git a/mobile/android/android-components/plugins/dependencies/src/main/java/DependenciesPlugin.kt b/mobile/android/android-components/plugins/dependencies/src/main/java/DependenciesPlugin.kt new file mode 100644 index 0000000000..a58ac29588 --- /dev/null +++ b/mobile/android/android-components/plugins/dependencies/src/main/java/DependenciesPlugin.kt @@ -0,0 +1,215 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import org.gradle.api.Plugin +import org.gradle.api.initialization.Settings + +// If you ever need to force a toolchain rebuild (taskcluster) then edit the following comment. +// FORCE REBUILD 2023-05-24 + +class DependenciesPlugin : Plugin<Settings> { + override fun apply(settings: Settings) = Unit +} + +// Synchronized version numbers for dependencies used by (some) modules +object Versions { + const val kotlin = "1.9.23" + const val coroutines = "1.8.0" + const val serialization = "1.6.3" + const val python_envs_plugin = "0.0.31" + + const val mozilla_glean = "59.0.0" + + const val junit = "4.13.2" + const val robolectric = "4.11.1" + const val mockito = "5.11.0" + const val maven_ant_tasks = "2.1.3" + const val jacoco = "0.8.11" + const val okhttp = "4.12.0" + const val okio = "3.9.0" + const val androidsvg = "1.4" + + const val android_gradle_plugin = "8.3.0" + + // This has to be synced to the gradlew plugin version. See + // http://googlesamples.github.io/android-custom-lint-rules/api-guide/example.md.html#example:samplelintcheckgithubproject/lintversion? + const val lint = "31.3.0" + const val detekt = "1.23.6" + const val ktlint = "0.49.1" + + const val sentry = "7.5.0" + + const val zxing = "3.5.3" + + const val disklrucache = "2.0.2" + const val leakcanary = "2.13" + + const val material = "1.9.0" + const val ksp = "1.0.19" + val ksp_plugin = "$kotlin-$ksp" + + // see https://android-developers.googleblog.com/2022/06/independent-versioning-of-Jetpack-Compose-libraries.html + // for Jetpack Compose libraries versioning + const val compose_compiler = "1.5.11" + + object AndroidX { + const val activityCompose = "1.7.2" + const val annotation = "1.7.1" + const val appcompat = "1.6.1" + const val autofill = "1.1.0" + const val browser = "1.8.0" + const val biometric = "1.1.0" + const val cardview = "1.0.0" + const val compose_bom = "2024.03.00" + const val constraintlayout = "2.1.4" + const val coordinatorlayout = "1.2.0" + const val core = "1.12.0" + const val drawerlayout = "1.2.0" + const val fragment = "1.6.2" + const val recyclerview = "1.3.2" + const val test = "1.5.0" + const val test_ext = "1.1.5" + const val test_runner = "1.5.2" + const val espresso = "3.5.1" + const val room = "2.6.1" + const val savedstate = "1.2.1" + const val paging = "3.2.1" + const val palette = "1.0.0" + const val preferences = "1.2.1" + const val lifecycle = "2.7.0" + const val media = "1.7.0" + const val navigation = "2.7.7" + const val work = "2.9.0" + const val arch = "2.2.0" + const val uiautomator = "2.3.0" + const val localbroadcastmanager = "1.0.0" + const val swiperefreshlayout = "1.1.0" + const val data_store_preferences="1.0.0" + } + + object Firebase { + const val messaging = "23.4.1" + } +} + +// Synchronized dependencies used by (some) modules +@Suppress("Unused", "MaxLineLength") +object ComponentsDependencies { + const val kotlin_coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}" + const val kotlin_reflect = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}" + const val kotlin_json = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.serialization}" + + const val testing_junit = "junit:junit:${Versions.junit}" + const val testing_robolectric = "org.robolectric:robolectric:${Versions.robolectric}" + const val testing_mockito = "org.mockito:mockito-core:${Versions.mockito}" + const val testing_mockwebserver = "com.squareup.okhttp3:mockwebserver:${Versions.okhttp}" + const val testing_coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines}" + const val testing_maven_ant_tasks = "org.apache.maven:maven-ant-tasks:${Versions.maven_ant_tasks}" + const val testing_leakcanary = "com.squareup.leakcanary:leakcanary-android-instrumentation:${Versions.leakcanary}" + + const val androidx_activity_compose = "androidx.activity:activity-compose:${Versions.AndroidX.activityCompose}" + const val androidx_annotation = "androidx.annotation:annotation:${Versions.AndroidX.annotation}" + const val androidx_appcompat = "androidx.appcompat:appcompat:${Versions.AndroidX.appcompat}" + const val androidx_autofill = "androidx.autofill:autofill:${Versions.AndroidX.autofill}" + const val androidx_arch_core_common = "androidx.arch.core:core-common:${Versions.AndroidX.arch}" + const val androidx_arch_core_testing = "androidx.arch.core:core-testing:${Versions.AndroidX.arch}" + const val androidx_biometric = "androidx.biometric:biometric:${Versions.AndroidX.biometric}" + const val androidx_browser = "androidx.browser:browser:${Versions.AndroidX.browser}" + const val androidx_cardview = "androidx.cardview:cardview:${Versions.AndroidX.cardview}" + + const val androidx_compose_bom = "androidx.compose:compose-bom:${Versions.AndroidX.compose_bom}" + const val androidx_compose_animation = "androidx.compose.animation:animation" + const val androidx_compose_ui = "androidx.compose.ui:ui" + const val androidx_compose_ui_graphics = "androidx.compose.ui:ui-graphics" + const val androidx_compose_ui_test = "androidx.compose.ui:ui-test-junit4" + const val androidx_compose_ui_test_manifest = "androidx.compose.ui:ui-test-manifest" + const val androidx_compose_ui_tooling = "androidx.compose.ui:ui-tooling" + const val androidx_compose_ui_tooling_preview = "androidx.compose.ui:ui-tooling-preview" + const val androidx_compose_foundation = "androidx.compose.foundation:foundation" + const val androidx_compose_material = "androidx.compose.material:material" + const val androidx_compose_runtime_livedata = "androidx.compose.runtime:runtime-livedata" + + const val androidx_safeargs = "androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.AndroidX.navigation}" + const val androidx_navigation_fragment = "androidx.navigation:navigation-fragment-ktx:${Versions.AndroidX.navigation}" + const val androidx_navigation_ui = "androidx.navigation:navigation-ui:${Versions.AndroidX.navigation}" + const val androidx_compose_navigation = "androidx.navigation:navigation-compose:${Versions.AndroidX.navigation}" + const val androidx_constraintlayout = "androidx.constraintlayout:constraintlayout:${Versions.AndroidX.constraintlayout}" + const val androidx_core = "androidx.core:core:${Versions.AndroidX.core}" + const val androidx_core_ktx = "androidx.core:core-ktx:${Versions.AndroidX.core}" + const val androidx_coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:${Versions.AndroidX.coordinatorlayout}" + const val androidx_drawerlayout = "androidx.drawerlayout:drawerlayout:${Versions.AndroidX.drawerlayout}" + const val androidx_fragment = "androidx.fragment:fragment:${Versions.AndroidX.fragment}" + const val androidx_lifecycle_common = "androidx.lifecycle:lifecycle-common:${Versions.AndroidX.lifecycle}" + const val androidx_lifecycle_livedata = "androidx.lifecycle:lifecycle-livedata-ktx:${Versions.AndroidX.lifecycle}" + const val androidx_lifecycle_process = "androidx.lifecycle:lifecycle-process:${Versions.AndroidX.lifecycle}" + const val androidx_lifecycle_runtime = "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.AndroidX.lifecycle}" + const val androidx_lifecycle_service = "androidx.lifecycle:lifecycle-service:${Versions.AndroidX.lifecycle}" + const val androidx_lifecycle_viewmodel = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.AndroidX.lifecycle}" + const val androidx_media = "androidx.media:media:${Versions.AndroidX.media}" + const val androidx_paging = "androidx.paging:paging-runtime:${Versions.AndroidX.paging}" + const val androidx_palette = "androidx.palette:palette-ktx:${Versions.AndroidX.palette}" + const val androidx_preferences = "androidx.preference:preference:${Versions.AndroidX.preferences}" + const val androidx_recyclerview = "androidx.recyclerview:recyclerview:${Versions.AndroidX.recyclerview}" + const val androidx_room_runtime = "androidx.room:room-ktx:${Versions.AndroidX.room}" + const val androidx_room_compiler = "androidx.room:room-compiler:${Versions.AndroidX.room}" + const val androidx_room_testing = "androidx.room:room-testing:${Versions.AndroidX.room}" + const val androidx_savedstate = "androidx.savedstate:savedstate:${Versions.AndroidX.savedstate}" + const val androidx_test_core = "androidx.test:core-ktx:${Versions.AndroidX.test}" + const val androidx_test_junit = "androidx.test.ext:junit-ktx:${Versions.AndroidX.test_ext}" + const val androidx_test_runner = "androidx.test:runner:${Versions.AndroidX.test_runner}" + const val androidx_test_rules = "androidx.test:rules:${Versions.AndroidX.test}" + const val androidx_test_uiautomator = "androidx.test.uiautomator:uiautomator:${Versions.AndroidX.uiautomator}" + const val androidx_work_runtime = "androidx.work:work-runtime:${Versions.AndroidX.work}" + const val androidx_work_testing = "androidx.work:work-testing:${Versions.AndroidX.work}" + const val androidx_espresso_core = "androidx.test.espresso:espresso-core:${Versions.AndroidX.espresso}" + const val androidx_localbroadcastmanager = "androidx.localbroadcastmanager:localbroadcastmanager:${Versions.AndroidX.localbroadcastmanager}" + const val androidx_swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:${Versions.AndroidX.swiperefreshlayout}" + const val androidx_data_store_preferences = "androidx.datastore:datastore-preferences:${Versions.AndroidX.data_store_preferences}" + + const val google_material = "com.google.android.material:material:${Versions.material}" + + const val plugin_serialization = "org.jetbrains.kotlin.plugin.serialization:org.jetbrains.kotlin.plugin.serialization.gradle.plugin:${Versions.kotlin}" + + const val leakcanary = "com.squareup.leakcanary:leakcanary-android:${Versions.leakcanary}" + + const val tools_androidgradle = "com.android.tools.build:gradle:${Versions.android_gradle_plugin}" + const val tools_kotlingradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" + + const val tools_lint = "com.android.tools.lint:lint:${Versions.lint}" + const val tools_lintapi = "com.android.tools.lint:lint-api:${Versions.lint}" + const val tools_lintchecks = "com.android.tools.lint:lint-checks:${Versions.lint}" + const val tools_linttests = "com.android.tools.lint:lint-tests:${Versions.lint}" + + const val tools_detekt_api = "io.gitlab.arturbosch.detekt:detekt-api:${Versions.detekt}" + const val tools_detekt_test = "io.gitlab.arturbosch.detekt:detekt-test:${Versions.detekt}" + + val mozilla_appservices_fxaclient = "${ApplicationServicesConfig.groupId}:fxaclient:${ApplicationServicesConfig.version}" + val mozilla_appservices_nimbus = "${ApplicationServicesConfig.groupId}:nimbus:${ApplicationServicesConfig.version}" + const val mozilla_glean_forUnitTests = "org.mozilla.telemetry:glean-native-forUnitTests:${Versions.mozilla_glean}" + val mozilla_appservices_autofill = "${ApplicationServicesConfig.groupId}:autofill:${ApplicationServicesConfig.version}" + val mozilla_appservices_logins = "${ApplicationServicesConfig.groupId}:logins:${ApplicationServicesConfig.version}" + val mozilla_appservices_places = "${ApplicationServicesConfig.groupId}:places:${ApplicationServicesConfig.version}" + val mozilla_appservices_syncmanager = "${ApplicationServicesConfig.groupId}:syncmanager:${ApplicationServicesConfig.version}" + val mozilla_remote_settings = "${ApplicationServicesConfig.groupId}:remotesettings:${ApplicationServicesConfig.version}" + val mozilla_appservices_push = "${ApplicationServicesConfig.groupId}:push:${ApplicationServicesConfig.version}" + val mozilla_appservices_tabs = "${ApplicationServicesConfig.groupId}:tabs:${ApplicationServicesConfig.version}" + val mozilla_appservices_suggest = "${ApplicationServicesConfig.groupId}:suggest:${ApplicationServicesConfig.version}" + val mozilla_appservices_httpconfig = "${ApplicationServicesConfig.groupId}:httpconfig:${ApplicationServicesConfig.version}" + val mozilla_appservices_full_megazord = "${ApplicationServicesConfig.groupId}:full-megazord:${ApplicationServicesConfig.version}" + val mozilla_appservices_full_megazord_forUnitTests = "${ApplicationServicesConfig.groupId}:full-megazord-forUnitTests:${ApplicationServicesConfig.version}" + + val mozilla_appservices_errorsupport = "${ApplicationServicesConfig.groupId}:errorsupport:${ApplicationServicesConfig.version}" + val mozilla_appservices_rust_log_forwarder = "${ApplicationServicesConfig.groupId}:rust-log-forwarder:${ApplicationServicesConfig.version}" + val mozilla_appservices_sync15 = "${ApplicationServicesConfig.groupId}:sync15:${ApplicationServicesConfig.version}" + + const val thirdparty_okhttp = "com.squareup.okhttp3:okhttp:${Versions.okhttp}" + const val thirdparty_okhttp_urlconnection = "com.squareup.okhttp3:okhttp-urlconnection:${Versions.okhttp}" + const val thirdparty_okio = "com.squareup.okio:okio:${Versions.okio}" + const val thirdparty_sentry = "io.sentry:sentry-android:${Versions.sentry}" + const val thirdparty_zxing = "com.google.zxing:core:${Versions.zxing}" + const val thirdparty_disklrucache = "com.jakewharton:disklrucache:${Versions.disklrucache}" + const val thirdparty_androidsvg = "com.caverock:androidsvg-aar:${Versions.androidsvg}" + + const val firebase_messaging = "com.google.firebase:firebase-messaging:${Versions.Firebase.messaging}" +} diff --git a/mobile/android/android-components/plugins/dependencies/src/main/java/ExtraRepositories.kt b/mobile/android/android-components/plugins/dependencies/src/main/java/ExtraRepositories.kt new file mode 100644 index 0000000000..210db48837 --- /dev/null +++ b/mobile/android/android-components/plugins/dependencies/src/main/java/ExtraRepositories.kt @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Extra Maven repositories to use +object ExtraRepositories { + val mozillaStaging = (ApplicationServicesConfig.channel == ApplicationServicesChannel.STAGING + || ApplicationServicesConfig.channel == ApplicationServicesChannel.NIGHTLY_STAGING) +} diff --git a/mobile/android/android-components/plugins/dependencies/src/main/java/LICENSE b/mobile/android/android-components/plugins/dependencies/src/main/java/LICENSE new file mode 100644 index 0000000000..14e2f777f6 --- /dev/null +++ b/mobile/android/android-components/plugins/dependencies/src/main/java/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/mobile/android/android-components/plugins/dependencies/src/main/java/appservices_version_bump.py b/mobile/android/android-components/plugins/dependencies/src/main/java/appservices_version_bump.py new file mode 100755 index 0000000000..70d5a8f980 --- /dev/null +++ b/mobile/android/android-components/plugins/dependencies/src/main/java/appservices_version_bump.py @@ -0,0 +1,216 @@ +#!/usr/bin/env python3 + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/ + +# Helper script for mach vendor / updatebot to update the application-services +# version pin in ApplicationServices.kt to the latest available +# application-services nightly build. +# +# This script was adapted from https://github.com/mozilla-mobile/relbot/ + +import datetime +import logging +import os +import re +from urllib.parse import quote_plus + +import requests +from mozbuild.vendor.host_base import BaseHost + +log = logging.getLogger(__name__) +logging.basicConfig( + format="%(asctime)s - %(name)s.%(funcName)s:%(lineno)s - %(levelname)s - %(message)s", # noqa E501 + level=logging.INFO, +) + + +def get_contents(path): + with open(path) as f: + return f.read() + + +def write_contents(path, new_content): + with open(path, "w") as f: + f.write(new_content) + + +def get_app_services_version_path(): + """Return the file path to dependencies file""" + p = "ApplicationServices.kt" + if os.path.exists(p): + return p + return "mobile/android/android-components/plugins/dependencies/src/main/java/ApplicationServices.kt" + + +def taskcluster_indexed_artifact_url(index_name, artifact_path): + artifact_path = quote_plus(artifact_path) + return ( + "https://firefox-ci-tc.services.mozilla.com/" + f"api/index/v1/task/{index_name}/artifacts/{artifact_path}" + ) + + +def validate_as_version(v): + """Validate that v is in an expected format for an app-services version. Returns v or raises an exception.""" + + match = re.match(r"(^\d+)\.\d+$", v) + if match: + # Application-services switched to following the 2-component the + # Firefox version number in v114 + if int(match.group(1)) >= 114: + return v + raise Exception(f"Invalid version format {v}") + + +def validate_as_channel(c): + """Validate that c is a valid app-services channel.""" + if c in ("staging", "nightly_staging"): + # These are channels are valid, but only used for preview builds. We don't have + # any way of auto-updating them + raise Exception(f"Can't update app-services channel {c}") + if c not in ("release", "nightly"): + raise Exception(f"Invalid app-services channel {c}") + return c + + +def get_current_as_version(): + """Return the current nightly app-services version""" + regex = re.compile(r'val VERSION = "([\d\.]+)"', re.MULTILINE) + + path = get_app_services_version_path() + src = get_contents(path) + match = regex.search(src) + if match: + return validate_as_version(match[1]) + raise Exception( + f"Could not find application-services version in {os.path.basename(path)}" + ) + + +def match_as_channel(src): + """ + Find the ApplicationServicesChannel channel in the contents of the given + ApplicationServices.kt file. + """ + match = re.compile( + r"val CHANNEL = ApplicationServicesChannel." + r"(NIGHTLY|NIGHTLY_STAGING|STAGING|RELEASE)", + re.MULTILINE, + ).search(src) + if match: + return validate_as_channel(match[1].lower()) + raise Exception("Could not match the channel in ApplicationServices.kt") + + +def get_current_as_channel(): + """Return the current app-services channel""" + content = get_contents(get_app_services_version_path()) + return match_as_channel(content) + + +def get_as_nightly_json(version="latest"): + r = requests.get( + taskcluster_indexed_artifact_url( + f"project.application-services.v2.nightly.{version}", + "public/build/nightly.json", + ) + ) + r.raise_for_status() + return r.json() + + +def compare_as_versions(a, b): + # Tricky cmp()-style function for application services versions. Note that + # this works with both 2-component versions and 3-component ones, Since + # python compares tuples element by element. + a = tuple(int(x) for x in validate_as_version(a).split(".")) + b = tuple(int(x) for x in validate_as_version(b).split(".")) + return (a > b) - (a < b) + + +def update_as_version(old_as_version, new_as_version): + """Update the VERSION in ApplicationServices.kt""" + path = get_app_services_version_path() + current_version_string = f'val VERSION = "{old_as_version}"' + new_version_string = f'val VERSION = "{new_as_version}"' + log.info(f"Updating app-services version in {path}") + + content = get_contents(path) + new_content = content.replace(current_version_string, new_version_string) + if content == new_content: + raise Exception( + "Update to ApplicationServices.kt resulted in no changes: " + "maybe the file was already up to date?" + ) + + write_contents(path, new_content) + + +def update_application_services(revision): + """Find the app-services nightly build version corresponding to revision; + if it is newer than the current version in ApplicationServices.kt, then + update ApplicationServices.kt with the newer version number.""" + as_channel = get_current_as_channel() + log.info(f"Current app-services channel is {as_channel}") + if as_channel != "nightly": + raise NotImplementedError( + "Only the app-services nightly channel is currently supported" + ) + + current_as_version = get_current_as_version() + log.info( + f"Current app-services {as_channel.capitalize()} version is {current_as_version}" + ) + + json = get_as_nightly_json(f"revision.{revision}") + target_as_version = json["version"] + log.info( + f"Target app-services {as_channel.capitalize()} version " + f"is {target_as_version}" + ) + + if compare_as_versions(current_as_version, target_as_version) >= 0: + log.warning( + f"No newer app-services {as_channel.capitalize()} release found. Exiting." + ) + return + + dry_run = os.getenv("DRY_RUN") == "True" + if dry_run: + log.warning("Dry-run so not continuing.") + return + + update_as_version( + current_as_version, + target_as_version, + ) + + +class ASHost(BaseHost): + def upstream_tag(self, revision): + if revision == "HEAD": + index = "latest" + else: + index = f"revision.{revision}" + json = get_as_nightly_json(index) + timestamp = json["version"].rsplit(".", 1)[1] + return ( + json["commit"], + datetime.datetime.strptime(timestamp, "%Y%m%d%H%M%S").isoformat(), + ) + + +def main(): + import sys + + if len(sys.argv) != 2: + print("Usage: {} <commit hash>".format(sys.argv[0]), file=sys.stderr) + sys.exit(1) + + update_application_services(sys.argv[1]) + + +if __name__ == "__main__": + main() diff --git a/mobile/android/android-components/plugins/dependencies/src/main/java/moz.yaml b/mobile/android/android-components/plugins/dependencies/src/main/java/moz.yaml new file mode 100644 index 0000000000..c0d1433487 --- /dev/null +++ b/mobile/android/android-components/plugins/dependencies/src/main/java/moz.yaml @@ -0,0 +1,74 @@ +# +# moz.yaml file to configure updatebot to perform version bumps for +# nightly application-services builds; the version bump occurs in +# ApplicationServices.kt. +# +# Note that application-services is not really vendored here: All the +# normal vendoring steps are skipped and a custom action is used to +# do the version bump. This allows us to drive version bumps in updatebot +# and leverage updatebot's bug and patch creation. +# + +# Version of this schema +schema: 1 + +bugzilla: + # Bugzilla product and component for this directory and subdirectories + product: Fenix + component: "General" + +# Document the source of externally hosted code +origin: + + # Short name of the package/library + name: android nightly application-services version bump + + description: android nightly application-services version bump + + # Full URL for the package's homepage/etc + # Usually different from repository url + url: https://github.com/mozilla/application-services + + # Human-readable identifier for this version/release + # Generally "version NNN", "tag SSS", "bookmark SSS" + release: 2550d98ec22599dd1b1d45915ad5b119d1b7d64c (2024-04-10T05:03:14). + + # Revision to pull in + # Must be a long or short commit SHA (long preferred) + revision: 2550d98ec22599dd1b1d45915ad5b119d1b7d64c + + # The package's license, where possible using the mnemonic from + # https://spdx.org/licenses/ + # Multiple licenses can be specified (as a YAML list) + # A "LICENSE" file must exist containing the full license text + license: MPL-2.0 + license-file: LICENSE + +updatebot: + maintainer-phab: "#release-managers" + maintainer-bz: dmeehan@mozilla.com + tasks: + - type: vendoring + enabled: true + frequency: every + fuzzy-query: "'test-components | 'test-apk" + +vendoring: + url: https://github.com/mozilla/application-services + source-hosting: yaml-dir + source-host-path: appservices_version_bump.ASHost + tracking: tag + + skip-vendoring-steps: + - fetch + - keep + - include + - exclude + - move-contents + - update-moz-build + + update-actions: + - action: run-script + script: '{yaml_dir}/appservices_version_bump.py' + cwd: '.' + args: ['{revision}'] |