Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Fix analysis of Java compilation to jar #1371

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ThisBuild / version := {
nightlyVersion match {
case Some(v) => v
case _ =>
if ((ThisBuild / isSnapshot).value) "2.0.0-alpha12-SNAPSHOT"
if ((ThisBuild / isSnapshot).value) "2.0.0-alpha15-SNAPSHOT"
else old
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ object JarUtils {
*/
def fromURL(url: URL, jar: Path): ClassInJar = {
val path = url.getPath
if (!path.contains("!")) sys.error(s"unexpected URL $url that does not include '!'")
if (!path.contains("!/")) sys.error(s"unexpected URL $url that does not include '!'")
else {
val Array(_, cls) = url.getPath.split("!")
val Array(_, cls) = url.getPath.split("!/")
apply(jar, cls)
}
}
Expand Down Expand Up @@ -299,6 +299,12 @@ object JarUtils {

val prevJarPrefix: String = "prev-jar"

def relativize(jar: Path, file: Path): Option[String] = {
val prefix = jar.toString + "!"
val filePath = file.toString
Option.when(filePath.startsWith(prefix))(filePath.stripPrefix(prefix))
}

/** Checks if given file stores a ClassInJar */
def isClassInJar(file: File): Boolean = {
file.toString.split("!") match {
Expand Down
Loading