@@ -84,7 +84,7 @@ lazy val publishSettings : Seq[Setting[_]] = Seq(
84
84
val mappings = artifacts.toSeq.map { case (a, f) =>
85
85
val typeSuffix = a.`type` match {
86
86
case " pom" => " -pom.xml"
87
- case " bundle " | " jar" => " .jar"
87
+ case " jar" => " .jar"
88
88
case " doc" => " -docs.jar"
89
89
case tpe => s " - $tpe. ${a.extension}"
90
90
}
@@ -99,6 +99,8 @@ lazy val publishSettings : Seq[Setting[_]] = Seq(
99
99
if (file.exists) List (Credentials (file))
100
100
else Nil
101
101
},
102
+ // Add a "default" Ivy configuration because sbt expects the Scala distribution to have one:
103
+ ivyConfigurations += Configuration (" default" , " Default" , true , List (Configurations .Runtime ), true ),
102
104
publishMavenStyle := true
103
105
)
104
106
@@ -236,8 +238,8 @@ def fixPom(extra: (String, scala.xml.Node)*): Setting[_] = {
236
238
) ++ extra) }
237
239
}
238
240
239
- /** Remove unwanted dependencies from the POM. */
240
- def removePomDependencies (deps : (String , String )* ): Setting [_] = {
241
+ /** Remove unwanted dependencies from the POM and ivy.xml . */
242
+ def removePomDependencies (deps : (String , String )* ): Seq [ Setting [_]] = Seq (
241
243
pomPostProcess := { n =>
242
244
val n2 = pomPostProcess.value.apply(n)
243
245
import scala .xml ._
@@ -252,14 +254,40 @@ def removePomDependencies(deps: (String, String)*): Setting[_] = {
252
254
case n => Seq (n)
253
255
}
254
256
})).transform(Seq (n2)).head
257
+ },
258
+ deliverLocal := {
259
+ import scala .xml ._
260
+ import scala .xml .transform ._
261
+ val f = deliverLocal.value
262
+ val e = (new RuleTransformer (new RewriteRule {
263
+ override def transform (node : Node ) = node match {
264
+ case e : Elem if e.label == " dependency" && {
265
+ val org = e.attribute(" org" ).getOrElse(" " ).toString
266
+ val name = e.attribute(" name" ).getOrElse(" " ).toString
267
+ deps.exists { case (g, a) =>
268
+ org == g && (name == a || name == (a + " _" + scalaBinaryVersion.value))
269
+ }
270
+ } => Seq .empty
271
+ case n => Seq (n)
272
+ }
273
+ })).transform(Seq (XML .loadFile(f))).head
274
+ XML .save(f.getAbsolutePath, e, xmlDecl = true )
275
+ f
255
276
}
256
- }
277
+ )
257
278
258
279
val disableDocs = Seq [Setting [_]](
259
280
sources in (Compile , doc) := Seq .empty,
260
281
publishArtifact in (Compile , packageDoc) := false
261
282
)
262
283
284
+ val disablePublishing = Seq [Setting [_]](
285
+ publishArtifact := false ,
286
+ // The above is enough for Maven repos but it doesn't prevent publishing of ivy.xml files
287
+ publish := {},
288
+ publishLocal := {}
289
+ )
290
+
263
291
lazy val setJarLocation : Setting [_] =
264
292
artifactPath in packageBin in Compile := {
265
293
// two lines below are copied over from sbt's sources:
@@ -397,43 +425,44 @@ lazy val compiler = configureAsSubproject(project)
397
425
" /project/description" -> <description >Compiler for the Scala Programming Language </description >,
398
426
" /project/packaging" -> <packaging >jar</packaging >
399
427
),
400
- apiURL := None ,
401
- removePomDependencies(
402
- (" org.apache.ant" , " ant" ),
403
- (" org.scala-lang.modules" , " scala-asm" )
404
- )
428
+ apiURL := None
405
429
)
430
+ .settings(removePomDependencies(
431
+ (" org.apache.ant" , " ant" ),
432
+ (" org.scala-lang.modules" , " scala-asm" )
433
+ ): _* )
406
434
.dependsOn(library, reflect)
407
435
408
436
lazy val interactive = configureAsSubproject(project)
409
437
.settings(disableDocs : _* )
438
+ .settings(disablePublishing : _* )
410
439
.settings(
411
440
name := " scala-compiler-interactive" ,
412
- description := " Scala Interactive Compiler" ,
413
- publishArtifact := false
441
+ description := " Scala Interactive Compiler"
414
442
)
415
443
.dependsOn(compiler)
416
444
417
445
lazy val repl = configureAsSubproject(project)
418
446
.settings(disableDocs : _* )
447
+ .settings(disablePublishing : _* )
419
448
.settings(
420
449
connectInput in run := true ,
421
- publishArtifact := false ,
422
450
run <<= (run in Compile ).partialInput(" -usejavacp" ) // Automatically add this so that `repl/run` works without additional arguments.
423
451
)
424
452
.dependsOn(compiler, interactive)
425
453
426
454
lazy val replJline = configureAsSubproject(Project (" repl-jline" , file(" ." ) / " src" / " repl-jline" ))
427
455
.settings(disableDocs : _* )
456
+ .settings(disablePublishing : _* )
428
457
.settings(
429
458
libraryDependencies += jlineDep,
430
- name := " scala-repl-jline" ,
431
- publishArtifact := false
459
+ name := " scala-repl-jline"
432
460
)
433
461
.dependsOn(repl)
434
462
435
463
lazy val replJlineEmbedded = Project (" repl-jline-embedded" , file(" ." ) / " target" / " repl-jline-embedded-src-dummy" )
436
464
.settings(scalaSubprojectSettings : _* )
465
+ .settings(disablePublishing : _* )
437
466
.settings(
438
467
name := " scala-repl-jline-embedded" ,
439
468
// There is nothing to compile for this project. Instead we use the compile task to create
@@ -464,18 +493,17 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target"
464
493
val outdir = (classDirectory in Compile ).value
465
494
JarJar (inputs, outdir, config)
466
495
}),
467
- publishArtifact := false ,
468
496
connectInput in run := true
469
497
)
470
498
.dependsOn(replJline)
471
499
472
500
lazy val scaladoc = configureAsSubproject(project)
473
501
.settings(disableDocs : _* )
502
+ .settings(disablePublishing : _* )
474
503
.settings(
475
504
name := " scala-compiler-doc" ,
476
505
description := " Scala Documentation Generator" ,
477
506
libraryDependencies ++= Seq (scalaXmlDep, scalaParserCombinatorsDep, partestDep),
478
- publishArtifact := false ,
479
507
includeFilter in unmanagedResources in Compile := " *.html" | " *.css" | " *.gif" | " *.png" | " *.js" | " *.txt"
480
508
)
481
509
.dependsOn(compiler)
@@ -497,10 +525,10 @@ lazy val partestExtras = configureAsSubproject(Project("partest-extras", file(".
497
525
.dependsOn(replJlineEmbedded)
498
526
.settings(clearSourceAndResourceDirectories : _* )
499
527
.settings(disableDocs : _* )
528
+ .settings(disablePublishing : _* )
500
529
.settings(
501
530
name := " scala-partest-extras" ,
502
531
description := " Scala Compiler Testing Tool (compiler-specific extras)" ,
503
- publishArtifact := false ,
504
532
libraryDependencies += partestDep,
505
533
unmanagedSourceDirectories in Compile := List (baseDirectory.value)
506
534
)
@@ -510,8 +538,8 @@ lazy val junit = project.in(file("test") / "junit")
510
538
.settings(clearSourceAndResourceDirectories : _* )
511
539
.settings(commonSettings : _* )
512
540
.settings(disableDocs : _* )
541
+ .settings(disablePublishing : _* )
513
542
.settings(
514
- publishArtifact := false ,
515
543
fork in Test := true ,
516
544
libraryDependencies ++= Seq (junitDep, junitIntefaceDep),
517
545
testOptions += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" ),
@@ -543,9 +571,9 @@ lazy val test = project
543
571
.configs(IntegrationTest )
544
572
.settings(commonSettings : _* )
545
573
.settings(disableDocs : _* )
574
+ .settings(disablePublishing : _* )
546
575
.settings(Defaults .itSettings: _* )
547
576
.settings(
548
- publishArtifact := false ,
549
577
libraryDependencies ++= Seq (asmDep, partestDep, scalaXmlDep, scalacheckDep),
550
578
unmanagedBase in IntegrationTest := baseDirectory.value / " files" / " lib" ,
551
579
unmanagedJars in IntegrationTest <+= (unmanagedBase) (j => Attributed .blank(j)) map(identity),
@@ -572,8 +600,8 @@ lazy val test = project
572
600
573
601
lazy val manual = configureAsSubproject(project)
574
602
.settings(disableDocs : _* )
603
+ .settings(disablePublishing : _* )
575
604
.settings(
576
- publishArtifact := false ,
577
605
libraryDependencies ++= Seq (scalaXmlDep, antDep),
578
606
classDirectory in Compile := (target in Compile ).value / " classes"
579
607
)
@@ -643,9 +671,9 @@ lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-di
643
671
644
672
lazy val root = (project in file(" ." ))
645
673
.settings(disableDocs : _* )
674
+ .settings(disablePublishing : _* )
646
675
.settings(generateBuildCharacterFileSettings : _* )
647
676
.settings(
648
- publishArtifact := false ,
649
677
publish := {},
650
678
publishLocal := {},
651
679
commands ++= ScriptCommands .all,
0 commit comments