3eb056
From e7ff390ef777bd818ccc6e6f8f3a56f36020abfe Mon Sep 17 00:00:00 2001
3eb056
From: Mat Booth <mat.booth@gmail.com>
3eb056
Date: Wed, 15 Sep 2021 10:21:53 +0100
3eb056
Subject: [PATCH 1/2] Always generate bytecode debuginfo
3eb056
3eb056
When ecj is used to build RPMs
3eb056
---
3eb056
 .../jdt/internal/compiler/batch/Main.java     | 23 +++++++++++++++++++
3eb056
 1 file changed, 23 insertions(+)
3eb056
3eb056
diff --git a/org/eclipse/jdt/internal/compiler/batch/Main.java b/org/eclipse/jdt/internal/compiler/batch/Main.java
3eb056
index f77372d..73a0d24 100644
3eb056
--- a/org/eclipse/jdt/internal/compiler/batch/Main.java
3eb056
+++ b/org/eclipse/jdt/internal/compiler/batch/Main.java
3eb056
@@ -3109,6 +3109,29 @@ public void configure(String[] argv) {
3eb056
 		this.options.put(CompilerOptions.OPTION_Process_Annotations, CompilerOptions.ENABLED);
3eb056
 	}
3eb056
 
3eb056
+	{
3eb056
+		// If we're building an RPM, force full debugging info to
3eb056
+		// be generated, no matter what options have been passed
3eb056
+		// by Ant.  This is something of a kludge, but it is far
3eb056
+		// better than the alternative, which is having class
3eb056
+		// files with debug info mysteriously missing.
3eb056
+
3eb056
+		String RpmPackageName = System.getenv("RPM_PACKAGE_NAME");
3eb056
+		String RpmArch = System.getenv("RPM_ARCH");
3eb056
+		String RpmBuildRoot = System.getenv("RPM_BUILD_ROOT");
3eb056
+		if (RpmPackageName != null && RpmArch != null && RpmBuildRoot != null) {
3eb056
+			this.options.put(
3eb056
+					CompilerOptions.OPTION_LocalVariableAttribute,
3eb056
+					CompilerOptions.GENERATE);
3eb056
+			this.options.put(
3eb056
+					CompilerOptions.OPTION_LineNumberAttribute,
3eb056
+					CompilerOptions.GENERATE);
3eb056
+			this.options.put(
3eb056
+					CompilerOptions.OPTION_SourceFileAttribute,
3eb056
+					CompilerOptions.GENERATE);
3eb056
+		}
3eb056
+	}
3eb056
+
3eb056
 	this.logger.logCommandLineArguments(newCommandLineArgs);
3eb056
 	this.logger.logOptions(this.options);
3eb056
 
3eb056
-- 
3eb056
2.31.1
3eb056