Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yoloing, part3 #4

Merged
merged 1 commit into from
Nov 10, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/publish_snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
key: diffuse-${{ github.sha }}

- name: Check size
run: du -h ktlint-gradle-plugin/build/libs/licensee-for-android.jar
run: du -h licensee-for-android/build/libs/licensee-for-android.jar
shell: bash

- name: Copy diffuse base artifact to be picked by cache save
run: cp ktlint-gradle-plugin/build/libs/licensee-for-android.jar diffuse-base-file
run: cp licensee-for-android/build/libs/licensee-for-android.jar diffuse-base-file
shell: bash
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ kotlin.code.style=official
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs="-XX:+UseParallelGC"
kotlin.stdlib.default.dependency=false
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", vers
assertj-core = { module = "org.assertj:assertj-core", version.ref = "maven-assertj" }
agp-gradle-api = { module = "com.android.tools.build:gradle-api", version.ref = "google-agp" }
kotlin-gradle-api = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "maven-kotlin" }
com-squareup-okio = "com.squareup.okio:okio:3.6.0"
com-squareup-kotlinpoet = "com.squareup:kotlinpoet:1.14.2"
org-jetbrains-kotlinx-kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "maven-kotlin-serialization" }
org-jetbrains-kotlinx-kotlinx-serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "maven-kotlin-serialization" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "maven-kotlin-serialization" }
kotlinx-serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "maven-kotlin-serialization" }
com-squareup-okio = "com.squareup.okio:okio:3.6.0"

[plugins]
starter-config = { id = "com.starter.config", version.ref = "gradle-starter" }
starter-versioning = { id = "com.starter.versioning", version.ref = "gradle-starter" }
starter-library-kotlin = { id = "com.starter.library.kotlin", version.ref = "gradle-starter" }
starter-library-android = { id = "com.starter.library.android", version.ref = "gradle-starter" }
gradle-pluginpublish = { id = "com.gradle.plugin-publish", version.ref = "gradle-pluginpublish" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "maven-kotlin-serialization" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "maven-kotlin" }
osacky-doctor = { id = "com.osacky.doctor", version.ref = "gradle-doctor" }
4 changes: 2 additions & 2 deletions licensee-for-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ dependencies {
exclude(module: "kotlin-reflect")
}

implementation(libs.org.jetbrains.kotlinx.kotlinx.serialization.json)
implementation(libs.org.jetbrains.kotlinx.kotlinx.serialization.json.okio)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.serialization.json.okio)
implementation(libs.com.squareup.okio)

testRuntimeOnly(libs.junit.jupiter.engine)
Expand Down
1 change: 1 addition & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.starter.config)
alias(libs.plugins.starter.library.android) apply false
alias(libs.plugins.starter.library.kotlin) apply false
}

commonConfig {
Expand Down
13 changes: 6 additions & 7 deletions sample/core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
plugins {
alias(libs.plugins.starter.library.android)
alias(libs.plugins.starter.library.kotlin)
alias(libs.plugins.kotlin.serialization)
}

android {
namespace "io.githhub.usefulness.licensee.android.core"
}

dependencies {
implementation(libs.org.jetbrains.kotlinx.kotlinx.serialization.json)
implementation(libs.org.jetbrains.kotlinx.kotlinx.serialization.json.okio)
api(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.serialization.json.okio)
api(libs.com.squareup.okio)

testImplementation(libs.org.jetbrains.kotlin.kotlin.test.junit)
testImplementation(libs.org.jetbrains.kotlinx.kotlinx.coroutines.test)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import okio.BufferedSource

interface LicenseParser {
@ExperimentalSerializationApi
fun decode(source: BufferedSource): List<Artifact> = Json.decodeFromBufferedSource(source)
fun decode(source: BufferedSource) = Json.decodeFromBufferedSource<List<Artifact>>(source)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package se.premex.gross.oss

import kotlinx.coroutines.test.runTest
import kotlinx.serialization.ExperimentalSerializationApi
import okio.buffer
import okio.source
import se.premex.gross.core.LicenseParser
import kotlin.test.Test

private const val ARTIFACTS_SMALL = """[
{
"groupId": "androidx.activity",
"artifactId": "activity",
"version": "1.7.0",
"name": "Activity",
"spdxLicenses": [
{
"identifier": "Apache-2.0",
"name": "Apache License 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
}
],
"scm": {
"url": "https://cs.android.com/androidx/platform/frameworks/support"
}
}
]"""

private const val ARTIFACTS_MEDIUM = """[
{
"groupId": "androidx.activity",
"artifactId": "activity",
"version": "1.7.0",
"name": "Activity",
"spdxLicenses": [
{
"identifier": "Apache-2.0",
"name": "Apache License 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
}
],
"scm": {
"url": "https://cs.android.com/androidx/platform/frameworks/support"
}
},
{
"groupId": "androidx.activity",
"artifactId": "activity-compose",
"version": "1.7.0",
"name": "Activity Compose",
"spdxLicenses": [
{
"identifier": "Apache-2.0",
"name": "Apache License 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
}
],
"scm": {
"url": "https://cs.android.com/androidx/platform/frameworks/support"
}
},
{
"groupId": "androidx.activity",
"artifactId": "activity-ktx",
"version": "1.7.0",
"name": "Activity Kotlin Extensions",
"spdxLicenses": [
{
"identifier": "Apache-2.0",
"name": "Apache License 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
}
],
"scm": {
"url": "https://cs.android.com/androidx/platform/frameworks/support"
}
}
]"""

class LicenseParserTest {
@Test
@ExperimentalSerializationApi
fun testSmall() = runTest {
val licenseParser = object : LicenseParser {}
licenseParser.decode(ARTIFACTS_SMALL.byteInputStream().source().buffer())
}

@Test
@ExperimentalSerializationApi
fun testMedium() = runTest {
val licenseParser = object : LicenseParser {}
licenseParser.decode(ARTIFACTS_MEDIUM.byteInputStream().source().buffer())
}
}
9 changes: 5 additions & 4 deletions sample/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.re
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "maven-junit" }
assertj-core = { module = "org.assertj:assertj-core", version.ref = "maven-assertj" }

kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "maven-kotlin-serialization" }
kotlinx-serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "maven-kotlin-serialization" }
com-squareup-okio = "com.squareup.okio:okio:3.6.0"

activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" }
org-jetbrains-kotlin-kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "maven-kotlin" }
androidx-lifecycle-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle-runtime-ktx" }
Expand All @@ -40,16 +44,13 @@ androidx-compose-ui = { module = "androidx.compose.ui:ui" }
androidx-compose-ui-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-compose-runtime-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
androidx-compose-ui-ui-text = { module = "androidx.compose.ui:ui-text" }
com-squareup-okio = "com.squareup.okio:okio:3.6.0"
androidx-core-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx" }
espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso-core" }
junit = { module = "junit:junit", version.ref = "junit" }
org-jetbrains-kotlinx-kotlinx-coroutines-test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3"
lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle-runtime-ktx" }
material3 = { module = "androidx.compose.material3:material3" }
org-jetbrains-kotlinx-kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "maven-kotlin-serialization" }
org-jetbrains-kotlinx-kotlinx-serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "maven-kotlin-serialization" }
org-jetbrains-kotlin-kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "maven-kotlin" }
ui = { module = "androidx.compose.ui:ui" }
ui-graphics = { module = "androidx.compose.ui:ui-graphics" }
Expand All @@ -60,7 +61,7 @@ ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
io-nlopez-compose = "io.nlopez.compose.rules:ktlint:0.3.3"

[plugins]
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "maven-kotlin-serialization" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "maven-kotlin" }
starter-config = { id = "com.starter.config", version.ref = "gradle-starter" }
starter-versioning = { id = "com.starter.versioning", version.ref = "gradle-starter" }
starter-library-kotlin = { id = "com.starter.library.kotlin", version.ref = "gradle-starter" }
Expand Down
12 changes: 3 additions & 9 deletions sample/ui/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
alias(libs.plugins.starter.library.android)
alias(libs.plugins.kotlin.serialization)
}

android {
Expand All @@ -19,26 +18,21 @@ android {
}
dependencies {
api(project(":core"))
implementation(libs.com.squareup.okio)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.runtime)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.foundation.foundation.layout)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.foundation)

implementation(libs.org.jetbrains.kotlinx.kotlinx.serialization.json)

implementation(libs.androidx.compose.material.material.icons.extended)

implementation(libs.androidx.compose.animation)

implementation(libs.androidx.compose.ui.ui.tooling)
implementation(libs.androidx.compose.runtime.runtime.livedata)
implementation(libs.androidx.compose.ui.ui.text)

implementation(libs.androidx.compose.material.material.icons.extended)
implementation(libs.androidx.core.core.ktx)

testImplementation(libs.org.jetbrains.kotlin.kotlin.test.junit)
testImplementation(libs.org.jetbrains.kotlinx.kotlinx.coroutines.test)

ktlintRuleSet(libs.io.nlopez.compose)
}
Loading