Skip to content

Commit

Permalink
Upgrade Scalafmt to v2.3.1. (digital-asset#3764)
Browse files Browse the repository at this point in the history
* Upgrade Scalafmt to v2.3.1.

* Reformat daml-assistant/daml-sdk/.../SdkMain.scala with Scalafmt.
  • Loading branch information
SamirTalwar authored and mergify[bot] committed Dec 6, 2019
1 parent 158d135 commit 1f6529a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
version = "1.5.1"

project.git = true

align = none # never align to make the fmt more diff friendly
maxColumn = 100
runner.fatalWarnings = true
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ import com.digitalasset.navigator.{NavigatorBackend => Navigator}
import com.digitalasset.platform.sandbox.{SandboxMain => Sandbox}

object SdkMain {
def main(args: Array[String]): Unit = {
val command = args(0)
val rest = args.drop(1)
command match {
case "trigger" => Trigger.main(rest)
case "script" => Script.main(rest)
case "codegen" => Codegen.main(rest)
case "extractor" => Extractor.main(rest)
case "json-api" => JsonApi.main(rest)
case "navigator" => Navigator.main(rest)
case "sandbox" => Sandbox.main(rest)
case _ => sys.exit(1)
}
def main(args: Array[String]): Unit = {
val command = args(0)
val rest = args.drop(1)
command match {
case "trigger" => Trigger.main(rest)
case "script" => Script.main(rest)
case "codegen" => Codegen.main(rest)
case "extractor" => Extractor.main(rest)
case "json-api" => JsonApi.main(rest)
case "navigator" => Navigator.main(rest)
case "sandbox" => Sandbox.main(rest)
case _ => sys.exit(1)
}
}
}

6 changes: 3 additions & 3 deletions nix/overrides/scalafmt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

let
baseName = "scalafmt";
version = "1.5.1";
version = "2.3.1";
deps = stdenv.mkDerivation {
name = "${baseName}-deps-${version}";
buildCommand = ''
export COURSIER_CACHE=$(pwd)
${coursier}/bin/coursier fetch com.geirsson:scalafmt-cli_2.12:${version} > deps
${coursier}/bin/coursier fetch org.scalameta:scalafmt-cli_2.12:${version} > deps
mkdir -p $out/share/java
cp $(< deps) $out/share/java/
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "15xfys9wdlx3rrqb2ab6qcfngkf6sa8v8q8shh10kk8jrc30g6dk";
outputHash = "17fws821ic60gp1bhnn689ly48gc9xi7z9wgqj6ac02l8pqyw6x7";
};
in
stdenv.mkDerivation rec {
Expand Down
2 changes: 1 addition & 1 deletion scalafmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
set -eu -o pipefail

cd "${0%/*}"
scalafmt --git true --diff --config .scalafmt.conf "$@"
scalafmt --mode=diff "$@"

0 comments on commit 1f6529a

Please sign in to comment.