Skip to content

Commit c90f9a1

Browse files
koeningerxkrogen
authored andcommitted
[SPARK-30570][BUILD] Update scalafmt plugin to 1.0.3 with onlyChangedFiles feature
Update the scalafmt plugin to 1.0.3 and use its new onlyChangedFiles feature rather than --diff Older versions of the plugin either didn't work with scala 2.13, or got rid of the --diff argument and didn't allow for formatting only changed files The /dev/scalafmt script no longer passes through arbitrary args, instead using the arg to select scala version. The issue here is the plugin name literally contains the scala version, and doesn't appear to have a shorter way to refer to it. If srowen or someone else with better maven-fu has an idea I'm all ears. Manually, e.g. edited a file and ran dev/scalafmt or dev/scalafmt 2.13 Closes apache#27279 from koeninger/SPARK-30570. Authored-by: cody koeninger <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit 843224e) Ref: LIHADOOP-54911 This required minor modifications to set the branch for diffing properly (to li-2.3.0) and configure the default Scala version to 2.11. RB=2208737 BUG=LIHADOOP-54911 G=spark-reviewers R=mmuralid,vsowrira A=mmuralid
1 parent b7e3f08 commit c90f9a1

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

dev/scalafmt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# limitations under the License.
1818
#
1919

20-
# by default, format only files that differ from git master
21-
params="${@:---diff}"
20+
VERSION="${@:-2.11}"
21+
./build/mvn -Pscala-$VERSION mvn-scalafmt_$VERSION:format -Dscalafmt.skip=false
2222

23-
./build/mvn mvn-scalafmt_2.12:format -Dscalafmt.skip=false -Dscalafmt.parameters="$params"

pom.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
<commons.collections.version>3.2.2</commons.collections.version>
162162
<scala.version>2.11.8</scala.version>
163163
<scala.binary.version>2.11</scala.binary.version>
164-
<scalafmt.parameters>--diff --test</scalafmt.parameters>
164+
<scalafmt.parameters>--test</scalafmt.parameters>
165165
<!-- for now, not running scalafmt as part of default verify pipeline -->
166166
<scalafmt.skip>true</scalafmt.skip>
167167
<codehaus.jackson.version>1.9.13</codehaus.jackson.version>
@@ -2695,12 +2695,16 @@
26952695
</plugin>
26962696
<plugin>
26972697
<groupId>org.antipathy</groupId>
2698-
<artifactId>mvn-scalafmt_2.12</artifactId>
2699-
<version>0.9_1.5.1</version>
2698+
<artifactId>mvn-scalafmt_${scala.binary.version}</artifactId>
2699+
<version>1.0.3</version>
27002700
<configuration>
27012701
<parameters>${scalafmt.parameters}</parameters> <!-- (Optional) Additional command line arguments -->
27022702
<skip>${scalafmt.skip}</skip> <!-- (Optional) skip formatting -->
2703-
<configLocation>dev/.scalafmt.conf</configLocation> <!-- (Optional) config locataion -->
2703+
<skipSources>${scalafmt.skip}</skipSources>
2704+
<skipTestSources>${scalafmt.skip}</skipTestSources>
2705+
<configLocation>dev/.scalafmt.conf</configLocation> <!-- (Optional) config location -->
2706+
<branch>li-2.3.0</branch>
2707+
<onlyChangedFiles>true</onlyChangedFiles>
27042708
</configuration>
27052709
<executions>
27062710
<execution>

0 commit comments

Comments
 (0)