You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Paul Philion <ph...@acmerocket.com> on 2000/07/19 15:11:00 UTC

[PATCH] Fixing property file problem in Property

Greetings...

I'm suggesting this patch because it seemed the best way to fix the
problem I've been having with setting "build.compiler" in the
.ant.properties file. The problem occurs because the code won't
override normal properties. I took out the code that checks for the
override because Project handles that (as it should).

There is plenty of cleanup do to in this file, but I just wanted to
get the problem fixed.

- Paul Philion

Index: src/main/org/apache/tools/ant/taskdefs/Property.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Pro
perty.java,v
retrieving revision 1.8
diff -u -c -r1.8 Property.java
cvs server: conflicting specifications of output style
*** src/main/org/apache/tools/ant/taskdefs/Property.java
2000/07/13 15:23:07     1.8
--- src/main/org/apache/tools/ant/taskdefs/Property.java
2000/07/19 13:05:19
***************
*** 159,164 ****
--- 159,168 ----
      }

      private void addProperty(String n, String v) {
+         project.setProperty(n, v);
+         /* Property doesn't set user properties! And don't bother
+          * with checking for override, that should be handled by
+          * project.
          if( userProperty ) {
              if (project.getUserProperty(n) == null) {
                  project.setUserProperty(n, v);
***************
*** 172,177 ****
--- 176,182 ----
                  log("Override ignored for " + name,
Project.MSG_VERBOSE);
              }
          }
+         */
      }

      private void resolveAllProperties(Hashtable props) {



Re: [PATCH] Fixing property file problem in Property

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "PP" == Paul Philion <ph...@acmerocket.com> writes:

 PP> I'm suggesting this patch because it seemed the best way to fix
 PP> the problem I've been having with setting "build.compiler" in the
 PP> .ant.properties file.

ISTR that once .ant.properties was a special file whose contents got
the same special treatment like properties specified on the command
line. When and why has this been dropped?

Another solution for your problem could be to set JAVACMD to 
"java -Dbuild.complier=whatever" to override the value specified in
the buildfile.

 PP> I took out the code that checks for the override because Project
 PP> handles that (as it should).

No, Project doesn't. It just ensures you don't override user
properties.