From b8c3a33e2c05f13073c66448a2b1fcdca5e64a53 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 24 Feb 2005 20:18:22 +0000 Subject: [PATCH] debug=false breaks Symantec compiler git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277727 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ .../compilers/DefaultCompilerAdapter.java | 18 ++++++++++++++++-- .../tools/ant/taskdefs/compilers/Sj.java | 12 ++++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 3f195c28f..febe07899 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -337,6 +337,9 @@ Fixed bugs: * NPE when when tries to configure a task that cannot be instantiated. Bugzilla Report 33689. +* created an invalid command line when running + the Symantec Java compiler. + Changes from Ant 1.6.1 to Ant 1.6.2 =================================== diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 129df1ccc..cd4397f59 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -276,8 +276,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { } else { cmd.createArgument().setValue("-g"); } - } else if (!assumeJava11()) { - cmd.createArgument().setValue("-g:none"); + } else if (getNoDebugArgument() != null) { + cmd.createArgument().setValue(getNoDebugArgument()); } if (optimize) { cmd.createArgument().setValue("-O"); @@ -608,5 +608,19 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { } return bp.concatSystemBootClasspath("ignore"); } + + /** + * The argument the compiler wants to see if the debug attribute + * has been set to false. + * + *

A return value of null means no argument at all.

+ * + * @return "-g:none" unless we expect to invoke a JDK 1.1 compiler. + * + * @since Ant 1.6.3 + */ + protected String getNoDebugArgument() { + return assumeJava11() ? null : "-g:none"; + } } diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java index f624065ea..ee9994ebd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,14 @@ public class Sj extends DefaultCompilerAdapter { executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; } - + /** + * Returns null since sj either has -g for debug=true or no + * argument at all. + * + * @since Ant 1.6.3 + */ + protected String getNoDebugArgument() { + return null; + } }