1- // to release, bump major/minor/micro as appropriate,
2- // update NEWS, update version in README.md, tag, then
3- // publishSigned.
4- // Release tags should follow: http://semver.org/
5- import scalariform .formatter .preferences ._
6-
71ThisBuild / git.baseVersion := " 1.4.0"
82ThisBuild / organization := " com.typesafe"
93ThisBuild / Compile / scalacOptions := List (" -unchecked" , " -deprecation" , " -feature" )
@@ -25,11 +19,6 @@ ThisBuild / description := "configuration library for JVM languages
2519ThisBuild / licenses := List (" Apache-2.0" -> url(" https://www.apache.org/licenses/LICENSE-2.0" ))
2620ThisBuild / homepage := Option (url(" https://github.com/lightbend/config" ))
2721ThisBuild / pomIncludeRepository := { _ => false }
28- ThisBuild / publishTo := {
29- val nexus = " https://oss.sonatype.org/"
30- if ((ThisBuild / isSnapshot).value) Option (" Sonatype OSS Snapshots" at nexus + " content/repositories/snapshots" )
31- else Option (" Sonatype OSS Staging" at nexus + " service/local/staging/deploy/maven2" )
32- }
3322ThisBuild / publishMavenStyle := true
3423
3524lazy val root = (project in file(" ." ))
@@ -40,49 +29,39 @@ lazy val root = (project in file("."))
4029 simpleLibJava, simpleAppJava, complexAppJava
4130 )
4231 .settings(commonSettings)
43- .settings(nocomma {
44- name := " config-root"
45- git.baseVersion := (ThisBuild / git.baseVersion).value
46- doc / aggregate := false
47- doc := (configLib / Compile / doc).value
48- packageDoc / aggregate := false
32+ .settings(
33+ name := " config-root" ,
34+ git.baseVersion := (ThisBuild / git.baseVersion).value,
35+ doc / aggregate := false ,
36+ doc := (configLib / Compile / doc).value,
37+ packageDoc / aggregate := false ,
4938 packageDoc := (configLib / Compile / packageDoc).value
50- checkstyle / aggregate := false
51- checkstyle := (configLib / Compile / checkstyle).value
52- useGpg := true
53- PgpKeys .publishSigned / aggregate := false
54- PgpKeys .publishSigned := (PgpKeys .publishSigned in configLib).value
55- PgpKeys .publishLocalSigned / aggregate := false
56- PgpKeys .publishLocalSigned := (PgpKeys .publishLocalSigned in configLib).value
57- })
39+ )
5840
5941lazy val configLib = Project (" config" , file(" config" ))
6042 .enablePlugins(SbtOsgi )
6143 .dependsOn(testLib % " test->test" )
6244 .settings(osgiSettings)
63- .settings(nocomma {
64- autoScalaLibrary := false
65- crossPaths := false
66- libraryDependencies += " net.liftweb" %% " lift-json" % " 3.3.0" % Test
67- libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test
45+ .settings(
46+ autoScalaLibrary := false ,
47+ crossPaths := false ,
48+ libraryDependencies += " net.liftweb" %% " lift-json" % " 3.3.0" % Test ,
49+ libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test ,
6850
6951 Compile / compile / javacOptions ++= Seq (" -source" , " 1.8" , " -target" , " 1.8" ,
70- " -g" , " -Xlint:unchecked" )
52+ " -g" , " -Xlint:unchecked" ),
7153
7254 Compile / doc / javacOptions ++= Seq (" -group" , s " Public API (version ${version.value}) " , " com.typesafe.config:com.typesafe.config.parser" ,
73- " -group" , " Internal Implementation - Not ABI Stable" , " com.typesafe.config.impl" )
74- javadocSourceBaseUrl := {
75- for (gitHead <- com.typesafe.sbt.SbtGit .GitKeys .gitHeadCommit.value)
76- yield s " https://github.com/lightbend/config/blob/ $gitHead/config/src/main/java "
77- }
55+ " -group" , " Internal Implementation - Not ABI Stable" , " com.typesafe.config.impl" ),
56+ javadocSourceBaseUrl := Some (" https://github.com/lightbend/config/tree/main/config/src/main/java" ),
7857 // because we test some global state such as singleton caches,
7958 // we have to run tests in serial.
80- Test / parallelExecution := false
59+ Test / parallelExecution := false ,
8160
82- test / fork := true
83- Test / fork := true
84- run / fork := true
85- Test / run / fork := true
61+ test / fork := true ,
62+ Test / fork := true ,
63+ run / fork := true ,
64+ Test / run / fork := true ,
8665
8766 // env vars for tests
8867 Test / envVars ++= Map (" testList.0" -> " 0" ,
@@ -99,63 +78,15 @@ lazy val configLib = Project("config", file("config"))
9978 " SECRET_A" -> " A" , // ConfigTest.renderShowEnvVariableValues
10079 " SECRET_B" -> " B" , // ConfigTest.renderShowEnvVariableValues
10180 " SECRET_C" -> " C" // ConfigTest.renderShowEnvVariableValues
102- )
81+ ),
10382
104- OsgiKeys .exportPackage := Seq (" com.typesafe.config" , " com.typesafe.config.impl" )
105- publish := sys.error(" use publishSigned instead of plain publish" )
106- publishLocal := sys.error(" use publishLocalSigned instead of plain publishLocal" )
83+ OsgiKeys .exportPackage := Seq (" com.typesafe.config" , " com.typesafe.config.impl" ),
10784 Compile / packageBin / packageOptions +=
10885 Package .ManifestAttributes (" Automatic-Module-Name" -> " typesafe.config" )
109- scalariformPreferences := scalariformPreferences.value
110- .setPreference(IndentSpaces , 4 )
111- .setPreference(FirstArgumentOnNewline , Preserve )
112-
113- checkstyleConfigLocation := CheckstyleConfigLocation .File ((baseDirectory.value / " checkstyle-config.xml" ).toString)
114-
115- Compile / checkstyle := {
116- val log = streams.value.log
117- (Compile / checkstyle).value
118- val resultFile = (Compile / checkstyleOutputFile).value
119- val results = scala.xml.XML .loadFile(resultFile)
120- val errorFiles = results \\ " checkstyle" \\ " file"
121-
122- def errorFromXml (node : scala.xml.NodeSeq ): (String , String , String ) = {
123- val line : String = (node \ " @line" text)
124- val msg : String = (node \ " @message" text)
125- val source : String = (node \ " @source" text)
126- (line, msg, source)
127- }
128- def errorsFromXml (fileNode : scala.xml.NodeSeq ): Seq [(String , String , String , String )] = {
129- val name : String = (fileNode \ " @name" text)
130- val errors = (fileNode \\ " error" ) map { e => errorFromXml(e) }
131- errors map { case (line, error, source) => (name, line, error, source) }
132- }
133-
134- val errors = errorFiles flatMap { f => errorsFromXml(f) }
135-
136- if (errors.nonEmpty) {
137- for (e <- errors) {
138- log.error(s " ${e._1}: ${e._2}: ${e._3} (from ${e._4}) " )
139- }
140- throw new RuntimeException (s " Checkstyle failed with ${errors.size} errors " )
141- }
142- log.info(" No errors from checkstyle" )
143- }
144-
145- // add checkstyle as a dependency of doc
146- Compile / doc := ((Compile / doc).dependsOn(Compile / checkstyle)).value
147-
148- findbugsReportType := Some (FindbugsReport .Html )
149- findbugsReportPath := Some (crossTarget.value / " findbugs.html" )
150- findbugsEffort := FindbugsEffort .Maximum
151- findbugsMaxMemory := 2000
152- })
86+ )
15387
15488lazy val commonSettings : Seq [Setting [_]] = Def .settings(
15589 unpublished,
156- scalariformPreferences := scalariformPreferences.value
157- .setPreference(IndentSpaces , 4 )
158- .setPreference(FirstArgumentOnNewline , Preserve ),
15990 Compile / compile / javacOptions ++= Seq (" -source" , " 1.8" , " -target" , " 1.8" ),
16091)
16192
0 commit comments