先执行:
execute >>> setting.gradle
再执行:host.buildscript
execute >>> buildscript
execute >>> buildscript.repositories
execute >>> buildscript.dependencies
接下来解析host文件
execute >>> host //这里可以进行host变量的声明
执行host文件的apply
execute >>> config.gradle
execute >>> config.gradle >>> ext
执行host文件的allprojects
execute >>> allprojects: host
execute >>> allprojects: host.repositories
execute >>> allprojects: host.dependencies
宿主执行先于subproject
execute >>> allprojects: app
execute >>> allprojects: app.repositories
execute >>> allprojects: app.dependencies
执行host文件的subprojects
execute >>> subprojects: app
先执行了buildscript这个task:buildscript先于apply
execute >>> app.buildscript
解析app的build.gradle
execute >>> app //这里可以进行host变量的声明
执行app的apply(注:当进入app下执行的时工程路径已经下沉到: ~./app/)
execute >>> config.gradle
execute >>> config.gradle >>> ext
执行app的android
execute >>> app.android//(注:这是因为apply了Android插件)
execute >>> app.dependencies
execute >>> app.repositories
结论:
1 buildscript: build.gradle 最先被执行的task > apply
2 即便是dependencies的位置先于repositories 执行顺序还是 repositories > dependencies
网友评论