Skip to content

Commit

Permalink
Merge pull request #3 from mateuszkwiecinski/updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski authored Nov 10, 2023
2 parents a8e0eec + 566f098 commit 9ebbc6c
Show file tree
Hide file tree
Showing 29 changed files with 1,022 additions and 82 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ ij_kotlin_allow_trailing_comma_on_call_site = true
ktlint_code_style = intellij_idea
ktlint_standard_property-naming = disabled
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 2
ktlint_function_naming_ignore_when_annotated_with = Composable
ktlint_compose_unstable-collections = disabled
49 changes: 49 additions & 0 deletions .github/workflows/publish_snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Project Snapshot

on:
push:
branches:
- 'master'
schedule:
- cron: '0 3 * * 1,4'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
diffuse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Write Gradle build properties to `~/.gradle/gradle.properties`
run: |
mkdir -p ~/.gradle
printf "org.gradle.jvmargs=-Xmx3G -XX:+UseParallelGC\n" >> ~/.gradle/gradle.properties
printf "org.gradle.vfs.watch=false\n" >> ~/.gradle/gradle.properties
shell: bash

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 21

- uses: gradle/gradle-build-action@v2

- run: ./gradlew assemble -PskipJarVersion

- name: Upload diffuse base artifact
uses: actions/cache@v3
with:
path: diffuse-base-file
key: diffuse-${{ github.sha }}

- name: Check size
run: du -h ktlint-gradle-plugin/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
shell: bash
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapperKt

plugins {
alias(libs.plugins.starter.config)
Expand All @@ -11,14 +12,22 @@ commonConfig {

allprojects {
pluginManager.withPlugin("kotlin") { plugin ->
def kotlinVersion = KotlinPluginWrapperKt.getKotlinPluginVersion(project)
configurations.matching { it.name != "detekt" }.configureEach {
resolutionStrategy.eachDependency {
if (requested.group == 'org.jetbrains.kotlin' && requested.name.startsWith("kotlin")) {
useVersion kotlinVersion
}
}
}
kotlin {
jvmToolchain(21)
}
}
pluginManager.withPlugin("java") {
if (project.hasProperty("skipJarVersion")) {
tasks.named("jar") {
archiveFile.set(new File(project.buildDir, "libs/${project.name}.jar"))
archiveFile.set(project.layout.buildDirectory.map { it.file("libs/${project.name}.jar")})
}
}
}
Expand Down
26 changes: 0 additions & 26 deletions core/build.gradle.kts

This file was deleted.

2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
android.useAndroidX=true
android.nonTransitiveRClass=true
kotlin.code.style=official
org.gradle.caching=true
org.gradle.parallel=true
Expand Down
48 changes: 1 addition & 47 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,16 @@ maven-kotlin = "1.9.20"
maven-junit = "5.10.1"
maven-assertj = "3.24.2"

activity-compose = "1.8.0"
androidx-compose-compiler = "1.4.7"
androidx-core = "1.12.0"
androidx-test-ext-junit = "1.1.5"
com-android-application = "8.1.3"
com-squareup-moshi = "1.15.0"
compose-bom = "2023.10.01"
core-ktx = "1.12.0"
espresso-core = "3.5.1"
junit = "4.13.2"
lifecycle-runtime-ktx = "2.6.2"

[libraries]
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "maven-junit" }
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" }
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" }

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" }
androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-ext-junit" }
com-android-tools-build-gradle = { module = "com.android.tools.build:gradle", version.ref = "com-android-application" }
com-squareup-moshi = { module = "com.squareup.moshi:moshi", version.ref = "com-squareup-moshi" }
com-squareup-moshi-moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "com-squareup-moshi" }
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "compose-bom" }
androidx-compose-animation = { module = "androidx.compose.animation:animation" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" }
androidx-compose-foundation-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" }
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
androidx-compose-material-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" }
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" }
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-jvm = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-jvm", 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" }
ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }

[plugins]
starter-config = { id = "com.starter.config", version.ref = "gradle-starter" }
Expand All @@ -72,4 +27,3 @@ starter-library-android = { id = "com.starter.library.android", version.ref = "g
gradle-pluginpublish = { id = "com.gradle.plugin-publish", version.ref = "gradle-pluginpublish" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "maven-kotlin-serialization" }
osacky-doctor = { id = "com.osacky.doctor", version.ref = "gradle-doctor" }
app-cash-licensee = "app.cash.licensee:1.8.0"
2 changes: 1 addition & 1 deletion licensee-for-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
dependencies {
compileOnly(libs.agp.gradle.api)
compileOnly(libs.kotlin.gradle.api)
implementation("com.squareup:kotlinpoet:1.14.2") {
implementation(libs.com.squareup.kotlinpoet) {
exclude(module: "kotlin-reflect")
}

Expand Down
20 changes: 20 additions & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
alias(libs.plugins.starter.config)
alias(libs.plugins.starter.library.android) apply false
}

commonConfig {
javaVersion = JavaVersion.VERSION_1_8
}

subprojects {
pluginManager.withPlugin("io.gitlab.arturbosch.detekt") {
detekt {
baseline = file("config/baseline.xml")
}
tasks.named("detektBaseline") {
jvmTarget = "20"
}
}

}
File renamed without changes.
14 changes: 14 additions & 0 deletions sample/core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
alias(libs.plugins.starter.library.android)
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.com.squareup.okio)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ package se.premex.gross.core
import kotlinx.serialization.Serializable

@Serializable
data class SpdxLicenses(val identifier: String, val name: String, val url: String)
data class SpdxLicenses(
val identifier: String,
val name: String,
val url: String,
)

@Serializable
data class Scm(val url: String)

@Serializable
data class UnknownLicenses(val name: String, val url: String)
data class UnknownLicenses(
val name: String,
val url: String,
)

@Serializable
data class Artifact(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ import okio.BufferedSource

interface LicenseParser {
@ExperimentalSerializationApi
fun decode(source: BufferedSource): List<Artifact> {
return Json.decodeFromBufferedSource(source)
}
fun decode(source: BufferedSource): List<Artifact> = Json.decodeFromBufferedSource(source)
}
6 changes: 6 additions & 0 deletions sample/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
android.useAndroidX=true
android.nonTransitiveRClass=true
kotlin.code.style=official
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs="-XX:+UseParallelGC"
67 changes: 67 additions & 0 deletions sample/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[versions]
gradle-starter = "0.65.0"
maven-kotlin-serialization = "1.6.0"
maven-kotlin = "1.9.20"
maven-junit = "5.10.1"
maven-assertj = "3.24.2"

activity-compose = "1.8.0"
androidx-compose-compiler = "1.5.4"
androidx-core = "1.12.0"
androidx-test-ext-junit = "1.1.5"
com-android-application = "8.1.3"
com-squareup-moshi = "1.15.0"
compose-bom = "2023.10.01"
core-ktx = "1.12.0"
espresso-core = "3.5.1"
junit = "4.13.2"
lifecycle-runtime-ktx = "2.6.2"

[libraries]
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "maven-junit" }
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" }

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" }
androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-ext-junit" }
com-android-tools-build-gradle = { module = "com.android.tools.build:gradle", version.ref = "com-android-application" }
com-squareup-moshi = { module = "com.squareup.moshi:moshi", version.ref = "com-squareup-moshi" }
com-squareup-moshi-moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "com-squareup-moshi" }
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "compose-bom" }
androidx-compose-animation = { module = "androidx.compose.animation:animation" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" }
androidx-compose-foundation-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" }
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
androidx-compose-material-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" }
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" }
ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
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" }
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" }
Binary file added sample/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions sample/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 9ebbc6c

Please sign in to comment.