Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Expose precompiled scripts as Gradle plugins #767

Merged
merged 1 commit into from
Mar 19, 2018
Merged

Conversation

bamboo
Copy link
Member

@bamboo bamboo commented Mar 19, 2018

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

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) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ typo Adater -> Adapter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍



private
fun KotlinLexer.skipWhiteSpaceAndComments() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Duplicate in BuildscriptBlockExtraction.kt

Copy link
Member Author

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")
}
Copy link
Member

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? =
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

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.

@bamboo bamboo deleted the bamboo/lcbp/ids branch March 25, 2018 18:26
@eskatos eskatos added this to the 0.16.x milestone May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants