mirror of https://github.com/sbt/sbt.git
Merge pull request #3215 from eed3si9n/wip/moduleid
[sbt 0.13] backport withXXX for ModuleID and Artifact
This commit is contained in:
commit
5c85acb17f
|
|
@ -9,6 +9,30 @@ import sbt.serialization._
|
|||
|
||||
final case class Artifact(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Iterable[Configuration], url: Option[URL], extraAttributes: Map[String, String]) {
|
||||
def extra(attributes: (String, String)*) = Artifact(name, `type`, extension, classifier, configurations, url, extraAttributes ++ ModuleID.checkE(attributes))
|
||||
|
||||
/** Copy with a new type. */
|
||||
def withType(`type`: String): Artifact =
|
||||
copy(`type` = `type`)
|
||||
|
||||
/** Copy with a new extension. */
|
||||
def withExtension(extension: String): Artifact =
|
||||
copy(extension = extension)
|
||||
|
||||
/** Copy with a new classifier. */
|
||||
def withClassifier(classifier: Option[String]): Artifact =
|
||||
copy(classifier = classifier)
|
||||
|
||||
/** Copy with new configurations. */
|
||||
def withConfigurations(configurations: Vector[Configuration]): Artifact =
|
||||
copy(configurations = configurations)
|
||||
|
||||
/** Copy with a new url. */
|
||||
def withUrl(url: Option[URL]): Artifact =
|
||||
copy(url = url)
|
||||
|
||||
/** Copy with new extraAttributes. */
|
||||
def withExtraAttributes(extraAttributes: Map[String, String]): Artifact =
|
||||
copy(extraAttributes = extraAttributes)
|
||||
}
|
||||
|
||||
import Configurations.{ config, Docs, Optional, Pom, Sources, Test }
|
||||
|
|
|
|||
|
|
@ -29,6 +29,50 @@ final case class ModuleID(organization: String, name: String, revision: String,
|
|||
/** Specifies the cross-version behavior for this module. See [CrossVersion] for details.*/
|
||||
def cross(v: CrossVersion): ModuleID = copy(crossVersion = v)
|
||||
|
||||
/** Copy with a new organization. */
|
||||
def withOrganization(organization: String): ModuleID =
|
||||
copy(organization = organization)
|
||||
|
||||
/** Copy with a new name. */
|
||||
def withName(name: String): ModuleID =
|
||||
copy(name = name)
|
||||
|
||||
/** Copy with a new revision. */
|
||||
def withRevision(revision: String): ModuleID =
|
||||
copy(revision = revision)
|
||||
|
||||
/** Copy with new configurations. */
|
||||
def withConfigurations(configurations: Option[String]): ModuleID =
|
||||
copy(configurations = configurations)
|
||||
|
||||
/** Copy with new isChanging. */
|
||||
def withIsChanging(isChanging: Boolean): ModuleID =
|
||||
copy(isChanging = isChanging)
|
||||
|
||||
/** Copy with new isTransitive. */
|
||||
def withIsTransitive(isTransitive: Boolean): ModuleID =
|
||||
copy(isTransitive = isTransitive)
|
||||
|
||||
/** Copy with new isForce. */
|
||||
def withIsForce(isForce: Boolean): ModuleID =
|
||||
copy(isForce = isForce)
|
||||
|
||||
/** Copy with new explicitArtifacts. */
|
||||
def withExplicitArtifacts(explicitArtifacts: Vector[Artifact]): ModuleID =
|
||||
copy(explicitArtifacts = explicitArtifacts)
|
||||
|
||||
/** Copy with new exclusions. */
|
||||
def withExclusions(exclusions: Vector[ExclusionRule]): ModuleID =
|
||||
copy(exclusions = exclusions)
|
||||
|
||||
/** Copy with new extraAttributes. */
|
||||
def withExtraAttributes(extraAttributes: Map[String, String]): ModuleID =
|
||||
copy(extraAttributes = extraAttributes)
|
||||
|
||||
/** Copy with new crossVersion. */
|
||||
def withCrossVersion(crossVersion: CrossVersion): ModuleID =
|
||||
copy(crossVersion = crossVersion)
|
||||
|
||||
// () required for chaining
|
||||
/** Do not follow dependencies of this module. Synonym for `intransitive`.*/
|
||||
def notTransitive() = intransitive()
|
||||
|
|
|
|||
Loading…
Reference in New Issue