Skip to content

Commit

Permalink
Fix Scala 2.12 release (zio#9027)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyri-petrou authored Jul 19, 2024
1 parent 63980f2 commit 36a7e23
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 60
if: ${{ ((github.event_name != 'repository_dispatch') && (github.event.action != 'update-docs')) }}
env:
CI_RELEASE_MODE: 1 # Needed to enable optimizers
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -117,7 +119,7 @@ jobs:
distribution: temurin
java-version: 17
check-latest: true

- name: Install NodeJS
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -322,7 +324,7 @@ jobs:
with:
branch: gh-pages
folder: ./website-artifact

update-docs:
runs-on: ubuntu-latest
if: ${{ ((github.event_name == 'repository_dispatch') && (github.event.action == 'update-docs')) }}
Expand All @@ -342,7 +344,7 @@ jobs:
git add package.json
commit_message="Update $package_name to $package_version"
git commit -m "$commit_message" || echo "No changes to commit"
- name: Create Pull Request to Update Docs
uses: peter-evans/create-pull-request@v4.2.4
with:
Expand Down
15 changes: 8 additions & 7 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,19 @@ object BuildHelper {
"-Ywarn-value-discard"
)

private def optimizerOptions(optimize: Boolean) =
if (optimize)
Seq(
private def optimizerOptions(optimize: Boolean, isScala213: Boolean) =
if (optimize) {
// We get some weird errors when trying to inline Scala 2.12 std lib
val inlineScala = if (isScala213) Seq("-opt-inline-from:scala.**") else Nil
inlineScala ++ Seq(
"-opt:l:method",
"-opt:l:inline",
"-opt-inline-from:zio.**",
"-opt-inline-from:scala.**",
// To remove calls to `assert` in releases. Assertions are level 2000
"-Xelide-below",
"2001"
)
else Nil
} else Nil

def buildInfoSettings(packageName: String) =
Seq(
Expand Down Expand Up @@ -124,7 +125,7 @@ object BuildHelper {
Seq(
"-Ywarn-unused:params,-implicits",
"-Ybackend-parallelism:4"
) ++ std2xOptions ++ optimizerOptions(optimize)
) ++ std2xOptions ++ optimizerOptions(optimize, isScala213 = true)
case Some((2, 12)) =>
Seq(
"-opt-warnings",
Expand All @@ -141,7 +142,7 @@ object BuildHelper {
"-Xsource:2.13",
"-Xmax-classfile-name",
"242"
) ++ std2xOptions ++ optimizerOptions(optimize)
) ++ std2xOptions ++ optimizerOptions(optimize, isScala213 = false)
case _ => Seq.empty
}

Expand Down

0 comments on commit 36a7e23

Please sign in to comment.