Finalize adds debug options to JAVA_OPTS
()
| 59 | |
| 60 | // Finalize adds debug options to JAVA_OPTS |
| 61 | func (d *DebugFramework) Finalize() error { |
| 62 | config, err := d.loadConfig() |
| 63 | if err != nil { |
| 64 | d.context.Log.Warning("Failed to load debug config: %s", err.Error()) |
| 65 | return nil // Don't fail the build |
| 66 | } |
| 67 | if !config.isEnabled() { |
| 68 | return nil |
| 69 | } |
| 70 | |
| 71 | port := config.getPort() |
| 72 | suspend := config.getSuspend() |
| 73 | |
| 74 | // Build JDWP agent string |
| 75 | suspendValue := "n" |
| 76 | if suspend { |
| 77 | suspendValue = "y" |
| 78 | } |
| 79 | |
| 80 | debugOpts := fmt.Sprintf("-agentlib:jdwp=transport=dt_socket,server=y,address=%d,suspend=%s", port, suspendValue) |
| 81 | |
| 82 | // Write JAVA_OPTS to .opts file with priority 20 (Ruby buildpack line 54) |
| 83 | if err := writeJavaOptsFile(d.context, 20, "debug", debugOpts); err != nil { |
| 84 | return fmt.Errorf("failed to write java_opts file: %w", err) |
| 85 | } |
| 86 | |
| 87 | return nil |
| 88 | } |
| 89 | |
| 90 | // isEnabled checks if debugging is enabled |
| 91 | func (d *debugConfig) isEnabled() bool { |
nothing calls this directly
no test coverage detected