简体   繁体   中英

How to convert “sourceSet” of Groovy -> Kotlin DSL (Gradle)?

Here is the sourceSet which I want to convert into Kotlin Gradle DSL. Basically it excludes all other directories inside src/main/resources/ except 'templates' and 'fonts'.

sourceSets {
    main {
        resources {
            include 'templates/*'
            include 'assets/fonts/*'
        }
    }
}

Here is what I've tried till now:

sourceSets.create("main") {
    resources.srcDir {
        include("templates/*")
        include("assets/fonts/*")
    }
}

But include doesn't seem to resolve the reference here. What am I doing wrong?

In the past, I've successfully managed to do it like this.

sourceSets {
    main {
        resources {
             srcDir("templates")
             srcDir("assets/fonts/")
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM