[EMAIL PROTECTED] wrote:
Author: kevj
Date: Fri May 11 23:09:06 2007
New Revision: 537344

URL: http://svn.apache.org/viewvc?view=rev&rev=537344
Log:
-new ResourceContains condition

Added:
    
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java

Added: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java?view=auto&rev=537344
==============================================================================
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java
 (added)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java
 Fri May 11 23:09:06 2007
@@ -0,0 +1,99 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.tools.ant.taskdefs.condition;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.util.FileUtils;
+
+/**
+ * <resourcecontains>
+ * Is a string contained in a resource (file currently)?
+ * @since Ant 1.7.1
+ */
+public class ResourceContains implements Condition {
+
+    private String substring;
+    private Resource resource;
+    private boolean casesensitive = true;
+ + /**
+     * Sets the resource to search
+     * @param r
+     */
+    public void setResource(String r) {
+        this.resource = new FileResource(new File(r));
+    }
+

Not sure about this. Why take a string? Its not being resolved relative to the project base, and is doing work that ant should do.

If we want to look in a resource for a string
 -the test should take any resource defined inline :
 add(Resource r)
or by a refid


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to