Skip to content

Commit

Permalink
Add .scalafmt.conf & fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed May 29, 2023
1 parent 64aa0f4 commit c152a3d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ out/
.bloop/
.metals/
.vscode/
.scala-build/
31 changes: 31 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version = "3.7.3"
runner.dialect = scala212

align.preset = more
maxColumn = 100
assumeStandardLibraryStripMargin = true
indent.defnSite = 2
indentOperator.topLevelOnly = false
align.preset = more
align.openParenCallSite = false
newlines.source = keep
newlines.beforeMultiline = keep
newlines.afterCurlyLambdaParams = keep
newlines.alwaysBeforeElseAfterCurlyIf = true

rewrite.rules = [
RedundantBraces
RedundantParens
SortModifiers
]

rewrite.redundantBraces {
ifElseExpressions = true
includeUnitMethods = false
stringInterpolation = true
}

rewrite.sortModifiers.order = [
"private", "final", "override", "protected",
"implicit", "sealed", "abstract", "lazy"
]
32 changes: 23 additions & 9 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import mill.scalalib._
import scala.util.Properties

def scalaDefaultVersion = "2.12.17"
def coursierVersion = "2.1.4"
def graalVmVersion = "22.1.0"
def utestVersion = "0.8.1"
def coursierVersion = "2.1.4"
def graalVmVersion = "22.1.0"
def utestVersion = "0.8.1"

object `cs-m1` extends JavaModule with NativeImage {
def ivyDeps = super.ivyDeps() ++ Seq(
Expand All @@ -26,7 +26,7 @@ object `cs-m1` extends JavaModule with NativeImage {

def nativeImageClassPath = runClasspath()
def nativeImageMainClass = "coursier.cli.Coursier"
def nativeImagePersist = System.getenv("CI") != null
def nativeImagePersist = System.getenv("CI") != null

def nativeImageOptions = T {
if (Properties.isLinux)
Expand Down Expand Up @@ -81,7 +81,14 @@ object ci extends Module {
if (version.endsWith("-SNAPSHOT")) ("nightly", true)
else ("v" + version, false)

Upload.upload("VirtusLab", "coursier-m1", ghToken, tag0, dryRun = false, overwrite = overwrite)(launchers: _*)
Upload.upload(
"VirtusLab",
"coursier-m1",
ghToken,
tag0,
dryRun = false,
overwrite = overwrite
)(launchers: _*)
}

private def computePublishVersion(state: VcsState): String =
Expand All @@ -92,10 +99,18 @@ object ci extends Module {
.map(_.stripPrefix("v"))
.flatMap { tag =>
val baseVersion = tag.takeWhile(c => c == '.' || c.isDigit)
if (baseVersion == tag || tag.stripPrefix(baseVersion).forall(c => c == '-' || c.isDigit)) {
if (
baseVersion == tag || tag
.stripPrefix(baseVersion)
.forall(c => c == '-' || c.isDigit)
) {
val idx = baseVersion.lastIndexOf(".")
if (idx >= 0)
Some(baseVersion.take(idx + 1) + (baseVersion.drop(idx + 1).toInt + 1).toString + "-SNAPSHOT")
Some(
baseVersion.take(idx + 1) + (baseVersion
.drop(idx + 1)
.toInt + 1).toString + "-SNAPSHOT"
)
else
None
}
Expand All @@ -108,8 +123,7 @@ object ci extends Module {
.getOrElse(state.format())
}
else
state
.lastTag
state.lastTag
.getOrElse(state.format())
.stripPrefix("v")

Expand Down
2 changes: 1 addition & 1 deletion cs-m1-tests/test/src/coursier/m1tests/LaunchTests.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package coursier.m1tests

object LaunchTests extends coursier.clitests.LaunchTests {
def launcher = Launcher.launcher
def launcher = Launcher.launcher
def acceptsDOptions = false
def acceptsJOptions = false
}

0 comments on commit c152a3d

Please sign in to comment.