equal
deleted
inserted
replaced
24 import kotlinx.serialization.Serializable |
24 import kotlinx.serialization.Serializable |
25 import kotlinx.serialization.json.Json |
25 import kotlinx.serialization.json.Json |
26 import okio.Source |
26 import okio.Source |
27 import okio.buffer |
27 import okio.buffer |
28 |
28 |
|
29 /** |
|
30 * Parse licences data generated by the [licensee](https://github.com/cashapp/licensee) gradle plugin. |
|
31 */ |
29 class LicenseeParser( |
32 class LicenseeParser( |
30 input: Source |
33 input: Source |
31 ): AutoCloseable { |
34 ): AutoCloseable { |
32 private val buffered = input.buffer() |
35 private val buffered = input.buffer() |
33 |
36 |
|
37 /** |
|
38 * Read licensee data |
|
39 * |
|
40 * @return a map of dependency name to license |
|
41 */ |
34 fun readLicensee(): Map<String, String> { |
42 fun readLicensee(): Map<String, String> { |
35 val json = Json { |
43 val json = Json { |
36 ignoreUnknownKeys = true |
44 ignoreUnknownKeys = true |
37 } |
45 } |
38 val items: List<LicenseItem> = json.decodeFromString(buffered.readUtf8()) |
46 val items: List<LicenseItem> = json.decodeFromString(buffered.readUtf8()) |