@@ -141,7 +141,7 @@ update() {
141
141
cd $2
142
142
143
143
git fetch --tags " https://github.com/$1 /$2 .git"
144
- (git fetch " https://github.com/$1 /$2 .git" $3 && git checkout -q FETCH_HEAD) # || git checkout -q $3 # || fallback is for local testing on tag
144
+ (git fetch " https://github.com/$1 /$2 .git" $3 && git checkout -fq FETCH_HEAD) # || git checkout -fq $3 # || fallback is for local testing on tag
145
145
git reset --hard
146
146
}
147
147
@@ -258,18 +258,21 @@ buildSwing() {
258
258
fi
259
259
}
260
260
261
+ # should only be called with publishTasks publishing to private-repo
261
262
buildScalacheck (){
262
263
if [ " $SCALACHECK_BUILT " != " yes" ] && [ " $forceRebuild " != " yes" ] && ( sbtResolve " org.scalacheck" " scalacheck" $SCALACHECK_VER )
263
264
then echo " Found scalacheck $SCALACHECK_VER ; not building."
264
265
else
265
266
update rickynils scalacheck $SCALACHECK_REF && gfxd
266
- sbtBuild ' set version := "' $SCALACHECK_VER ' "' ' set VersionKeys.scalaParserCombinatorsVersion := "' $PARSERS_VER ' "' $clean $publishPrivateTask # test times out NOTE: never published to sonatype
267
+ sbtBuild ' set version := "' $SCALACHECK_VER ' "' ' set VersionKeys.scalaParserCombinatorsVersion := "' $PARSERS_VER ' "' $clean publish # test times out NOTE: never published to sonatype
267
268
SCALACHECK_BUILT=" yes"
268
269
fi
269
270
}
270
271
271
272
# build modules, using ${buildTasks[@]} (except for Scalacheck, which is hard-coded to publish to private-repo)
272
273
buildModules () {
274
+ publishTasks=(' set credentials += Credentials(Path.userHome / ".credentials-private-repo")' " set every publishTo := Some(\" private-repo\" at \" $releaseTempRepoUrl \" )" )
275
+ buildTasks=($publishPrivateTask )
273
276
buildXML
274
277
buildParsers
275
278
buildSwing
@@ -278,6 +281,16 @@ buildModules() {
278
281
# buildPartestIface
279
282
}
280
283
284
+ buildPublishedModules () {
285
+ publishTasks=(' set credentials += Credentials(Path.userHome / ".credentials-sonatype")' " set pgpPassphrase := Some(Array.empty)" )
286
+ buildTasks=($publishSonatypeTaskModules )
287
+ buildXML
288
+ buildParsers
289
+ buildSwing
290
+ buildPartest
291
+ # buildPartestIface
292
+ }
293
+
281
294
282
295
# # BUILD STEPS:
283
296
@@ -416,6 +429,29 @@ deriveModuleVersions() {
416
429
# PARTEST_IFACE_VER=${PARTEST_IFACE_VER-$(deriveVersion scala scala-partest-interface "$PARTEST_IFACE_REF")}
417
430
}
418
431
432
+ createNetrcFile () {
433
+ local netrcFile=$HOME /` basename $1 ` -netrc
434
+ grep ' host=' $1 | sed ' s/host=\(.*\)/machine \1/' > $netrcFile
435
+ grep ' user=' $1 | sed ' s/user=\(.*\)/login \1/' >> $netrcFile
436
+ grep ' password=' $1 | sed ' s/password=\(.*\)/password \1/' >> $netrcFile
437
+ }
438
+
439
+ removeExistingBuilds () {
440
+ createNetrcFile " $HOME /.credentials-private-repo"
441
+ local netrcFile=" $HOME /.credentials-private-repo-netrc"
442
+
443
+ local storageApiUrl=` echo $releaseTempRepoUrl | sed ' s/\(scala-release-temp\)/api\/storage\/\1/' `
444
+ local scalaLangModules=` curl -s $storageApiUrl /org/scala-lang | jq -r ' .children | .[] | "org/scala-lang" + .uri' `
445
+
446
+ for module in " org/scalacheck" $scalaLangModules ; do
447
+ local artifacts=` curl -s $storageApiUrl /$module | jq -r " .children | .[] | select(.uri | contains(\" $SCALA_VER \" )) | .uri" `
448
+ for artifact in $artifacts ; do
449
+ echo " Deleting $releaseTempRepoUrl$module$artifact "
450
+ curl -s --netrc-file $netrcFile -X DELETE $releaseTempRepoUrl$module$artifact
451
+ done
452
+ done
453
+ }
454
+
419
455
constructUpdatedModuleVersions () {
420
456
updatedModuleVersions=()
421
457
@@ -466,8 +502,6 @@ bootstrap() {
466
502
# publish to our internal repo (so we can resolve the modules in the scala build below)
467
503
# we only need to build the modules necessary to build Scala itself
468
504
# since the version of locker and quick are the same
469
- publishTasks=(' set credentials += Credentials(Path.userHome / ".credentials-private-repo")' " set every publishTo := Some(\" private-repo\" at \" $releaseTempRepoUrl \" )" )
470
- buildTasks=($publishPrivateTask )
471
505
buildModules
472
506
473
507
constructUpdatedModuleVersions
@@ -521,9 +555,7 @@ publishSonatype() {
521
555
# (was hoping we could make everything go to the same staging repo, but it's not timing that causes two staging repos to be opened)
522
556
# NOTE: only publish those for which versions are set
523
557
# test and publish to sonatype, assuming you have ~/.sbt/0.13/sonatype.sbt and ~/.sbt/0.13/plugin/gpg.sbt
524
- publishTasks=(' set credentials += Credentials(Path.userHome / ".credentials-sonatype")' " set pgpPassphrase := Some(Array.empty)" )
525
- buildTasks=($publishSonatypeTaskModules )
526
- buildModules
558
+ buildPublishedModules
527
559
528
560
open=$( st_stagingReposOpen)
529
561
allOpenUrls=$( echo $open | jq ' .repositoryURI' | tr -d \" )
@@ -543,15 +575,10 @@ determineScalaVersion
543
575
544
576
deriveModuleVersions
545
577
578
+ removeExistingBuilds
579
+
546
580
bootstrap
547
581
548
582
if [ " $publishToSonatype " == " yes" ]
549
583
then publishSonatype
550
- else # build modules one more time, just to mimic the regular build as much when running as nightly
551
- echo " ### Rebuilding modules with quick, publishing to $baseDir /ivy/local"
552
- buildTasks=(publish-local)
553
- # buildScalacheck always uses publishPrivateTask (not buildTasks). we override it to avoid publishing to private-repo.
554
- publishPrivateTask=" publish-local"
555
- forceRebuild=" yes"
556
- buildModules
557
584
fi
0 commit comments