Merge pull request #7148 from armanbilge/feature/release-notes-url

Add `releaseNotesURL` setting
This commit is contained in:
eugene yokota 2023-03-07 10:37:46 -05:00 committed by GitHub
commit 4a470dcd17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 3 deletions

View File

@ -200,6 +200,7 @@ object Defaults extends BuildCommon {
autoCompilerPlugins :== true,
scalaHome :== None,
apiURL := None,
releaseNotesURL := None,
javaHome :== None,
discoveredJavaHomes := CrossJava.discoverJavaHomes,
javaHomes :== ListMap.empty,
@ -3388,7 +3389,12 @@ object Classpaths {
p1.extra(SbtPomExtraProperties.VERSION_SCHEME_KEY -> x)
case _ => p1
}
p2
val p3 = releaseNotesURL.value match {
case Some(u) =>
p2.extra(SbtPomExtraProperties.POM_RELEASE_NOTES_KEY -> u.toExternalForm)
case _ => p2
}
p3
}
def pluginProjectID: Initialize[ModuleID] =
Def.setting {

View File

@ -346,6 +346,7 @@ object Keys {
val entryApiURL = AttributeKey[URL]("entryApiURL", "Base URL for the API documentation for a classpath entry.")
val apiMappings = taskKey[Map[File, URL]]("Mappings from classpath entry to API documentation base URL.").withRank(BMinusSetting)
val autoAPIMappings = settingKey[Boolean]("If true, automatically manages mappings to the API doc URL.").withRank(BMinusSetting)
val releaseNotesURL = settingKey[Option[URL]]("URL for release notes.").withRank(BMinusSetting)
val scmInfo = settingKey[Option[ScmInfo]]("Basic SCM information for the project.").withRank(BMinusSetting)
val projectInfo = settingKey[ModuleInfo]("Addition project information like formal name, homepage, licenses etc.").withRank(CSetting)
val defaultConfiguration = settingKey[Option[Configuration]]("Defines the configuration used when none is specified for a dependency in ivyXML.").withRank(CSetting)

View File

@ -45,6 +45,7 @@ object CoursierInputsTasks {
sv: String,
sbv: String,
auOpt: Option[URL],
rnOpt: Option[URL],
description: String,
homepage: Option[URL],
vsOpt: Option[String],
@ -70,8 +71,15 @@ object CoursierInputsTasks {
proj1.withProperties(proj1.properties :+ (SbtPomExtraProperties.VERSION_SCHEME_KEY -> vs))
case _ => proj1
}
proj2.withInfo(
proj2.info.withDescription(description).withHomePage(homepage.fold("")(_.toString))
val proj3 = rnOpt match {
case Some(rn) =>
proj2.withProperties(
proj2.properties :+ (SbtPomExtraProperties.POM_RELEASE_NOTES_KEY -> rn.toString)
)
case _ => proj2
}
proj3.withInfo(
proj3.info.withDescription(description).withHomePage(homepage.fold("")(_.toString))
)
}
@ -84,6 +92,7 @@ object CoursierInputsTasks {
scalaVersion.value,
scalaBinaryVersion.value,
apiURL.value,
releaseNotesURL.value,
description.value,
homepage.value,
versionScheme.value,

View File

@ -5,7 +5,11 @@ lazy val root = (project in file(".")) settings (
TaskKey[Unit]("checkPom") := checkPom.value,
TaskKey[Unit]("checkExtra") := checkExtra.value,
TaskKey[Unit]("checkVersionPlusMapping") := checkVersionPlusMapping.value,
TaskKey[Unit]("checkAPIURL") := checkAPIURL.value,
TaskKey[Unit]("checkReleaseNotesURL") := checkReleaseNotesURL.value,
resolvers += Resolver.sonatypeRepo("snapshots"),
apiURL := Some(url("https://www.scala-sbt.org/1.x/api/")),
releaseNotesURL := Some(url("https://github.com/sbt/sbt/releases")),
makePomConfiguration := {
val p = makePomConfiguration.value
p.withExtra(<extra-tag/>)
@ -46,6 +50,16 @@ lazy val checkVersionPlusMapping = (readPom) map { (pomXml) =>
()
}
lazy val checkAPIURL = (readPom) map { (pomXml) =>
val notes = pomXml \ "properties" \ "info.apiURL"
if (notes.isEmpty) sys.error("'apiURL' not found in generated pom.xml.") else ()
}
lazy val checkReleaseNotesURL = (readPom) map { (pomXml) =>
val notes = pomXml \ "properties" \ "info.releaseNotesUrl"
if (notes.isEmpty) sys.error("'releaseNotesUrl' not found in generated pom.xml.") else ()
}
lazy val checkPom = Def task {
val pomXML = readPom.value
checkProject(pomXML)

View File

@ -1,3 +1,5 @@
> checkPom
> checkExtra
> checkVersionPlusMapping
> checkAPIURL
> checkReleaseNotesURL