chore(observability): Add proguard/r8 rule to keep the SchemaId annotation.

This commit is contained in:
Mateusz Armatys
2023-08-16 17:50:31 +02:00
committed by MargeBot
parent a5c8b5ae47
commit 1285c82958
2 changed files with 6 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Proton Technologies AG
* Copyright (c) 2023 Proton AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
@@ -41,7 +41,7 @@ public sealed class ObservabilityData {
public companion object {
private fun getSchemaIdUri(klass: Class<out ObservabilityData>): URI {
val schemaId = requireNotNull(klass.getAnnotation(SchemaId::class.java)) {
"Missing ${SchemaId::class.simpleName} annotation for metric: ${this::class.simpleName}."
"Missing SchemaId annotation for metric: ${klass.name}."
}
return URI.create(schemaId.id)
}
@@ -0,0 +1,4 @@
# Useful for keeping the `SchemaId` annotation class, which is needed at runtime.
# In R8 full mode, annotations are only kept for classes which are matched by keep rules.
# https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md#r8-full-mode
-keep,allowshrinking,allowoptimization,allowobfuscation,allowaccessmodification class * extends me.proton.core.observability.domain.metrics.ObservabilityData