Skip to content

Commit

Permalink
feat(dependencies): update to gradle 8 and update plugins/dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
andreschaefer committed Mar 7, 2023
1 parent ef3c3a9 commit fc003fb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 36 deletions.
37 changes: 10 additions & 27 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ plugins {
kotlin("jvm") version embeddedKotlinVersion
`kotlin-dsl`
`maven-publish`
id("com.gradle.plugin-publish") version "0.20.0"
id("com.gradle.plugin-publish") version "1.1.0"
`java-gradle-plugin`
id("fr.brouillard.oss.gradle.jgitver") version "0.10.0-rc03"
id("com.github.hierynomus.license-base") version "0.16.1"
id("com.github.ben-manes.versions") version "0.42.0"
id("com.github.ben-manes.versions") version "0.46.0"
}

dependencies {
implementation(platform(kotlin("bom")))

implementation("org.slf4j:slf4j-api:1.7.36")
implementation("org.dom4j:dom4j:2.1.3")
implementation("org.yaml:snakeyaml:1.30")
implementation("org.dom4j:dom4j:2.1.4")
implementation("org.yaml:snakeyaml:2.0")
implementation("xerces:xercesImpl:2.12.2")

testImplementation(kotlin("test"))
Expand All @@ -36,9 +35,14 @@ tasks.withType<Test> {
}

gradlePlugin {
website.set("https://github.com/merkle-open/gradle-license-enforce-plugin")
vcsUrl.set("https://github.com/merkle-open/gradle-license-enforce-plugin")
plugins {
register("com.namics.oss.gradle.license-enforce-plugin") {
create("com.namics.oss.gradle.license-enforce-plugin") {
id = "com.namics.oss.gradle.license-enforce-plugin"
displayName = "Gradle dependency licenses enforcement plugin"
description = "Under development! ${project.description}"
tags.set(listOf("dependency-management", "license", "enforce"))
implementationClass = "com.namics.oss.gradle.license.LicenseEnforcePlugin"
}
}
Expand All @@ -48,27 +52,6 @@ jgitver {
useDistance = false
}

pluginBundle {
website = "https://github.com/namics/gradle-license-enforce-plugin"
vcsUrl = "https://github.com/namics/gradle-license-enforce-plugin"
description = project.description
tags = listOf("dependency-management", "license", "enforce")
(plugins) {
"com.namics.oss.gradle.license-enforce-plugin" {
// id is captured from java-gradle-plugin configuration
displayName = "Gradle dependency licenses enforcement plugin"
description = "Under development! Gradle dependency licenses enforcement plugin"
tags = listOf("dependency-management", "license", "enforce")
version = project.version.toString()
}
}
mavenCoordinates {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
}
}

tasks.create("licenseHeader") {
dependsOn("licenseFormatMain", "licenseFormatTest")
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package com.namics.oss.gradle.license

import org.yaml.snakeyaml.LoaderOptions
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.Constructor

Expand All @@ -33,26 +34,26 @@ class LicenseDictionary {
private val byUrl: MutableMap<String, LicenseDefinition> = HashMap()
private val byName: MutableMap<String, LicenseDefinition> = HashMap()

fun addConfig(data: String) = Yaml(Constructor(LicenseDefinition::class.java)).loadAll(data).forEach {
fun addConfig(data: String) = Yaml(Constructor(LicenseDefinition::class.java, LoaderOptions())).loadAll(data).forEach {
addDefinition(it as LicenseDefinition)
}

private fun addDefinition(input: LicenseDefinition) {
val candidate = byId.getOrPut(input.id.toLowerCase()) { input }
val candidate = byId.getOrPut(input.id.lowercase()) { input }
candidate.names.add(input.name)
candidate.names.addAll(input.names)
candidate.urls.add(input.url)
candidate.urls.addAll(input.urls)

byName[candidate.id.toLowerCase()] = candidate
byName[candidate.name.toLowerCase()] = candidate
candidate.names.forEach { byName[it.toLowerCase()] = candidate }
byName[candidate.id.lowercase()] = candidate
byName[candidate.name.lowercase()] = candidate
candidate.names.forEach { byName[it.lowercase()] = candidate }

byUrl[candidate.url.toLowerCase()] = candidate
candidate.urls.forEach { byUrl[it.toLowerCase()] = candidate }
byUrl[candidate.url.lowercase()] = candidate
candidate.urls.forEach { byUrl[it.lowercase()] = candidate }
}

fun lookup(representation: String) = representation.toLowerCase().let { byUrl[it] ?: byName[it] }
fun lookup(representation: String) = representation.lowercase().let { byUrl[it] ?: byName[it] }

fun knownLicenses() = byId.values
}

0 comments on commit fc003fb

Please sign in to comment.