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