1
1
import sbtcrossproject .CrossPlugin .autoImport .{crossProject , CrossType }
2
2
3
- publish / skip := true // root project
3
+ publish / skip := true // root project
4
4
5
5
ThisBuild / startYear := Some (2002 )
6
- ThisBuild / licenses += ((" Apache-2.0" , url(" https://www.apache.org/licenses/LICENSE-2.0" )))
6
+ ThisBuild / licenses += (
7
+ (
8
+ " Apache-2.0" ,
9
+ url(" https://www.apache.org/licenses/LICENSE-2.0" )
10
+ )
11
+ )
7
12
8
13
// because it doesn't declare it itself
9
14
ThisBuild / libraryDependencySchemes += " org.scala-js" %% " scalajs-library" % " semver-spec"
@@ -14,12 +19,14 @@ lazy val configSettings: Seq[Setting[_]] = Seq(
14
19
val sv = scalaVersion.value
15
20
Seq (
16
21
CrossVersion .partialVersion(sv) match {
17
- case Some ((major, minor)) if major > 2 || (major == 2 && minor >= 13 ) => file(dir.getPath ++ " -2.13+" )
18
- case _ => file(dir.getPath ++ " -2.13-" )
22
+ case Some ((major, minor))
23
+ if major > 2 || (major == 2 && minor >= 13 ) =>
24
+ file(dir.getPath ++ " -2.13+" )
25
+ case _ => file(dir.getPath ++ " -2.13-" )
19
26
},
20
27
CrossVersion .partialVersion(sv) match {
21
- case Some ((2 , _)) => file(dir.getPath ++ " -2.x" )
22
- case _ => file(dir.getPath ++ " -3.x" )
28
+ case Some ((2 , _)) => file(dir.getPath ++ " -2.x" )
29
+ case _ => file(dir.getPath ++ " -3.x" )
23
30
}
24
31
)
25
32
}
@@ -33,30 +40,30 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
33
40
.settings(ScalaModulePlugin .scalaModuleSettings)
34
41
.jvmSettings(ScalaModulePlugin .scalaModuleOsgiSettings)
35
42
.settings(
36
- name := " scala-xml" ,
43
+ name := " scala-xml" ,
37
44
scalaModuleAutomaticModuleName := Some (" scala.xml" ),
38
45
crossScalaVersions := Seq (" 2.13.7" , " 2.12.15" , " 3.0.2" , " 3.1.0" ),
39
46
scalaVersion := " 2.12.15" ,
40
-
41
47
// Don't publish for Scala 3.1 or later, only from 3.0
42
48
publish / skip := (CrossVersion .partialVersion(scalaVersion.value) match {
43
49
case Some ((3 , x)) if x > 0 => true
44
50
case _ => false
45
51
}),
46
-
47
52
scalacOptions ++= (CrossVersion .partialVersion(scalaVersion.value) match {
48
53
case Some ((3 , _)) =>
49
54
Seq (" -language:Scala2" )
50
55
case _ =>
51
56
// Compiler team advised avoiding the -Xsource:3 option for releases.
52
57
// The output with -Xsource:3 should be periodically checked, though.
53
- Seq (" -deprecation:false" , " -feature" , " -Xlint:-stars-align,-nullary-unit,_" )
58
+ Seq (
59
+ " -deprecation:false" ,
60
+ " -feature" ,
61
+ " -Xlint:-stars-align,-nullary-unit,_"
62
+ )
54
63
}),
55
-
56
- Test / scalacOptions += " -Xxml:coalescing" ,
57
-
58
- headerLicense := Some (HeaderLicense .Custom (
59
- s """ |Scala (https://www.scala-lang.org)
64
+ Test / scalacOptions += " -Xxml:coalescing" ,
65
+ headerLicense := Some (
66
+ HeaderLicense .Custom (s """ |Scala (https://www.scala-lang.org)
60
67
|
61
68
|Copyright EPFL and Lightbend, Inc.
62
69
|
@@ -65,8 +72,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
65
72
|
66
73
|See the NOTICE file distributed with this work for
67
74
|additional information regarding copyright ownership.
68
- | """ .stripMargin)),
69
-
75
+ | """ .stripMargin)
76
+ ),
70
77
// Note: Change back to BinaryAndSourceCompatible after 2.1.0 release
71
78
versionPolicyIntention := Compatibility .BinaryCompatible ,
72
79
// Note: See discussion on non-JVM Mima in https://github.com/scala/scala-xml/pull/517
@@ -77,43 +84,64 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
77
84
// afaict this is just a JDK 8 vs 16 difference, producing a false positive when
78
85
// we compare classes built on JDK 16 (which we only do on CI, not at release time)
79
86
// to previous-version artifacts that were built on 8. see scala/scala-xml#501
80
- exclude[DirectMissingMethodProblem ](" scala.xml.include.sax.XIncluder.declaration" ),
81
-
87
+ exclude[DirectMissingMethodProblem ](
88
+ " scala.xml.include.sax.XIncluder.declaration"
89
+ ),
82
90
// necessitated by the switch from DefaultHandler to DefaultHandler2 in FactoryAdapter:
83
- exclude[MissingTypesProblem ](" scala.xml.parsing.FactoryAdapter" ), // see #549
91
+ exclude[MissingTypesProblem ](
92
+ " scala.xml.parsing.FactoryAdapter"
93
+ ), // see #549
84
94
85
95
// necessitated by the introduction of new abstract methods in FactoryAdapter:
86
- exclude[ReversedMissingMethodProblem ](" scala.xml.parsing.FactoryAdapter.createComment" ), // see #549
87
- exclude[ReversedMissingMethodProblem ](" scala.xml.parsing.FactoryAdapter.createPCData" ) // see #558
96
+ exclude[ReversedMissingMethodProblem ](
97
+ " scala.xml.parsing.FactoryAdapter.createComment"
98
+ ), // see #549
99
+ exclude[ReversedMissingMethodProblem ](
100
+ " scala.xml.parsing.FactoryAdapter.createPCData"
101
+ ) // see #558
88
102
)
89
103
},
90
104
// Mima signature checking stopped working after 3.0.2 upgrade, see #557
91
- mimaReportSignatureProblems := (CrossVersion .partialVersion(scalaVersion.value) match {
105
+ mimaReportSignatureProblems := (CrossVersion .partialVersion(
106
+ scalaVersion.value
107
+ ) match {
92
108
case Some ((3 , _)) => false
93
- case _ => true
109
+ case _ => true
94
110
}),
95
-
96
- apiMappings ++= scalaInstance.value.libraryJars.filter { file =>
97
- file.getName.startsWith(" scala-library" ) && file.getName.endsWith(" .jar" )
98
- }.map { libraryJar =>
99
- libraryJar ->
100
- url(s " http://www.scala-lang.org/api/ ${scalaVersion.value}/ " )
101
- }.toMap ++ {
102
- // http://stackoverflow.com/questions/16934488
103
- Option (System .getProperty(" sun.boot.class.path" )).flatMap { classPath =>
104
- classPath.split(java.io.File .pathSeparator).find(_.endsWith(java.io.File .separator + " rt.jar" ))
105
- }.map { jarPath =>
106
- Map (
107
- file(jarPath)
108
- -> url(" http://docs.oracle.com/javase/8/docs/api" )
111
+ apiMappings ++= scalaInstance.value.libraryJars
112
+ .filter { file =>
113
+ file.getName.startsWith(" scala-library" ) && file.getName.endsWith(
114
+ " .jar"
109
115
)
110
- } getOrElse {
116
+ }
117
+ .map { libraryJar =>
118
+ libraryJar ->
119
+ url(s " http://www.scala-lang.org/api/ ${scalaVersion.value}/ " )
120
+ }
121
+ .toMap ++ {
122
+ // http://stackoverflow.com/questions/16934488
123
+ Option (System .getProperty(" sun.boot.class.path" ))
124
+ .flatMap { classPath =>
125
+ classPath
126
+ .split(java.io.File .pathSeparator)
127
+ .find(_.endsWith(java.io.File .separator + " rt.jar" ))
128
+ }
129
+ .map { jarPath =>
130
+ Map (
131
+ file(jarPath)
132
+ -> url(" http://docs.oracle.com/javase/8/docs/api" )
133
+ )
134
+ } getOrElse {
111
135
// If everything fails, jam in Java 11 modules.
112
136
Map (
113
137
file(" /modules/java.base" )
114
- -> url(" https://docs.oracle.com/en/java/javase/11/docs/api/java.base" ),
138
+ -> url(
139
+ " https://docs.oracle.com/en/java/javase/11/docs/api/java.base"
140
+ ),
115
141
file(" /modules/java.xml" )
116
- -> url(" https://docs.oracle.com/en/java/javase/11/docs/api/java.xml" )
142
+ -> url(
143
+ " https://docs.oracle.com/en/java/javase/11/docs/api/java.xml"
144
+ )
117
145
)
118
146
}
119
147
}
@@ -123,16 +151,17 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
123
151
)
124
152
.jvmSettings(
125
153
OsgiKeys .exportPackage := Seq (s " scala.xml.*;version= ${version.value}" ),
126
-
127
154
libraryDependencies += " junit" % " junit" % " 4.13.2" % Test ,
128
- libraryDependencies += " com.github.sbt" % " junit-interface" % " 0.13.2 " % Test ,
155
+ libraryDependencies += " com.github.sbt" % " junit-interface" % " 0.13.3 " % Test ,
129
156
libraryDependencies += " org.apache.commons" % " commons-lang3" % " 3.12.0" % Test ,
130
- libraryDependencies ++= (CrossVersion .partialVersion(scalaVersion.value) match {
157
+ libraryDependencies ++= (CrossVersion .partialVersion(
158
+ scalaVersion.value
159
+ ) match {
131
160
case Some ((3 , _)) =>
132
161
Seq ()
133
162
case _ =>
134
163
Seq (" org.scala-lang" % " scala-compiler" % scalaVersion.value % Test )
135
- }),
164
+ })
136
165
)
137
166
.jsSettings(
138
167
// Scala.js cannot run forked tests
@@ -158,7 +187,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
158
187
.fold(w => throw w.resolveException, identity(_))
159
188
val jarPath = cp
160
189
.find(_.toString.contains(" junit-plugin" ))
161
- .getOrElse(throw new Exception (" Can't find Scala Native junit-plugin jar" ))
190
+ .getOrElse(
191
+ throw new Exception (" Can't find Scala Native junit-plugin jar" )
192
+ )
162
193
s " -Xplugin: $jarPath"
163
194
},
164
195
Test / testOptions += Tests .Argument (TestFrameworks .JUnit , " -a" , " -s" , " -v" )
0 commit comments