@@ -1373,7 +1373,31 @@ object ci extends Module {
1373
1373
os.proc(" gh" , " pr" , " create" , " --fill" , " --base" , " main" , " --head" , targetBranch)
1374
1374
.call(cwd = scalaCliDir)
1375
1375
}
1376
- def updateBrewFormula () = T .command {
1376
+ def brewLaunchersSha (x86LauncherPath : os.Path , arm64LauncherPath : os.Path , targetDir : os.Path ) = {
1377
+ val x86BinarySha256 = os.proc(" openssl" , " dgst" , " -sha256" , " -binary" )
1378
+ .call(
1379
+ cwd = targetDir,
1380
+ stdin = os.read.stream(x86LauncherPath)
1381
+ ).out.bytes
1382
+ val arm64BinarySha256 = os.proc(" openssl" , " dgst" , " -sha256" , " -binary" )
1383
+ .call(
1384
+ cwd = targetDir,
1385
+ stdin = os.read.stream(arm64LauncherPath)
1386
+ ).out.bytes
1387
+ val x86Sha256 = os.proc(" xxd" , " -p" , " -c" , " 256" )
1388
+ .call(
1389
+ cwd = targetDir,
1390
+ stdin = x86BinarySha256
1391
+ ).out.trim()
1392
+ val arm64Sha256 = os.proc(" xxd" , " -p" , " -c" , " 256" )
1393
+ .call(
1394
+ cwd = targetDir,
1395
+ stdin = arm64BinarySha256
1396
+ ).out.trim()
1397
+
1398
+ (x86Sha256, arm64Sha256)
1399
+ }
1400
+ def updateScalaCliBrewFormula () = T .command {
1377
1401
val version = cli.publishVersion()
1378
1402
1379
1403
val targetDir = os.pwd / " target"
@@ -1391,33 +1415,14 @@ object ci extends Module {
1391
1415
gitClone(repo, branch, targetDir)
1392
1416
setupGithubRepo(homebrewFormulaDir)
1393
1417
1394
- val x86LauncherPath = os.Path (" artifacts" , os.pwd) / " scala-cli-x86_64-apple-darwin.gz"
1395
- val arm64LauncherPath = os.Path (" artifacts" , os.pwd) / " scala-cli-aarch64-apple-darwin.gz"
1396
1418
val x86LauncherURL =
1397
1419
s " https://github.com/Virtuslab/scala-cli/releases/download/v $version/scala-cli-x86_64-apple-darwin.gz "
1398
1420
val arm64LauncherURL =
1399
1421
s " https://github.com/Virtuslab/scala-cli/releases/download/v $version/scala-cli-aarch64-apple-darwin.gz "
1400
1422
1401
- val x86BinarySha256 = os.proc(" openssl" , " dgst" , " -sha256" , " -binary" )
1402
- .call(
1403
- cwd = targetDir,
1404
- stdin = os.read.stream(x86LauncherPath)
1405
- ).out.bytes
1406
- val arm64BinarySha256 = os.proc(" openssl" , " dgst" , " -sha256" , " -binary" )
1407
- .call(
1408
- cwd = targetDir,
1409
- stdin = os.read.stream(arm64LauncherPath)
1410
- ).out.bytes
1411
- val x86Sha256 = os.proc(" xxd" , " -p" , " -c" , " 256" )
1412
- .call(
1413
- cwd = targetDir,
1414
- stdin = x86BinarySha256
1415
- ).out.trim()
1416
- val arm64Sha256 = os.proc(" xxd" , " -p" , " -c" , " 256" )
1417
- .call(
1418
- cwd = targetDir,
1419
- stdin = arm64BinarySha256
1420
- ).out.trim()
1423
+ val x86LauncherPath = os.Path (" artifacts" , os.pwd) / " scala-cli-x86_64-apple-darwin.gz"
1424
+ val arm64LauncherPath = os.Path (" artifacts" , os.pwd) / " scala-cli-aarch64-apple-darwin.gz"
1425
+ val (x86Sha256, arm64Sha256) = brewLaunchersSha(x86LauncherPath, arm64LauncherPath, targetDir)
1421
1426
1422
1427
val templateFormulaPath = os.pwd / " .github" / " scripts" / " scala-cli.rb.template"
1423
1428
val template = os.read(templateFormulaPath)
@@ -1434,6 +1439,48 @@ object ci extends Module {
1434
1439
1435
1440
commitChanges(s " Update for $version" , branch, homebrewFormulaDir)
1436
1441
}
1442
+ def updateScalaExperimentalBrewFormula () = T .command {
1443
+ val version = cli.publishVersion()
1444
+
1445
+ val targetDir = os.pwd / " target"
1446
+ val homebrewFormulaDir = targetDir / " homebrew-scala-experimental"
1447
+
1448
+ // clean target directory
1449
+ if (os.exists(targetDir)) os.remove.all(targetDir)
1450
+
1451
+ os.makeDir.all(targetDir)
1452
+
1453
+ val branch = " main"
1454
+ val repo = s " [email protected] :VirtusLab/homebrew-scala-experimental.git"
1455
+
1456
+ // Cloning
1457
+ gitClone(repo, branch, targetDir)
1458
+ setupGithubRepo(homebrewFormulaDir)
1459
+
1460
+ val x86LauncherURL =
1461
+ s " https://github.com/Virtuslab/scala-cli/releases/download/v $version/scala-cli-x86_64-apple-darwin.gz "
1462
+ val arm64LauncherURL =
1463
+ s " https://github.com/Virtuslab/scala-cli/releases/download/v $version/scala-cli-aarch64-apple-darwin.gz "
1464
+
1465
+ val x86LauncherPath = os.Path (" artifacts" , os.pwd) / " scala-cli-x86_64-apple-darwin.gz"
1466
+ val arm64LauncherPath = os.Path (" artifacts" , os.pwd) / " scala-cli-aarch64-apple-darwin.gz"
1467
+ val (x86Sha256, arm64Sha256) = brewLaunchersSha(x86LauncherPath, arm64LauncherPath, targetDir)
1468
+
1469
+ val templateFormulaPath = os.pwd / " .github" / " scripts" / " scala.rb.template"
1470
+ val template = os.read(templateFormulaPath)
1471
+
1472
+ val updatedFormula = template
1473
+ .replace(" @X86_LAUNCHER_URL@" , x86LauncherURL)
1474
+ .replace(" @ARM64_LAUNCHER_URL@" , arm64LauncherURL)
1475
+ .replace(" @X86_LAUNCHER_SHA256@" , x86Sha256)
1476
+ .replace(" @ARM64_LAUNCHER_SHA256@" , arm64Sha256)
1477
+ .replace(" @LAUNCHER_VERSION@" , version)
1478
+
1479
+ val formulaPath = homebrewFormulaDir / " scala.rb"
1480
+ os.write.over(formulaPath, updatedFormula)
1481
+
1482
+ commitChanges(s " Update for $version" , branch, homebrewFormulaDir)
1483
+ }
1437
1484
def updateInstallationScript () = T .command {
1438
1485
val version = cli.publishVersion()
1439
1486
0 commit comments