@@ -210,15 +210,15 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
210
210
CurrentParams .workspaceOpt = Some (inputs.workspace)
211
211
212
212
val initialBuildOptions = mkBuildOptions(
213
- baseOptions,
214
- options.shared.sharedVersionOptions,
215
- options.publishParams,
216
- options.sharedPublish,
217
- options.publishRepo,
218
- options.signingCli,
219
- options.connectionOptions,
220
- options.mainClass,
221
- options.ivy2LocalLike
213
+ baseOptions = baseOptions ,
214
+ sharedVersionOptions = options.shared.sharedVersionOptions,
215
+ publishParams = options.publishParams,
216
+ sharedPublish = options.sharedPublish,
217
+ publishRepo = options.publishRepo,
218
+ scalaSigning = options.signingCli,
219
+ publishConnection = options.connectionOptions,
220
+ mainClass = options.mainClass,
221
+ ivy2LocalLike = options.ivy2LocalLike
222
222
).orExit(logger)
223
223
val threads = BuildThreads .create()
224
224
@@ -289,11 +289,11 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
289
289
290
290
if watch then {
291
291
val watcher = Build .watch(
292
- inputs,
293
- initialBuildOptions,
294
- compilerMaker,
295
- docCompilerMaker,
296
- logger,
292
+ inputs = inputs ,
293
+ options = initialBuildOptions,
294
+ compilerMaker = compilerMaker ,
295
+ docCompilerMakerOpt = docCompilerMaker,
296
+ logger = logger ,
297
297
crossBuilds = cross,
298
298
buildTests = buildTests,
299
299
partial = None ,
@@ -375,11 +375,27 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
375
375
case _ : Build .Cancelled => false
376
376
case _ : Build .Failed => false
377
377
}
378
+ if allOk then logger.log(" All standard builds ok..." )
379
+ else {
380
+ val failedBuilds = builds.all.filterNot(_.success)
381
+ val cancelledBuilds = builds.all.filter(_.cancelled)
382
+ logger.log(
383
+ s " Some standard builds were not successful ( ${failedBuilds.length} failed, ${cancelledBuilds.length} cancelled). "
384
+ )
385
+ }
378
386
val allDocsOk = builds.allDoc.forall {
379
387
case _ : Build .Successful => true
380
388
case _ : Build .Cancelled => true
381
389
case _ : Build .Failed => false
382
390
}
391
+ if allDocsOk then logger.log(" All doc builds ok..." )
392
+ else {
393
+ val failedBuilds = builds.allDoc.filterNot(_.success)
394
+ val cancelledBuilds = builds.allDoc.filter(_.cancelled)
395
+ logger.log(
396
+ s " Some doc builds were not successful ( ${failedBuilds.length} failed, ${cancelledBuilds.length} cancelled). "
397
+ )
398
+ }
383
399
if allOk && allDocsOk then {
384
400
val builds0 = builds.all.collect {
385
401
case s : Build .Successful => s
@@ -391,7 +407,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
391
407
builds.builds match {
392
408
case b if b.forall(_.success) && mainClassOptions.mainClassLs.contains(true ) =>
393
409
mainClassOptions.maybePrintMainClasses(
394
- builds0.flatMap(_.foundMainClasses()).distinct,
410
+ mainClasses = builds0.flatMap(_.foundMainClasses()).distinct,
395
411
shouldExit = allowExit
396
412
)
397
413
case _ => prepareFilesAndUpload(
@@ -444,7 +460,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
444
460
445
461
logger.message(s " Publishing $org: $moduleName: $ver" )
446
462
447
- val mainJar = {
463
+ val mainJar : os. Path = {
448
464
val mainClassOpt : Option [String ] =
449
465
(builds.head.options.mainClass.filter(_.nonEmpty) match {
450
466
case Some (cls) => Right (cls)
@@ -469,17 +485,22 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
469
485
}
470
486
471
487
}).toOption
472
- val libraryJar = Library .libraryJar(builds, mainClassOpt)
473
- val dest = workingDir / org / s " $moduleName- $ver.jar "
488
+ logger.debug(s " Retained main class: ${mainClassOpt.getOrElse(" (no main class found)" )}" )
489
+ val libraryJar : os.Path = Library .libraryJar(builds, mainClassOpt)
490
+ val dest : os.Path = workingDir / org / s " $moduleName- $ver.jar "
491
+ logger.debug(s " Copying library jar from $libraryJar to $dest... " )
474
492
os.copy.over(libraryJar, dest, createFolders = true )
493
+ logger.log(s " Successfully copied library jar from $libraryJar to $dest" )
475
494
dest
476
495
}
477
496
478
497
val sourceJarOpt =
479
498
if publishOptions.contextual(isCi).sourceJar.getOrElse(true ) then {
480
- val content = PackageCmd .sourceJar(builds, now.toEpochMilli)
481
- val sourceJar = workingDir / org / s " $moduleName- $ver-sources.jar "
499
+ val content = PackageCmd .sourceJar(builds, now.toEpochMilli)
500
+ val sourceJar : os.Path = workingDir / org / s " $moduleName- $ver-sources.jar "
501
+ logger.debug(s " Saving source jar to $sourceJar... " )
482
502
os.write.over(sourceJar, content, createFolders = true )
503
+ logger.log(s " Successfully saved source jar to $sourceJar" )
483
504
Some (sourceJar)
484
505
}
485
506
else None
@@ -489,14 +510,16 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
489
510
docBuilds match {
490
511
case Nil => None
491
512
case docBuilds =>
492
- val docJarPath = value(PackageCmd .docJar(
513
+ val docJarPath : os. Path = value(PackageCmd .docJar(
493
514
builds = docBuilds,
494
515
logger = logger,
495
516
extraArgs = Nil ,
496
517
withTestScope = withTestScope
497
518
))
498
- val docJar = workingDir / org / s " $moduleName- $ver-javadoc.jar "
519
+ val docJar : os.Path = workingDir / org / s " $moduleName- $ver-javadoc.jar "
520
+ logger.debug(s " Copying doc jar from $docJarPath to $docJar... " )
499
521
os.copy.over(docJarPath, docJar, createFolders = true )
522
+ logger.log(s " Successfully copied doc jar from $docJarPath to $docJar" )
500
523
Some (docJar)
501
524
}
502
525
else None
@@ -512,19 +535,25 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
512
535
case (b, 1 ) if b.head.scope != Scope .Main => Some (Configuration (b.head.scope.name))
513
536
case _ => None
514
537
}
538
+ logger.debug(s " Dependency ${dep0.module.organization}: ${dep0.module.name}: ${dep0.version}" )
515
539
(dep0.module.organization, dep0.module.name, dep0.version, config, dep0.minimizedExclusions)
516
540
}
517
- val url = publishOptions.url.map(_.value)
541
+ val url = publishOptions.url.map(_.value)
542
+ logger.debug(s " Published project URL: ${url.getOrElse(" (not set)" )}" )
518
543
val license = publishOptions.license.map(_.value).map { l =>
519
544
Pom .License (l.name, l.url)
520
545
}
546
+ logger.debug(s " Published project license: ${license.map(_.name).getOrElse(" (not set)" )}" )
521
547
val scm = publishOptions.versionControl.map { vcs =>
522
548
Pom .Scm (vcs.url, vcs.connection, vcs.developerConnection)
523
549
}
550
+ logger.debug(s " Published project SCM: ${scm.map(_.url).getOrElse(" (not set)" )}" )
524
551
val developers = publishOptions.developers.map { dev =>
525
552
Pom .Developer (dev.id, dev.name, dev.url, dev.mail)
526
553
}
554
+ logger.debug(s " Published project developers: ${developers.map(_.name).mkString(" , " )}" )
527
555
val description = publishOptions.description.getOrElse(moduleName)
556
+ logger.debug(s " Published project description: $description" )
528
557
529
558
val pomContent = Pom .create(
530
559
organization = coursier.Organization (org),
@@ -576,7 +605,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
576
605
hasSources = sourceJarOpt.isDefined
577
606
)
578
607
579
- def mavenFileSet = {
608
+ def mavenFileSet : FileSet = {
580
609
val basePath = Path (org.split('.' ).toSeq ++ Seq (moduleName, ver))
581
610
582
611
val mainEntries = Seq (
@@ -603,7 +632,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
603
632
FileSet (mainEntries ++ sourceJarEntries ++ docJarEntries)
604
633
}
605
634
606
- def ivy2LocalLikeFileSet = {
635
+ def ivy2LocalLikeFileSet : FileSet = {
607
636
val basePath = Path (Seq (org, moduleName, ver))
608
637
609
638
val mainEntries = Seq (
@@ -633,7 +662,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
633
662
FileSet (mainEntries ++ sourceJarEntries ++ docJarEntries)
634
663
}
635
664
636
- val fileSet = if isIvy2LocalLike then ivy2LocalLikeFileSet else mavenFileSet
665
+ val fileSet : FileSet = if isIvy2LocalLike then ivy2LocalLikeFileSet else mavenFileSet
637
666
638
667
val mod = coursier.core.Module (
639
668
coursier.core.Organization (org),
@@ -794,9 +823,10 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
794
823
case PSigner .BouncyCastle
795
824
if publishOptions.contextual(isCi).secretKey.isDefined =>
796
825
val secretKeyConfigOpt = publishOptions.contextual(isCi).secretKey.get
797
- for {
798
- secretKey <- secretKeyConfigOpt.get(configDb())
799
- } yield getBouncyCastleSigner(secretKey, getSecretKeyPasswordOpt)
826
+ for { secretKey <- secretKeyConfigOpt.get(configDb()) } yield getBouncyCastleSigner(
827
+ secretKey = secretKey,
828
+ secretKeyPasswordOpt = getSecretKeyPasswordOpt
829
+ )
800
830
801
831
// user specified --signer=bc or target repository requires signing
802
832
// --secret-key-password is possibly specified (not mandatory)
@@ -807,8 +837,8 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
807
837
secretKeyOpt <- configDb().get(Keys .pgpSecretKey).wrapConfigException
808
838
secretKey <- secretKeyOpt.toRight(
809
839
new MissingPublishOptionError (
810
- " secret key" ,
811
- " --secret-key" ,
840
+ name = " secret key" ,
841
+ optionName = " --secret-key" ,
812
842
directiveName = " " ,
813
843
configKeys = Seq (Keys .pgpSecretKey.fullName),
814
844
extraMessage = shouldSignMsg
@@ -824,13 +854,13 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
824
854
}
825
855
826
856
val signerLogger =
827
- new InteractiveSignerLogger (new OutputStreamWriter (System .err), verbosity = 1 )
828
- val signRes = value(signer).signatures(
829
- fileSet0,
830
- now,
831
- ChecksumType .all.map(_.extension).toSet,
832
- Set (" maven-metadata.xml" ),
833
- signerLogger
857
+ new InteractiveSignerLogger (out = new OutputStreamWriter (System .err), verbosity = 1 )
858
+ val signRes : Either [( Path , Content , String ), FileSet ] = value(signer).signatures(
859
+ fileSet = fileSet0,
860
+ now = now ,
861
+ dontSignExtensions = ChecksumType .all.map(_.extension).toSet,
862
+ dontSignFiles = Set (" maven-metadata.xml" ),
863
+ logger = signerLogger
834
864
)
835
865
836
866
val fileSet1 = value {
@@ -863,11 +893,11 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
863
893
}
864
894
}
865
895
val checksums = Checksums (
866
- checksumTypes,
867
- fileSet1,
868
- now,
869
- ec,
870
- checksumLogger
896
+ types = checksumTypes,
897
+ fileSet = fileSet1,
898
+ now = now ,
899
+ pool = ec,
900
+ logger = checksumLogger
871
901
).unsafeRun()(using ec)
872
902
val fileSet2 = fileSet1 ++ checksums
873
903
@@ -876,7 +906,8 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
876
906
else fileSet2.order(ec).unsafeRun()(using ec)
877
907
878
908
val isSnapshot0 = modVersionOpt.exists(_._2.endsWith(" SNAPSHOT" ))
879
- val authOpt0 = value(authOpt(
909
+ if isSnapshot0 then logger.message(" Publishing a SNAPSHOT version..." )
910
+ val authOpt0 = value(authOpt(
880
911
repo = repoParams.repo.repo(isSnapshot0).root,
881
912
isLegacySonatype = repoParams.isSonatype
882
913
))
@@ -939,11 +970,12 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
939
970
val errors =
940
971
try
941
972
upload.uploadFileSet(
942
- retainedRepo,
943
- finalFileSet,
944
- uploadLogger,
945
- if parallelUpload.getOrElse(repoParams.defaultParallelUpload) then Some (ec) else None
946
- ).unsafeRun()(ec)
973
+ repository = retainedRepo,
974
+ fileSet = finalFileSet,
975
+ logger = uploadLogger,
976
+ parallel =
977
+ if parallelUpload.getOrElse(repoParams.defaultParallelUpload) then Some (ec) else None
978
+ ).unsafeRun()(using ec)
947
979
catch {
948
980
case NonFatal (e) =>
949
981
// Wrap exception from coursier, as it sometimes throws exceptions from other threads,
@@ -954,9 +986,11 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
954
986
errors.toList match {
955
987
case (h @ (_, _, e : Upload .Error .HttpError )) :: _
956
988
if repoParams0.isSonatype && errors.distinctBy(_._3.getMessage()).size == 1 =>
989
+ logger.log(s " Error message: ${e.getMessage}" )
957
990
val httpCodeRegex = " HTTP (\\ d+)\n .*" .r
958
991
e.getMessage match {
959
992
case httpCodeRegex(" 403" ) =>
993
+ if logger.verbosity >= 2 then e.printStackTrace()
960
994
logger.error(
961
995
s """
962
996
|Uploading files failed!
0 commit comments