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

Script plugins can use the plugins DSL to define their dependencies on arbitrary plugins #427

Closed
bamboo opened this issue Jul 20, 2017 · 5 comments

Comments

@bamboo
Copy link
Member

bamboo commented Jul 20, 2017

The dependencies of a script plugin are currently completely hidden from the projects that apply them. That’s because “apply from:” statements are discovered only after the classpath of a project’s buildscript is already set up.

A very common pattern is applying a community plugin, pre-configuring it, but still giving projects the choice to further configure the community plugin. This “kind of works” with Groovy, because of its dynamic nature. As long as you don’t try to reference the types of the community plugin, you can still configure its extensions and tasks. However, this is not an option for statically typed Kotlin.

The following should work:

// bar.gradle.kts

plugins {
  id("foo.plugin.id") version "2.0"
}

// build.gradle.kts
plugins {
  script("bar.gradle.kts")
}

fooExtension { // contributed by "foo.plugin.id", a dependency of bar.gradle.kts
  //some more specific, statically typed configuration
}
@bamboo bamboo added this to the 0.11.0 milestone Jul 20, 2017
@bamboo bamboo changed the title Script plugins can expose API to build scripts, just like binary plugins can Script plugins can use the plugins DSL to define their dependencies on arbitrary plugins Jul 20, 2017
@bamboo bamboo modified the milestones: 0.11.0, 0.12.0 Jul 26, 2017
@bamboo bamboo modified the milestones: 1.0.0, 0.12.0 Sep 5, 2017
@bamboo bamboo removed this from the 1.0.0 milestone Jan 18, 2018
@guenhter
Copy link
Contributor

The script("...") seems not to be available in current versions.

@bamboo
Copy link
Member Author

bamboo commented Mar 16, 2018

@guenhter It is not.

@guenhter
Copy link
Contributor

Ah, sorry. I get you now. This should be done with this ticket.
Looking forward to this!

@fuzzyweapon
Copy link

Also looking forward to this. This is a huge piece of the puzzle for applied script plugins.

@gildor
Copy link
Contributor

gildor commented Apr 24, 2019

Why this was dropped? Of course, precompiled script plugins solve problems, but require unnecessary buildSrc dir with settings.gradle and build.gradle and src/main/kotlin dir

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants