-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from DavidGregory084/modes
Add dev, CI, release mode functionality to the plugin
- Loading branch information
Showing
15 changed files
with
1,257 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
rules = [ | ||
OrganizeImports | ||
] | ||
|
||
OrganizeImports { | ||
preset = INTELLIJ_2020_3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version = 3.4.3 | ||
|
||
runner.dialect = scala212 | ||
|
||
preset = defaultWithAlign | ||
|
||
maxColumn = 100 | ||
|
||
indent { | ||
callSite = 2 | ||
defnSite = 2 | ||
extendSite = 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/scala/io/github/davidgregory084/OptionsMode.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2022 David Gregory | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.github.davidgregory084 | ||
|
||
sealed abstract class OptionsMode extends Product with Serializable | ||
|
||
case object DevMode extends OptionsMode | ||
case object CiMode extends OptionsMode | ||
case object ReleaseMode extends OptionsMode |
38 changes: 38 additions & 0 deletions
38
src/main/scala/io/github/davidgregory084/ScalaVersion.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2022 David Gregory | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.github.davidgregory084 | ||
|
||
import scala.Ordering.Implicits._ | ||
|
||
case class ScalaVersion(major: Long, minor: Long, patch: Long) { | ||
def isBetween(addedVersion: ScalaVersion, removedVersion: ScalaVersion) = | ||
this >= addedVersion && this < removedVersion | ||
} | ||
|
||
object ScalaVersion { | ||
val V2_11_0 = ScalaVersion(2, 11, 0) | ||
val V2_12_0 = ScalaVersion(2, 12, 0) | ||
val V2_13_0 = ScalaVersion(2, 13, 0) | ||
val V2_13_3 = ScalaVersion(2, 13, 3) | ||
val V2_13_4 = ScalaVersion(2, 13, 4) | ||
val V2_13_5 = ScalaVersion(2, 13, 5) | ||
val V2_13_6 = ScalaVersion(2, 13, 6) | ||
val V3_0_0 = ScalaVersion(3, 0, 0) | ||
|
||
implicit val scalaVersionOrdering: Ordering[ScalaVersion] = | ||
Ordering.by(version => (version.major, version.minor, version.patch)) | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/scala/io/github/davidgregory084/ScalacOption.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2022 David Gregory | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.github.davidgregory084 | ||
|
||
/** A Scala compiler option. | ||
* | ||
* @param tokens | ||
* The tokens which must be provided to declare this option. | ||
* @param isSupported | ||
* A predicate function determining whether the provided Scala compiler version supports this | ||
* option. | ||
*/ | ||
class ScalacOption( | ||
val tokens: List[String], | ||
val isSupported: ScalaVersion => Boolean = _ => true | ||
) { | ||
override def hashCode(): Int = | ||
41 * tokens.hashCode | ||
|
||
override def equals(other: Any): Boolean = | ||
other match { | ||
case that: ScalacOption => this.tokens == that.tokens | ||
case _ => false | ||
} | ||
} |
Oops, something went wrong.