Skip to content

Commit

Permalink
Merge pull request #24 from alexarchambault/topic/ammonite-1.6.3
Browse files Browse the repository at this point in the history
Switch to ammonite 1.6.3
  • Loading branch information
alexarchambault authored Feb 1, 2019
2 parents b945966 + c59aafb commit 5463ec4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ jobs:
scala: 2.12.8
- stage: release
script: sbt ci-release
branches:
only:
- master
- /^v\d+\.\d+.*$/ # tagged versions
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ final class AmmoniteClassServer(host: String, bindTo: String, port: Int, frames:
frames
.toStream
.flatMap(_.classpath)
.filter(_.getProtocol == "file")
.map(url => new File(url.toURI))
.filter(f => f.isDirectory)
.map(path.split('/').foldLeft(_)(new File(_, _)))
.collectFirst { case f if f.exists() => Files.readAllBytes(f.toPath) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.apache.spark.sql.ammonitesparkinternals

import java.io.File
import java.net.{InetAddress, URI}
import java.net.{InetAddress, URI, URL}
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Paths}

Expand Down Expand Up @@ -39,10 +39,19 @@ object AmmoniteSparkSessionBuilder {
)
}

def shouldPassToSpark(classpathEntry: File): Boolean =
classpathEntry.isFile &&
classpathEntry.getName.endsWith(".jar") &&
!classpathEntry.getName.endsWith("-sources.jar")
def shouldPassToSpark(classpathEntry: URL): Boolean = {
val isJarFile = classpathEntry.getProtocol == "file" &&
classpathEntry.getPath.endsWith(".jar") &&
!classpathEntry.getPath.endsWith("-sources.jar")
// Should be useful in almond, if one generates a launcher for it with the --standalone option (to embed the
// dependencies in the launcher).
// Since https://github.com/coursier/coursier/pull/1024 in coursier, these embedded dependencies should have URLs
// like jar:file:/…, with possible multiple '!/' in them.
val isJarInJar = classpathEntry.getProtocol == "jar" &&
classpathEntry.getFile.endsWith(".jar!/") &&
!classpathEntry.getPath.endsWith("-sources.jar!/")
isJarFile || isJarInJar
}

def classpath(cl: ClassLoader): Stream[java.net.URL] = {
if (cl == null)
Expand Down Expand Up @@ -198,7 +207,7 @@ class AmmoniteSparkSessionBuilder
.frames
.flatMap(_.classpath)
.filter(AmmoniteSparkSessionBuilder.shouldPassToSpark)
.map(_.getAbsoluteFile.toURI)
.map(_.toURI)

val baseJars = {
val cp = AmmoniteSparkSessionBuilder.classpath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class TestRepl {
val colors = Ref(Colors.BlackWhite)
def newCompiler() = interp.compilerManager.init(force = true)
def compiler = interp.compilerManager.compiler.compiler
def interactiveCompiler = interp.compilerManager.pressy.compiler
def fullImports = interp.predefImports ++ imports
def imports = interp.frameImports
def usedEarlierDefinitions = interp.frameUsedEarlierDefinitions
Expand Down
2 changes: 1 addition & 1 deletion project/Deps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sbt.Keys._

object Deps {

def ammoniteRepl = ("com.lihaoyi" % "ammonite-repl" % "1.6.0").cross(CrossVersion.full)
def ammoniteRepl = ("com.lihaoyi" % "ammonite-repl" % "1.6.3").cross(CrossVersion.full)
def jettyServer = "org.eclipse.jetty" % "jetty-server" % "8.1.22.v20160922"
def utest = "com.lihaoyi" %% "utest" % "0.6.6"

Expand Down

0 comments on commit 5463ec4

Please sign in to comment.