Rewrite tasks using Def.ifS

This commit is contained in:
Eugene Yokota 2020-05-15 23:18:32 -04:00
parent 2feecf8a1f
commit fc791cc23e
1 changed files with 9 additions and 16 deletions

View File

@ -2128,17 +2128,9 @@ object Defaults extends BuildCommon {
) )
def dependencyResolutionTask: Def.Initialize[Task[DependencyResolution]] = def dependencyResolutionTask: Def.Initialize[Task[DependencyResolution]] =
Def.taskDyn { Def.ifS(useCoursier.toTask)(Def.task { CoursierDependencyResolution(csrConfiguration.value) })(
if (useCoursier.value) { Def.task { IvyDependencyResolution(ivyConfiguration.value, CustomHttp.okhttpClient.value) }
Def.task { CoursierDependencyResolution(csrConfiguration.value) } )
} else
Def.task {
IvyDependencyResolution(
ivyConfiguration.value,
CustomHttp.okhttpClient.value
)
}
}
} }
object Classpaths { object Classpaths {
@ -2955,13 +2947,14 @@ object Classpaths {
publishTask(config) publishTask(config)
def publishTask(config: TaskKey[PublishConfiguration]): Initialize[Task[Unit]] = def publishTask(config: TaskKey[PublishConfiguration]): Initialize[Task[Unit]] =
Def.taskDyn { Def.ifS((publish / skip).toTask)(Def.task {
val s = streams.value val s = streams.value
val skp = (skip in publish).value
val ref = thisProjectRef.value val ref = thisProjectRef.value
if (skp) Def.task { s.log.debug(s"Skipping publish* for ${ref.project}") } else s.log.debug(s"Skipping publish* for ${ref.project}")
Def.task { IvyActions.publish(ivyModule.value, config.value, s.log) } })(Def.task {
} tag (Tags.Publish, Tags.Network) val s = streams.value
IvyActions.publish(ivyModule.value, config.value, s.log)
}) tag (Tags.Publish, Tags.Network)
val moduleIdJsonKeyFormat: sjsonnew.JsonKeyFormat[ModuleID] = val moduleIdJsonKeyFormat: sjsonnew.JsonKeyFormat[ModuleID] =
new sjsonnew.JsonKeyFormat[ModuleID] { new sjsonnew.JsonKeyFormat[ModuleID] {