diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index acbefdb16..3275fe092 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -273,6 +273,7 @@ object Defaults extends BuildCommon { .toHex(Hash(appConfiguration.value.baseDirectory.toString)) .## % 1000), serverAuthentication := Set(ServerAuthentication.Token), + insideCI :== sys.env.contains("BUILD_NUMBER") || sys.env.contains("CI"), )) def defaultTestTasks(key: Scoped): Seq[Setting[_]] = @@ -1749,12 +1750,10 @@ object Classpaths { dependencyOverrides :== Vector.empty, libraryDependencies :== Nil, excludeDependencies :== Nil, - ivyLoggingLevel :== { - // This will suppress "Resolving..." logs on Jenkins and Travis. - if (sys.env.get("BUILD_NUMBER").isDefined || sys.env.get("CI").isDefined) - UpdateLogging.Quiet - else UpdateLogging.Default - }, + ivyLoggingLevel := (// This will suppress "Resolving..." logs on Jenkins and Travis. + if (insideCI.value) + UpdateLogging.Quiet + else UpdateLogging.Default), ivyXML :== NodeSeq.Empty, ivyValidate :== false, moduleConfigurations :== Nil, diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 2572e6cce..ca92e306b 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -445,6 +445,7 @@ object Keys { val skip = taskKey[Boolean]("For tasks that support it (currently only 'compile' and 'update'), setting skip to true will force the task to not to do its work. This exact semantics may vary by task.").withRank(BSetting) val templateResolverInfos = settingKey[Seq[TemplateResolverInfo]]("Template resolvers used for 'new'.").withRank(BSetting) val interactionService = taskKey[InteractionService]("Service used to ask for user input through the current user interface(s).").withRank(CTask) + val insideCI = SettingKey[Boolean]("insideCI", "Determines if the SBT is running in a Continuous Integration environment", AMinusSetting) // special val sessionVars = AttributeKey[SessionVar.Map]("sessionVars", "Bindings that exist for the duration of the session.", Invisible) diff --git a/sbt/src/sbt-test/project/inside-ci/build.sbt b/sbt/src/sbt-test/project/inside-ci/build.sbt new file mode 100644 index 000000000..9e772fdcd --- /dev/null +++ b/sbt/src/sbt-test/project/inside-ci/build.sbt @@ -0,0 +1,7 @@ +name := "inside-ci" + +organization := "org.example" + +val t = taskKey[Boolean]("inside-ci") + +t := insideCI.value \ No newline at end of file diff --git a/sbt/src/sbt-test/project/inside-ci/test b/sbt/src/sbt-test/project/inside-ci/test new file mode 100644 index 000000000..08a542bb3 --- /dev/null +++ b/sbt/src/sbt-test/project/inside-ci/test @@ -0,0 +1,2 @@ +# just need to verify it loads +> help \ No newline at end of file