Skip to content

Commit 0dec6f2

Browse files
Merge pull request #224 from typelevel/update/sbt-typelevel-0.7.2
Update sbt-typelevel to 0.7.2
2 parents f89d6d9 + 26a6a3c commit 0dec6f2

File tree

4 files changed

+99
-71
lines changed

4 files changed

+99
-71
lines changed

.github/workflows/ci.yml

Lines changed: 87 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -15,55 +15,45 @@ on:
1515
tags: [v*]
1616

1717
env:
18-
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
19-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
20-
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
21-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
22-
PGP_SECRET: ${{ secrets.PGP_SECRET }}
2318
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2419

20+
21+
concurrency:
22+
group: ${{ github.workflow }} @ ${{ github.ref }}
23+
cancel-in-progress: true
24+
2525
jobs:
2626
build:
2727
name: Build and Test
2828
strategy:
2929
matrix:
3030
os: [ubuntu-latest]
31-
scala: [2.12.18]
31+
scala: [2.12]
3232
java: [temurin@8]
3333
runs-on: ${{ matrix.os }}
34+
timeout-minutes: 60
3435
steps:
36+
- name: Install sbt
37+
if: contains(runner.os, 'macos')
38+
run: brew install sbt
39+
3540
- name: Checkout current branch (full)
36-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
3742
with:
3843
fetch-depth: 0
3944

40-
- name: Download Java (temurin@8)
41-
id: download-java-temurin-8
42-
if: matrix.java == 'temurin@8'
43-
uses: typelevel/download-java@v2
44-
with:
45-
distribution: temurin
46-
java-version: 8
47-
4845
- name: Setup Java (temurin@8)
46+
id: setup-java-temurin-8
4947
if: matrix.java == 'temurin@8'
50-
uses: actions/setup-java@v3
48+
uses: actions/setup-java@v4
5149
with:
52-
distribution: jdkfile
50+
distribution: temurin
5351
java-version: 8
54-
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
52+
cache: sbt
5553

56-
- name: Cache sbt
57-
uses: actions/cache@v3
58-
with:
59-
path: |
60-
~/.sbt
61-
~/.ivy2/cache
62-
~/.coursier/cache/v1
63-
~/.cache/coursier/v1
64-
~/AppData/Local/Coursier/Cache/v1
65-
~/Library/Caches/Coursier/v1
66-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
54+
- name: sbt update
55+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
56+
run: sbt +update
6757

6858
- name: Check that workflows are up to date
6959
run: sbt githubWorkflowCheck
@@ -85,15 +75,15 @@ jobs:
8575

8676
- name: Make target directories
8777
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
88-
run: mkdir -p plugin/target scalafix/rules/target target/sbt-tpolecat-scalafix-aggregate/target scalafix/output/target scalafix/tests/target target scalafix/input/target project/target
78+
run: mkdir -p plugin/target scalafix/rules/target project/target
8979

9080
- name: Compress target directories
9181
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
92-
run: tar cf targets.tar plugin/target scalafix/rules/target target/sbt-tpolecat-scalafix-aggregate/target scalafix/output/target scalafix/tests/target target scalafix/input/target project/target
82+
run: tar cf targets.tar plugin/target scalafix/rules/target project/target
9383

9484
- name: Upload target directories
9585
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
96-
uses: actions/upload-artifact@v3
86+
uses: actions/upload-artifact@v4
9787
with:
9888
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
9989
path: targets.tar
@@ -108,59 +98,95 @@ jobs:
10898
java: [temurin@8]
10999
runs-on: ${{ matrix.os }}
110100
steps:
101+
- name: Install sbt
102+
if: contains(runner.os, 'macos')
103+
run: brew install sbt
104+
111105
- name: Checkout current branch (full)
112-
uses: actions/checkout@v3
106+
uses: actions/checkout@v4
113107
with:
114108
fetch-depth: 0
115109

116-
- name: Download Java (temurin@8)
117-
id: download-java-temurin-8
110+
- name: Setup Java (temurin@8)
111+
id: setup-java-temurin-8
118112
if: matrix.java == 'temurin@8'
119-
uses: typelevel/download-java@v2
113+
uses: actions/setup-java@v4
120114
with:
121115
distribution: temurin
122116
java-version: 8
117+
cache: sbt
123118

124-
- name: Setup Java (temurin@8)
125-
if: matrix.java == 'temurin@8'
126-
uses: actions/setup-java@v3
127-
with:
128-
distribution: jdkfile
129-
java-version: 8
130-
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
119+
- name: sbt update
120+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
121+
run: sbt +update
131122

132-
- name: Cache sbt
133-
uses: actions/cache@v3
134-
with:
135-
path: |
136-
~/.sbt
137-
~/.ivy2/cache
138-
~/.coursier/cache/v1
139-
~/.cache/coursier/v1
140-
~/AppData/Local/Coursier/Cache/v1
141-
~/Library/Caches/Coursier/v1
142-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
143-
144-
- name: Download target directories (2.12.18)
145-
uses: actions/download-artifact@v3
123+
- name: Download target directories (2.12)
124+
uses: actions/download-artifact@v4
146125
with:
147-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.18
126+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12
148127

149-
- name: Inflate target directories (2.12.18)
128+
- name: Inflate target directories (2.12)
150129
run: |
151130
tar xf targets.tar
152131
rm targets.tar
153132
154133
- name: Import signing key
155134
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
156-
run: echo $PGP_SECRET | base64 -di | gpg --import
135+
env:
136+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
137+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
138+
run: echo $PGP_SECRET | base64 -d -i - | gpg --import
157139

158140
- name: Import signing key and strip passphrase
159141
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
142+
env:
143+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
144+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
160145
run: |
161-
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
146+
echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg
162147
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
163148
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
164149
165150
- name: Publish
151+
env:
152+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
153+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
154+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
166155
run: sbt tlCiRelease
156+
157+
dependency-submission:
158+
name: Submit Dependencies
159+
if: github.event_name != 'pull_request'
160+
strategy:
161+
matrix:
162+
os: [ubuntu-latest]
163+
java: [temurin@8]
164+
runs-on: ${{ matrix.os }}
165+
steps:
166+
- name: Install sbt
167+
if: contains(runner.os, 'macos')
168+
run: brew install sbt
169+
170+
- name: Checkout current branch (full)
171+
uses: actions/checkout@v4
172+
with:
173+
fetch-depth: 0
174+
175+
- name: Setup Java (temurin@8)
176+
id: setup-java-temurin-8
177+
if: matrix.java == 'temurin@8'
178+
uses: actions/setup-java@v4
179+
with:
180+
distribution: temurin
181+
java-version: 8
182+
cache: sbt
183+
184+
- name: sbt update
185+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
186+
run: sbt +update
187+
188+
- name: Submit Dependencies
189+
uses: scalacenter/sbt-dependency-submission@v2
190+
with:
191+
modules-ignore: sbt-tpolecat_2.12
192+
configs-ignore: test scala-tool scala-doc-tool test-internal

build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ lazy val `sbt-tpolecat-scalafix` = scalafixProject("sbt-tpolecat")
6464
)
6565
)
6666
.inputSettings(addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.0"))
67+
.inputSettings(tlFatalWarnings := false)
6768
.inputConfigure(_.enablePlugins(SbtPlugin))
69+
.outputSettings(tlFatalWarnings := false)
6870
.outputConfigure(_.dependsOn(`sbt-tpolecat-plugin`))
6971
.outputConfigure(_.enablePlugins(SbtPlugin))

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.22")
1+
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.2")
22
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")
33
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")

scalafix/rules/src/main/scala/fix/v0_5.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ class v0_5 extends SemanticRule("v0_5") {
9797

9898
def handleImports(importees: List[Importee], createNewImport: Importee => Patch): Patch =
9999
importees.collect {
100-
case importee @ Importee.Name(name) =>
100+
case importee @ Importee.Name(_) =>
101101
createNewImport(importee) + Patch.removeImportee(importee)
102-
case rename @ Importee.Rename(name, _) =>
102+
case rename @ Importee.Rename(_, _) =>
103103
createNewImport(rename) + Patch.removeImportee(rename)
104104
case importee @ Importee.Wildcard() =>
105105
createNewImport(importee) + Patch.removeImportee(importee)
@@ -108,7 +108,7 @@ class v0_5 extends SemanticRule("v0_5") {
108108
override def fix(implicit doc: SemanticDocument): Patch =
109109
doc.tree.collect {
110110
// Handle imports from `io.github.davidgregory084`
111-
case importer @ Importer(ref, importees) if PackageSym.matches(ref) =>
111+
case _ @Importer(ref, importees) if PackageSym.matches(ref) =>
112112
importees.collect {
113113
case importee @ Importee.Name(name) if PluginSym.matches(name) =>
114114
makePluginImport(importee) + Patch.removeImportee(importee)
@@ -124,25 +124,25 @@ class v0_5 extends SemanticRule("v0_5") {
124124
Patch.removeImportee(importee)
125125
}.asPatch
126126
// Handle imports from `io.github.davidgregory084.TpolecatPlugin`
127-
case importer @ Importer(ref, importees) if TpolecatPluginSym.matches(ref) =>
127+
case _ @Importer(ref, importees) if TpolecatPluginSym.matches(ref) =>
128128
handleImports(importees, makeTpolecatPluginObjectImport)
129129
// Handle imports from `io.github.davidgregory084.ScalaVersion`
130-
case importer @ Importer(ref, importees) if ScalaVersionSym.matches(ref) =>
130+
case _ @Importer(ref, importees) if ScalaVersionSym.matches(ref) =>
131131
handleImports(importees, makeScalaVersionObjectImport)
132132
// Handle imports from `io.github.davidgregory084.TpolecatPlugin.ScalacOptions`
133-
case importer @ Importer(ref, importees) if TpolecatPluginScalacOptionsSym.matches(ref) =>
133+
case _ @Importer(ref, importees) if TpolecatPluginScalacOptionsSym.matches(ref) =>
134134
handleImports(importees, makeScalacOptionsObjectImport)
135135
// Handle imports from `io.github.davidgregory084.TpolecatPlugin.autoImport`
136-
case importer @ Importer(ref, importees) if TpolecatPluginAutoImportSym.matches(ref) =>
136+
case _ @Importer(ref, importees) if TpolecatPluginAutoImportSym.matches(ref) =>
137137
importees.collect {
138138
// The `ScalacOptions` object moved to `scalac-options`
139139
case importee @ Importee.Name(name) if TpolecatPluginScalacOptionsSym.matches(name) =>
140140
makeScalacOptionsImport(importee) + Patch.removeImportee(importee)
141141
case rename @ Importee.Rename(name, _) if TpolecatPluginScalacOptionsSym.matches(name) =>
142142
makeScalacOptionsImport(rename) + Patch.removeImportee(rename)
143-
case importee @ Importee.Name(name) =>
143+
case importee @ Importee.Name(_) =>
144144
makeAutoImportObjectImport(importee) + Patch.removeImportee(importee)
145-
case rename @ Importee.Rename(name, _) =>
145+
case rename @ Importee.Rename(_, _) =>
146146
makeAutoImportObjectImport(rename) + Patch.removeImportee(rename)
147147
case importee @ Importee.Wildcard() =>
148148
makeAutoImportObjectImport(importee) + Patch.removeImportee(importee)

0 commit comments

Comments
 (0)