Skip to content
Closed
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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Gross is a Gradle plugin that helps you manage and document open source licenses
- **Kotlin Code Generation**: Generates a static list of open source artifacts with their licenses as Kotlin code
- **Android Asset Generation**: Saves the licensee report as an Android asset for runtime access
- **License Compliance**: Makes it easier to comply with open source license requirements in your projects
- **Core Library**: Provides data classes for artifacts and licenses in a separate library that can be used by other modules

## Installation

Expand Down Expand Up @@ -92,6 +93,16 @@ You can use `AssetLicenseParser` to read and parse this file at runtime:
val licenses = AssetLicenseParser(context).parse()
```

### Core Library

The core module provides the data classes (`Artifact`, `SpdxLicenses`, `Scm`, `UnknownLicenses`) that can be used by other modules in your project. To use them, you just need to add a dependency to the core module:

```kotlin
dependencies {
implementation("se.premex.gross:core:1.0")
}
```

## Usage Examples

### Creating a licenses screen in an Android app with Jetpack Compose
Expand Down
14 changes: 13 additions & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
kotlin("jvm") version "2.3.20"
alias(libs.plugins.org.jetbrains.kotlin.plugin.serialization)
alias(libs.plugins.io.gitlab.arturbosch.detekt)

id("maven-publish")
}

detekt {
Expand Down Expand Up @@ -32,3 +32,15 @@ dependencies {

detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.8")
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])

groupId = "se.premex.gross"
artifactId = "core"
version = "1.0"
}
}
}
24 changes: 24 additions & 0 deletions core/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
rootProject.name = "core"

pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
google()
}
}

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
@Suppress("UnstableApiUsage")
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
@Suppress("UnstableApiUsage")
repositories {
google()
mavenCentral()
}
}
1 change: 1 addition & 0 deletions gross-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dependencies {
implementation(libs.org.jetbrains.kotlinx.kotlinx.serialization.json.okio)
implementation(libs.com.squareup.okio)
compileOnly(libs.com.squareup.licensee)
implementation("se.premex.gross:core:1.0")

testImplementation(platform(libs.org.junit.junit.bom))
testImplementation(libs.org.junit.jupiter.junit.jupiter.api)
Expand Down
6 changes: 6 additions & 0 deletions gross-plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
rootProject.name = "gross-plugin"

includeBuild("../core") {
dependencySubstitution {
substitute(module("se.premex.gross:core")).using(project(":"))
}
}

pluginManagement {
repositories {
gradlePluginPortal()
Expand Down
23 changes: 0 additions & 23 deletions gross-plugin/src/main/kotlin/se/premex/gross/core/Artifact.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class ArtifactGeneratorTest {
private val artifactCodeGenerator =
ArtifactCodeGenerator(
packageName = packageName,
licenseeTypesGenerator.unknownLicensesTypeSpec,
licenseeTypesGenerator.spdxLicensesTypeSpec,
licenseeTypesGenerator.scmTypeSpec,
licenseeTypesGenerator.unknownLicensesTypeSpec,
)

@Test
Expand Down Expand Up @@ -74,7 +74,7 @@ class ArtifactGeneratorTest {
name = "testName",
spdxLicenses = kotlin.collections.listOf(
),
scm = se.premex.gross.SpdxLicenses("testUrl"),
scm = se.premex.gross.Scm("testUrl"),
unknownLicenses = kotlin.collections.listOf(
),
)
Expand Down Expand Up @@ -110,13 +110,13 @@ class ArtifactGeneratorTest {
version = "testVersion",
name = "testName",
spdxLicenses = kotlin.collections.listOf(
se.premex.gross.UnknownLicenses(identifier = "spdxId1", name = "spdxName1", url = "spdxUrl1"),
se.premex.gross.UnknownLicenses(identifier = "spdxId2", name = "spdxName2", url = "spdxUrl2"),
se.premex.gross.SpdxLicenses(identifier = "spdxId1", name = "spdxName1", url = "spdxUrl1"),
se.premex.gross.SpdxLicenses(identifier = "spdxId2", name = "spdxName2", url = "spdxUrl2"),
),
scm = se.premex.gross.SpdxLicenses("testUrl"),
scm = se.premex.gross.Scm("testUrl"),
unknownLicenses = kotlin.collections.listOf(
se.premex.gross.Scm(name = "unknown1", url = "unknown1"),
se.premex.gross.Scm(name = "unknown2", url = "unknown2"),
se.premex.gross.UnknownLicenses(name = "unknown1", url = "unknown1"),
se.premex.gross.UnknownLicenses(name = "unknown2", url = "unknown2"),
),
)

Expand Down
Loading