我正在尝试为使用SBT的Scala扩展Jan Berkel 的 Android 插件。
我有类似的操作和设置,比如已经定义android:install-device
和android:install-emulator
.
让它们被称为android:dev-install-device
and android:dev-install-emulator
。
我在以下位置添加了新密钥AndroidKeys.scala
:
val devInstallDevice = TaskKey[Unit]("dev-install-device")
val devInstallEmulator = TaskKey[Unit]("dev-install-emulator")
val devStartDevice = TaskKey[Unit]("dev-start-device", "Start package on device after installation")
val devStartEmulator = TaskKey[Unit]("dev-start-emulator", "Start package on emulator after installation")
我还在AndroidLaunch.scala
:
lazy val settings: Seq[Setting[_]] =
//AndroidInstall.settings ++
AndroidFastInstall.settings ++
inConfig(Android) (Seq (
devStartDevice <<= startTask(false),
devStartEmulator <<= startTask(true),
//startDevice <<= startTask(false),
//startEmulator <<= startTask(true),
devStartDevice <<= devStartDevice dependsOn devInstallDevice,
devStartEmulator <<= devStartEmulator dependsOn devInstallEmulator
//startDevice <<= startDevice dependsOn installDevice,
//startEmulator <<= startEmulator dependsOn installEmulator
))
问题是,如果我希望自己的任务可用,我必须注释掉原来的标准任务,而我不想这样做。
有什么我忽略的吗?
更新:
我尝试了不同的设置顺序。
当AndroidFastInstall
出现之前AndroidInstall
,AndroidInstall
无论我调用android:install-device
还是执行android:dev-install-device
。
lazy val settings: Seq[Setting[_]] =
AndroidFastInstall.settings ++
inConfig(Android) (Seq (
devStartDevice <<= devStartTask(false),
devStartEmulator <<= devStartTask(true),
devStartDevice <<= devStartDevice dependsOn devInstallDevice,
devStartEmulator <<= devStartEmulator dependsOn devInstallEmulator
))++
AndroidInstall.settings ++
inConfig(Android) (Seq (
startDevice <<= startTask(false),
startEmulator <<= startTask(true),
startDevice <<= startDevice dependsOn installDevice,
startEmulator <<= startEmulator dependsOn installEmulator
))
当AndroidInstall
出现之前AndroidFastInstall
,AndroidFastInstall
无论我调用android:install-device
还是执行android:dev-install-device
。
lazy val settings: Seq[Setting[_]] =
AndroidInstall.settings ++
inConfig(Android) (Seq (
startDevice <<= startTask(false),
startEmulator <<= startTask(true),
startDevice <<= startDevice dependsOn installDevice,
startEmulator <<= startEmulator dependsOn installEmulator
)) ++
AndroidFastInstall.settings ++
inConfig(Android) (Seq (
devStartDevice <<= devStartTask(false),
devStartEmulator <<= devStartTask(true),
devStartDevice <<= devStartDevice dependsOn devInstallDevice,
devStartEmulator <<= devStartEmulator dependsOn devInstallEmulator
))
似乎最后添加的总是覆盖它们之前的可见性。有谁知道这个问题的解决方案?