From c3e6d10cac152219fb942fc43ef474a9ea6b8110 Mon Sep 17 00:00:00 2001 From: "crosson.david@gmail.com" Date: Thu, 30 Nov 2017 23:17:47 +0100 Subject: [PATCH 1/6] do not take into account the generated scala file as itself a dependency --- .../com/truelaurel/codingame/tool/bundle/BundlerIo.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/truelaurel/codingame/tool/bundle/BundlerIo.scala b/src/main/scala/com/truelaurel/codingame/tool/bundle/BundlerIo.scala index c8ec2e2..3c3391d 100644 --- a/src/main/scala/com/truelaurel/codingame/tool/bundle/BundlerIo.scala +++ b/src/main/scala/com/truelaurel/codingame/tool/bundle/BundlerIo.scala @@ -55,7 +55,7 @@ case class StdBundlerIo(srcFolder: String = "./src/main/scala") extends BundlerI } def findFile(fileName: String): File = { - Files.find(Paths.get("."), Int.MaxValue, (path, _) => path.endsWith(fileName)) + Files.find(Paths.get("src"), Int.MaxValue, (path, _) => path.endsWith(fileName)) .findAny() .orElseThrow(() => new IllegalArgumentException(s"$fileName not found")) .toFile @@ -67,4 +67,4 @@ case class StdBundlerIo(srcFolder: String = "./src/main/scala") extends BundlerI Objects.requireNonNull(files, "visibleFiles should not be null in folder " + folder) files.filterNot(_.isDirectory).toList.sortBy(_.getAbsolutePath) } -} \ No newline at end of file +} From 87aa89e427948575ba6100aebf80d63e3c0ac6d0 Mon Sep 17 00:00:00 2001 From: "crosson.david@gmail.com" Date: Sat, 2 Dec 2017 21:24:53 +0100 Subject: [PATCH 2/6] update scala release to 2.12.4 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 534902f..ac0ab26 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,9 @@ name := "CodinGame-Scala-Kit" version := "0.1.0" -scalaVersion := "2.12.2" -libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test" +scalaVersion := "2.12.4" -libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.12.2" % "test" +libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test" +libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.12.4" % "test" enablePlugins(JmhPlugin) enablePlugins(JavaAppPackaging) \ No newline at end of file From 1d827d266053692f274d5dab2d9dd633a0f0f2af Mon Sep 17 00:00:00 2001 From: "crosson.david@gmail.com" Date: Sat, 2 Dec 2017 21:36:44 +0100 Subject: [PATCH 3/6] Generated scala file is now formatted using scalafmt --- build.sbt | 2 ++ .../scala/com/truelaurel/codingame/tool/bundle/Bundler.scala | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ac0ab26..e41e78b 100644 --- a/build.sbt +++ b/build.sbt @@ -4,6 +4,8 @@ scalaVersion := "2.12.4" libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test" libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.12.4" % "test" +libraryDependencies += "com.geirsson" %% "scalafmt-core" % "1.3.0" +libraryDependencies += "com.geirsson" %% "scalafmt-cli" % "1.3.0" enablePlugins(JmhPlugin) enablePlugins(JavaAppPackaging) \ No newline at end of file diff --git a/src/main/scala/com/truelaurel/codingame/tool/bundle/Bundler.scala b/src/main/scala/com/truelaurel/codingame/tool/bundle/Bundler.scala index ee5736b..fe1c1e9 100644 --- a/src/main/scala/com/truelaurel/codingame/tool/bundle/Bundler.scala +++ b/src/main/scala/com/truelaurel/codingame/tool/bundle/Bundler.scala @@ -9,7 +9,8 @@ case class Bundler(fileName: String, io: BundlerIo) { def bundle(): Unit = { val outputFileContent = buildOutput - io.save(fileName, outputFileContent) + val formattedOutputFileContent = org.scalafmt.Scalafmt.format(outputFileContent).get + io.save(fileName, formattedOutputFileContent) } def buildOutput: String = { From 498aa9833bd4983e1559ced5b7cf350a9c27bea7 Mon Sep 17 00:00:00 2001 From: "crosson.david@gmail.com" Date: Thu, 28 Dec 2017 11:33:06 +0100 Subject: [PATCH 4/6] Add FOLLOW_LINKS option to look for source file to integrate, really useful when scalakit is used as a git submodule --- .../com/truelaurel/codingame/tool/bundle/BundlerIo.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/truelaurel/codingame/tool/bundle/BundlerIo.scala b/src/main/scala/com/truelaurel/codingame/tool/bundle/BundlerIo.scala index 3c3391d..2242bc3 100644 --- a/src/main/scala/com/truelaurel/codingame/tool/bundle/BundlerIo.scala +++ b/src/main/scala/com/truelaurel/codingame/tool/bundle/BundlerIo.scala @@ -1,7 +1,7 @@ package com.truelaurel.codingame.tool.bundle import java.io.{File, PrintWriter} -import java.nio.file.{Files, Paths} +import java.nio.file.{Files, Paths, FileVisitOption} import java.util.Objects import scala.io.Source @@ -55,7 +55,7 @@ case class StdBundlerIo(srcFolder: String = "./src/main/scala") extends BundlerI } def findFile(fileName: String): File = { - Files.find(Paths.get("src"), Int.MaxValue, (path, _) => path.endsWith(fileName)) + Files.find(Paths.get("src"), Int.MaxValue, (path, _) => path.endsWith(fileName), FileVisitOption.FOLLOW_LINKS) .findAny() .orElseThrow(() => new IllegalArgumentException(s"$fileName not found")) .toFile From ede6ee64c039ae30e4af72d36ec1a7dfee140c70 Mon Sep 17 00:00:00 2001 From: Crosson David Date: Fri, 29 Dec 2017 13:34:21 +0100 Subject: [PATCH 5/6] Add information on how to use the scalakit as a git submodule --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 97e677c..c2643cc 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,12 @@ The example Bot [Ghost in the Cell](https://www.codingame.com/multiplayer/bot-pr 5. Open CodinGame Sync to synchronize Player.scala file continuously to online IDE +## CodinGame Scala Kit integration into your own git depo + +Using CodinGame Scala Kit as a git submodule inside your own git depot you can both store your solutions into +a private depot, and still use and contribute to this scala kit. +[All instructions are available within this example project](https://github.com/dacr/codingame-with-scalakit-example) + ## Screenshot ![alt tag](./asset/screenshot.png) From 07ebc75d7c59325a7bb89fcbe4470d3598a08c18 Mon Sep 17 00:00:00 2001 From: Crosson David Date: Fri, 29 Dec 2017 13:46:29 +0100 Subject: [PATCH 6/6] Add vi/vim temporary file into ignore list --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fd89e8d..061da2c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,8 @@ project/boot/ ### Kit -brutaltester \ No newline at end of file +brutaltester + +### Vi +*.swp +