-
Notifications
You must be signed in to change notification settings - Fork 429
Expose precompiled scripts as Gradle plugins #767
Conversation
The Gradle plugin id is derived from the script file name and its package declaration if any. The implementation is currently limited to scripts under `src/main/kotlin`. Future commits will lift this restriction. See #669
|
||
|
||
internal | ||
fun ScriptPlugin.writeScriptPluginAdaterTo(outputDir: File) = |
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.
❌ typo Adater
-> Adapter
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.
👍
|
||
|
||
private | ||
fun KotlinLexer.skipWhiteSpaceAndComments() { |
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.
❌ Duplicate in BuildscriptBlockExtraction.kt
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.
I didn't want to couple them.
plugins { | ||
id("my-plugin") | ||
id("org.acme.my-other-plugin") | ||
} |
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.
😍
|
||
|
||
private | ||
fun packageNameOf(code: String): String? = |
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.
❓ given this will happen before :kotlinCompile
I wonder about the behavior if the lexer throws.
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.
I would expect the build to fail.
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.
Right. I'm wondering how it would fail and if the error would make sense to the user
I think we should have a test for this and make sure we display a reasonable error.
private | ||
fun Project.exposeScriptsAsGradlePlugins() { | ||
|
||
// TODO: script plugins from custom source-set dirs |
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.
I'd be fine with handling a single source set for now.
In that case consider using gradlePlugin.pluginSourceSet
.
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.
Makes a lot of sense. Done.
The Gradle plugin id is derived from the script file name and its package declaration if any.
The implementation is currently limited to scripts under
src/main/kotlin
. Future commits will lift this restriction.See #669