Skip to content

Commit

Permalink
3.1.0: Use circe to generate s3.plugin instead of concatenating strings
Browse files Browse the repository at this point in the history
(Merge branch 'jsantos17-766-windows-compatible-plugin')

This should fix the problems with backslashes in Windows.
  • Loading branch information
djspiewak committed Jul 28, 2018
2 parents 70b8ecc + 7e88b81 commit 146884e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions project/AssembleDatasource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import scala.sys.process._
import java.util.stream.Collectors
import java.lang.Runtime

import io.circe.Json
import sbt.{Cache => _, MavenRepository => _, Tags => _, Task => _, _}
import sbt.Keys._
import scalaz._, Scalaz._
Expand Down Expand Up @@ -137,13 +138,13 @@ object AssembleDatasource {

// the .plugin file requires all dependency jar paths
// to be relative to the plugins folder
classPath = fetchedJarFiles.map(p => datasourcePluginsFolder.toPath.relativize(p.toPath)) ++ Seq(relativeDatasourceJarPath)
classPath = fetchedJarFiles.map(p => datasourcePluginsFolder.toPath.relativize(p.toPath)) ++ List(relativeDatasourceJarPath)

// format the classPath as readable json for the .plugin file
cpJson = classPath.map(s => "\"" + s + "\"").mkString("[\n ", ",\n ", "\n ]")
cpJson = Json.arr(classPath.map(_.toString).map(Json.fromString(_)) :_*)
mainJar = Json.fromString(relativeDatasourceJarPath)

// include the datasource jar and classpath into the .plugin file
outJson = s"""{\n "mainJar": "$relativeDatasourceJarPath",\n "classPath": $cpJson\n}"""
outJson = Json.obj("mainJar" -> mainJar, "classPath" -> cpJson).spaces2

// delete an old .plugin file, write the new one
_ <- Task.delay {
Expand Down
3 changes: 2 additions & 1 deletion project/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ libraryDependencies += "org.kohsuke" % "github-api" % "1.59" exclude("org.jenkin
// should remain the newest coursier version.
libraryDependencies ++= Seq(
"io.get-coursier" %% "coursier" % "1.0.1",
"io.get-coursier" %% "coursier-cache" % "1.0.1"
"io.get-coursier" %% "coursier-cache" % "1.0.1",
"io.circe" %% "circe-core" % "0.9.3"
)

scalacOptions --= Seq(
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "3.0.0"
version in ThisBuild := "3.1.0"

0 comments on commit 146884e

Please sign in to comment.