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

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

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

Comments

@cbeams
Copy link
Contributor

cbeams commented May 30, 2016

See https://kotlinlang.slack.com/archives/general/p1463589189004393

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

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 added a commit that referenced this issue Jun 20, 2016
bamboo added a commit that referenced this issue Jun 20, 2016
bamboo added a commit that referenced this issue Jun 21, 2016
This reverts commit 0297783.

See #36
bamboo added a commit that referenced this issue Jun 21, 2016
So they can also be used with regular dot invocation syntax:

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

See #36
@cbeams
Copy link
Contributor Author

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 as completed Jun 21, 2016
@bsideup
Copy link

bsideup commented Jun 22, 2016

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

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

4 participants