mirror of https://github.com/sbt/sbt.git
commit
e1a8e0fabe
|
|
@ -85,7 +85,7 @@ public class CachePath {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File defaultCacheDirectory() {
|
public static File defaultCacheDirectory() {
|
||||||
return new File(CoursierPaths.cacheDirectory(), "v1");
|
return CoursierPaths.cacheDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ConcurrentHashMap<File, Object> processStructureLocks = new ConcurrentHashMap<File, Object>();
|
private static ConcurrentHashMap<File, Object> processStructureLocks = new ConcurrentHashMap<File, Object>();
|
||||||
|
|
|
||||||
|
|
@ -30,18 +30,19 @@ public final class CoursierPaths {
|
||||||
if (path == null)
|
if (path == null)
|
||||||
path = System.getProperty("coursier.cache");
|
path = System.getProperty("coursier.cache");
|
||||||
|
|
||||||
String xdgPath = coursierDirectories.projectCacheDir;
|
File baseXdgDir = new File(coursierDirectories.projectCacheDir);
|
||||||
File xdgDir = new File(xdgPath);
|
File xdgDir = new File(baseXdgDir, "v1");
|
||||||
|
String xdgPath = xdgDir.getAbsolutePath();
|
||||||
|
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
if (xdgDir.isDirectory())
|
if (baseXdgDir.isDirectory())
|
||||||
path = xdgPath;
|
path = xdgPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
File coursierDotFile = new File(System.getProperty("user.home") + "/.coursier");
|
File coursierDotFile = new File(System.getProperty("user.home") + "/.coursier");
|
||||||
if (coursierDotFile.isDirectory())
|
if (coursierDotFile.isDirectory())
|
||||||
path = System.getProperty("user.home") + "/.coursier/cache/";
|
path = System.getProperty("user.home") + "/.coursier/cache/v1/";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
|
|
@ -49,12 +50,7 @@ public final class CoursierPaths {
|
||||||
xdgDir.mkdirs();
|
xdgDir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
File coursierCacheDirectory = new File(path).getAbsoluteFile();
|
return new File(path).getAbsoluteFile();
|
||||||
|
|
||||||
if (coursierCacheDirectory.getName().equals("v1"))
|
|
||||||
coursierCacheDirectory = coursierCacheDirectory.getParentFile();
|
|
||||||
|
|
||||||
return coursierCacheDirectory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File cacheDirectory() {
|
public static File cacheDirectory() {
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ object Settings {
|
||||||
sbtVersion := {
|
sbtVersion := {
|
||||||
scalaBinaryVersion.value match {
|
scalaBinaryVersion.value match {
|
||||||
case "2.10" => "0.13.8"
|
case "2.10" => "0.13.8"
|
||||||
case "2.12" => "1.0.1"
|
case "2.12" => "1.0.2"
|
||||||
case _ => sbtVersion.value
|
case _ => sbtVersion.value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ object SbtCompatibility {
|
||||||
def dependencies = module.modules
|
def dependencies = module.modules
|
||||||
}
|
}
|
||||||
|
|
||||||
def needsIvyXmlLocal = sbt.Keys.deliverLocalConfiguration
|
def needsIvyXmlLocal = List(sbt.Keys.deliverLocalConfiguration)
|
||||||
def needsIvyXml = sbt.Keys.deliverConfiguration
|
def needsIvyXml = List(sbt.Keys.deliverConfiguration)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,28 @@ object SbtCompatibility {
|
||||||
|
|
||||||
type IvySbt = sbt.internal.librarymanagement.IvySbt
|
type IvySbt = sbt.internal.librarymanagement.IvySbt
|
||||||
|
|
||||||
def needsIvyXmlLocal = sbt.Keys.publishLocalConfiguration
|
lazy val needsIvyXmlLocal = Seq(sbt.Keys.publishLocalConfiguration) ++ {
|
||||||
def needsIvyXml = sbt.Keys.publishConfiguration
|
try {
|
||||||
|
val cls = sbt.Keys.getClass
|
||||||
|
val m = cls.getMethod("makeIvyXmlLocalConfiguration")
|
||||||
|
val task = m.invoke(sbt.Keys).asInstanceOf[sbt.TaskKey[sbt.PublishConfiguration]]
|
||||||
|
List(task)
|
||||||
|
} catch {
|
||||||
|
case _: Throwable => // FIXME Too wide
|
||||||
|
Nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lazy val needsIvyXml = Seq(sbt.Keys.publishConfiguration) ++ {
|
||||||
|
try {
|
||||||
|
val cls = sbt.Keys.getClass
|
||||||
|
val m = cls.getMethod("makeIvyXmlConfiguration")
|
||||||
|
val task = m.invoke(sbt.Keys).asInstanceOf[sbt.TaskKey[sbt.PublishConfiguration]]
|
||||||
|
List(task)
|
||||||
|
} catch {
|
||||||
|
case _: Throwable => // FIXME Too wide
|
||||||
|
Nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,8 +196,6 @@ object CoursierPlugin extends AutoPlugin {
|
||||||
withClassifiers = true,
|
withClassifiers = true,
|
||||||
sbtClassifiers = true
|
sbtClassifiers = true
|
||||||
).value,
|
).value,
|
||||||
makeIvyXmlBefore(needsIvyXmlLocal, shadedConfigOpt),
|
|
||||||
makeIvyXmlBefore(needsIvyXml, shadedConfigOpt),
|
|
||||||
update := Tasks.updateTask(
|
update := Tasks.updateTask(
|
||||||
shadedConfigOpt,
|
shadedConfigOpt,
|
||||||
withClassifiers = false
|
withClassifiers = false
|
||||||
|
|
@ -280,7 +278,8 @@ object CoursierPlugin extends AutoPlugin {
|
||||||
// Tests artifacts from Maven repositories are given this type.
|
// Tests artifacts from Maven repositories are given this type.
|
||||||
// Adding it here so that these work straightaway.
|
// Adding it here so that these work straightaway.
|
||||||
classpathTypes += "test-jar"
|
classpathTypes += "test-jar"
|
||||||
)
|
) ++
|
||||||
|
(needsIvyXml ++ needsIvyXmlLocal).map(makeIvyXmlBefore(_, shadedConfigOpt))
|
||||||
|
|
||||||
override lazy val buildSettings = super.buildSettings ++ Seq(
|
override lazy val buildSettings = super.buildSettings ++ Seq(
|
||||||
coursierParallelDownloads := 6,
|
coursierParallelDownloads := 6,
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,8 @@ object ShadingPlugin extends AutoPlugin {
|
||||||
transitive = true
|
transitive = true
|
||||||
)
|
)
|
||||||
|
|
||||||
// make that a setting?
|
|
||||||
val shadingNamespace = SettingKey[String]("shading-namespace")
|
val shadingNamespace = SettingKey[String]("shading-namespace")
|
||||||
|
|
||||||
// make that a setting?
|
|
||||||
val shadeNamespaces = SettingKey[Set[String]]("shade-namespaces")
|
val shadeNamespaces = SettingKey[Set[String]]("shade-namespaces")
|
||||||
|
|
||||||
val toShadeJars = TaskKey[Seq[File]]("to-shade-jars")
|
val toShadeJars = TaskKey[Seq[File]]("to-shade-jars")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue