Support alternative to string-based dependency configuration syntax, e.g. "testCompile"(...) #36

Closed
cbeams opened this Issue May 30, 2016 · 3 comments

Projects

None yet

4 participants

@cbeams cbeams added this to the 1.0.0-M2 milestone May 30, 2016
@cbeams cbeams changed the title from Support alternative to string-based dependency configuration syntax to Support alternative to string-based dependency configuration syntax, e.g. "testCompile(...)" May 31, 2016
@cbeams cbeams changed the title from Support alternative to string-based dependency configuration syntax, e.g. "testCompile(...)" to Support alternative to string-based dependency configuration syntax, e.g. "testCompile"(...) May 31, 2016
@DanielThomas

Thought I'd copy this here for you - Kotlin Slack is limited to 10K messages, and I'd expect this to be bumped out of the history pretty quickly:

val DependencyHandler.testCompile by DependencyProperty

interface DependencyHandler {
    fun add(s: String, s2: String)
}

object DependencyProperty {
    operator fun getValue(handler: DependencyHandler, property: KProperty<*>): (String) -> Unit = {
        handler.add(property.name, it)
    }
}

fun dependencies(d: DependencyHandler.() -> Unit) {
}

fun test() {
    dependencies {
        testCompile("")
    }
}
@bamboo bamboo was assigned by cbeams Jun 13, 2016
@bamboo bamboo added a commit that referenced this issue Jun 20, 2016
@bamboo bamboo Generate common configuration accessors
See #36
aedde84
@bamboo bamboo added a commit that referenced this issue Jun 20, 2016
@bamboo bamboo Favor configuration extensions
See #36
fd21e60
@bamboo bamboo added a commit that referenced this issue Jun 21, 2016
@bamboo bamboo Favor configuration extensions
This reverts commit 0297783.

See #36
9ff4d04
@bamboo bamboo added a commit that referenced this issue Jun 21, 2016
@bamboo bamboo Move configuration extensions to DependencyHandler
So they can also be used with regular dot invocation syntax:

    dependencies.testCompile("junit:junit:4.12")

See #36
9a8816d
@cbeams
Member
cbeams commented Jun 21, 2016

Resolving as complete with the above commits. @bamboo, I assume it was just an oversight that you didn't close this yourself.

@cbeams cbeams closed this Jun 21, 2016
@bsideup
bsideup commented Jun 22, 2016

AFAIR this one was proposed by me :D Yay :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment