Skip to content

Commit

Permalink
Removed support for sbt 0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
magnolia-k committed Jan 2, 2025
1 parent 4af911a commit 43cbe0c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
22 changes: 0 additions & 22 deletions src/main/scala-sbt-1.0/Compat.scala

This file was deleted.

23 changes: 20 additions & 3 deletions src/main/scala/org/scalatra/sbt/DistPlugin.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package org.scalatra.sbt

import java.util.regex.Pattern
import java.io.File
import java.util.zip.ZipFile

import scala.sys.process._

import _root_.sbt._
import Def.Initialize
Expand Down Expand Up @@ -40,7 +44,7 @@ object DistPlugin extends AutoPlugin {
Def.task {
IO.delete(tgt.value)
val (libs, dirs) =
cp.value.files partition Compat.ClasspathUtilities.isArchive
cp.value.files partition isArchive
val jars =
libs.descendantsExcept(GlobFilter("*"), excl.value) pair Path.flat(
tgt.value / "lib"
Expand All @@ -54,6 +58,19 @@ object DistPlugin extends AutoPlugin {
}
}

private def isArchive(file: File): Boolean = {
if (!file.exists() || !file.isFile) {
false
} else {
try {
new ZipFile(file)
true
} catch {
case _: Exception => false
}
}
}

private def createLauncherScriptTask(
base: File,
name: String,
Expand All @@ -76,7 +93,7 @@ object DistPlugin extends AutoPlugin {
envExports
)
)
Compat.executeProccess("chmod +x %s".format(f.getAbsolutePath), logger)
"chmod +x %s".format(f.getAbsolutePath) ! logger
f
}

Expand Down Expand Up @@ -104,7 +121,7 @@ object DistPlugin extends AutoPlugin {
}

private def classPathString(base: File, libFiles: Seq[File]) = {
(libFiles filter Compat.ClasspathUtilities.isArchive map (_.relativeTo(
(libFiles filter isArchive map (_.relativeTo(
base
))).flatten mkString java.io.File.pathSeparator
}
Expand Down

0 comments on commit 43cbe0c

Please sign in to comment.