Skip to content

Commit

Permalink
Add dependency inclusion list
Browse files Browse the repository at this point in the history
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
  • Loading branch information
OscarSpruit committed Dec 6, 2024
1 parent 670e327 commit daca45c
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 68 deletions.
54 changes: 0 additions & 54 deletions .github/.release_notes_dependency_exclusion_list

This file was deleted.

89 changes: 89 additions & 0 deletions .github/release_notes_dependency_list.toml
Original file line number Diff line number Diff line change
@@ -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" = ""
24 changes: 10 additions & 14 deletions scripts/generate_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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']
Expand All @@ -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:
Expand All @@ -127,14 +122,15 @@ 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)

# If the versions isn't updated we can ignore the dependency
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
Expand Down

0 comments on commit daca45c

Please sign in to comment.