From daca45c9a1fb474418a7d5a7b5bd5ba33a7d78e2 Mon Sep 17 00:00:00 2001 From: Oscar Spruit Date: Fri, 6 Dec 2024 13:04:35 +0100 Subject: [PATCH] Add dependency inclusion list The inclusion list allows us to put links with the dependencies. When an dependency is neither in the inclusion list nor the exclusion list an exception will be thrown, so we are aware a new dependency was added and we explicitly have to add it. COAND-1017 --- .../.release_notes_dependency_exclusion_list | 54 ----------- .github/release_notes_dependency_list.toml | 89 +++++++++++++++++++ scripts/generate_release_notes.py | 24 +++-- 3 files changed, 99 insertions(+), 68 deletions(-) delete mode 100644 .github/.release_notes_dependency_exclusion_list create mode 100644 .github/release_notes_dependency_list.toml diff --git a/.github/.release_notes_dependency_exclusion_list b/.github/.release_notes_dependency_exclusion_list deleted file mode 100644 index caccb1ac77..0000000000 --- a/.github/.release_notes_dependency_exclusion_list +++ /dev/null @@ -1,54 +0,0 @@ -androidx.arch.core:core-testing -androidx.compose.material3:material3 -androidx.compose.ui:ui -androidx.compose.ui:ui-graphics -androidx.compose.ui:ui-test-manifest -androidx.compose.ui:ui-tooling -androidx.compose.ui:ui-tooling-preview -androidx.hilt:hilt-navigation-compose -androidx.preference:preference-ktx -androidx.test.espresso:espresso-contrib -androidx.test.espresso:espresso-core -androidx.test.espresso:espresso-intents -androidx.test.ext:junit-ktx -androidx.test.uiautomator:uiautomator -androidx.test:rules -app.cash.turbine:turbine -com.adevinta.android:barista -com.android.application -com.android.tools.lint:lint -com.android.tools.lint:lint-api -com.android.tools.lint:lint-tests -com.google.dagger.hilt.android -com.google.dagger:hilt-android -com.google.dagger:hilt-android-compiler -com.google.dagger:hilt-android-testing -com.google.dagger:hilt-compiler -com.google.devtools.ksp -com.google.pay.button:compose-pay-button -com.lemonappdev:konsist -com.pinterest.ktlint:ktlint-cli -com.squareup.leakcanary:leakcanary-android -com.squareup.moshi:moshi-adapters -com.squareup.moshi:moshi-kotlin -com.squareup.okhttp3:logging-interceptor -com.squareup.okhttp3:mockwebserver -com.squareup.retrofit2:converter-moshi -com.squareup.retrofit2:retrofit -io.gitlab.arturbosch.detekt -io.gitlab.arturbosch.detekt:detekt-formatting -jacoco -org.bitbucket.b_c:jose4j -org.jetbrains.dokka -org.jetbrains.kotlinx.binary-compatibility-validator -org.jetbrains.kotlinx:kotlinx-coroutines-test -org.json:json -org.junit.jupiter:junit-jupiter-api -org.junit.jupiter:junit-jupiter-engine -org.junit.jupiter:junit-jupiter-params -org.junit.vintage:junit-vintage-engine -org.mockito.kotlin:mockito-kotlin -org.mockito:mockito-android -org.mockito:mockito-junit-jupiter -org.robolectric:robolectric -org.sonarqube diff --git a/.github/release_notes_dependency_list.toml b/.github/release_notes_dependency_list.toml new file mode 100644 index 0000000000..9b009c8fa7 --- /dev/null +++ b/.github/release_notes_dependency_list.toml @@ -0,0 +1,89 @@ +[included] +"androidx.activity:activity" = "[AndroidX Activity](https://developer.android.com/jetpack/androidx/releases/activity)" +"androidx.activity:activity-compose" = "[AndroidX Activity Compose](https://developer.android.com/jetpack/androidx/releases/activity)" +"androidx.annotation:annotation" = "[AndroidX Annotation](https://developer.android.com/jetpack/androidx/releases/annotation)" +"androidx.appcompat:appcompat" = "[AndroidX Appcompat](https://developer.android.com/jetpack/androidx/releases/appcompat)" +"androidx.autofill:autofill" = "[AndroidX Autofill](https://developer.android.com/jetpack/androidx/releases/autofill)" +"androidx.browser:browser" = "[AndroidX Browser](https://developer.android.com/jetpack/androidx/releases/browser)" +"androidx.compose.compiler:compiler" = "[AndroidX Compose Compiler](https://developer.android.com/jetpack/androidx/releases/compose-compiler)" +"androidx.compose:compose-bom" = "[AndroidX Compose BoM](https://developer.android.com/develop/ui/compose/bom/bom-mapping)" +"androidx.constraintlayout:constraintlayout" = "[AndroidX ConstraintLayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout)" +"androidx.fragment:fragment-ktx" = "[AndroidX Fragment](https://developer.android.com/jetpack/androidx/releases/fragment)" +"androidx.lifecycle:lifecycle-runtime-ktx" = "[AndroidX Lifecycle Runtime](https://developer.android.com/jetpack/androidx/releases/lifecycle)" +"androidx.lifecycle:lifecycle-viewmodel-compose" = "[AndroidX Lifecycle ViewModel Compose](https://developer.android.com/jetpack/androidx/releases/lifecycle)" +"androidx.lifecycle:lifecycle-viewmodel-ktx" = "[AndroidX Lifecycle ViewModel](https://developer.android.com/jetpack/androidx/releases/lifecycle)" +"androidx.preference:preference-ktx" = "[AndroidX Preference](https://developer.android.com/jetpack/androidx/releases/preference)" +"androidx.recyclerview:recyclerview" = "[AndroidX RecyclerView](https://developer.android.com/jetpack/androidx/releases/recyclerview)" +"app.cash.paykit:core" = "[CashApp Pay](https://github.com/cashapp/cash-app-pay-android-sdk/releases)" +"ch.twint.payment.sdk:android-sdk" = "Twint" +"com.adyen.threeds:adyen-3ds2" = "[Adyen 3DS2](https://github.com/Adyen/adyen-3ds2-android/releases)" +"com.android.library" = "[Android Gradle Plugin](https://developer.android.com/build/releases/gradle-plugin)" +"com.google.android.gms:play-services-wallet" = "[Play Services Wallet](https://developers.google.com/pay/api/android/support/release-notes)" +"com.google.android.material:material" = "[Material](https://github.com/material-components/material-components-android/releases)" +"com.squareup.okhttp3:okhttp" = "[OkHttp](https://square.github.io/okhttp/changelogs/changelog/)" +"com.tencent.mm.opensdk:wechat-sdk-android-without-mta" = "[WeChat](https://developers.weixin.qq.com/doc/oplatform/en/Mobile_App/Access_Guide/Android.html)" +"kotlin" = "[Kotlin](https://github.com/JetBrains/kotlin/releases)" +"org.jetbrains.kotlinx:kotlinx-coroutines-android" = "[Kotlin Coroutines Android](https://github.com/Kotlin/kotlinx.coroutines/releases)" +"org.jetbrains.kotlinx:kotlinx-coroutines-core" = "[Kotlin Coroutines](https://github.com/Kotlin/kotlinx.coroutines/releases)" + +[excluded] +# We only need the package name, but since toml files are key value base we set an empty value. +"androidx.arch.core:core-testing" = "" +"androidx.compose.material3:material3" = "" +"androidx.compose.ui:ui" = "" +"androidx.compose.ui:ui-graphics" = "" +"androidx.compose.ui:ui-test-manifest" = "" +"androidx.compose.ui:ui-tooling" = "" +"androidx.compose.ui:ui-tooling-preview" = "" +"androidx.hilt:hilt-navigation-compose" = "" +"androidx.preference:preference-ktx" = "" +"androidx.test.espresso:espresso-contrib" = "" +"androidx.test.espresso:espresso-core" = "" +"androidx.test.espresso:espresso-intents" = "" +"androidx.test.ext:junit-ktx" = "" +"androidx.test.uiautomator:uiautomator" = "" +"androidx.test:rules" = "" +"app.cash.turbine:turbine" = "" +"com.adevinta.android:barista" = "" +"com.android.application" = "" +"com.android.tools.lint:lint" = "" +"com.android.tools.lint:lint-api" = "" +"com.android.tools.lint:lint-tests" = "" +"com.google.dagger.hilt.android" = "" +"com.google.dagger:hilt-android" = "" +"com.google.dagger:hilt-android-compiler" = "" +"com.google.dagger:hilt-android-testing" = "" +"com.google.dagger:hilt-compiler" = "" +"com.google.devtools.ksp" = "" +"com.google.pay.button:compose-pay-button" = "" +"com.lemonappdev:konsist" = "" +"com.pinterest.ktlint:ktlint-cli" = "" +"com.squareup.leakcanary:leakcanary-android" = "" +"com.squareup.moshi:moshi-adapters" = "" +"com.squareup.moshi:moshi-kotlin" = "" +"com.squareup.okhttp3:logging-interceptor" = "" +"com.squareup.okhttp3:mockwebserver" = "" +"com.squareup.retrofit2:converter-moshi" = "" +"com.squareup.retrofit2:retrofit" = "" +"io.gitlab.arturbosch.detekt" = "" +"io.gitlab.arturbosch.detekt:detekt-formatting" = "" +"jacoco" = "" +"org.bitbucket.b_c:jose4j" = "" +"org.jetbrains.dokka" = "" +"org.jetbrains.kotlinx.binary-compatibility-validator" = "" +"org.jetbrains.kotlinx:kotlinx-coroutines-test" = "" +"org.json:json" = "" +"org.junit.jupiter:junit-jupiter-api" = "" +"org.junit.jupiter:junit-jupiter-engine" = "" +"org.junit.jupiter:junit-jupiter-params" = "" +"org.junit.vintage:junit-vintage-engine" = "" +"org.mockito.kotlin:mockito-kotlin" = "" +"org.mockito:mockito-android" = "" +"org.mockito:mockito-junit-jupiter" = "" +"org.robolectric:robolectric" = "" +"org.sonarqube" = "" +# These are used in our SDK, but we already display Kotlin in through another dependency. +"kotlin-android" = "" +"kotlin-parcelize" = "" +"org.jetbrains.kotlin.android" = "" +"org.jetbrains.kotlin:kotlin-parcelize-runtime" = "" diff --git a/scripts/generate_release_notes.py b/scripts/generate_release_notes.py index 3771cb98a0..47cd238545 100644 --- a/scripts/generate_release_notes.py +++ b/scripts/generate_release_notes.py @@ -62,22 +62,11 @@ def get_label_content(label: str, pr_body: str) -> str: return content -dependency_exclusion_list = [] -with open('.github/.release_notes_dependency_exclusion_list') as file: - dependency_exclusion_list = file.read().splitlines() - -def is_dependency_excluded(id: str) -> bool: - for line in dependency_exclusion_list: - if id == line: - return True - - return False - def format_dependency_table(dependency_updates: [DependencyUpdate]) -> str: table = '| Name | Version |\n|------|---------|' for dependency in dependency_updates: - table = table + '\n| {} | `{}` -> `{}` |'.format(dependency.id, dependency.old_version, dependency.new_version) + table = table + '\n| {} | `{}` -> `{}` |'.format(dependency.link, dependency.old_version, dependency.new_version) return table @@ -110,6 +99,9 @@ def generate_dependency_updates(latest_tag: str) -> [DependencyUpdate]: all_versions = {**old_versions['libraries'], **new_versions['libraries'], **old_versions['plugins'], **new_versions['plugins']} + with open('.github/release_notes_dependency_list.toml') as file: + dependency_list = toml.load(file) + for value in all_versions.values(): if 'group' in value and 'name' in value: id = value['group'] + ':' + value['name'] @@ -118,7 +110,10 @@ def generate_dependency_updates(latest_tag: str) -> [DependencyUpdate]: else: id = value['id'] - if is_dependency_excluded(id): + if id not in dependency_list['excluded'] and id not in dependency_list['included']: + raise Exception('Dependency not recognized: ' + id) + + if id in dependency_list['excluded']: continue if 'version' in value: @@ -127,6 +122,7 @@ def generate_dependency_updates(latest_tag: str) -> [DependencyUpdate]: # If there is no explicit version defined the version probably comes from a BoM and it's safe to skip continue + link = dependency_list['included'][id] new_version = new_versions['versions'].get(version_ref, None) old_version = old_versions['versions'].get(version_ref, None) @@ -134,7 +130,7 @@ def generate_dependency_updates(latest_tag: str) -> [DependencyUpdate]: if new_version == old_version: continue - dependency_update = DependencyUpdate(id, None, new_version, old_version) + dependency_update = DependencyUpdate(id, link, new_version, old_version) updates.append(dependency_update) return updates