@@ -2,13 +2,13 @@ package com.sourcegraph.lsif_java.buildtools
22
33import java .nio .charset .StandardCharsets
44import java .nio .file .Files
5+ import java .nio .file .NoSuchFileException
56import java .nio .file .Path
67import java .nio .file .Paths
78import java .nio .file .StandardCopyOption
89
910import scala .collection .mutable .ListBuffer
1011
11- import com .sourcegraph .io .CopyVisitor
1212import com .sourcegraph .lsif_java .Embedded
1313import com .sourcegraph .lsif_java .commands .IndexCommand
1414
@@ -105,10 +105,25 @@ case class GradleJavaCompiler(languageVersion: String, javacPath: Path) {
105105 // as well as <java-installation-path>/jre/lib in JDK <=8, else we get
106106 // "no class roots are found in the JDK path" from the compile{Test}Kotlin tasks.
107107 // https://docs.oracle.com/en/java/javase/12/migrate/index.html#JSMIG-GUID-A78CC891-701D-4549-AA4E-B8DD90228B4B
108+
109+ val copyFiles =
110+ (source : Path , destination : Path ) => {
111+ Files
112+ .walk(source)
113+ .forEach(t => {
114+ val destPath = destination.resolve(source.relativize(t))
115+ try {
116+ Files .copy(t, destPath)
117+ } catch {
118+ case _ : NoSuchFileException =>
119+ return
120+ }
121+ })
122+ }
123+
108124 val libPath = dir.resolve(" lib" )
109- Files .createDirectory(libPath)
110125 val javacLibPath = javacPath.getParent.getParent.resolve(" lib" )
111- Files .walkFileTree (javacLibPath, new CopyVisitor (javacLibPath, libPath) )
126+ copyFiles (javacLibPath, libPath)
112127
113128 if (languageVersion == " 8" ) {
114129 val jreLibPath = dir.resolve(" jre" ).resolve(" lib" )
@@ -119,10 +134,7 @@ case class GradleJavaCompiler(languageVersion: String, javacPath: Path) {
119134 .resolve(" jre" )
120135 .resolve(" lib" )
121136
122- Files .walkFileTree(
123- javacJreLibPath,
124- new CopyVisitor (javacJreLibPath, jreLibPath)
125- )
137+ copyFiles(javacJreLibPath, jreLibPath)
126138 }
127139 }
128140}
0 commit comments