diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 4c48a9ee4..92add3fb5 100644 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -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 { diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 6bacd690d..cd5b520c0 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -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) diff --git a/main/src/main/scala/sbt/coursierint/CoursierInputsTasks.scala b/main/src/main/scala/sbt/coursierint/CoursierInputsTasks.scala index 9059f36ef..70b7f2ffc 100644 --- a/main/src/main/scala/sbt/coursierint/CoursierInputsTasks.scala +++ b/main/src/main/scala/sbt/coursierint/CoursierInputsTasks.scala @@ -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, diff --git a/sbt-app/src/sbt-test/dependency-management/make-pom/build.sbt b/sbt-app/src/sbt-test/dependency-management/make-pom/build.sbt index f0bfc1f18..03d7f883b 100644 --- a/sbt-app/src/sbt-test/dependency-management/make-pom/build.sbt +++ b/sbt-app/src/sbt-test/dependency-management/make-pom/build.sbt @@ -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() @@ -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) diff --git a/sbt-app/src/sbt-test/dependency-management/make-pom/test b/sbt-app/src/sbt-test/dependency-management/make-pom/test index 1e92792f9..b6f7bda7d 100644 --- a/sbt-app/src/sbt-test/dependency-management/make-pom/test +++ b/sbt-app/src/sbt-test/dependency-management/make-pom/test @@ -1,3 +1,5 @@ > checkPom > checkExtra > checkVersionPlusMapping +> checkAPIURL +> checkReleaseNotesURL