Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to give URL or stream for bundle to LicenseBundleNormalizer #301

Closed
Vampire opened this issue Apr 25, 2024 · 1 comment
Closed

Allow to give URL or stream for bundle to LicenseBundleNormalizer #301

Vampire opened this issue Apr 25, 2024 · 1 comment
Assignees
Milestone

Comments

@Vampire
Copy link

Vampire commented Apr 25, 2024

When building a convention plugin with an embedded normalizer bundle, it would be nice if you could give it as resource or stream to the LicenseBundleNormalizer constructor.
Currently, you can only give it a file.

@Vampire
Copy link
Author

Vampire commented Apr 26, 2024

Here a way to do it by customization using Kotlin:

class CustomLicenseBundleNormalizer : LicenseBundleNormalizer(null, false) {
    @Synchronized
    override fun init() {
        if (isInitialized) {
            return
        }

        super.init()

        val slurpResult = JsonSlurper()
            .setType(LAX)
            .parse(javaClass.getResource("license-normalizer-bundle.json"))
        mergeConfigIntoGlobalConfig(toConfig(slurpResult) as LicenseBundleNormalizerConfig)
    }
}

@jk1 jk1 self-assigned this May 26, 2024
@jk1 jk1 added this to the 2.8 milestone May 26, 2024
@jk1 jk1 closed this as completed May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants