Android Gradle 插件中是否有包含 bundleDebug 和 bundleRelease 的锚任务?
is there an anchor task that contains bundleDebug and bundleRelease in Android Gradle plugin?
在AndroidGradle插件中,任务"assemble"是一个包含assembleDebug和assembleRelease的锚任务。有没有类似的包含bundleDebug和bundleRelease的锚任务。我目前有以下构建脚本,其中任务依赖于 bundleDebug:
android.libraryVariants.all {
variant -> variant.javaCompile.classpath += configurations.provided
}
task removeCameraApiJar(dependsOn: 'bundleDebug') << {
FileCollection outputs = tasks['bundleDebug'].getOutputs().getFiles()
outputs.each {
File file ->
println file.name
}
println 'removeCameraApiJar'
}
task assemble.dependsOn(removeCameraApiJar)
但是,如果我只用 "bundle" 替换 bundleDebug,脚本将失败并显示以下消息:
- What went wrong: Could not determine the dependencies of task ':camerasupport:removeCameraApiJar'.
Task with path 'bundle' not found in project ':camerasupport'.
Android 插件似乎没有创建这样的任务。但是你可以做类似
的事情
task removeCameraApiJar(dependsOn: tasks.matching { it.name.startsWith('bundle') })
在 gradle android 插件 (1.5.0) 的当前版本中,捆绑任务可以作为 属性 ("packageLibrary")变体输出:
android.libraryVariants.all {
variant ->
variant.outputs.each { output ->
FileCollection outputs =
output.packageLibrary.getOutputs().getFiles()
}
}
prinln output.packageLibrary.name 将产生 "bundle"+buildVariant.
在AndroidGradle插件中,任务"assemble"是一个包含assembleDebug和assembleRelease的锚任务。有没有类似的包含bundleDebug和bundleRelease的锚任务。我目前有以下构建脚本,其中任务依赖于 bundleDebug:
android.libraryVariants.all {
variant -> variant.javaCompile.classpath += configurations.provided
}
task removeCameraApiJar(dependsOn: 'bundleDebug') << {
FileCollection outputs = tasks['bundleDebug'].getOutputs().getFiles()
outputs.each {
File file ->
println file.name
}
println 'removeCameraApiJar'
}
task assemble.dependsOn(removeCameraApiJar)
但是,如果我只用 "bundle" 替换 bundleDebug,脚本将失败并显示以下消息:
- What went wrong: Could not determine the dependencies of task ':camerasupport:removeCameraApiJar'.
Task with path 'bundle' not found in project ':camerasupport'.
Android 插件似乎没有创建这样的任务。但是你可以做类似
的事情task removeCameraApiJar(dependsOn: tasks.matching { it.name.startsWith('bundle') })
在 gradle android 插件 (1.5.0) 的当前版本中,捆绑任务可以作为 属性 ("packageLibrary")变体输出:
android.libraryVariants.all {
variant ->
variant.outputs.each { output ->
FileCollection outputs =
output.packageLibrary.getOutputs().getFiles()
}
}
prinln output.packageLibrary.name 将产生 "bundle"+buildVariant.