-
Notifications
You must be signed in to change notification settings - Fork 313
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
fix(notifier): Provide the types for mailClient and jiraClient #8684
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,15 +43,20 @@ class Notifier( | |
) : ScriptRunner() { | ||
private val customProperties = buildMap { | ||
put("ortResult", ortResult) | ||
|
||
config.mail?.let { put("mailClient", MailNotifier(it)) } | ||
config.jira?.let { put("jiraClient", JiraNotifier(it)) } | ||
|
||
put("mailClient", config.mail?.let { MailNotifier(it) }) | ||
put("jiraClient", config.jira?.let { JiraNotifier(it) }) | ||
put("resolutionProvider", resolutionProvider) | ||
} | ||
|
||
private val customPropertyTypes = mapOf( | ||
"ortResult" to KotlinType(OrtResult::class), | ||
"mailClient" to KotlinType(MailNotifier::class, isNullable = true), | ||
"jiraClient" to KotlinType(JiraNotifier::class, isNullable = true), | ||
Comment on lines
+53
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making these types nullable will be a breaking change because all notifier scripts will need to be adjusted. |
||
"resolutionProvider" to KotlinType(ResolutionProvider::class) | ||
) | ||
|
||
override val compConfig = createJvmCompilationConfigurationFromTemplate<NotificationsScriptTemplate> { | ||
providedProperties(customProperties.mapValues { (_, v) -> KotlinType(v::class) }) | ||
providedProperties(customPropertyTypes) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be inlined, like done here (using a vararg of pairs). And I'd probably inline |
||
} | ||
|
||
override val evalConfig = ScriptEvaluationConfiguration { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the condition is now not at the outer level anymore,
buildMap
can be replaced withmapOf
and"mailClient" to config.mail?.let { MailNotifier(it) }
etc.