1- import java .net .URL
1+ import xerial .sbt .Sonatype ._
2+
23import scala .xml .transform .{RewriteRule , RuleTransformer }
34import scala .xml .{Node => XmlNode , NodeSeq => XmlNodeSeq , _ }
45
5- // @formatter:off
6-
76//
87// Environment variables used by the build:
98// GRAPHVIZ_DOT_PATH - Full path to Graphviz dot utility. If not defined Scaladocs will be build without diagrams.
109// JAR_BUILT_BY - Name to be added to Jar metadata field "Built-By" (defaults to System.getProperty("user.name")
1110//
1211
13- val projectVersion = " 0.8.0"
12+ val projectVersion = " 0.8.0.1-SNAPSHOT "
1413val versionTagDir = if (projectVersion.endsWith(" SNAPSHOT" )) " master" else " v." + projectVersion
15- val _scalaVersions = Seq (" 3.2.2 " , " 2.13.10 " , " 2.12.17 " )
14+ val _scalaVersions = Seq (" 3.3.3 " , " 2.13.13 " , " 2.12.19 " )
1615val _scalaVersion = _scalaVersions.head
1716
18- ThisBuild / version := projectVersion
19- ThisBuild / crossScalaVersions := _scalaVersions
20- ThisBuild / scalaVersion := _scalaVersion
21- ThisBuild / organization := " org.scalafx"
17+ ThisBuild / version := projectVersion
18+ ThisBuild / crossScalaVersions := _scalaVersions
19+ ThisBuild / scalaVersion := _scalaVersion
20+ ThisBuild / organization := " org.scalafx"
2221
23- publishArtifact := false
24- publish / skip := true
22+ publishArtifact := false
23+ publish / skip := true
24+
25+ lazy val libEnumeratum = " com.beachape" %% " enumeratum" % " 1.7.3"
26+ lazy val libLogbackClassic = " ch.qos.logback" % " logback-classic" % " 1.5.3"
27+ lazy val libParadise = " org.scalamacros" % " paradise" % " 2.1.1" cross CrossVersion .full
28+ lazy val libScalaLogging = " com.typesafe.scala-logging" %% " scala-logging" % " 3.9.5"
29+ lazy val libScalaFX = " org.scalafx" %% " scalafx" % " 22.0.0-R33"
30+ lazy val libScalaFXML = " org.scalafx" %% " scalafxml-core-sfx8" % " 0.5"
31+ lazy val libScalaTest = " org.scalatest" %% " scalatest" % " 3.2.18"
32+ lazy val libScalaReflect = " org.scala-lang" % " scala-reflect"
2533
2634def isScala2 (scalaVersion : String ): Boolean = {
2735 CrossVersion .partialVersion(scalaVersion) match {
@@ -63,7 +71,7 @@ lazy val scalaFXExtras = (project in file("scalafx-extras")).settings(
6371 baseDirectory.value.toString,
6472 " -doc-root-content" ,
6573 baseDirectory.value + " /src/main/scala/root-doc.creole"
66- ),
74+ )
6775)
6876
6977// ScalaFX Extras Demos project
@@ -77,8 +85,8 @@ lazy val scalaFXExtrasDemos = (project in file("scalafx-extras-demos")).settings
7785 ),
7886 publishArtifact := false ,
7987 libraryDependencies ++= Seq (
80- " com.typesafe.scala-logging " %% " scala-logging " % " 3.9.5 " ,
81- " ch.qos.logback " % " logback-classic " % " 1.4.7 " % Runtime
88+ libScalaLogging ,
89+ libLogbackClassic % Runtime
8290 )
8391).dependsOn(scalaFXExtras % " compile;test->test" )
8492
@@ -99,14 +107,15 @@ lazy val scalaFXExtrasSettings = Seq(
99107 " -encoding" ,
100108 " utf8" ,
101109 " -feature" ,
102- " -release" , " 8"
110+ " -release" ,
111+ " 8"
103112 ) ++
104113 (
105114 if (isScala2(scalaVersion.value))
106115 Seq (
107116 " -explaintypes" ,
108117 " -Xcheckinit" ,
109- " -Xsource:3" ,
118+ " -Xsource:3"
110119// "-Xlint",
111120// "-Xcheckinit",
112121// "-Xlint:missing-interpolator",
@@ -123,10 +132,11 @@ lazy val scalaFXExtrasSettings = Seq(
123132 Compile / doc / scalacOptions ++= Opts .doc.version(projectVersion),
124133 Compile / doc / scalacOptions ++= Seq (" -doc-footer" , s " ScalaFX Extras API v. $projectVersion" ),
125134 Compile / doc / scalacOptions ++= (
126- if (isScala2(scalaVersion.value))
135+ if (isScala2(scalaVersion.value))
127136 Seq (
128137 s " -doc-external-doc: ${scalaInstance.value.libraryJars.head}#https://www.scala-lang.org/api/ ${scalaVersion.value}/ " ,
129- " -doc-source-url" , " https://github.com/SscalaFX-Extras/scalafx-extras/blob/" + versionTagDir + " /scalafx/€{FILE_PATH}.scala"
138+ " -doc-source-url" ,
139+ " https://github.com/SscalaFX-Extras/scalafx-extras/blob/" + versionTagDir + " /scalafx/€{FILE_PATH}.scala"
130140 ) ++ (
131141 Option (System .getenv(" GRAPHVIZ_DOT_PATH" )) match {
132142 case Some (path) => Seq (" -diagrams" , " -diagrams-dot-path" , path)
@@ -141,40 +151,39 @@ lazy val scalaFXExtrasSettings = Seq(
141151 // If using Scala 2.12 or lower, enable macro processing through compiler plugin
142152 libraryDependencies ++= (
143153 if (isScala2_12(scalaVersion.value))
144- Seq (compilerPlugin(
145- " org.scalamacros" % " paradise" % " 2.1.1" cross CrossVersion .full
146- ))
154+ Seq (compilerPlugin(libParadise))
147155 else
148156 Seq .empty[sbt.ModuleID ]
149157 ),
150158 libraryDependencies ++= Seq (
151- " org.scalafx " %% " scalafx " % " 20.0.0-R31 " ,
152- " org.scalatest " %% " scalatest " % " 3.2.15 " % " test"
159+ libScalaFX ,
160+ libScalaTest % " test"
153161 ),
154162 libraryDependencies ++= (
155163 if (isScala2(scalaVersion.value))
156164 Seq (
157- " com.beachape " %% " enumeratum " % " 1.7.2 " ,
158- " org.scala-lang " % " scala-reflect " % scalaVersion.value,
159- " org.scalafx " %% " scalafxml-core-sfx8 " % " 0.5 "
165+ libEnumeratum ,
166+ libScalaReflect % scalaVersion.value,
167+ libScalaFXML
160168 )
161169 else
162170 Seq .empty[sbt.ModuleID ]
163171 ),
164172 // Use `pomPostProcess` to remove dependencies marked as "provided" from publishing in POM
165173 // This is to avoid dependency on wrong OS version JavaFX libraries
166174 // See also [https://stackoverflow.com/questions/27835740/sbt-exclude-certain-dependency-only-during-publish]
167- pomPostProcess := { node : XmlNode =>
168- new RuleTransformer (new RewriteRule {
169- override def transform (node : XmlNode ): XmlNodeSeq = node match {
170- case e : Elem if e.label == " dependency" && e.child.exists(c => c.label == " scope" && c.text == " provided" ) =>
171- val organization = e.child.filter(_.label == " groupId" ).flatMap(_.text).mkString
172- val artifact = e.child.filter(_.label == " artifactId" ).flatMap(_.text).mkString
173- val version = e.child.filter(_.label == " version" ).flatMap(_.text).mkString
174- Comment (s " provided dependency $organization# $artifact; $version has been omitted " )
175- case _ => node
176- }
177- }).transform(node).head
175+ pomPostProcess := {
176+ node : XmlNode =>
177+ new RuleTransformer (new RewriteRule {
178+ override def transform (node : XmlNode ): XmlNodeSeq = node match {
179+ case e : Elem if e.label == " dependency" && e.child.exists(c => c.label == " scope" && c.text == " provided" ) =>
180+ val organization = e.child.filter(_.label == " groupId" ).flatMap(_.text).mkString
181+ val artifact = e.child.filter(_.label == " artifactId" ).flatMap(_.text).mkString
182+ val version = e.child.filter(_.label == " version" ).flatMap(_.text).mkString
183+ Comment (s " provided dependency $organization# $artifact; $version has been omitted " )
184+ case _ => node
185+ }
186+ }).transform(node).head
178187 },
179188 autoAPIMappings := true ,
180189 manifestSetting,
@@ -204,14 +213,12 @@ lazy val manifestSetting = packageOptions += {
204213 )
205214}
206215
207- import xerial .sbt .Sonatype .*
208-
209216// Metadata needed by Maven Central
210217// See also http://maven.apache.org/pom.html#Developers
211218lazy val mavenCentralSettings = Seq (
212- homepage := Some (new URL (" https://www.scalafx.org/" )),
213- startYear := Some (2016 ),
214- licenses := Seq ((" BSD" , new URL (" https://github.com/scalafx/scalafx-extras/blob/master/LICENSE.txt" ))),
219+ homepage := Some (new URI (" https://www.scalafx.org/" ).toURL ),
220+ startYear := Some (2016 ),
221+ licenses := Seq ((" BSD" , new URI (" https://github.com/scalafx/scalafx-extras/blob/master/LICENSE.txt" ).toURL )),
215222 sonatypeProfileName := " org.scalafx" ,
216223 sonatypeProjectHosting
:= Some (
GitHubHosting (
" org.scalafx" ,
" scalafx-extras" ,
" [email protected] " )),
217224 publishMavenStyle := true ,
0 commit comments