@@ -210,15 +210,15 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
210210 CurrentParams .workspaceOpt = Some (inputs.workspace)
211211
212212 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
222222 ).orExit(logger)
223223 val threads = BuildThreads .create()
224224
@@ -289,11 +289,11 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
289289
290290 if watch then {
291291 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 ,
297297 crossBuilds = cross,
298298 buildTests = buildTests,
299299 partial = None ,
@@ -375,11 +375,27 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
375375 case _ : Build .Cancelled => false
376376 case _ : Build .Failed => false
377377 }
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+ }
378386 val allDocsOk = builds.allDoc.forall {
379387 case _ : Build .Successful => true
380388 case _ : Build .Cancelled => true
381389 case _ : Build .Failed => false
382390 }
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+ }
383399 if allOk && allDocsOk then {
384400 val builds0 = builds.all.collect {
385401 case s : Build .Successful => s
@@ -391,7 +407,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
391407 builds.builds match {
392408 case b if b.forall(_.success) && mainClassOptions.mainClassLs.contains(true ) =>
393409 mainClassOptions.maybePrintMainClasses(
394- builds0.flatMap(_.foundMainClasses()).distinct,
410+ mainClasses = builds0.flatMap(_.foundMainClasses()).distinct,
395411 shouldExit = allowExit
396412 )
397413 case _ => prepareFilesAndUpload(
@@ -444,7 +460,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
444460
445461 logger.message(s " Publishing $org: $moduleName: $ver" )
446462
447- val mainJar = {
463+ val mainJar : os. Path = {
448464 val mainClassOpt : Option [String ] =
449465 (builds.head.options.mainClass.filter(_.nonEmpty) match {
450466 case Some (cls) => Right (cls)
@@ -469,17 +485,22 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
469485 }
470486
471487 }).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... " )
474492 os.copy.over(libraryJar, dest, createFolders = true )
493+ logger.log(s " Successfully copied library jar from $libraryJar to $dest" )
475494 dest
476495 }
477496
478497 val sourceJarOpt =
479498 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... " )
482502 os.write.over(sourceJar, content, createFolders = true )
503+ logger.log(s " Successfully saved source jar to $sourceJar" )
483504 Some (sourceJar)
484505 }
485506 else None
@@ -489,14 +510,16 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
489510 docBuilds match {
490511 case Nil => None
491512 case docBuilds =>
492- val docJarPath = value(PackageCmd .docJar(
513+ val docJarPath : os. Path = value(PackageCmd .docJar(
493514 builds = docBuilds,
494515 logger = logger,
495516 extraArgs = Nil ,
496517 withTestScope = withTestScope
497518 ))
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... " )
499521 os.copy.over(docJarPath, docJar, createFolders = true )
522+ logger.log(s " Successfully copied doc jar from $docJarPath to $docJar" )
500523 Some (docJar)
501524 }
502525 else None
@@ -512,19 +535,25 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
512535 case (b, 1 ) if b.head.scope != Scope .Main => Some (Configuration (b.head.scope.name))
513536 case _ => None
514537 }
538+ logger.debug(s " Dependency ${dep0.module.organization}: ${dep0.module.name}: ${dep0.version}" )
515539 (dep0.module.organization, dep0.module.name, dep0.version, config, dep0.minimizedExclusions)
516540 }
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)" )}" )
518543 val license = publishOptions.license.map(_.value).map { l =>
519544 Pom .License (l.name, l.url)
520545 }
546+ logger.debug(s " Published project license: ${license.map(_.name).getOrElse(" (not set)" )}" )
521547 val scm = publishOptions.versionControl.map { vcs =>
522548 Pom .Scm (vcs.url, vcs.connection, vcs.developerConnection)
523549 }
550+ logger.debug(s " Published project SCM: ${scm.map(_.url).getOrElse(" (not set)" )}" )
524551 val developers = publishOptions.developers.map { dev =>
525552 Pom .Developer (dev.id, dev.name, dev.url, dev.mail)
526553 }
554+ logger.debug(s " Published project developers: ${developers.map(_.name).mkString(" , " )}" )
527555 val description = publishOptions.description.getOrElse(moduleName)
556+ logger.debug(s " Published project description: $description" )
528557
529558 val pomContent = Pom .create(
530559 organization = coursier.Organization (org),
@@ -576,7 +605,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
576605 hasSources = sourceJarOpt.isDefined
577606 )
578607
579- def mavenFileSet = {
608+ def mavenFileSet : FileSet = {
580609 val basePath = Path (org.split('.' ).toSeq ++ Seq (moduleName, ver))
581610
582611 val mainEntries = Seq (
@@ -603,7 +632,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
603632 FileSet (mainEntries ++ sourceJarEntries ++ docJarEntries)
604633 }
605634
606- def ivy2LocalLikeFileSet = {
635+ def ivy2LocalLikeFileSet : FileSet = {
607636 val basePath = Path (Seq (org, moduleName, ver))
608637
609638 val mainEntries = Seq (
@@ -633,7 +662,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
633662 FileSet (mainEntries ++ sourceJarEntries ++ docJarEntries)
634663 }
635664
636- val fileSet = if isIvy2LocalLike then ivy2LocalLikeFileSet else mavenFileSet
665+ val fileSet : FileSet = if isIvy2LocalLike then ivy2LocalLikeFileSet else mavenFileSet
637666
638667 val mod = coursier.core.Module (
639668 coursier.core.Organization (org),
@@ -794,9 +823,10 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
794823 case PSigner .BouncyCastle
795824 if publishOptions.contextual(isCi).secretKey.isDefined =>
796825 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+ )
800830
801831 // user specified --signer=bc or target repository requires signing
802832 // --secret-key-password is possibly specified (not mandatory)
@@ -807,8 +837,8 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
807837 secretKeyOpt <- configDb().get(Keys .pgpSecretKey).wrapConfigException
808838 secretKey <- secretKeyOpt.toRight(
809839 new MissingPublishOptionError (
810- " secret key" ,
811- " --secret-key" ,
840+ name = " secret key" ,
841+ optionName = " --secret-key" ,
812842 directiveName = " " ,
813843 configKeys = Seq (Keys .pgpSecretKey.fullName),
814844 extraMessage = shouldSignMsg
@@ -824,13 +854,13 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
824854 }
825855
826856 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
834864 )
835865
836866 val fileSet1 = value {
@@ -863,11 +893,11 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
863893 }
864894 }
865895 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
871901 ).unsafeRun()(using ec)
872902 val fileSet2 = fileSet1 ++ checksums
873903
@@ -876,7 +906,8 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
876906 else fileSet2.order(ec).unsafeRun()(using ec)
877907
878908 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(
880911 repo = repoParams.repo.repo(isSnapshot0).root,
881912 isLegacySonatype = repoParams.isSonatype
882913 ))
@@ -939,11 +970,12 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
939970 val errors =
940971 try
941972 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)
947979 catch {
948980 case NonFatal (e) =>
949981 // Wrap exception from coursier, as it sometimes throws exceptions from other threads,
@@ -954,9 +986,11 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
954986 errors.toList match {
955987 case (h @ (_, _, e : Upload .Error .HttpError )) :: _
956988 if repoParams0.isSonatype && errors.distinctBy(_._3.getMessage()).size == 1 =>
989+ logger.log(s " Error message: ${e.getMessage}" )
957990 val httpCodeRegex = " HTTP (\\ d+)\n .*" .r
958991 e.getMessage match {
959992 case httpCodeRegex(" 403" ) =>
993+ if logger.verbosity >= 2 then e.printStackTrace()
960994 logger.error(
961995 s """
962996 |Uploading files failed!
0 commit comments