Skip to content

Commit

Permalink
Publish test fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski committed Nov 14, 2023
1 parent 38f6117 commit cbc1ab5
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions licensee-for-android-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.starter.library.kotlin)
alias(libs.plugins.kotlinx.binarycompatibility)
alias(libs.plugins.drewhamilton.poko)
id("java-test-fixtures")
id("com.starter.publishing")
}
description = "core library for io.github.usefulness.licensee-for-android gradle plugin. Exposes shareable classes and interfaces, useful in multi-module projects"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.github.usefulness.licensee

class FakeLicensee(override val artifacts: List<Artifact>) : Licensee

fun stubArtifact(
groupId: String = "com.example",
artifactId: String = "foo-bar",
version: String = "0.1.0-alpha04",
name: String? = "Fixture Name of $groupId:$artifactId:$version",
spdxLicenses: List<SpdxLicense> = listOf(stubSpdxLicense()),
scm: Scm? = stubScm(),
unknownLicenses: List<UnknownLicense> = listOf(stubUnknownLicense()),
) = Artifact(
groupId = groupId,
artifactId = artifactId,
version = version,
name = name,
spdxLicenses = spdxLicenses,
scm = scm,
unknownLicenses = unknownLicenses,
)

fun stubSpdxLicense(
identifier: String = "Apache-2.0",
name: String = "Apache License 2.0",
url: String = "https://www.apache.org/licenses/LICENSE-2.0",
) = SpdxLicense(
identifier = identifier,
name = name,
url = url,
)

fun stubApacheLicense() = stubSpdxLicense(
identifier = "Apache-2.0",
name = "Apache License 2.0",
url = "https://www.apache.org/licenses/LICENSE-2.0",
)

fun stubMitLicense() = stubSpdxLicense(
identifier = "MIT",
name = "MIT License",
url = "https://opensource.org/licenses/MIT",
)

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",
) = UnknownLicense(
name = name,
url = url,
)

0 comments on commit cbc1ab5

Please sign in to comment.