Gradle/Groovy syntax confusion

后端 未结 2 1539
青春惊慌失措
青春惊慌失措 2021-01-16 05:06

Can anyone explain/comment on this fraction of Groovy code?

task copyImageFolders(type: Copy) {
    from(\'images\') {
        include \'*.jpg\'
        into         


        
2条回答
  •  爱一瞬间的悲伤
    2021-01-16 05:13

    The short answer is it's calling from(sourcePath, configureAction).

    Groovy has optional brackets in a number of cases and accepts the last parameter (if it's a closure) outside of brackets and in this case that's the closure that you're passing to from().

    This is a good blog post explaining the different ways a closure can be passed to a method in Groovy if you want more examples and this offers more examples of optional brackets in general.

提交回复
热议问题