diff options
Diffstat (limited to 'src/main/java/net/sf/antcontrib/cpptasks/ide')
4 files changed, 169 insertions, 3 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ide/CommentDef.java b/src/main/java/net/sf/antcontrib/cpptasks/ide/CommentDef.java new file mode 100644 index 0000000..3a6f19f --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/ide/CommentDef.java @@ -0,0 +1,42 @@ +/* + * + * Copyright 2008 The Ant-Contrib project + * + * Licensed 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 net.sf.antcontrib.cpptasks.ide; + + +/** + * Defines a comment to place in the generated project files. + * + */ +public final class CommentDef { + private String text; + + public CommentDef() { + text = ""; + } + + + public String getText() { + return text; + } + public void addText(final String newText) { + text += newText; + } + + public String toString() { + return text; + } +} diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ide/DependencyDef.java b/src/main/java/net/sf/antcontrib/cpptasks/ide/DependencyDef.java new file mode 100644 index 0000000..a04cad1 --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/ide/DependencyDef.java @@ -0,0 +1,77 @@ +/* + * + * Copyright 2004-2006 The Ant-Contrib project + * + * Licensed 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 net.sf.antcontrib.cpptasks.ide; + +import org.apache.tools.ant.util.StringUtils; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +/** + * Defines a dependency + * + */ +public final class DependencyDef { + private String id; + private File file; + private String name; + private String depends; + + public DependencyDef() { + } + + + public void setID(final String val) { + id = val; + } + public File getFile() { + return file; + } + public void setFile(final File val) { + file = val; + } + public void setName(final String val) { + name = val; + } + public String getName() { + if (name != null) { + return name; + } else if(file != null) { + return file.getName(); + } + return "null"; + } + public String getID() { + if (id != null) { + return id; + } + return getName(); + } + public String getDepends() { + return depends; + } + public void setDepends(final String val) { + depends = val; + } + public List getDependsList() { + if (depends != null) { + return StringUtils.split(depends, ','); + } + return Collections.EMPTY_LIST; + } +} diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectDef.java b/src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectDef.java index df0177c..8883ebb 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectDef.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectDef.java @@ -1,6 +1,6 @@ /* * - * Copyright 2004-2006 The Ant-Contrib project + * Copyright 2004-2008 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.apache.tools.ant.types.DataType; import java.io.File; import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.Hashtable; import java.util.List; @@ -83,6 +84,16 @@ public final class ProjectDef */ private File objDir; + /** + * List of dependency definitions. + */ + private List dependencies = new ArrayList(); + + /** + * List of comments. + */ + private List comments = new ArrayList(); + /** * Constructor. * @@ -120,6 +131,10 @@ public final class ProjectDef * <td>Microsoft Visual C++ 2005</td> * </tr> * <tr> + * <td>msvc9</td> + * <td>Microsoft Visual C++ 2008</td> + * </tr> + * <tr> * <td>xcode</td> * <td>Apple Xcode</td> * </tr> @@ -319,6 +334,33 @@ public final class ProjectDef this.objDir = oDir; } + /** + * Add a dependency definition to the project. + * @param dependency dependency. + */ + public void addDependency(final DependencyDef dependency) { + dependencies.add(dependency); + + } + + public List getDependencies() { + return new ArrayList(dependencies); + } + + + /** + * Add comment for the generated project file. + * @param comment comment, may not be null. + */ + public void addComment(final CommentDef comment) { + comments.add(comment); + + } + + public List getComments() { + return new ArrayList(comments); + } + /** * Required by documentation generator. */ diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectWriterEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectWriterEnum.java index e100dbc..a50a7b2 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectWriterEnum.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectWriterEnum.java @@ -1,6 +1,6 @@ /* * - * Copyright 2004-2006 The Ant-Contrib project + * Copyright 2004-2008 The Ant-Contrib project * * Licensed 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 @@ -51,6 +51,10 @@ import org.apache.tools.ant.types.EnumeratedAttribute; * <td>Microsoft Visual C++ 2005</td> * </tr> * <tr> + * <td>msvc9</td> + * <td>Microsoft Visual C++ 2008</td> + * </tr> + * <tr> * <td>xcode</td> * <td>Apple Xcode</td> * </tr> @@ -66,7 +70,7 @@ public final class ProjectWriterEnum */ private static String[] values = new String[] { "cbuilderx", "msvc5", - "msvc6", "msvc7", "msvc71", "msvc8", "xcode"}; + "msvc6", "msvc7", "msvc71", "msvc8", "msvc9", "xcode"}; /** * Project writers associated with enumeration values. @@ -77,6 +81,7 @@ public final class ProjectWriterEnum new VisualStudioNETProjectWriter("7.00", "TRUE", "FALSE"), new VisualStudioNETProjectWriter("7.10", "TRUE", "FALSE"), new VisualStudioNETProjectWriter("8.00", "true", "false"), + new VisualStudioNETProjectWriter("9.00", "true", "false"), new XcodeProjectWriter()}; /** |