mirror of https://github.com/sbt/sbt.git
preserve semanticdb files in pullRemoteCache task
This commit is contained in:
parent
a2fc24bb6f
commit
e0e11c71d5
|
|
@ -291,7 +291,12 @@ object RemoteCache {
|
||||||
IO.delete(output)
|
IO.delete(output)
|
||||||
IO.unzip(jar, output, preserveLastModified = preserveLastModified)
|
IO.unzip(jar, output, preserveLastModified = preserveLastModified)
|
||||||
processOutput(output)
|
processOutput(output)
|
||||||
IO.delete(output / "META-INF")
|
|
||||||
|
// preserve semanticdb dir
|
||||||
|
// https://github.com/scalameta/scalameta/blob/a7927ee8e012cfff/semanticdb/scalac/library/src/main/scala/scala/meta/internal/semanticdb/scalac/SemanticdbPaths.scala#L9
|
||||||
|
Option((output / "META-INF").listFiles).foreach(
|
||||||
|
_.iterator.filterNot(_.getName == "semanticdb").foreach(IO.delete)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private def extractAnalysis(output: File, analysisFile: File): Unit = {
|
private def extractAnalysis(output: File, analysisFile: File): Unit = {
|
||||||
|
|
@ -300,7 +305,6 @@ object RemoteCache {
|
||||||
if (expandedAnalysis.exists) {
|
if (expandedAnalysis.exists) {
|
||||||
IO.move(expandedAnalysis, analysisFile)
|
IO.move(expandedAnalysis, analysisFile)
|
||||||
}
|
}
|
||||||
IO.delete(metaDir)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private def extractTestResult(output: File, testResult: File): Unit = {
|
private def extractTestResult(output: File, testResult: File): Unit = {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
name := "my-project"
|
||||||
|
|
||||||
|
scalaVersion := "2.12.12"
|
||||||
|
|
||||||
|
semanticdbIncludeInJar := true
|
||||||
|
|
||||||
|
semanticdbEnabled := true
|
||||||
|
|
||||||
|
pushRemoteCacheTo := Some(
|
||||||
|
MavenCache("local-cache", (ThisBuild / baseDirectory).value / "remote-cache-semanticdb")
|
||||||
|
)
|
||||||
|
|
||||||
|
remoteCacheId := "fixed-id"
|
||||||
|
|
||||||
|
remoteCacheIdCandidates := Seq(remoteCacheId.value)
|
||||||
|
|
||||||
|
pushRemoteCacheConfiguration := pushRemoteCacheConfiguration.value.withOverwrite(true)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
object MyClass
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
object MyTest
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
> pushRemoteCache
|
||||||
|
|
||||||
|
# Generated sources, compiled classes
|
||||||
|
$ exists target/scala-2.12/classes/MyClass.class
|
||||||
|
$ exists target/scala-2.12/classes/MyClass$.class
|
||||||
|
$ exists target/scala-2.12/classes/META-INF/semanticdb/src/main/scala/MyClass.scala.semanticdb
|
||||||
|
$ exists target/scala-2.12/zinc/inc_compile_2.12.zip
|
||||||
|
$ exists target/scala-2.12/test-classes/MyTest.class
|
||||||
|
$ exists target/scala-2.12/test-classes/MyTest$.class
|
||||||
|
$ exists target/scala-2.12/test-classes/META-INF/semanticdb/src/test/scala/MyTest.scala.semanticdb
|
||||||
|
$ exists target/scala-2.12/test-zinc/inc_compile_2.12.zip
|
||||||
|
|
||||||
|
# Pom file
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id.pom
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id.pom.md5
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id.pom.sha1
|
||||||
|
|
||||||
|
# Compile
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id-cached-compile.jar
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id-cached-compile.jar.md5
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id-cached-compile.jar.sha1
|
||||||
|
|
||||||
|
# Test
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id-cached-test.jar
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id-cached-test.jar.md5
|
||||||
|
$ exists remote-cache-semanticdb/my-project/my-project_2.12/0.0.0-fixed-id/my-project_2.12-0.0.0-fixed-id-cached-test.jar.sha1
|
||||||
|
|
||||||
|
> clean
|
||||||
|
|
||||||
|
$ absent target/scala-2.12/classes/MyClass.class
|
||||||
|
$ absent target/scala-2.12/classes/MyClass$.class
|
||||||
|
$ absent target/scala-2.12/classes/META-INF
|
||||||
|
$ absent target/scala-2.12/zinc/inc_compile_2.12.zip
|
||||||
|
$ absent target/scala-2.12/test-classes/MyTest.class
|
||||||
|
$ absent target/scala-2.12/test-classes/MyTest$.class
|
||||||
|
$ absent target/scala-2.12/test-classes/META-INF
|
||||||
|
$ absent target/scala-2.12/test-zinc/inc_compile_2.12.zip
|
||||||
|
|
||||||
|
> pullRemoteCache
|
||||||
|
|
||||||
|
# Files extracted from the cache artifacts
|
||||||
|
$ exists target/scala-2.12/classes/MyClass.class
|
||||||
|
$ exists target/scala-2.12/classes/MyClass$.class
|
||||||
|
$ exists target/scala-2.12/classes/META-INF/semanticdb/src/main/scala/MyClass.scala.semanticdb
|
||||||
|
$ exists target/scala-2.12/zinc/inc_compile_2.12.zip
|
||||||
|
$ exists target/scala-2.12/test-classes/MyTest.class
|
||||||
|
$ exists target/scala-2.12/test-classes/MyTest$.class
|
||||||
|
$ exists target/scala-2.12/test-classes/META-INF/semanticdb/src/test/scala/MyTest.scala.semanticdb
|
||||||
|
$ exists target/scala-2.12/test-zinc/inc_compile_2.12.zip
|
||||||
|
|
||||||
|
# Artifacts can be pushed twice (enabled overriding)
|
||||||
|
> pushRemoteCache
|
||||||
|
|
||||||
Loading…
Reference in New Issue