diff --git a/.gitignore b/.gitignore index 6181603d..7e73c966 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,8 @@ target/ +!scalariform.update/target/ lib_managed/ src_managed/ -project/boot/ bin/ -.scala_dependencies -core/target/ -core/lib_managed/ -core/src_managed/ -gui/target/ -gui/lib_managed/ -gui/src_managed/ -corpusscan/target/ -corpusscan/lib_managed/ -corpusscan/src_managed/ -docs/build -nohup.out .history .cache .idea/ @@ -22,3 +10,4 @@ nohup.out .classpath .project .cache* +*~ diff --git a/CHANGELOG b/CHANGELOG index 64b11ed4..cc3e41c2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +0.2.2 (19/July/17) + +* Added IDE friendly preference descriptors +* Added Maven components for generating Eclipse update site +* Uploaded generated Eclipse update site + 0.2.1 (14/July/17) * FIX: Revert removal of DoubleIndentClassDeclaration which was erroneously marked as having been deprecated since scalariform 0.1.5 (in reality the deprecation occurred in 0.2.0-snapshot) diff --git a/README.rst b/README.rst index 88bbf07a..f39dcfbe 100644 --- a/README.rst +++ b/README.rst @@ -52,7 +52,7 @@ Usage within a project Have a use for the scalariform source code directly? You can use it as a build dependency: :: - "org.scalariform" %% "scalariform" % "0.2.1" + "org.scalariform" %% "scalariform" % "0.2.2" Integration with Eclipse ------------------------ @@ -71,6 +71,11 @@ To set preferences, go to either - Window -> Preferences -> Scala -> Editor -> Formatter - Project -> Properties -> Scala Formatter +From the formatter preference window you can import/export existing preferences. +See the `reference.conf`_ for a listing of all available preferences and their defaults. + +.. _reference.conf: https://github.com/scala-ide/scalariform/blob/master/formatterPreferences.properties + Integration with Emacs/ENSIME ----------------------------- @@ -132,7 +137,7 @@ Usage (Gradle 2.1 and above):: alignParameters = true alignSingleLineCaseStatements = true } - + formatAllScala See `the documentation`_ for further usage examples. @@ -159,7 +164,9 @@ the following to ``.vimrc`` :: au BufEnter *.scala setl equalprg=java\ -jar\ /home/me/bin/scalariform.jar\ -f\ -q\ +compactControlReadability\ +alignParameters\ +alignSingleLineCaseStatements\ +doubleIndentConstructorArguments\ +rewriteArrowSymbols\ +preserveSpaceBeforeArguments\ --stdin\ --stdout -You can create your own executable scalariform.jar by following the instructions at the top of this file, in "Packaging an executable JAR." +Download scalariform.jar from the `latest release`_ + +.. _latest release: https://github.com/scala-ide/scalariform/releases/latest Command line tool ----------------- @@ -396,7 +403,7 @@ becomes: If ``Preserve``, scalariform will try to match what unformatted source code is already doing per parenthesis, either forcing or preventing. -doubleIndentClassDeclaration +~~doubleIndentClassDeclaration~~ (Deprecated, use `doubleIndentConstructorArguments`) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Default: ``false`` diff --git a/cli/src/main/scala/scalariform/Utils.scala b/cli/src/main/scala/scalariform/Utils.scala index 26f54a6e..43aba717 100644 --- a/cli/src/main/scala/scalariform/Utils.scala +++ b/cli/src/main/scala/scalariform/Utils.scala @@ -2,7 +2,7 @@ package scalariform object Utils { def writeText(file: java.io.File, text: String, encodingOpt: Option[String] = None) { - import java.io.{ OutputStreamWriter, FileOutputStream } + import java.io.{OutputStreamWriter, FileOutputStream} val encoding = encodingOpt getOrElse (System getProperty "file.encoding") val writer = new OutputStreamWriter(new FileOutputStream(file), encoding) try diff --git a/cli/src/main/scala/scalariform/commandline/ScalaFileWalker.scala b/cli/src/main/scala/scalariform/commandline/ScalaFileWalker.scala index 0b00446b..9daa19ae 100644 --- a/cli/src/main/scala/scalariform/commandline/ScalaFileWalker.scala +++ b/cli/src/main/scala/scalariform/commandline/ScalaFileWalker.scala @@ -1,7 +1,7 @@ package scalariform.commandline import java.io.File -import java.util.{ ArrayList, Collection } +import java.util.{ArrayList, Collection} import scala.collection.JavaConverters._ import org.apache.commons.io._ diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..fb1f8f6e --- /dev/null +++ b/pom.xml @@ -0,0 +1,182 @@ + + + 4.0.0 + org.scalariform + scalariform.parent + 0.2.2 + pom + + + + scm:git://github.com/scala-ide/scalariform.git + https://github.com/scala-ide/scalariform + + + + UTF-8 + 0.24.0 + 2.12.2 + 1.0.6 + 1.0.6 + 2_12 + + + + scalariform + scalariform.feature + scalariform.update + + + + org.scala-lang + scala-library + ${scala.version} + + + + + + + org.eclipse.tycho + tycho-versions-plugin + ${tycho.version} + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho.version} + true + + + org.eclipse.tycho + target-platform-configuration + ${tycho.version} + + p2 + consider + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + 1.1 + + + validate + + create + + + + + false + false + 7 + + + + + org.eclipse.tycho + tycho-packaging-plugin + ${tycho.version} + + '${scala.version.suffix}-'yyyyMMddHHmm'-${buildNumber}' + true + + + + net.alchim31.maven + scala-maven-plugin + 3.2.1 + + + + add-source + compile + + + + + ${scala.version} + + -Xmx1024m + -Xss4m + + + + + + + + neon + p2 + http://download.eclipse.org/releases/neon + + + sonatype.release + Sonatype maven release repository + https://oss.sonatype.org/content/repositories/releases/ + false + + + sonatype.snapshot + Sonatype maven snapshot repository + https://oss.sonatype.org/content/repositories/snapshots + + daily + + + + + + scala-2.10.x + + 2.10.6 + + + + scala-2.11.x + + 2.11.11 + 2.11 + + + + org.scala-lang.modules + scala-xml_${version.suffix} + ${scala.xml.version} + + + org.scala-lang.modules + scala-parser-combinators_${version.suffix} + ${scala.parser-combinators.version} + + + + + scala-2.12.x + + 2.12.2 + 2.12 + + + + org.scala-lang.modules + scala-xml_${version.suffix} + ${scala.xml.version} + + + org.scala-lang.modules + scala-parser-combinators_${version.suffix} + ${scala.parser-combinators.version} + + + + + diff --git a/project/project/plugins.sbt b/project/project/plugins.sbt deleted file mode 100644 index 737941de..00000000 --- a/project/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0") diff --git a/scalariform.feature/build.properties b/scalariform.feature/build.properties new file mode 100644 index 00000000..64f93a9f --- /dev/null +++ b/scalariform.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/scalariform.feature/feature.xml b/scalariform.feature/feature.xml new file mode 100644 index 00000000..cf85a70f --- /dev/null +++ b/scalariform.feature/feature.xml @@ -0,0 +1,55 @@ + + + + + Scala Code formatter + + + + The MIT License + +Copyright (c) 2010 Matthew D. Russell + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and +to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + + + + + + + + + + + + + + diff --git a/scalariform.feature/pom.xml b/scalariform.feature/pom.xml new file mode 100644 index 00000000..1c786914 --- /dev/null +++ b/scalariform.feature/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + scalariform.feature + eclipse-feature + + scalariform.parent + org.scalariform + 0.2.2 + + diff --git a/scalariform.update/pom.xml b/scalariform.update/pom.xml new file mode 100644 index 00000000..01ac2adb --- /dev/null +++ b/scalariform.update/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + scalariform.update + eclipse-update-site + + scalariform.parent + org.scalariform + 0.2.2 + + diff --git a/scalariform.update/site.xml b/scalariform.update/site.xml new file mode 100644 index 00000000..57aa97cb --- /dev/null +++ b/scalariform.update/site.xml @@ -0,0 +1,11 @@ + + + + Scalariform Update Site + + + + + + diff --git a/scalariform.update/target/site.zip b/scalariform.update/target/site.zip new file mode 100644 index 00000000..6d30ec85 Binary files /dev/null and b/scalariform.update/target/site.zip differ diff --git a/scalariform.update/target/site/artifacts.jar b/scalariform.update/target/site/artifacts.jar new file mode 100644 index 00000000..ef4419ca Binary files /dev/null and b/scalariform.update/target/site/artifacts.jar differ diff --git a/scalariform.update/target/site/content.jar b/scalariform.update/target/site/content.jar new file mode 100644 index 00000000..95467877 Binary files /dev/null and b/scalariform.update/target/site/content.jar differ diff --git a/scalariform.update/target/site/features/scalariform.feature_0.2.2.jar b/scalariform.update/target/site/features/scalariform.feature_0.2.2.jar new file mode 100644 index 00000000..d8f9eed9 Binary files /dev/null and b/scalariform.update/target/site/features/scalariform.feature_0.2.2.jar differ diff --git a/scalariform.update/target/site/plugins/scalariform_0.2.2.jar b/scalariform.update/target/site/plugins/scalariform_0.2.2.jar new file mode 100644 index 00000000..5c7aaeb7 Binary files /dev/null and b/scalariform.update/target/site/plugins/scalariform_0.2.2.jar differ diff --git a/scalariform.update/target/site/site.xml b/scalariform.update/target/site/site.xml new file mode 100644 index 00000000..57aa97cb --- /dev/null +++ b/scalariform.update/target/site/site.xml @@ -0,0 +1,11 @@ + + + + Scalariform Update Site + + + + + + diff --git a/scalariform.update/target/site_assembly.zip b/scalariform.update/target/site_assembly.zip new file mode 100644 index 00000000..71f405b9 Binary files /dev/null and b/scalariform.update/target/site_assembly.zip differ diff --git a/scalariform/META-INF/MANIFEST.MF b/scalariform/META-INF/MANIFEST.MF index 086aed4b..62896053 100644 --- a/scalariform/META-INF/MANIFEST.MF +++ b/scalariform/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Scalariform Bundle-SymbolicName: scalariform -Bundle-Version: 0.2.0.qualifier +Bundle-Version: 0.2.2 Require-Bundle: org.scala-lang.scala-library, org.scala-lang.modules.scala-xml Bundle-ClassPath: . @@ -13,4 +13,4 @@ Export-Package: scalariform, scalariform.lexer, scalariform.parser, scalariform.utils -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/scalariform/pom.xml b/scalariform/pom.xml new file mode 100644 index 00000000..4c3276b2 --- /dev/null +++ b/scalariform/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + org.scalariform + scalariform + eclipse-plugin + + scalariform.parent + org.scalariform + 0.2.2 + + + + + + + org.eclipse.tycho + tycho-compiler-plugin + ${tycho.version} + + + **/*.scala + + + + + + diff --git a/scalariform/src/main/scala/scalariform/formatter/preferences/PreferenceDescriptor.scala b/scalariform/src/main/scala/scalariform/formatter/preferences/PreferenceDescriptor.scala index fb1ac083..ffc5b178 100755 --- a/scalariform/src/main/scala/scalariform/formatter/preferences/PreferenceDescriptor.scala +++ b/scalariform/src/main/scala/scalariform/formatter/preferences/PreferenceDescriptor.scala @@ -131,25 +131,25 @@ case object AlignSingleLineCaseStatements extends BooleanPreferenceDescriptor { case object CompactControlReadability extends BooleanPreferenceDescriptor { val key = "compactControlReadability" - val description = "Enable Compact Control Readability style" + val description = "Compact Control Readability style" val defaultValue = false } case object CompactStringConcatenation extends BooleanPreferenceDescriptor { val key = "compactStringConcatenation" - val description = "Omit spaces when formatting a '+' operator on String literals" + val description = "Compact spaces when formatting a '+' operator on String literals" val defaultValue = false } case object DanglingCloseParenthesis extends IntentPreferenceDescriptor { val key = "danglingCloseParenthesis" - val description = "Put a newline before a ')' in an argument expression" + val description = "Dangling closing ')' in an argument expression on a new line" val defaultValue = Prevent } case object DoubleIndentConstructorArguments extends BooleanPreferenceDescriptor { val key = "doubleIndentConstructorArguments" - val description = "Class (and trait / object) declarations will be formatted as recommended by the Scala Style Guide" + val description = "Double indent constructor arguments, if they span multiple lines" val defaultValue = false } @@ -168,13 +168,13 @@ case object DoubleIndentMethodDeclaration extends BooleanPreferenceDescriptor { case object FirstArgumentOnNewline extends IntentPreferenceDescriptor { val key = "firstArgumentOnNewline" - val description = "Places the first argument to functions calls on a new line" + val description = "First argument to functions calls on a new line" val defaultValue = Force } case object FirstParameterOnNewline extends IntentPreferenceDescriptor { val key = "firstParameterOnNewline" - val description = "Places the first parameter in function or class definitions on a new line" + val description = "First parameter in function or class definitions on a new line" val defaultValue = Force } @@ -217,7 +217,7 @@ case object MultilineScaladocCommentsStartOnFirstLine extends BooleanPreferenceD case object NewlineAtEndOfFile extends BooleanPreferenceDescriptor { val key = "newlineAtEndOfFile" - val description = "Add a newline at the end of all files" + val description = "Newline at the end of all files" val defaultValue = false } @@ -241,36 +241,36 @@ case object RewriteArrowSymbols extends BooleanPreferenceDescriptor { case object SpaceBeforeColon extends BooleanPreferenceDescriptor { val key = "spaceBeforeColon" - val description = "Add a space before colons" + val description = "Space before colons" val defaultValue = false } case object SpaceBeforeContextColon extends BooleanPreferenceDescriptor { val key = "spaceBeforeContextColon" - val description = "Add a space before colons in context bounds" + val description = "Space before colons in context bounds" val defaultValue = false } case object SpaceInsideBrackets extends BooleanPreferenceDescriptor { val key = "spaceInsideBrackets" - val description = "Require a space after '[' and before ']'" + val description = "Space after '[' and before ']'" val defaultValue = false } case object SpaceInsideParentheses extends BooleanPreferenceDescriptor { val key = "spaceInsideParentheses" - val description = "Require a space after '(' and before ')'" + val description = "Space after '(' and before ')'" val defaultValue = false } case object SpacesAroundMultiImports extends BooleanPreferenceDescriptor { val key = "spacesAroundMultiImports" - val description = "Place spaces around multi imports (import a.{ b, c, d }" + val description = "Spaces around multi imports (import a.{ b, c, d }" val defaultValue = true } case object SpacesWithinPatternBinders extends BooleanPreferenceDescriptor { val key = "spacesWithinPatternBinders" - val description = "Add a space around the @ token in pattern binders" + val description = "Spaces around the @ token in pattern binders" val defaultValue = true } diff --git a/version.sbt b/version.sbt index a500ff92..11d1a4c7 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "0.2.1" +version in ThisBuild := "0.2.2"