Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ fun Libs.Builder.withJson(byteArray: ByteArray): Libs.Builder {
* Auto discover the generated library definition data by the default name and location
* `res/raw/aboutlibraries.json`
*
* Please remember to disable resource shrinking when using this API.
* https://developer.android.com/topic/performance/app-optimization/customize-which-resources-to-keep
*
* ```
* <?xml version="1.0" encoding="utf-8"?>
* <resources xmlns:tools="http://schemas.android.com/tools"
* tools:keep="@raw/aboutlibraries.json" />
* ```
*
* @param ctx context used to retrieve the resource
*/
fun Libs.Builder.withContext(ctx: Context): Libs.Builder {
Expand All @@ -35,10 +44,12 @@ fun Libs.Builder.withJson(ctx: Context, rawResId: Int): Libs.Builder {
try {
withJson(ctx.resources.openRawResource(rawResId).bufferedReader().use { it.readText() })
} catch (t: Throwable) {
Log.e("AboutLibraries", """
Log.e(
"AboutLibraries", """
Unable to retrieve library information given the `raw` resource identifier.
Please make sure either the gradle plugin is properly set up, or the file is manually provided.
""".trimIndent())
""".trimIndent()
)
println("Could not retrieve libraries")
}
return this
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cardview = "1.0.0"
constraintLayout = "2.2.1"
core = "1.17.0"
lifecycle = { require = "2.9.3" }
navigation = "2.9.4"
navigation = "2.9.5"
recyclerView = "1.4.0"
# google
material = "1.13.0"
Expand All @@ -18,7 +18,7 @@ itemAnimators = "1.1.0"
ivy = "2.5.3"
modelBuilder = "3.9.11"
materialDrawer = "9.0.2"
okhttp = "5.1.0"
okhttp = "5.2.1"

[plugins]
navSafeArgs = { id = "androidx.navigation.safeargs", version.ref = "navigation" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 0 additions & 3 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions plugin-build/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.vanniktech.maven.publish.GradlePublishPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
id("com.android.lint")
Expand Down Expand Up @@ -42,6 +43,10 @@ java {

kotlin {
jvmToolchain(11)
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_1_8)
languageVersion.set(KotlinVersion.KOTLIN_1_8)
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class AboutLibrariesTask : BaseAboutLibrariesTask() {
abstract val deprecated: Property<Boolean>

override fun getDescription(): String = "Exports dependency meta data from the current module.${variant.orNull?.let { " Filtered by variant: '$it'." } ?: ""}"
override fun getGroup(): String = super.group ?: org.gradle.language.base.plugins.LifecycleBasePlugin.BUILD_GROUP
override fun getGroup(): String = super.getGroup() ?: org.gradle.language.base.plugins.LifecycleBasePlugin.BUILD_GROUP

fun configureOutputFile(outputFile: Provider<RegularFile>? = null) {
if (outputFile != null && outputFile.isPresent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ data class License(
* Ensures and applies fixes to the library names (shorten, ...)
*/
private fun resolveLicenseId(name: String, url: String?): String? {
for (l: SpdxLicense in SpdxLicense.entries) {
for (l: SpdxLicense in SpdxLicense.values()) {
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using values() instead of entries is correct for older Kotlin versions, but consider that entries is the preferred approach in Kotlin 1.8.20+ for better performance and API consistency.

Suggested change
for (l: SpdxLicense in SpdxLicense.values()) {
for (l: SpdxLicense in SpdxLicense.entries) {

Copilot uses AI. Check for mistakes.
val matcher = l.customMatcher
if (l.id.equals(name, true) || l.name.equals(name, true) || l.fullName.equals(name, true) || (matcher != null && matcher.invoke(name, url))) {
return l.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,15 @@ enum class SpdxLicense(
Leptonica("Leptonica License", "Leptonica"),
LGPL_2_0_only("GNU Library General Public License v2 only", "LGPL-2.0-only"),
LGPL_2_0_or_later("GNU Library General Public License v2 or later", "LGPL-2.0-or-later"),
LGPL_2_1_only("GNU Lesser General Public License v2.1 only", "LGPL-2.1-only",
LGPL_2_1_only(
"GNU Lesser General Public License v2.1 only", "LGPL-2.1-only",
customMatcher = { name, _ ->
name.equals("GNU Lesser General Public License (LGPL), Version 2.1", true)
}
),
LGPL_2_1_or_later("GNU Lesser General Public License v2.1 or later", "LGPL-2.1-or-later"),
LGPL_3_0_only("GNU Lesser General Public License v3.0 only", "LGPL-3.0-only",
LGPL_3_0_only(
"GNU Lesser General Public License v3.0 only", "LGPL-3.0-only",
customMatcher = { name, _ ->
name.equals("GNU General Lesser Public License (LGPL) version 3.0", true)
}
Expand Down Expand Up @@ -247,11 +249,12 @@ enum class SpdxLicense(
mpich2("mpich2 License", "mpich2"),
MPL_1_0("Mozilla Public License 1.0", "MPL-1.0"),
MPL_1_1("Mozilla Public License 1.1", "MPL-1.1"),
MPL_2_0("Mozilla Public License 2.0", "MPL-2.0",
MPL_2_0(
"Mozilla Public License 2.0", "MPL-2.0",
customMatcher = { name, url ->
name.contains("Mozilla Public License", true)
&& url?.contains("mozilla.org", true) == true
&& url.contains("MPL/2.0", true)
&& url?.contains("mozilla.org", true) == true
&& url.contains("MPL/2.0", true)
}
),
MPL_2_0_no_copyleft_exception(
Expand Down Expand Up @@ -474,7 +477,7 @@ enum class SpdxLicense(

companion object {
internal fun find(key: String): SpdxLicense? {
for (l: SpdxLicense in entries) {
for (l: SpdxLicense in values()) {
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using values() instead of entries is correct for older Kotlin versions, but consider that entries is the preferred approach in Kotlin 1.8.20+ for better performance and API consistency.

Copilot uses AI. Check for mistakes.
if (l.id.equals(key, true) || l.name.equals(key, true) || l.fullName.equals(key, true)) {
return l
}
Expand All @@ -483,7 +486,7 @@ enum class SpdxLicense(
}

internal fun getById(id: String): SpdxLicense {
return entries.first { it.id.equals(id, true) }
return values().first { it.id.equals(id, true) }
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using values() instead of entries is correct for older Kotlin versions, but consider that entries is the preferred approach in Kotlin 1.8.20+ for better performance and API consistency.

Suggested change
return values().first { it.id.equals(id, true) }
return entries.first { it.id.equals(id, true) }

Copilot uses AI. Check for mistakes.
}
}
}
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencyResolutionManagement {

versionCatalogs {
create("baseLibs") {
from("com.mikepenz:version-catalog:0.8.6")
from("com.mikepenz:version-catalog:0.8.7")
}
}
}
Expand Down
Loading