diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 402daa5a5..8f8ef109d 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -1259,7 +1259,7 @@ object Defaults extends BuildCommon { } } } - def psTask: Initialize[Task[Vector[JobHandle]]] = + def psTask: Initialize[Task[Seq[JobHandle]]] = Def.task { val xs = bgList.value val s = streams.value @@ -1795,7 +1795,7 @@ object Classpaths { useJCenter.value) match { case (Some(delegated), Seq(), _, _) => delegated case (_, rs, Some(ars), uj) => ars ++ rs - case (_, rs, _, uj) => Resolver.combineDefaultResolvers(rs, uj, mavenCentral = true) + case (_, rs, _, uj) => Resolver.combineDefaultResolvers(rs.toVector, uj, mavenCentral = true) }), appResolvers := { val ac = appConfiguration.value @@ -1866,12 +1866,11 @@ object Classpaths { retrieveConfiguration := { if (retrieveManaged.value) Some( - RetrieveConfiguration( - managedDirectory.value, - retrievePattern.value, - retrieveManagedSync.value, - configurationsToRetrieve.value.getOrElse(Vector.empty).map(c => ConfigRef(c.name)) - )) + RetrieveConfiguration() + .withRetrieveDirectory(managedDirectory.value) + .withOutputPattern(retrievePattern.value) + .withSync(retrieveManagedSync.value) + .withConfigurationsToRetrieve(configurationsToRetrieve.value map { _.toVector })) else None }, dependencyResolution := IvyDependencyResolution(ivyConfiguration.value), @@ -1903,7 +1902,7 @@ object Classpaths { if (isSnapshot.value) "integration" else "release", ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, packagedArtifacts.in(publish).value.toVector, - checksums.in(publish).value, + checksums.in(publish).value.toVector, getPublishTo(publishTo.value).name, ivyLoggingLevel.value, isSnapshot.value @@ -1915,7 +1914,7 @@ object Classpaths { if (isSnapshot.value) "integration" else "release", ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, packagedArtifacts.in(publishLocal).value.toVector, - checksums.in(publishLocal).value, + checksums.in(publishLocal).value.toVector, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value ), @@ -1925,7 +1924,7 @@ object Classpaths { if (isSnapshot.value) "integration" else "release", ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, packagedArtifacts.in(publishM2).value.toVector, - checksums = checksums.in(publishM2).value, + checksums = checksums.in(publishM2).value.toVector, resolverName = Resolver.publishMavenLocal.name, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value @@ -1991,8 +1990,9 @@ object Classpaths { excludes.toVector, c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), // scalaModule, - srcTypes, - docTypes), + srcTypes.toVector, + docTypes.toVector + ), uwConfig, Vector.empty, s.log @@ -2062,19 +2062,16 @@ object Classpaths { new IvySbt(ivyConfiguration.value) } def moduleSettings0: Initialize[Task[ModuleSettings]] = Def.task { - ModuleDescriptorConfiguration( - ivyValidate.value, - scalaModuleInfo.value, - projectID.value, - projectInfo.value, - allDependencies.value.toVector, - dependencyOverrides.value, - excludeDependencies.value.toVector, - ivyXML.value, - ivyConfigurations.value.toVector, - defaultConfiguration.value, - conflictManager.value - ) + ModuleDescriptorConfiguration(projectID.value, projectInfo.value) + .withValidate(ivyValidate.value) + .withScalaModuleInfo(scalaModuleInfo.value) + .withDependencies(allDependencies.value.toVector) + .withOverrides(dependencyOverrides.value.toVector) + .withExcludes(excludeDependencies.value.toVector) + .withIvyXML(ivyXML.value) + .withConfigurations(ivyConfigurations.value.toVector) + .withDefaultConfiguration(defaultConfiguration.value) + .withConflictManager(conflictManager.value) } private[this] def sbtClassifiersGlobalDefaults = @@ -2148,8 +2145,8 @@ object Classpaths { excludes.toVector, c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), - srcTypes, - docTypes), + srcTypes.toVector, + docTypes.toVector), uwConfig, log ) match { @@ -2587,7 +2584,7 @@ object Classpaths { .withOtherResolvers(other) .withModuleConfigurations(moduleConfigurations.value.toVector) .withLock(lock(appConfiguration.value)) - .withChecksums((checksums in update).value) + .withChecksums((checksums in update).value.toVector) .withResolutionCacheDir(crossTarget.value / "resolution-cache") .withUpdateOptions(updateOptions.value) .withLog(s.log) diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 5fea4ca9d..c65cc6806 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -45,6 +45,7 @@ import sbt.librarymanagement.LibraryManagementCodec._ import sbt.librarymanagement.ivy.{ Credentials, UpdateOptions } import sbt.librarymanagement.{ Artifact, + ConfigRef, Configuration, ConflictManager, ConflictWarning, @@ -83,6 +84,9 @@ import sbt.BuildSyntax._ // format: off object Keys { + // Normally we prefer concrete datatype like Vector, but due to ++= implicits and for backward compatibility, + // for keys we should stick to using Seq. + val TraceValues = "-1 to disable, 0 for up to the first sbt frame, or a positive number to set the maximum number of frames shown." // logging @@ -258,8 +262,8 @@ object Keys { val envVars = TaskKey[Map[String, String]]("envVars", "Environment variables used when forking a new JVM", BTask) val bgJobService = settingKey[BackgroundJobService]("Job manager used to run background jobs.") - val bgList = taskKey[Vector[JobHandle]]("List running background jobs.") - val ps = taskKey[Vector[JobHandle]]("bgList variant that displays on the log.") + val bgList = taskKey[Seq[JobHandle]]("List running background jobs.") + val ps = taskKey[Seq[JobHandle]]("bgList variant that displays on the log.") val bgStop = inputKey[Unit]("Stop a background job by providing its ID.") val bgWaitFor = inputKey[Unit]("Wait for a background job to finish by providing its ID.") val bgRun = inputKey[JobHandle]("Start an application's default main class as a background job") @@ -352,8 +356,8 @@ object Keys { val updateClassifiers = TaskKey[UpdateReport]("update-classifiers", "Resolves and optionally retrieves classified artifacts, such as javadocs and sources, for dependency definitions, transitively.", BPlusTask, update) val transitiveClassifiers = SettingKey[Seq[String]]("transitive-classifiers", "List of classifiers used for transitively obtaining extra artifacts for sbt or declared dependencies.", BSetting) val updateSbtClassifiers = TaskKey[UpdateReport]("update-sbt-classifiers", "Resolves and optionally retrieves classifiers, such as javadocs and sources, for sbt, transitively.", BPlusTask, updateClassifiers) - val sourceArtifactTypes = SettingKey[Vector[String]]("source-artifact-types", "Ivy artifact types that correspond to source artifacts. Used by IDEs to resolve these resources.", BSetting) - val docArtifactTypes = SettingKey[Vector[String]]("doc-artifact-types", "Ivy artifact types that correspond to javadoc artifacts. Used by IDEs to resolve these resources.", BSetting) + val sourceArtifactTypes = settingKey[Seq[String]]("Ivy artifact types that correspond to source artifacts. Used by IDEs to resolve these resources.") // BSetting + val docArtifactTypes = settingKey[Seq[String]]("Ivy artifact types that correspond to javadoc artifacts. Used by IDEs to resolve these resources.") // BSetting val publishConfiguration = TaskKey[PublishConfiguration]("publish-configuration", "Configuration for publishing to a repository.", DTask) val publishLocalConfiguration = TaskKey[PublishConfiguration]("publish-local-configuration", "Configuration for publishing to the local Ivy repository.", DTask) @@ -381,13 +385,13 @@ object Keys { val moduleID = SettingKey[ModuleID]("module-id", "A dependency management descriptor. This is currently used for associating a ModuleID with a classpath entry.", BPlusSetting) val projectID = SettingKey[ModuleID]("project-id", "The dependency management descriptor for the current module.", BMinusSetting) val overrideBuildResolvers = SettingKey[Boolean]("override-build-resolvers", "Whether or not all the build resolvers should be overridden with what's defined from the launcher.", BMinusSetting) - val bootResolvers = TaskKey[Option[Vector[Resolver]]]("boot-resolvers", "The resolvers used by the sbt launcher.", BMinusSetting) - val appResolvers = SettingKey[Option[Vector[Resolver]]]("app-resolvers", "The resolvers configured for this application by the sbt launcher.", BMinusSetting) - val externalResolvers = TaskKey[Vector[Resolver]]("external-resolvers", "The external resolvers for automatically managed dependencies.", BMinusSetting) - val resolvers = SettingKey[Vector[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask) + val bootResolvers = TaskKey[Option[Seq[Resolver]]]("boot-resolvers", "The resolvers used by the sbt launcher.", BMinusSetting) + val appResolvers = SettingKey[Option[Seq[Resolver]]]("app-resolvers", "The resolvers configured for this application by the sbt launcher.", BMinusSetting) + val externalResolvers = TaskKey[Seq[Resolver]]("external-resolvers", "The external resolvers for automatically managed dependencies.", BMinusSetting) + val resolvers = SettingKey[Seq[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask) val projectResolver = TaskKey[Resolver]("project-resolver", "Resolver that handles inter-project dependencies.", DTask) - val fullResolvers = TaskKey[Vector[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask) - val otherResolvers = TaskKey[Vector[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting) + val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask) + val otherResolvers = TaskKey[Seq[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting) val useJCenter = SettingKey[Boolean]("use-jcenter", "Use JCenter as the default repository.", BSetting) val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations", "Defines module configurations, which override resolvers on a per-module basis.", BMinusSetting) val retrievePattern = SettingKey[String]("retrieve-pattern", "Pattern used to retrieve managed dependencies to the current build.", DSetting) @@ -396,7 +400,7 @@ object Keys { val ivyPaths = SettingKey[IvyPaths]("ivy-paths", "Configures paths used by Ivy for dependency management.", DSetting) val dependencyCacheDirectory = TaskKey[File]("dependency-cache-directory", "The base directory for cached dependencies.", DTask) val libraryDependencies = SettingKey[Seq[ModuleID]]("library-dependencies", "Declares managed dependencies.", APlusSetting) - val dependencyOverrides = SettingKey[Vector[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting) + val dependencyOverrides = SettingKey[Seq[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting) val excludeDependencies = SettingKey[Seq[InclExclRule]]("exclude-dependencies", "Declares managed dependency exclusions.", BSetting) val allDependencies = TaskKey[Seq[ModuleID]]("all-dependencies", "Inter-project and library dependencies.", CTask) val projectDependencies = TaskKey[Seq[ModuleID]]("project-dependencies", "Inter-project dependencies.", DTask) @@ -410,12 +414,12 @@ object Keys { val autoUpdate = SettingKey[Boolean]("auto-update", "", Invisible) val retrieveManaged = SettingKey[Boolean]("retrieve-managed", "If true, enables retrieving dependencies to the current build. Otherwise, dependencies are used directly from the cache.", BSetting) val retrieveManagedSync = SettingKey[Boolean]("retrieve-managed-sync", "If true, enables synchronizing the dependencies retrieved to the current build by removed unneeded files.", BSetting) - val configurationsToRetrieve = SettingKey[Option[Vector[Configuration]]]("configurations-to-retrieve", "An optional set of configurations from which to retrieve dependencies if retrieveManaged is set to true", BSetting) + val configurationsToRetrieve = SettingKey[Option[Seq[ConfigRef]]]("configurations-to-retrieve", "An optional set of configurations from which to retrieve dependencies if retrieveManaged is set to true", BSetting) val managedDirectory = SettingKey[File]("managed-directory", "Directory to which managed dependencies are retrieved.", BSetting) val classpathTypes = SettingKey[Set[String]]("classpath-types", "Artifact types that are included on the classpath.", BSetting) val publishArtifact = SettingKey[Boolean]("publish-artifact", "Enables (true) or disables (false) publishing an artifact.", AMinusSetting) val packagedArtifact = TaskKey[(Artifact, File)]("packaged-artifact", "Generates a packaged artifact, returning the Artifact and the produced File.", CTask) - val checksums = SettingKey[Vector[String]]("checksums", "The list of checksums to generate and to verify for dependencies.", BSetting) + val checksums = SettingKey[Seq[String]]("checksums", "The list of checksums to generate and to verify for dependencies.", BSetting) val forceUpdatePeriod = SettingKey[Option[FiniteDuration]]("force-update-period", "Duration after which to force a full update to occur", CSetting) val classifiersModule = TaskKey[GetClassifiersModule]("classifiers-module", rank = CTask) diff --git a/main/src/main/scala/sbt/internal/GlobalPlugin.scala b/main/src/main/scala/sbt/internal/GlobalPlugin.scala index d69f67d7e..3dc96f5bb 100644 --- a/main/src/main/scala/sbt/internal/GlobalPlugin.scala +++ b/main/src/main/scala/sbt/internal/GlobalPlugin.scala @@ -69,7 +69,7 @@ object GlobalPlugin { GlobalPluginData(projectID.value, projectDependencies.value, depMap, - resolvers.value, + resolvers.value.toVector, (fullClasspath in Runtime).value, (prods ++ intcp).distinct)(updateReport) } diff --git a/main/src/main/scala/sbt/internal/Load.scala b/main/src/main/scala/sbt/internal/Load.scala index f7c050d64..114196fb9 100755 --- a/main/src/main/scala/sbt/internal/Load.scala +++ b/main/src/main/scala/sbt/internal/Load.scala @@ -1131,7 +1131,7 @@ private[sbt] object Load { PluginData( removeEntries(cp, prod), prod, - Some(fullResolvers.value), + Some(fullResolvers.value.toVector), Some(update.value), opts ) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index 789b9bc4e..a4d40a450 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -12,6 +12,8 @@ The Scala Center is working with Lightbend to provide [an automatic migration to - sbt 1.0 renames `Global` as scope component to `Zero` to disambiguate from `GlobalScope`. [@eed3si9n][@eed3si9n] - sbt 1.0 uses `ConfigRef` in places where `String` was used to reference configuration, such as `update.value.configuration(...)`. Pass in `Configuration`, which implicitly converts to `ConfigRef`. +- sbt 1.0 changes `sourceArtifactTypes` and `docArtifactTypes` from `Set[String]` to `Seq[String]` settings. +- sbt 1.0 renames `ivyScala: IvyScala` to `scalaModuleInfo: ScalaModuleInfo`. #### Fixes