Author: bodewig
Date: Thu Oct 30 21:45:37 2008
New Revision: 709346
URL: http://svn.apache.org/viewvc?rev=709346&view=rev
Log:
convenience base class
Added:
ant/sandbox/javafront/src/etc/examples/AntUnitTest.java (with props)
ant/sandbox/javafront/src/main/org/apache/ant/javafront/BuildFileBase.java
(with props)
Added: ant/sandbox/javafront/src/etc/examples/AntUnitTest.java
URL:
http://svn.apache.org/viewvc/ant/sandbox/javafront/src/etc/examples/AntUnitTest.java?rev=709346&view=auto
==============================================================================
--- ant/sandbox/javafront/src/etc/examples/AntUnitTest.java (added)
+++ ant/sandbox/javafront/src/etc/examples/AntUnitTest.java Thu Oct 30 21:45:37
2008
@@ -0,0 +1,39 @@
+/*
+ * 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.ant.javafront.example;
+
+import org.apache.ant.javafront.BuildFileBase;
+import org.apache.ant.javafront.annotations.AntProject;
+import org.apache.ant.javafront.annotations.AntTarget;
+import org.apache.tools.ant.Project;
+
[EMAIL PROTECTED](Name="example using AntUnit", BaseDir="../../..",
+ DefaultTarget="describe")
+public class AntUnitTest extends BuildFileBase {
+ public AntUnitTest(Project p) {
+ super(p);
+ }
+
+ @AntTarget(Description="describes this build file")
+ public void describe() {
+ build().newTag("echo")
+ .withAttribute("message", "${ant.version}").execute();
+ build().newTag("echo")
+ .withNestedText("Demonstrates running an AntUnit test.").execute();
+ }
+}
\ No newline at end of file
Propchange: ant/sandbox/javafront/src/etc/examples/AntUnitTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
ant/sandbox/javafront/src/main/org/apache/ant/javafront/BuildFileBase.java
URL:
http://svn.apache.org/viewvc/ant/sandbox/javafront/src/main/org/apache/ant/javafront/BuildFileBase.java?rev=709346&view=auto
==============================================================================
--- ant/sandbox/javafront/src/main/org/apache/ant/javafront/BuildFileBase.java
(added)
+++ ant/sandbox/javafront/src/main/org/apache/ant/javafront/BuildFileBase.java
Thu Oct 30 21:45:37 2008
@@ -0,0 +1,42 @@
+/*
+ * 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.ant.javafront;
+
+import org.apache.ant.javafront.builder.TagBuilder;
+import org.apache.tools.ant.Project;
+
+/**
+ * Convenience base class for build files, completely optional.
+ */
+public abstract class BuildFileBase {
+ private final Project project;
+ private final TagBuilder tagBuilder;
+
+ protected BuildFileBase(Project p) {
+ project = p;
+ tagBuilder = TagBuilder.forProject(p);
+ }
+
+ protected final Project getProject() {
+ return project;
+ }
+
+ protected final TagBuilder build() {
+ return tagBuilder;
+ }
+}
\ No newline at end of file
Propchange:
ant/sandbox/javafront/src/main/org/apache/ant/javafront/BuildFileBase.java
------------------------------------------------------------------------------
svn:eol-style = native