Skip to content

Commit d82e20b

Browse files
committed
set dependencies.json
1 parent 368ca8c commit d82e20b

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

build.gradle.kts

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
2+
import com.github.jk1.license.render.JsonReportRenderer
13
import org.jetbrains.kotlin.com.intellij.openapi.util.SystemInfoRt
24
import java.nio.file.Path
35
import kotlin.io.path.div
@@ -6,6 +8,7 @@ plugins {
68
alias(libs.plugins.kotlin)
79
alias(libs.plugins.serialization)
810
`java-library`
11+
alias(libs.plugins.dependency.license.report)
912
}
1013

1114
repositories {
@@ -21,6 +24,13 @@ dependencies {
2124
implementation(libs.okhttp)
2225
}
2326

27+
licenseReport {
28+
renderers = arrayOf(JsonReportRenderer("dependencies.json"))
29+
filters = arrayOf(ExcludeTransitiveDependenciesFilter())
30+
// jq script to convert to our format:
31+
// `jq '[.dependencies[] | {name: .moduleName, version: .moduleVersion, url: .moduleUrl, license: .moduleLicense, licenseUrl: .moduleLicenseUrl}]' < build/reports/dependency-license/dependencies.json > src/main/resources/dependencies.json`
32+
}
33+
2434
tasks.compileKotlin {
2535
kotlinOptions.freeCompilerArgs += listOf(
2636
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",

gradle/libs.versions.toml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ coroutines = "1.7.3"
55
serialization = "1.5.0"
66
okhttp = "4.10.0"
77
slf4j = "2.0.3"
8+
dependency-license-report = "2.5"
89

910
[libraries]
1011
kotlin-stdlib = { module = "com.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
@@ -22,3 +23,4 @@ serialization = [ "serialization-core", "serialization-json", "serialization-jso
2223
[plugins]
2324
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
2425
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
26+
dependency-license-report = { id = "com.github.jk1.dependency-license-report", version.ref = "dependency-license-report" }

src/main/resources/dependencies.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[
2+
{
3+
"name": "Toolbox App plugin API",
4+
"version": "2.1.0.16946",
5+
"url": "https://jetbrains.com/toolbox-app/",
6+
"license": "The Apache Software License, Version 2.0",
7+
"licenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt"
8+
},
9+
{
10+
"name": "com.squareup.okhttp3:okhttp",
11+
"version": "4.10.0",
12+
"url": "https://square.github.io/okhttp/",
13+
"license": "The Apache Software License, Version 2.0",
14+
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
15+
},
16+
{
17+
"name": "Kotlin",
18+
"version": "1.9.0",
19+
"url": "https://kotlinlang.org/",
20+
"license": "The Apache License, Version 2.0",
21+
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt"
22+
},
23+
{
24+
"name": "kotlinx.coroutines",
25+
"version": "1.7.3",
26+
"url": "https://github.com/Kotlin/kotlinx.coroutines/",
27+
"license": "The Apache License, Version 2.0",
28+
"licenseUrl": "https://github.com/Kotlin/kotlinx.coroutines/blob/master/LICENSE.txt"
29+
},
30+
{
31+
"name": "kotlinx.serialization",
32+
"version": "1.5.0",
33+
"url": "https://github.com/Kotlin/kotlinx.serialization/",
34+
"license": "The Apache License, Version 2.0",
35+
"licenseUrl": "https://github.com/Kotlin/kotlinx.serialization/blob/master/LICENSE.txt"
36+
},
37+
{
38+
"name": "org.slf4j:slf4j-api",
39+
"version": "2.0.3",
40+
"url": "http://www.slf4j.org",
41+
"license": "MIT License",
42+
"licenseUrl": "http://www.opensource.org/licenses/mit-license.php"
43+
}
44+
]

0 commit comments

Comments
 (0)