Skip to content

Commit

Permalink
Merge pull request #359 from xeno-by/lang/scalafix-hackweek
Browse files Browse the repository at this point in the history
Assorted fixes
  • Loading branch information
olafurpg committed Sep 18, 2017
2 parents 4edc623 + 3df0d6d commit afe851e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
23 changes: 20 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Dependencies._
inThisBuild(
List(
organization := "ch.epfl.scala",
version := customScalafixVersion.getOrElse(version.value)
version := customScalafixVersion.getOrElse(version.value.replace('+', '-'))
)
)
name := {
Expand All @@ -33,9 +33,26 @@ commands += Command.command("ci-slow") { s =>
s
}

lazy val adhocRepoUri = sys.props("scalafix.repository.uri")
lazy val adhocRepoCredentials = sys.props("scalafix.repository.credentials")
lazy val isCustomRepository = adhocRepoUri != null && adhocRepoCredentials != null

lazy val publishSettings = Seq(
publishTo := Some(
"releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
publishTo := {
if (isCustomRepository) Some("adhoc" at adhocRepoUri)
else {
val uri = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
Some("Releases" at uri)
}
},
credentials ++= {
val credentialsFile = {
if (adhocRepoCredentials != null) new File(adhocRepoCredentials)
else null
}
if (credentialsFile != null) List(new FileCredentials(credentialsFile))
else Nil
},
publishArtifact in Test := false,
licenses := Seq(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
Expand Down
14 changes: 7 additions & 7 deletions scalafix-core/shared/src/main/scala/scalafix/rule/Rule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ object Rule {

/** Combine two rules into a single rule */
def merge(a: Rule, b: Rule): Rule = (a, b) match {
case (c1: CompositeRule, c2: CompositeRule) =>
new CompositeRule(c1.rules ::: c2.rules)
case (c1: CompositeRule, _) =>
new CompositeRule(b :: c1.rules)
case (_, c2: CompositeRule) =>
new CompositeRule(b :: c2.rules)
case (_, _) =>
case (ac: CompositeRule, bc: CompositeRule) =>
new CompositeRule(ac.rules ::: bc.rules)
case (ac: CompositeRule, b) =>
new CompositeRule(b :: ac.rules)
case (a, bc: CompositeRule) =>
new CompositeRule(a :: bc.rules)
case (a, b) =>
new CompositeRule(a :: b :: Nil)
}
}

0 comments on commit afe851e

Please sign in to comment.