-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use source file mapping for all compilation providers
All compilation providers should be setting the source file attribute for use in debugging, there is no need to limit this to Java. This should allow for deletions of Kotlin classes to be handled correctly.
- Loading branch information
1 parent
5d094fa
commit c61a3e2
Showing
6 changed files
with
80 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesClassVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.quarkus.deployment.dev; | ||
|
||
import java.io.File; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import org.objectweb.asm.ClassVisitor; | ||
|
||
import io.quarkus.gizmo.Gizmo; | ||
import io.quarkus.paths.PathCollection; | ||
|
||
public class RuntimeUpdatesClassVisitor extends ClassVisitor { | ||
private final PathCollection sourcePaths; | ||
private final String classesPath; | ||
private String sourceFile; | ||
|
||
public RuntimeUpdatesClassVisitor(PathCollection sourcePaths, String classesPath) { | ||
super(Gizmo.ASM_API_VERSION); | ||
this.sourcePaths = sourcePaths; | ||
this.classesPath = classesPath; | ||
} | ||
|
||
@Override | ||
public void visitSource(String source, String debug) { | ||
this.sourceFile = source; | ||
} | ||
|
||
public Path getSourceFileForClass(final Path classFilePath) { | ||
for (Path sourcesDir : sourcePaths) { | ||
final Path classesDir = Paths.get(classesPath); | ||
final StringBuilder sourceRelativeDir = new StringBuilder(); | ||
sourceRelativeDir.append(classesDir.relativize(classFilePath.getParent())); | ||
sourceRelativeDir.append(File.separator); | ||
sourceRelativeDir.append(sourceFile); | ||
final Path sourceFilePath = sourcesDir.resolve(Path.of(sourceRelativeDir.toString())); | ||
if (Files.exists(sourceFilePath)) { | ||
return sourceFilePath; | ||
} | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters