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

Add convenience functions to configure child project and java plugin source sets #194

Closed
orangy opened this issue Dec 6, 2016 · 1 comment
Milestone

Comments

@orangy
Copy link

orangy commented Dec 6, 2016

/**
 * Configures the child project with the given [name]
 *
 * Executes the given configuration block against the child [Project] for the given name
 *
 * @param name the project name
 * @param configuration the configuration block
 * @return instance of child [Project] for the given [name]
 * @throws UnknownProjectException when the [Project] with the given [name] cannot be found
 */
fun Project.project(name: String, configuration: Project.() -> Unit): Project =
    project(name, closureOf(configuration))


/**
 * Configures the java plugin in this project
 *
 * Executes the given configuration block against the [JavaPluginConvention] for this project
 *
 * @param configuration the configuration block
 * @throws UnknownDomainObjectException when the java plugin was not applied
 */
fun Project.java(configuration: JavaPluginConvention.() -> Unit) = configure(configuration)

/**
 * Configures the source set with the given [name]
 *
 * Executes the given configuration block against the [SourceSet] for the given name
 *
 * @param name the SourceSet name
 * @param configuration the configuration block
 * @return instance of [SourceSet] for the given [name]
 * @throws UnknownDomainObjectException when the [SourceSet] with the given [name] cannot be found
 */
operator fun SourceSetContainer.invoke(name: String, configuration: SourceSet.() -> Unit): SourceSet =
    getByName(name)!!.apply(configuration)
@bamboo bamboo added this to the 0.6.0 milestone Dec 6, 2016
@bamboo
Copy link
Member

bamboo commented Dec 15, 2016

Thank you very much for the suggestions!

The missing Project#project(String, Action<Project>) overload has been added to the Gradle API in gradle/gradle@3be1672 as part of #122.

The java extension member will be solved as part of #159.

And the solution to configuring source-sets in aSourceSetContainer will be handled as part of #200 most likely as you suggested.

@bamboo bamboo closed this as completed Dec 15, 2016
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

2 participants