Skip to content

Commit

Permalink
Merge pull request #969 from mikepenz/develop
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
mikepenz committed Mar 23, 2024
2 parents f2f5b81 + b9b986a commit a517c17
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 59 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@

## Latest releases 🛠

- Kotlin && Multiplatform && Plugin | [v10.10.0](https://github.com/mikepenz/AboutLibraries/tree/v10.10.0)
- Compose 1.6.1 / Compose Multiplatform 1.6.0 | [v11.1.0](https://github.com/mikepenz/AboutLibraries/tree/v11.1.0)
- Kotlin && Multiplatform && Compose && Plugin | [v11.1.1](https://github.com/mikepenz/AboutLibraries/tree/v11.1.1)

## Gradle Plugin

Expand Down
1 change: 1 addition & 0 deletions aboutlibraries-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
id("com.android.library")
id("org.jetbrains.dokka")
id("com.vanniktech.maven.publish")
kotlin("plugin.serialization") version libs.versions.kotlinCore.get()
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.ImmutableSet
import kotlinx.collections.immutable.toImmutableList
import kotlinx.collections.immutable.toImmutableSet
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* The [Libs] class is the main access point to the generated data of the plugin.
* Provides accessors for the [Library] and [License] lists, containing all the dependency information for the module.
*/
@Serializable
data class Libs constructor(
val libraries: ImmutableList<Library>,
val licenses: ImmutableSet<License>,
@SerialName("libraries") val libraries: ImmutableList<Library>,
@SerialName("licenses") val licenses: ImmutableSet<License>,
) {
/**
* Builder used to automatically parse and interpret the generated library data from the plugin.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.mikepenz.aboutlibraries.entity

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Describes the [Developer] defined in the `pom.xml` file.
*
Expand All @@ -8,7 +11,8 @@ package com.mikepenz.aboutlibraries.entity
* @param name of the developer
* @param organisationUrl optional organisation url for the developer
*/
@Serializable
data class Developer(
val name: String?,
val organisationUrl: String?
@SerialName("name") val name: String?,
@SerialName("organisationUrl") val organisationUrl: String?
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.mikepenz.aboutlibraries.entity

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Describes the [Funding] as defined by the dependency.
* This is only supported for projects hosted for dependencies hosted on: https://github.com/mikepenz/AboutLibraries#special-repository-support
Expand All @@ -8,7 +11,8 @@ package com.mikepenz.aboutlibraries.entity
* @param platform name of the platform allowing to fund the project
* @param url url pointing towards the location to fund the project
*/
@Serializable
data class Funding(
val platform: String,
val url: String
@SerialName("platform") val platform: String,
@SerialName("url") val url: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.mikepenz.aboutlibraries.entity
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.ImmutableSet
import kotlinx.collections.immutable.persistentSetOf
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Describes a complete [Library] element, specifying important information about a used dependency.
Expand All @@ -18,18 +20,19 @@ import kotlinx.collections.immutable.persistentSetOf
* @param licenses all identified licenses for this artifact
* @param funding all identified funding opportunities for this artifact
*/
@Serializable
data class Library(
val uniqueId: String,
val artifactVersion: String?,
val name: String,
val description: String?,
val website: String?,
val developers: ImmutableList<Developer>,
val organization: Organization?,
val scm: Scm?,
val licenses: ImmutableSet<License> = persistentSetOf(),
val funding: ImmutableSet<Funding> = persistentSetOf(),
val tag: String? = null,
@SerialName("uniqueId") val uniqueId: String,
@SerialName("artifactVersion") val artifactVersion: String?,
@SerialName("name") val name: String,
@SerialName("description") val description: String?,
@SerialName("website") val website: String?,
@SerialName("developers") val developers: ImmutableList<Developer>,
@SerialName("organization") val organization: Organization?,
@SerialName("scm") val scm: Scm?,
@SerialName("licenses") val licenses: ImmutableSet<License> = persistentSetOf(),
@SerialName("funding") val funding: ImmutableSet<Funding> = persistentSetOf(),
@SerialName("tag") val tag: String? = null,
) {
/**
* defines the [uniqueId]:[artifactVersion] combined
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.mikepenz.aboutlibraries.entity

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Describes a complete [License] element.
* Either retrieved from spdx or downloaded from the artifacts repo
Expand All @@ -11,13 +14,14 @@ package com.mikepenz.aboutlibraries.entity
* @param licenseContent contains the whole license content as downloaded from the server
* @param hash usually calculated to identify if a license is re-used and can be used for multiple artifacts
*/
@Serializable
data class License(
val name: String,
val url: String?,
val year: String? = null,
val spdxId: String? = null,
val licenseContent: String? = null,
val hash: String
@SerialName("name") val name: String,
@SerialName("url") val url: String?,
@SerialName("year") val year: String? = null,
@SerialName("spdxId") val spdxId: String? = null,
@SerialName("licenseContent") val licenseContent: String? = null,
@SerialName("hash") val hash: String
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.mikepenz.aboutlibraries.entity

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Describes the [Organization] defined in the `pom.xml` file.
*
Expand All @@ -8,7 +11,8 @@ package com.mikepenz.aboutlibraries.entity
* @param name of the organisation
* @param url optional url to the website of the defined organisation
*/
@Serializable
data class Organization(
val name: String,
val url: String?
@SerialName("name") val name: String,
@SerialName("url") val url: String?
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.mikepenz.aboutlibraries.entity

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Describes the [Scm] defined in the `pom.xml` file.
*
Expand All @@ -9,8 +12,9 @@ package com.mikepenz.aboutlibraries.entity
* @param developerConnection optionally describing the developer connection
* @param url optionally linking to the hosted form of this artifact
*/
@Serializable
data class Scm(
val connection: String?,
val developerConnection: String?,
val url: String?
@SerialName("connection") val connection: String?,
@SerialName("developerConnection") val developerConnection: String?,
@SerialName("url") val url: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class SimpleLibraryItem(internal val library: Library, private val libsBuilder:
openLicense(ctx, libsBuilder, library)
}
}
} else {
holder.itemView.setOnClickListener(null)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.util.Log
import androidx.lifecycle.ViewModel
import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.LibsBuilder
import com.mikepenz.aboutlibraries.entity.Library
import com.mikepenz.aboutlibraries.ui.item.HeaderItem
import com.mikepenz.aboutlibraries.ui.item.LibraryItem
import com.mikepenz.aboutlibraries.ui.item.LoaderItem
Expand All @@ -16,12 +17,11 @@ import com.mikepenz.fastadapter.GenericItem
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.withContext
import java.util.*

class LibsViewModel(
private val ctx: Context,
internal val builder: LibsBuilder, // ui module
private val libsBuilder: Libs.Builder
private val libsBuilder: Libs.Builder,
) : ViewModel() {

private var versionName: String? = null
Expand All @@ -34,23 +34,28 @@ class LibsViewModel(

builder.aboutShowIcon = ctx.extractBooleanBundleOrResource(builder._aboutShowIcon, "aboutLibraries_description_showIcon") ?: false
builder.aboutShowVersion = ctx.extractBooleanBundleOrResource(builder._aboutShowVersion, "aboutLibraries_description_showVersion") ?: false
builder.aboutShowVersionName = ctx.extractBooleanBundleOrResource(builder._aboutShowVersionName, "aboutLibraries_description_showVersionName")
?: false
builder.aboutShowVersionCode = ctx.extractBooleanBundleOrResource(builder._aboutShowVersionCode, "aboutLibraries_description_showVersionCode")
?: false
builder.aboutShowVersionName = ctx.extractBooleanBundleOrResource(
builder._aboutShowVersionName, "aboutLibraries_description_showVersionName"
) ?: false
builder.aboutShowVersionCode = ctx.extractBooleanBundleOrResource(
builder._aboutShowVersionCode, "aboutLibraries_description_showVersionCode"
) ?: false

builder.aboutAppName = ctx.extractStringBundleOrResource(builder.aboutAppName, "aboutLibraries_description_name") ?: ""
builder.aboutDescription = ctx.extractStringBundleOrResource(builder.aboutDescription, "aboutLibraries_description_text") ?: ""

builder.aboutAppSpecial1 = ctx.extractStringBundleOrResource(builder.aboutAppSpecial1, "aboutLibraries_description_special1_name")
builder.aboutAppSpecial1Description =
ctx.extractStringBundleOrResource(builder.aboutAppSpecial1Description, "aboutLibraries_description_special1_text")
builder.aboutAppSpecial1Description = ctx.extractStringBundleOrResource(
builder.aboutAppSpecial1Description, "aboutLibraries_description_special1_text"
)
builder.aboutAppSpecial2 = ctx.extractStringBundleOrResource(builder.aboutAppSpecial2, "aboutLibraries_description_special2_name")
builder.aboutAppSpecial2Description =
ctx.extractStringBundleOrResource(builder.aboutAppSpecial2Description, "aboutLibraries_description_special2_text")
builder.aboutAppSpecial2Description = ctx.extractStringBundleOrResource(
builder.aboutAppSpecial2Description, "aboutLibraries_description_special2_text"
)
builder.aboutAppSpecial3 = ctx.extractStringBundleOrResource(builder.aboutAppSpecial3, "aboutLibraries_description_special3_name")
builder.aboutAppSpecial3Description =
ctx.extractStringBundleOrResource(builder.aboutAppSpecial3Description, "aboutLibraries_description_special3_text")
builder.aboutAppSpecial3Description = ctx.extractStringBundleOrResource(
builder.aboutAppSpecial3Description, "aboutLibraries_description_special3_text"
)


//load the data for the header
Expand Down Expand Up @@ -91,8 +96,11 @@ class LibsViewModel(
return@withContext
}

if (builder.libraryComparator != null) {
Collections.sort(builtLibs.libraries, builder.libraryComparator)
val comparator = builder.libraryComparator
val libraries: Iterable<Library> = if (comparator != null) {
builtLibs.libraries.sortedWith(comparator)
} else {
builtLibs.libraries
}

val finalList = mutableListOf<GenericItem>()
Expand All @@ -106,11 +114,13 @@ class LibsViewModel(
val showVersionInfo = builder.aboutShowVersion || builder.aboutShowVersionName || builder.aboutShowVersionCode
if (builder.aboutShowIcon && showVersionInfo) {
//add this cool thing to the headerView of our listView
finalList.add(HeaderItem(builder).withAboutVersionName(versionName).withAboutVersionCode(versionCode).withAboutIcon(icon))
finalList.add(
HeaderItem(builder).withAboutVersionName(versionName).withAboutVersionCode(versionCode).withAboutIcon(icon)
)
}

//add the libs
for (library in builtLibs.libraries) {
for (library in libraries) {
when {
builder.aboutMinimalDesign -> finalList.add(SimpleLibraryItem(library, builder))
else -> finalList.add(LibraryItem(library, builder))
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GROUP=com.mikepenz

VERSION_NAME=11.1.0
VERSION_CODE=110100
VERSION_NAME=11.1.1
VERSION_CODE=110101
POM_URL=https://github.com/mikepenz/AboutLibraries
POM_SCM_URL=https://github.com/mikepenz/AboutLibraries
POM_SCM_CONNECTION=scm:git@github.com:mikepenz/AboutLibraries.git
Expand Down
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ coreMinSdk = "19"
minSdk = "21"
targetSdk = "34"
# build
gradleBuild = "8.2.2"
gradleBuild = "8.3.1"
# kotlin
dokka = "1.9.10"
kotlinCore = { require = "1.9.22" }
dokka = "1.9.20"
kotlinCore = { require = "1.9.23" }
kotlinCoroutines = { require = "1.8.0" }
kotlinxSerialization = "1.6.3"
kotlinxCollections = "0.3.7"
# compose
compose = "1.6.2"
composeUi = "1.6.2" # foundation / material
composeCompiler = "1.5.10"
composejb = "1.6.0"
composeCompilerJb = "1.5.8"
compose = "1.6.4"
composeUi = "1.6.4" # foundation / material
composeCompiler = "1.5.11"
composejb = "1.6.1"
composeCompilerJb = "1.5.10"
# androidx
activity = "1.8.2"
cardview = "1.0.0"
Expand All @@ -34,7 +34,7 @@ fastAdapter = "5.7.0"
gradleMvnPublish = "0.25.3"
iconics = "5.4.0"
itemAnimators = "1.1.0"
ivy = "2.5.1"
ivy = "2.5.2"
materialDrawer = "9.0.2"
okhttp = "4.12.0"

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-8.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Binary file modified plugin-build/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin-build/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-8.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit a517c17

Please sign in to comment.