Skip to content

Commit 650e1f0

Browse files
committed
Enable debug information in java recompile
1 parent ffc6a51 commit 650e1f0

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/main/java/net/minecraftforge/mcmaven/impl/tasks/RecompileTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ private File recompileSourcesImpl(Task inputTask, File output) {
6767
var sourcesJar = inputTask.execute();
6868

6969
cache.add("sources", sourcesJar);
70+
cache.addKnown("debug", "true");
7071

7172
if (Mavenizer.checkCache(output, cache))
7273
return output;
@@ -78,7 +79,7 @@ private File recompileSourcesImpl(Task inputTask, File output) {
7879
throw new IllegalStateException("JDK not found: " + javaTarget, e);
7980
}
8081

81-
ProcessUtils.recompileJar(jdk, this.classpath.get(), sourcesJar, output);
82+
ProcessUtils.recompileJar(jdk, this.classpath.get(), sourcesJar, output, true);
8283

8384
cache.save();
8485
return output;

src/main/java/net/minecraftforge/mcmaven/impl/util/ProcessUtils.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public static Result runJar(File javaHome, File workDir, File logFile, File tool
270270
}
271271
}
272272

273-
public static File recompileJar(File javaHome, List<File> classpath, File sourcesJar, File outputJar) {
273+
public static File recompileJar(File javaHome, List<File> classpath, File sourcesJar, File outputJar, boolean enableDebug) {
274274
// classpath arg
275275
var classpathString = makeClasspathString(classpath);
276276

@@ -326,12 +326,14 @@ public static File recompileJar(File javaHome, List<File> classpath, File source
326326

327327
var outputClasses = new File(temp, "classes");
328328
FileUtils.ensure(outputClasses);
329-
var args = List.of(
329+
var args = new ArrayList<>(List.of(
330330
"-nowarn",
331331
"-d " + wrap(outputClasses.getAbsolutePath().replace('\\', '/')),
332332
"-classpath " + wrap(classpathString),
333333
sourcePath.toString()
334-
);
334+
));
335+
if (enableDebug)
336+
args.add("-g");
335337

336338
var process = ProcessUtils.runJavac(javaHome, temp, new File(outputJar.getAbsolutePath() + ".log"), args);
337339
if (process.exitCode != 0) {

0 commit comments

Comments
 (0)