Gradle Goodness: Display Available Tasks
To see which tasks are available for our build we can run Gradle with the command-line option -t or --tasks. Gradle outputs the available tasks from our build script. By default only the tasks which are dependencies on other tasks are shown. To see all tasks we must add the command-line option --all.
00.3.times { counter ->01.task "lib$counter" {02.description = "Build lib$counter"03.if (counter > 0) {04.dependsOn = ["lib${counter - 1}"]05.}06.}07.} 08. 09.task compile {10.dependsOn { 11.project.tasks.findAll { 12.it.name.startsWith('lib')13.}14.}15.description = "Compile sources"16.}$ gradle -q -t------------------------------------------------------------Root Project------------------------------------------------------------Tasks-----:compile - Compile sources$ gradle -q --tasks -all------------------------------------------------------------Root Project------------------------------------------------------------Tasks-----:compile - Compile sources:lib0 - Build lib0:lib1 - Build lib1:lib2 - Build lib2But if we add our tasks to a group, we get even more verbose output. Gradle will group the tasks together and without the --all option we get to see all tasks belonging to the group, even those that are dependency tasks. And with the --all option we see for each task on which tasks it depends on. So by setting the group property on the task we get much better output when we ask Gradle about the available tasks.
00.3.times { counter ->01.task "lib$counter" {02.description = "Build lib$counter"03.if (counter > 0) {04.dependsOn = ["lib${counter - 1}"]05.}06.}07.} 08. 09.task compile {10.dependsOn { 11.project.tasks.findAll { 12.it.name.startsWith('lib')13.}14.}15.description = "Compile sources"16.}17. 18.tasks*.group = 'Compile'$ gradle -q -t------------------------------------------------------------Root Project------------------------------------------------------------Compile tasks-------------:compile - Compile sources:lib0 - Build lib0:lib1 - Build lib1:lib2 - Build lib2$ gradle -q --tasks -all------------------------------------------------------------Root Project------------------------------------------------------------Compile tasks-------------:compile - Compile sources [:lib0, :lib1, :lib2]:lib0 - Build lib0:lib1 - Build lib1 [:lib0]:lib2 - Build lib2 [:lib1]Gradle Goodness: Display Available Tasks的更多相关文章
- Gradle Goodness: Group Similar Tasks
In Gradle we can assign a task to a group. Gradle uses the group for example in the output of $ grad ...
- Gradle Goodness: Automatic Clean Tasks
Gradle adds the task rule clean<Taskname> to our projects when we apply the base plugin. This ...
- Gradle Goodness: Continue Build Even with Failed Tasks
If we run a Gradle build and one of the tasks fails, the whole build stops immediately. So we have f ...
- Gradle Goodness: Task Output Annotations Create Directory Automatically
Gradle Goodness: Task Output Annotations Create Directory Automatically One of the great features of ...
- Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects
Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects Gradle is very flexible. ...
- Gradle Goodness: Copy Files with Filtering
Gradle Goodness: Copy Files with Filtering Gradle's copy task is very powerful and includes filterin ...
- Gradle Goodness: Changing Name of Default Build File
Gradle uses the name build.gradle as the default name for a build file. If we write our build code i ...
- Gradle Goodness: Excluding Tasks for Execution
In Gradle we can create dependencies between tasks. But we can also exclude certain tasks from those ...
- Gradle Goodness: Adding Tasks to a Predefined Group
In Gradle we can group related tasks using the group property of a task. We provide the name of our ...
随机推荐
- 轻松学习java可重入锁(ReentrantLock)的实现原理(转 图解)
前言 相信学过java的人都知道 synchronized 这个关键词,也知道它用于控制多线程对并发资源的安全访问,兴许,你还用过Lock相关的功能,但你可能从来没有想过java中的锁底层的机制是怎么 ...
- BZOJ1021 [SHOI2008]循环的债务
Description Alice.Bob和Cynthia总是为他们之间混乱的债务而烦恼,终于有一天,他们决定坐下来一起解决这个问题. 不过,鉴别钞票的真伪是一件很麻烦的事情,于是他们决定要在清还债务 ...
- dukuwiki简单教程
=====请先阅读下面的说明,有助于你快速入门===== * DokuWiki(也就是我们通常称谓的wiki) 支持一些简单的标记语言, 以尽最大可能使文档看上去更友好. * 你可以把它理解为一种和c ...
- 给大家分享下坐标转换的代码的JS和Python两个版本的源码【转】
/** * Created by Wandergis on 2015/7/8. * 提供了百度坐标(BD09).国测局坐标(火星坐标,GCJ02).和WGS84坐标系之间的转换 */ /** * 百度 ...
- GAN背后的数学原理
模拟上帝之手的对抗博弈——GAN背后的数学原理 简介 深度学习的潜在优势就在于可以利用大规模具有层级结构的模型来表示相关数据所服从的概率密度.从深度学习的浪潮掀起至今,深度学习的最大成功在于判别式 ...
- HBuilder设置APP状态栏
一. 前言 状态栏就是手机屏幕最顶部的区域,包括了:信号.运营商.电量等信息.通常APP都有属于自己的色调风格,为了达到整体视觉美观,通常会设置状态栏和标题栏的色调设置成一致. 图例: 二.状态栏状态 ...
- [翻译] IGLDropDownMenu
IGLDropDownMenu An iOS drop down menu with pretty animation. 一种iOS点击下拉菜单样式,动画效果很绚丽. Screenshot - 截图 ...
- [翻译] CNPGridMenu
CNPGridMenu CNPGridMenu is a Mailbox style grid menu with a blurred background for iOS 7 & iOS 8 ...
- windows 下 gdb 的安装
在 windows 下 gcc/g++ 的安装 这篇文章中已经提到,用MinGW Installation Manager可以方便地管理 MinGW 组件,因此使用该软件安装 gdb . 打开 Min ...
- Python初学者第十二天 购物车程序小作业
12day 作业题目: 购物车程序 作业需求: 数据结构: goods = [ {"name": "电脑", "price": 1999}, ...