Skip to content

Commit

Permalink
Merge branch 'main' into fix/soft-cap-scala-version
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao authored Nov 21, 2024
2 parents 86abbb3 + b8ab90d commit 8f43f79
Show file tree
Hide file tree
Showing 38 changed files with 433 additions and 72 deletions.
2 changes: 2 additions & 0 deletions .github/release/release-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
- [ ] Copy any fixes over to the draft after getting the PR reviewed and merged.
- [ ] Mark the release draft as `pre-release` and then `Publish Release`
- [ ] Wait for a green release CI build with all the updated versions.
- [ ] Double check if none of the steps failed, including individual distribution channels in
the `update-packages` and `windows-packages` jobs.
- [ ] ScalaCLI Setup
- [ ] Merge pull request with updated Scala CLI version
in [scala-cli-setup](https://github.com/VirtusLab/scala-cli-setup) repository. Pull request should be opened
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/get-latest-cs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

CS_VERSION="2.1.13"
CS_VERSION="2.1.17"

DIR="$(cs get --archive "https://github.com/coursier/coursier/releases/download/v$CS_VERSION/cs-x86_64-pc-win32.zip")"

Expand Down
51 changes: 50 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,48 @@ jobs:
retention-days: 2

publish:
needs: [unit-tests, jvm-tests-1, jvm-tests-2, jvm-tests-3, jvm-tests-4, jvm-tests-5, format, checks, reference-doc]
needs:
- unit-tests
- jvm-tests-1
- jvm-tests-2
- jvm-tests-3
- jvm-tests-4
- jvm-tests-5
- native-linux-tests-1
- native-linux-tests-2
- native-linux-tests-3
- native-linux-tests-4
- native-linux-tests-5
- native-macos-tests-1
- native-macos-tests-2
- native-macos-tests-3
- native-macos-tests-4
- native-macos-tests-5
- native-macos-m1-tests-1
- native-macos-m1-tests-2
- native-macos-m1-tests-3
- native-macos-m1-tests-4
- native-macos-m1-tests-5
- native-windows-tests-1
- native-windows-tests-2
- native-windows-tests-3
- native-windows-tests-4
- native-windows-tests-5
- native-mostly-static-tests-1
- native-mostly-static-tests-2
- native-mostly-static-tests-3
- native-mostly-static-tests-4
- native-mostly-static-tests-5
- native-static-tests-1
- native-static-tests-2
- native-static-tests-3
- native-static-tests-4
- native-static-tests-5
- vc-redist
- format
- checks
- reference-doc
- docs-tests
if: github.event_name == 'push' && github.repository == 'VirtusLab/scala-cli'
runs-on: ubuntu-20.04
steps:
Expand Down Expand Up @@ -1787,31 +1828,38 @@ jobs:
${{ secrets.HOMEBREW_SCALA_EXPERIMENTAL_KEY }}
${{ secrets.SCALA_CLI_SETUP_KEY }}
- run: ./mill -i ci.updateInstallationScript
continue-on-error: true
- run: ./mill -i ci.updateScalaCliBrewFormula
continue-on-error: true
- name: GPG setup
run: .github/scripts/gpg-setup.sh
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
- run: ./mill -i ci.updateDebianPackages
continue-on-error: true
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
GPG_EMAIL: ${{ secrets.GPG_EMAIL }}
- run: ./mill -i ci.updateCentOsPackages
continue-on-error: true
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
KEYGRIP: ${{ secrets.KEYGRIP }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GPG_EMAIL: ${{ secrets.GPG_EMAIL }}
- run: ./mill -i ci.updateStandaloneLauncher
continue-on-error: true
env:
UPLOAD_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to SDKMAN
continue-on-error: true
run: .github/scripts/publish-sdkman.sh
shell: bash
env:
SDKMAN_KEY: ${{ secrets.SDKMAN_KEY }}
SDKMAN_TOKEN: ${{ secrets.SDKMAN_TOKEN }}
- run: ./mill -i ci.updateScalaCliSetup
continue-on-error: true
- run: ./mill -i ci.updateScalaExperimentalBrewFormula

update-windows-packages:
Expand All @@ -1835,6 +1883,7 @@ jobs:
path: artifacts/
- name: Publish to chocolatey
run: ./mill -i ci.updateChocolateyPackage
continue-on-error: true
env:
CHOCO_SECRET: ${{ secrets.CHOCO_SECRET_KEY }}
- uses: vedantmgoyal9/winget-releaser@main
Expand Down
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.12
0.11.13
7 changes: 4 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
import $ivy.`io.get-coursier::coursier-launcher:2.1.13`
import $ivy.`io.github.alexarchambault.mill::mill-native-image-upload:0.1.26`
import $ivy.`io.get-coursier::coursier-launcher:2.1.17`
import $ivy.`io.github.alexarchambault.mill::mill-native-image-upload:0.1.29`
import $file.project.deps, deps.{Deps, Docker, InternalDeps, Java, Scala, TestDeps}
import $file.project.publish, publish.{ghOrg, ghName, ScalaCliPublishModule, organization}
import $file.project.settings, settings.{
Expand Down Expand Up @@ -228,6 +228,7 @@ trait GenerateReferenceDoc extends CrossSbtModule with ScalaCliScalafixModule {
)
def repositoriesTask = T.task(super.repositoriesTask() ++ customRepositories)
def ivyDeps = Agg(
Deps.argonautShapeless,
Deps.caseApp,
Deps.munit
)
Expand Down Expand Up @@ -1819,7 +1820,7 @@ object ci extends Module {
"--env", "GPG_EMAIL",
"--env", "KEYGRIP",
"--privileged",
"fedora",
"fedora:40",
"sh", "updateCentOsPackages.sh"
)
// format: on
Expand Down
2 changes: 1 addition & 1 deletion mill
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Adapted from

coursier_version="2.1.13"
coursier_version="2.1.17"

# https://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux/17072017#17072017
if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" == "Linux" ]; then
Expand Down
2 changes: 1 addition & 1 deletion mill.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rem but I don't think we need to support them in 2019
setlocal enabledelayedexpansion

if [!DEFAULT_MILL_VERSION!]==[] (
set "DEFAULT_MILL_VERSION=0.11.12"
set "DEFAULT_MILL_VERSION=0.11.13"
)

set "MILL_REPO_URL=https://github.com/com-lihaoyi/mill"
Expand Down
2 changes: 1 addition & 1 deletion millw
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
set -e

if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
DEFAULT_MILL_VERSION=0.11.12
DEFAULT_MILL_VERSION=0.11.13
fi


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package scala.cli.commands
import caseapp.Name
import caseapp.core.app.Command
import caseapp.core.parser.Parser
import caseapp.core.util.Formatter
import caseapp.core.util.{CaseUtil, Formatter}
import caseapp.core.{Arg, Error}

import scala.build.Logger
import scala.build.input.ScalaCliInvokeData
import scala.build.internal.util.WarningMessages
import scala.build.internals.FeatureType
import scala.build.internals.{ConsoleUtils, FeatureType}
import scala.cli.ScalaCli
import scala.cli.util.ArgHelpers.*

Expand Down Expand Up @@ -57,6 +57,16 @@ object RestrictedCommandsParser {
if arg.isExperimental && !shouldSuppressExperimentalWarnings =>
logger.experimentalWarning(passedOption, FeatureType.Option)
r
case (r @ Right(Some(_, arg: Arg, _)), passedOption :: _)
if arg.isDeprecated =>
// TODO implement proper deprecation logic: https://github.com/VirtusLab/scala-cli/issues/3258
arg.deprecatedOptionAliases.find(_ == passedOption)
.foreach { deprecatedAlias =>
logger.message(
s"""[${Console.YELLOW}warn${Console.RESET}] The $deprecatedAlias option alias has been deprecated and may be removed in a future version."""
)
}
r
case (other, _) =>
other
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object New extends ScalaCommand[NewOptions] {

override def scalaSpecificationLevel = SpecificationLevel.EXPERIMENTAL

val giter8Dependency =
private def giter8Dependency =
Seq(dep"${Constants.giter8Organization}::${Constants.giter8Name}:${Constants.giter8Version}")

override def runCommand(options: NewOptions, remainingArgs: RemainingArgs, logger: Logger): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ final case class PackageOptions(
library: Boolean = false,
@Group(HelpGroup.Package.toString)
@HelpMessage("Generate a source JAR rather than an executable JAR")
@Name("sourcesJar")
@Name("jarSources")
@Name("sources")
@Name("src")
@Name("source")
@Tag(tags.deprecated("source")) // alias to be removed in 1.6.x
@Tag(tags.restricted)
@Tag(tags.inShortHelp)
source: Boolean = false,
src: Boolean = false,
@Group(HelpGroup.Package.toString)
@HelpMessage("Generate a scaladoc JAR rather than an executable JAR")
@ExtraName("scaladoc")
Expand Down Expand Up @@ -144,7 +147,7 @@ final case class PackageOptions(
def packageTypeOpt: Option[PackageType] =
forcedPackageTypeOpt.orElse {
if (library) Some(PackageType.LibraryJar)
else if (source) Some(PackageType.SourceJar)
else if (src) Some(PackageType.SourceJar)
else if (assembly) Some(
PackageType.Assembly(
addPreamble = preamble,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ final case class ScalaJsOptions(
@HelpMessage("Enable jsdom")
jsDom: Option[Boolean] = None,

@Group(HelpGroup.ScalaJs.toString)
@Tag(tags.experimental)
@HelpMessage("Emit WASM")
jsEmitWasm: Option[Boolean] = None,

@Group(HelpGroup.ScalaJs.toString)
@Tag(tags.should)
@HelpMessage("A header that will be added at the top of generated .js files")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ final case class SharedOptions(
smallModuleForPackage = jsSmallModuleForPackage,
esVersionStr = jsEsVersion,
noOpt = jsNoOpt,
remapEsModuleImportMap = jsEsModuleImportMap.filter(_.trim.nonEmpty).map(os.Path(_, Os.pwd))
remapEsModuleImportMap = jsEsModuleImportMap.filter(_.trim.nonEmpty).map(os.Path(_, Os.pwd)),
jsEmitWasm = jsEmitWasm.getOrElse(false)
)
}

Expand Down
21 changes: 19 additions & 2 deletions modules/cli/src/main/scala/scala/cli/util/ArgHelpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package scala.cli.util

import caseapp.core.Arg
import caseapp.core.help.HelpFormat
import caseapp.core.util.CaseUtil

import scala.build.input.ScalaCliInvokeData
import scala.build.internal.util.WarningMessages
Expand All @@ -12,8 +13,24 @@ import scala.cli.commands.{SpecificationLevel, tags}
object ArgHelpers {
extension (arg: Arg) {
private def hasTag(tag: String): Boolean = arg.tags.exists(_.name == tag)
def isExperimental: Boolean = arg.hasTag(tags.experimental)
def isRestricted: Boolean = arg.hasTag(tags.restricted)
private def hasTagPrefix(tagPrefix: String): Boolean =
arg.tags.exists(_.name.startsWith(tagPrefix))
def isExperimental: Boolean = arg.hasTag(tags.experimental)
def isRestricted: Boolean = arg.hasTag(tags.restricted)
def isDeprecated: Boolean = arg.hasTagPrefix(tags.deprecatedPrefix)

def deprecatedNames: List[String] = arg.tags
.filter(_.name.startsWith(tags.deprecatedPrefix))
.map(_.name.stripPrefix(s"${tags.deprecatedPrefix}${tags.valueSeparator}"))
.toList

def deprecatedOptionAliases: List[String] = arg.deprecatedNames.map {
case name if name.startsWith("-") => name
case name if name.length == 1 => "-" + name
case name => "--" + CaseUtil.pascalCaseSplit(name.toCharArray.toList).map(
_.toLowerCase
).mkString("-")
}

def isExperimentalOrRestricted: Boolean = arg.isRestricted || arg.isExperimental

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scala.build.internal

import bloop.rifle.VersionUtil.parseJavaVersion
import coursier.jvm.{JavaHome, JvmIndex}
import coursier.jvm.{JavaHome, JvmChannel}

import java.io.IOException
import java.nio.charset.Charset
Expand Down Expand Up @@ -56,7 +56,7 @@ object OsLibc {
// FIXME These values should be the default ones in coursier-jvm

lazy val jvmIndexOs: String = {
val default = JvmIndex.defaultOs()
val default = JvmChannel.defaultOs
if (default == "linux" && isMusl.getOrElse(false)) "linux-musl"
else default
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import scala.cli.commands.SpecificationLevel
@DirectiveExamples("//> using test.dep org.scalatest::scalatest:3.2.10")
@DirectiveExamples("//> using test.dep org.scalameta::munit:0.7.29")
@DirectiveExamples(
"//> using dep tabby:tabby:0.2.3,url=https://github.com/bjornregnell/tabby/releases/download/v0.2.3/tabby_3-0.2.3.jar"
"//> using dep \"tabby:tabby:0.2.3,url=https://github.com/bjornregnell/tabby/releases/download/v0.2.3/tabby_3-0.2.3.jar\""
)
@DirectiveUsage(
"//> using dep org:name:ver | //> using deps org:name:ver org2:name2:ver2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ import scala.util.Try
|`//> using jsModuleSplitStyleStr` _value_
|
|`//> using jsEsVersionStr` _value_
|
|`//> using jsEmitWasm` _true|false_
|
|`//> using jsEsModuleImportMap` _value_
|""".stripMargin
Expand All @@ -65,7 +67,8 @@ final case class ScalaJs(
jsAvoidClasses: Option[Boolean] = None,
jsAvoidLetsAndConsts: Option[Boolean] = None,
jsModuleSplitStyleStr: Option[String] = None,
jsEsVersionStr: Option[String] = None
jsEsVersionStr: Option[String] = None,
jsEmitWasm: Option[Boolean] = None
) extends HasBuildOptions {
// format: on
def buildOptions: Either[BuildException, BuildOptions] =
Expand All @@ -83,7 +86,8 @@ final case class ScalaJs(
avoidLetsAndConsts = jsAvoidLetsAndConsts,
moduleSplitStyleStr = jsModuleSplitStyleStr,
esVersionStr = jsEsVersionStr,
noOpt = jsNoOpt
noOpt = jsNoOpt,
jsEmitWasm = jsEmitWasm.getOrElse(false)
)

def absFilePath(pathStr: String): Either[ImportMapNotFound, Path] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ object GenerateReferenceDoc extends CaseApp[InternalDocOptions] {
names
.tail
.sortBy(_.dropWhile(_ == '-'))
.map(n => s"`$n`")
.map {
case name if arg.deprecatedOptionAliases.contains(name) =>
s"[deprecated] `$name`"
case name => s"`$name`"
}
.mkString("Aliases: ", ", ", "\n\n")
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ class NativePackagerTests extends ScalaCliSuite {
}

if (Properties.isLinux)
test("building docker image with scala native app") {
// FIXME make this test pass consistently on the CI again
test("building docker image with scala native app".flaky) {
TestUtil.retryOnCi() {
runNativeTest()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,11 +859,16 @@ abstract class PackageTestDefinitions extends ScalaCliSuite with TestScalaVersio
test("source JAR") {
val dest = os.rel / "sources.jar"
simpleInputWithScalaAndSc.fromRoot { root =>
os.proc(TestUtil.cli, "--power", "package", extraOptions, ".", "-o", dest, "--source").call(
cwd = root,
stdin = os.Inherit,
stdout = os.Inherit
)
val r =
os.proc(TestUtil.cli, "--power", "package", extraOptions, ".", "-o", dest, "--source").call(
cwd = root,
stdin = os.Inherit,
stdout = os.Inherit,
stderr = os.Pipe
)
expect(r.err.trim().contains(
"The --source option alias has been deprecated and may be removed in a future version"
))

expect(os.isFile(root / dest))

Expand Down
Loading

0 comments on commit 8f43f79

Please sign in to comment.