From 8c4e3711dbc6dc903e5309c302f4ba6826d65fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Kwiecin=CC=81ski?= Date: Mon, 29 Jan 2024 21:13:01 +0100 Subject: [PATCH 1/2] Make unknown Licenses nullable --- .../src/main/kotlin/io/github/usefulness/licensee/Artifact.kt | 4 ++-- .../kotlin/io/github/usefulness/licensee/Stubs.kt | 4 ++-- .../io/github/usefulness/licensee/serialization/Artifact.kt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/licensee-for-android-core/src/main/kotlin/io/github/usefulness/licensee/Artifact.kt b/licensee-for-android-core/src/main/kotlin/io/github/usefulness/licensee/Artifact.kt index de5061d..ea0357a 100644 --- a/licensee-for-android-core/src/main/kotlin/io/github/usefulness/licensee/Artifact.kt +++ b/licensee-for-android-core/src/main/kotlin/io/github/usefulness/licensee/Artifact.kt @@ -23,6 +23,6 @@ public class Scm(public val url: String) @Poko public class UnknownLicense( - public val name: String, - public val url: String, + public val name: String?, + public val url: String?, ) diff --git a/licensee-for-android-core/src/testFixtures/kotlin/io/github/usefulness/licensee/Stubs.kt b/licensee-for-android-core/src/testFixtures/kotlin/io/github/usefulness/licensee/Stubs.kt index b6094f0..b329907 100644 --- a/licensee-for-android-core/src/testFixtures/kotlin/io/github/usefulness/licensee/Stubs.kt +++ b/licensee-for-android-core/src/testFixtures/kotlin/io/github/usefulness/licensee/Stubs.kt @@ -43,8 +43,8 @@ fun stubMitLicense() = stubSpdxLicense( fun stubScm(url: String = "url") = Scm(url = url) fun stubUnknownLicense( - name: String = "Android Software Development Kit License", - url: String = "https://developer.android.com/studio/terms.html", + name: String? = "Android Software Development Kit License", + url: String? = "https://developer.android.com/studio/terms.html", ) = UnknownLicense( name = name, url = url, diff --git a/licensee-for-android/src/main/kotlin/io/github/usefulness/licensee/serialization/Artifact.kt b/licensee-for-android/src/main/kotlin/io/github/usefulness/licensee/serialization/Artifact.kt index 27f8f5b..fa4de0c 100644 --- a/licensee-for-android/src/main/kotlin/io/github/usefulness/licensee/serialization/Artifact.kt +++ b/licensee-for-android/src/main/kotlin/io/github/usefulness/licensee/serialization/Artifact.kt @@ -14,8 +14,8 @@ internal data class Scm(val url: String) @Serializable internal data class UnknownLicenses( - val name: String, - val url: String, + val name: String?, + val url: String?, ) @Serializable From 5307eab0c65d89a73795d5ba8c26ad7a2b75945b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Kwiecin=CC=81ski?= Date: Mon, 29 Jan 2024 21:36:12 +0100 Subject: [PATCH 2/2] Bump actions, fix nullability, fix codestyle --- .github/workflows/default.yml | 4 ++-- .github/workflows/dependencies.yml | 4 ++-- .github/workflows/diffuse.yml | 2 +- .github/workflows/publish_release.yml | 2 +- .github/workflows/publish_snapshots.yml | 4 ++-- sample/gradle/libs.versions.toml | 2 +- .../serialization/SerializationArtifact.kt | 4 ++-- sample/settings.gradle | 4 ++-- .../src/main/kotlin/se/premex/gross/ui/OssView.kt | 14 ++++++++------ .../premex/gross/ui/{OssViewModel.kt => State.kt} | 0 10 files changed, 21 insertions(+), 19 deletions(-) rename sample/ui/src/main/kotlin/se/premex/gross/ui/{OssViewModel.kt => State.kt} (100%) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index dba0c2a..c25f80b 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -37,7 +37,7 @@ jobs: - uses: gradle/wrapper-validation-action@v1 - - uses: gradle/gradle-build-action@v2 + - uses: gradle/actions/setup-gradle@v3 - run: ./gradlew assemble @@ -96,7 +96,7 @@ jobs: distribution: 'temurin' java-version: ${{ matrix.java }} - - uses: gradle/gradle-build-action@v2 + - uses: gradle/actions/setup-gradle@v3 continue-on-error: true with: build-root-directory: sample diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index abafebd..637f491 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -38,7 +38,7 @@ jobs: java-version: 21 - name: Assemble - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: arguments: assemble -m @@ -91,7 +91,7 @@ jobs: java-version: 21 - name: Assemble - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: arguments: assemble -m diff --git a/.github/workflows/diffuse.yml b/.github/workflows/diffuse.yml index 2a56b6f..58304bb 100644 --- a/.github/workflows/diffuse.yml +++ b/.github/workflows/diffuse.yml @@ -48,7 +48,7 @@ jobs: key: diffuse-${{ github.event.pull_request.base.sha }}-always-cache-miss restore-keys: diffuse-${{ github.event.pull_request.base.sha }} - - uses: gradle/gradle-build-action@v2 + - uses: gradle/actions/setup-gradle@v3 - run: ./gradlew assemble -PskipJarVersion diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 9a7f548..6a59f7b 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -36,7 +36,7 @@ jobs: distribution: 'temurin' java-version: 21 - - uses: gradle/gradle-build-action@v2 + - uses: gradle/actions/setup-gradle@v3 - name: Unwrap GPG key env: diff --git a/.github/workflows/publish_snapshots.yml b/.github/workflows/publish_snapshots.yml index 31f9ff4..180850a 100644 --- a/.github/workflows/publish_snapshots.yml +++ b/.github/workflows/publish_snapshots.yml @@ -39,7 +39,7 @@ jobs: java-version: 21 - name: Build app with Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 - run: ./gradlew assemble @@ -71,7 +71,7 @@ jobs: distribution: 'temurin' java-version: 21 - - uses: gradle/gradle-build-action@v2 + - uses: gradle/actions/setup-gradle@v3 - run: ./gradlew assemble -PskipJarVersion diff --git a/sample/gradle/libs.versions.toml b/sample/gradle/libs.versions.toml index 3f1a703..436ba51 100644 --- a/sample/gradle/libs.versions.toml +++ b/sample/gradle/libs.versions.toml @@ -6,7 +6,7 @@ maven-junit = "5.10.1" maven-junit4 = "4.13.2" maven-assertj = "3.25.2" activity-compose = "1.8.2" -androidx-compose-compiler = "1.5.4" +androidx-compose-compiler = "1.5.8" androidx-core = "1.12.0" androidx-test-ext-junit = "1.1.5" com-squareup-moshi = "1.15.0" diff --git a/sample/serialization/src/main/kotlin/io/github/usefulness/licensee/serialization/SerializationArtifact.kt b/sample/serialization/src/main/kotlin/io/github/usefulness/licensee/serialization/SerializationArtifact.kt index bfdcf76..b7c66a3 100644 --- a/sample/serialization/src/main/kotlin/io/github/usefulness/licensee/serialization/SerializationArtifact.kt +++ b/sample/serialization/src/main/kotlin/io/github/usefulness/licensee/serialization/SerializationArtifact.kt @@ -14,8 +14,8 @@ data class Scm(val url: String) @Serializable data class UnknownLicenses( - val name: String, - val url: String, + val name: String?, + val url: String?, ) @Serializable diff --git a/sample/settings.gradle b/sample/settings.gradle index c433d3b..d9e0771 100644 --- a/sample/settings.gradle +++ b/sample/settings.gradle @@ -12,7 +12,7 @@ pluginManagement { } gradlePluginPortal { content { - excludeModule("io.github.usefulness", "lincensee-for-android") + excludeModule("io.github.usefulness", "licensee-for-android") } } } @@ -33,7 +33,7 @@ dependencyResolutionManagement { google() mavenCentral { content { - excludeModule("io.github.usefulness", "lincensee-for-android-core") + excludeModule("io.github.usefulness", "licensee-for-android-core") } } } diff --git a/sample/ui/src/main/kotlin/se/premex/gross/ui/OssView.kt b/sample/ui/src/main/kotlin/se/premex/gross/ui/OssView.kt index ac2eede..c723fcf 100644 --- a/sample/ui/src/main/kotlin/se/premex/gross/ui/OssView.kt +++ b/sample/ui/src/main/kotlin/se/premex/gross/ui/OssView.kt @@ -113,8 +113,8 @@ private data class ViewArtifact( ) private data class ViewLicense( - val title: String, - val url: String, + val title: String?, + val url: String?, ) @Composable @@ -158,7 +158,7 @@ private fun LicenseSelector(dialogData: LicensesDialogData, onDismissRequest: () dialogData.licenses.forEach { license -> ListItem( headlineContent = { - Text(text = license.title) + license.title?.let { Text(text = it) } }, leadingContent = { Icon( @@ -166,9 +166,11 @@ private fun LicenseSelector(dialogData: LicensesDialogData, onDismissRequest: () contentDescription = null, ) }, - modifier = Modifier.clickable { - uriHandler.openUri(license.url) - }, + modifier = license.url?.let { url -> + Modifier.clickable { + uriHandler.openUri(url) + } + } ?: Modifier, ) } } diff --git a/sample/ui/src/main/kotlin/se/premex/gross/ui/OssViewModel.kt b/sample/ui/src/main/kotlin/se/premex/gross/ui/State.kt similarity index 100% rename from sample/ui/src/main/kotlin/se/premex/gross/ui/OssViewModel.kt rename to sample/ui/src/main/kotlin/se/premex/gross/ui/State.kt