Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted fixes #359

Merged
merged 4 commits into from
Sep 18, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 14 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,20 @@ 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 Some("Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
},
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)
}
}