[SOLVED] Kotlin how to fill Dependencies object

Hi, in regular Kotlin notation there is

object SomeBuild: BuildType({
    dependencies {
        snapshot(SomeOtherBuild) {
    }
}

 

if we wanted to have it based on some class

class SomeBuildTemplate constructor(
    dependencies: Dependencies
) : BuildType({
    dependencies {
        dependencies
    }
})

then the instantiation would be cca

buildType(SomeBuildTemplate(dependencies = Dependencies()))

but I can't find out how to create/add the snapshot dependency into the Dependencies object, is this possible?

Thank you!

 

2 comments
Comment actions Permalink

Looks like it might work with

Dependencies().apply {
    snapshot(SomeOtherBuild) {}
}

Edit: looks like TC does not fail on this, but does not actually add the dependency either...

0
Comment actions Permalink

So this setup actually seems to work

class SomeBuildTemplate constructor(
    suppliedDependencies: Dependencies
) : BuildType({
    dependencies.apply {
        items.addAll(suppliedDependencies.items)
    }
})

object SomeBuild: SomeBuildTemplate(
    suppliedDependencies= Dependencies().apply {
        snapshot(Module) {}
    }
)

 

Though at some point I renamed the dependencies argument and somehow it worked regardless, which makes me question if it's really working, but... hopefully yes

 

0

Please sign in to leave a comment.