zoukankan      html  css  js  c++  java
  • Gradle basic

    1. execute default file (build.gradle)

    gradlew

    2. execute another file

    gradlew -b [filename]

    3.  basic task

    task ta {
        println "from task ta"
    }

    another way to define task

    task tc
    tc.doLast{println "from task tc"}

    4. task with left shift

    will not be execute like this

    gradlew

    only execute when call task name

    gradlew ta
    task ta <<{
        println "from task ta"
    }

    equal to 

    task ta {
        doLast {
            println "from task ta"
        }
    }

     5. dependsOn

    do before the task

    task putOnSocks {
        doLast {
            println "Putting on Socks."
        }
    }
    
    task putOnShoes {
        dependsOn "putOnSocks"
        doLast {
            println "Putting on Shoes."
        }
    }

    6. finalizedBy

    do after the task

    task eatBreakfast {
        finalizedBy "brushYourTeeth"
        doLast{
            println "Om nom nom breakfast!"
        }
    }
    
    task brushYourTeeth {
        doLast {
            println "Brushie Brushie Brushie."
        }
    }

    7. copy task

    task copyJpegs(type: Copy) {
        from 'images'
        include '*.jpg'
        into 'build'
    }

     8. define a task type

    // type definition
    class HelloNameTask extends DefaultTask {
        String firstName
    
        @TaskAction
        void doAction() {
            println "Hello, $firstName"
        }
    }
    
    
    // create a task with type
    task helloName(type: HelloNameTask) {
        firstName = 'Jeremy'
    }
  • 相关阅读:
    10-18 noip提高组模拟赛(codecomb)T2贪心
    vj1011:记忆化搜索
    vj1010:高精乘+细心模拟
    10-18 noip提高组模拟赛(codecomb)T1倍增[未填]
    CODEFORCES ROUND #273 DIV2
    Unkown2
    2014.first[未填]
    Unknown
    历年noip复赛试题整合
    快速幂(模板)
  • 原文地址:https://www.cnblogs.com/phoenix13suns/p/4906084.html
Copyright © 2011-2022 走看看