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
19 changes: 18 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)

`maven-publish`
}

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

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

publishing {
publications {
create<MavenPublication>("maven") {
groupId = "se.premex.gross"
artifactId = "core"
version = "1.0"
from(components["java"])
}
}
repositories {
maven {
name = "testing"
url = uri(File(rootDir, "../gross-plugin/build/localMaven"))
}
}
}
22 changes: 22 additions & 0 deletions core/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
rootProject.name = "core"

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

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

testImplementation(platform(libs.org.junit.junit.bom))
Expand All @@ -73,6 +74,7 @@ group = "se.premex"
tasks.named("test") {
(this as Test).systemProperties["grossVersion"] = version
dependsOn(":publishAllPublicationsToTestingRepository")
dependsOn(gradle.includedBuild("core").task(":publishAllPublicationsToTestingRepository"))
}

publishing {
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ class ArtifactCodeGenerator(
arguments.add(artifact.groupId)
arguments.add(artifact.artifactId)
arguments.add(artifact.version)
if (artifact.name != null) {
val artifactName = artifact.name
if (artifactName != null) {
appendLine("""name = %S,""")
arguments.add(artifact.name)
arguments.add(artifactName)
} else {
appendLine("""name = null,""")
}
Expand All @@ -48,10 +49,11 @@ class ArtifactCodeGenerator(
}
appendLine("""),""")

if (artifact.scm != null) {
val artifactScm = artifact.scm
if (artifactScm != null) {
appendLine("""scm = %T(%S), """.trimMargin())
arguments.add(ClassName(packageName, scmTypeSpec.name!!))
arguments.add(artifact.scm.url)
arguments.add(artifactScm.url)
} else {
appendLine("""scm = null, """.trimMargin())
}
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,
spdxLicensesTypeSpec = licenseeTypesGenerator.spdxLicensesTypeSpec,
scmTypeSpec = licenseeTypesGenerator.scmTypeSpec,
unknownLicensesTypeSpec = 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
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ dependencyResolutionManagement {
rootProject.name = "Gross"

includeBuild("gross-plugin")
includeBuild("core")

include("ui")
include("core")
include(":app")

2 changes: 1 addition & 1 deletion ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ kotlin {
}

dependencies {
api(projects.core)
api("se.premex.gross:core:1.0")
implementation(libs.com.squareup.okio)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.runtime)
Expand Down
Loading