diff --git a/.travis.yml b/.travis.yml
index 9e3b8e81..5ae498ff 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@ language: scala
env:
matrix:
- - TRAVIS_JDK=adopt@1.8.0-222
+ - TRAVIS_JDK=adopt@1.8-0
before_install: curl -Ls https://git.io/jabba | bash && . ~/.jabba/jabba.sh
install: jabba install "$TRAVIS_JDK" && jabba use $_ && java -Xmx32m -version
@@ -19,7 +19,7 @@ jobs:
- script: sbt verify
name: "Compile, test and build docs with JDK11"
- env: TRAVIS_JDK=adopt@1.11.0-4
+ env: TRAVIS_JDK=adopt@1.11-0
- stage: publish
script: sbt ci-release
@@ -48,7 +48,3 @@ cache:
before_cache:
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete
-
-notifications:
- email:
- on_success: never
diff --git a/README.markdown b/README.markdown
index 15527d74..65bbf648 100644
--- a/README.markdown
+++ b/README.markdown
@@ -1,12 +1,10 @@
-Paradox [![scaladex-badge][]][scaladex] [![travis-badge][]][travis] [![gitter-badge][]][gitter]
+Paradox [![scaladex-badge][]][scaladex] [![travis-badge][]][travis]
=======
[scaladex]: https://index.scala-lang.org/lightbend/paradox
[scaladex-badge]: https://index.scala-lang.org/lightbend/paradox/paradox/latest.svg
-[travis]: https://travis-ci.org/lightbend/paradox
-[travis-badge]: https://travis-ci.org/lightbend/paradox.svg?branch=master
-[gitter]: https://gitter.im/lightbend/paradox
-[gitter-badge]: https://badges.gitter.im/lightbend/paradox.svg
+[travis]: https://travis-ci.com/lightbend/paradox
+[travis-badge]: https://travis-ci.com/lightbend/paradox.svg?branch=master
Paradox is a markdown documentation tool for software projects. See [Paradox docs](http://developer.lightbend.com/docs/paradox/latest/) for details.
@@ -18,4 +16,4 @@ This software is licensed under the Apache 2 license.
**Paradox is NOT supported under the Lightbend subscription.**
-The project is maintained by the [Paradox Team](https://github.com/orgs/lightbend/teams/paradox) and all [the contributors](https://github.com/lightbend/paradox/graphs/contributors). Pull requests are very welcome–thanks in advance!
+The project is community maintained by [the contributors](https://github.com/lightbend/paradox/graphs/contributors). Pull requests are very welcome–thanks in advance!
diff --git a/core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala b/core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala
index d65b9b22..71d5e3cb 100644
--- a/core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala
+++ b/core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala
@@ -696,6 +696,7 @@ case class InlineGroupDirective(groups: Seq[String]) extends InlineDirective(gro
* Dependency directive.
*/
case class DependencyDirective(ctx: Writer.Context) extends LeafBlockDirective("dependency") {
+ val BomVersionSymbols = "bomVersionSymbols"
val VersionSymbol = "symbol"
val VersionValue = "value"
val ScalaBinaryVersionVar = "scala.binary.version"
@@ -714,6 +715,9 @@ case class DependencyDirective(ctx: Writer.Context) extends LeafBlockDirective("
def renderDependency(tools: String, node: DirectiveNode, printer: Printer): Unit = {
val classes = Seq("dependency", node.attributes.classesString).filter(_.nonEmpty)
+ val bomPostfixes = node.attributes.keys().asScala.toSeq
+ .filter(_.startsWith(BomVersionSymbols)).sorted.map(_.replace(BomVersionSymbols, ""))
+
val symbolPostfixes = node.attributes.keys().asScala.toSeq
.filter(_.startsWith(VersionSymbol)).sorted.map(_.replace(VersionSymbol, ""))
@@ -775,35 +779,61 @@ case class DependencyDirective(ctx: Writer.Context) extends LeafBlockDirective("
}
}
- def gradle(group: String, artifact: String, rawArtifact: String, version: String, scope: Option[String], classifier: Option[String]): String = {
- val artifactName = ScalaBinaryVersion match {
+ /**
+ * Replace Scala bin version in artifact postfix with the property.
+ */
+ def artifactNameWithScalaBin(artifact: String, rawArtifact: String, property: String) = {
+ ScalaBinaryVersion match {
case Some(v) if (rawArtifact.endsWith(scalaBinaryVersionVarUse)) =>
- "\"" + artifact.substring(0, artifact.length - v.length) + "${versions.ScalaBinary}\""
- case _ => s"'$artifact'"
+ artifact.substring(0, artifact.length - v.length) + property
+ case _ => artifact
}
- val conf = scope.getOrElse("compile")
- val extra = classifier.map(c => s", classifier: '$c'").getOrElse("")
- val v = if (symbols.contains(version)) s"versions.$version" else s"'$version'"
- s"""$conf group: '$group', name: $artifactName, version: $v$extra""".stripMargin
}
- def mvn(group: String, artifact: String, rawArtifact: String, version: String, scope: Option[String], classifier: Option[String]): String = {
- val artifactName = ScalaBinaryVersion match {
- case Some(v) if rawArtifact.endsWith(scalaBinaryVersionVarUse) =>
- artifact.substring(0, artifact.length - v.length) + "${scala.binary.version}"
- case _ => artifact
+ def gradle(group: String, artifact: String, rawArtifact: String, version: Option[String], scope: Option[String], classifier: Option[String]): String = {
+ val artifactName = artifactNameWithScalaBin(artifact, rawArtifact, "${versions.ScalaBinary}")
+ val conf = scope match {
+ case None => "implementation"
+ case Some("test") => "testImplementation"
+ case Some(other) => other
}
+ val ver = version.map(v => if (symbols.contains(v)) s":$${versions.$v}" else s":$v").getOrElse("")
+ val extra = classifier.map(c => s":$c").getOrElse("")
+ s"""$conf "$group:$artifactName$ver$extra""""
+ }
+
+ def gradleBom(group: String, artifact: String, rawArtifact: String, version: String): String = {
+ val artifactName = artifactNameWithScalaBin(artifact, rawArtifact, "${versions.ScalaBinary}")
+ val ver = if (symbols.contains(version)) s"versions.$version" else version
+ s""" implementation platform("$group:$artifactName:$ver")"""
+ }
+
+ def mvn(group: String, artifact: String, rawArtifact: String, version: Option[String], `type`: Option[String], scope: Option[String], classifier: Option[String], indent: String): String = {
+ val artifactName = artifactNameWithScalaBin(artifact, rawArtifact, "${scala.binary.version}")
val elements =
- Seq("groupId" -> group, "artifactId" -> artifactName, "version" -> {
- if (symbols.contains(version)) s"$${${dotted(version)}}" else version
- }) ++
- classifier.map("classifier" -> _) ++ scope.map("scope" -> _)
+ Seq("groupId" -> group, "artifactId" -> artifactName) ++
+ version.map(v => "version" -> {
+ if (symbols.contains(v)) s"$${${dotted(v)}}" else v
+ }) ++ classifier.map("classifier" -> _) ++ `type`.map("type" -> _) ++ scope.map("scope" -> _)
elements.map {
- case (element, value) => s" <$element>$value$element>"
- }.mkString("
|
- |versions += [
+ |def versions = [
| ScalaBinary: "2.12"
|]
|dependencies {
- | compile group: 'com.typesafe.akka', name: "akka-http_$${versions.ScalaBinary}", version: '10.0.10'
+ | implementation "com.typesafe.akka:akka-http_$${versions.ScalaBinary}:10.0.10"
|}
|
|
|
- |<dependency>
- | <groupId>com.example</groupId>
- | <artifactId>domain</artifactId>
- | <version>0.1.0-RC2</version>
- | <classifier>assets</classifier>
- | <scope>runtime</scope>
- |</dependency>
+ |<dependencies>
+ | <dependency>
+ | <groupId>com.example</groupId>
+ | <artifactId>domain</artifactId>
+ | <version>0.1.0-RC2</version>
+ | <classifier>assets</classifier>
+ | <scope>runtime</scope>
+ | </dependency>
+ |</dependencies>
|
|
|dependencies {
- | runtime group: 'com.example', name: 'domain', version: '0.1.0-RC2', classifier: 'assets'
+ | runtime "com.example:domain:0.1.0-RC2:assets"
+ |}
+ |
+ |
+ |
+ |libraryDependencies += "com.example" % "domain" % "0.1.0-RC2" % Test
+ |
+ |
+ |<dependencies>
+ | <dependency>
+ | <groupId>com.example</groupId>
+ | <artifactId>domain</artifactId>
+ | <version>0.1.0-RC2</version>
+ | <scope>test</scope>
+ | </dependency>
+ |</dependencies>
+ |
+ |
+ |dependencies {
+ | testImplementation "com.example:domain:0.1.0-RC2"
|}
|
|
|
- |<dependency>
- | <groupId>org.example</groupId>
- | <artifactId>foo_2.12</artifactId>
- | <version>0.1.0</version>
- |</dependency>
- |<dependency>
- | <groupId>org.example</groupId>
- | <artifactId>bar_2.12</artifactId>
- | <version>0.2.0</version>
- |</dependency>
+ |<dependencies>
+ | <dependency>
+ | <groupId>org.example</groupId>
+ | <artifactId>foo_2.12</artifactId>
+ | <version>0.1.0</version>
+ | </dependency>
+ | <dependency>
+ | <groupId>org.example</groupId>
+ | <artifactId>bar_2.12</artifactId>
+ | <version>0.2.0</version>
+ | </dependency>
+ |</dependencies>
|
|
|
|dependencies {
- | compile group: 'org.example', name: 'foo_2.12', version: '0.1.0',
- | compile group: 'org.example', name: 'bar_2.12', version: '0.2.0'
+ | implementation "org.example:foo_2.12:0.1.0"
+ | implementation "org.example:bar_2.12:0.2.0"
|}
|
|
@@ -263,22 +308,24 @@ class DependencyDirectiveSpec extends MarkdownBaseSpec {
| <akka.http.version>10.1.0</akka.http.version>
| <scala.binary.version>2.12</scala.binary.version>
|</properties>
- |<dependency>
- | <groupId>com.typesafe.akka</groupId>
- | <artifactId>akka-http_$${scala.binary.version}</artifactId>
- | <version>$${akka.http.version}</version>
- |</dependency>
+ |<dependencies>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-http_$${scala.binary.version}</artifactId>
+ | <version>$${akka.http.version}</version>
+ | </dependency>
+ |</dependencies>
|
|
|
- |versions += [
+ |def versions = [
| AkkaHttpVersion: "10.1.0",
| ScalaBinary: "2.12"
|]
|dependencies {
- | compile group: 'com.typesafe.akka', name: "akka-http_$${versions.ScalaBinary}", version: versions.AkkaHttpVersion
+ | implementation "com.typesafe.akka:akka-http_$${versions.ScalaBinary}:$${versions.AkkaHttpVersion}"
|}
|
|
|
- |versions += [
+ |def versions = [
| AkkaVersion: "2.5.29",
| AkkaHttpVersion: "10.1.0",
| ScalaBinary: "2.12"
|]
|dependencies {
- | compile group: 'com.typesafe.akka', name: "akka-stream_$${versions.ScalaBinary}", version: versions.AkkaVersion,
- | compile group: 'com.typesafe.akka', name: "akka-http_$${versions.ScalaBinary}", version: versions.AkkaHttpVersion
+ | implementation "com.typesafe.akka:akka-stream_$${versions.ScalaBinary}:$${versions.AkkaVersion}"
+ | implementation "com.typesafe.akka:akka-http_$${versions.ScalaBinary}:$${versions.AkkaHttpVersion}"
|}
|
|
+ |
+ |val AkkaHttpVersion = "10.1.0"
+ |libraryDependencies += "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion
+ |
+ |
+ |<properties>
+ | <scala.binary.version>2.12</scala.binary.version>
+ |</properties>
+ |<dependencyManagement>
+ | <dependencies>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-http-bom_$${scala.binary.version}</artifactId>
+ | <version>10.1.0</version>
+ | <type>pom</type>
+ | <scope>import</scope>
+ | </dependency>
+ | </dependencies>
+ |</dependencyManagement>
+ |<dependencies>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-http_$${scala.binary.version}</artifactId>
+ | </dependency>
+ |</dependencies>
+ |
+ |
+ |def versions = [
+ | ScalaBinary: "2.12"
+ |]
+ |dependencies {
+ | implementation platform("com.typesafe.akka:akka-http-bom_$${versions.ScalaBinary}:10.1.0")
+ |
+ | implementation "com.typesafe.akka:akka-http_$${versions.ScalaBinary}"
+ |}
+ |
+ |
+ |
+ |<properties>
+ | <scala.binary.version>2.12</scala.binary.version>
+ |</properties>
+ |<dependencyManagement>
+ | <dependencies>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-bom_$${scala.binary.version}</artifactId>
+ | <version>2.6.12</version>
+ | <type>pom</type>
+ | <scope>import</scope>
+ | </dependency>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-http-bom_$${scala.binary.version}</artifactId>
+ | <version>10.1.0</version>
+ | <type>pom</type>
+ | <scope>import</scope>
+ | </dependency>
+ | </dependencies>
+ |</dependencyManagement>
+ |<dependencies>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-stream_$${scala.binary.version}</artifactId>
+ | </dependency>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-http_$${scala.binary.version}</artifactId>
+ | </dependency>
+ |</dependencies>
+ |
+ |
+ |def versions = [
+ | ScalaBinary: "2.12"
+ |]
+ |dependencies {
+ | implementation platform("com.typesafe.akka:akka-bom_$${versions.ScalaBinary}:2.6.12")
+ | implementation platform("com.typesafe.akka:akka-http-bom_$${versions.ScalaBinary}:10.1.0")
+ |
+ | implementation "com.typesafe.akka:akka-stream_$${versions.ScalaBinary}"
+ | implementation "com.typesafe.akka:akka-http_$${versions.ScalaBinary}"
+ |}
+ |
+ |
+ |
+ |<properties>
+ | <scala.binary.version>2.12</scala.binary.version>
+ |</properties>
+ |<dependencyManagement>
+ | <dependencies>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-bom_$${scala.binary.version}</artifactId>
+ | <version>2.6.12</version>
+ | <type>pom</type>
+ | <scope>import</scope>
+ | </dependency>
+ | </dependencies>
+ |</dependencyManagement>
+ |<dependencies>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-stream_$${scala.binary.version}</artifactId>
+ | </dependency>
+ | <dependency>
+ | <groupId>com.typesafe.akka</groupId>
+ | <artifactId>akka-http_$${scala.binary.version}</artifactId>
+ | </dependency>
+ |</dependencies>
+ |
+ |
+ |def versions = [
+ | ScalaBinary: "2.12"
+ |]
+ |dependencies {
+ | implementation platform("com.typesafe.akka:akka-bom_$${versions.ScalaBinary}:2.6.12")
+ |
+ | implementation "com.typesafe.akka:akka-stream_$${versions.ScalaBinary}"
+ | implementation "com.typesafe.akka:akka-http_$${versions.ScalaBinary}"
+ |}
+ |
+ |