summaryrefslogtreecommitdiff
path: root/src/net/sf/antcontrib/cpptasks/devstudio
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sf/antcontrib/cpptasks/devstudio')
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/CVS/Entries13
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/CVS/Repository1
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/CVS/Root1
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java50
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java132
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java80
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java146
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java36
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java44
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java112
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java90
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioProjectWriter.java560
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java119
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/VisualStudioNETProjectWriter.java409
-rw-r--r--src/net/sf/antcontrib/cpptasks/devstudio/package.html27
15 files changed, 1820 insertions, 0 deletions
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Entries b/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Entries
new file mode 100644
index 0000000..35f1652
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Entries
@@ -0,0 +1,13 @@
+/DevStudioCCompiler.java/1.21/Sat Feb 28 19:01:00 2004//
+/DevStudioCompatibleCCompiler.java/1.10/Fri Apr 23 20:15:45 2004//
+/DevStudioCompatibleLibrarian.java/1.10/Thu Apr 22 08:06:53 2004//
+/DevStudioCompatibleLinker.java/1.12/Tue May 11 03:50:11 2004//
+/DevStudioLibrarian.java/1.19/Sat Feb 28 19:01:00 2004//
+/DevStudioLinker.java/1.27/Thu Apr 22 13:54:52 2004//
+/DevStudioMIDLCompiler.java/1.20/Tue May 11 03:50:11 2004//
+/DevStudioProcessor.java/1.14/Sat Feb 28 19:01:00 2004//
+/DevStudioProjectWriter.java/1.6/Fri Jan 21 20:18:57 2005//
+/DevStudioResourceCompiler.java/1.19/Tue May 11 03:50:11 2004//
+/VisualStudioNETProjectWriter.java/1.5/Fri Jan 21 20:18:57 2005//
+/package.html/1.1/Sat Jun 26 02:45:17 2004//
+D
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Repository b/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Repository
new file mode 100644
index 0000000..e7764bc
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Repository
@@ -0,0 +1 @@
+cpptasks/src/net/sf/antcontrib/cpptasks/devstudio
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Root b/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Root
new file mode 100644
index 0000000..1ac95cd
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ant-contrib
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java
new file mode 100644
index 0000000..6b6c5b5
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * Copyright 2002-2004 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.devstudio;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.compiler.Processor;
+
+import org.apache.tools.ant.types.Environment;
+/**
+ * Adapter for the Microsoft(r) C/C++ Optimizing Compiler
+ *
+ * @author Adam Murdoch
+ */
+public final class DevStudioCCompiler extends DevStudioCompatibleCCompiler {
+ private static final DevStudioCCompiler instance = new DevStudioCCompiler(
+ "cl", false, null);
+ public static DevStudioCCompiler getInstance() {
+ return instance;
+ }
+ private DevStudioCCompiler(String command, boolean newEnvironment,
+ Environment env) {
+ super(command, "/bogus", newEnvironment, env);
+ }
+ public Processor changeEnvironment(boolean newEnvironment, Environment env) {
+ if (newEnvironment || env != null) {
+ return new DevStudioCCompiler(getCommand(), newEnvironment, env);
+ }
+ return this;
+ }
+ public Linker getLinker(LinkType type) {
+ return DevStudioLinker.getInstance().getLinker(type);
+ }
+ public int getMaximumCommandLength() {
+ return 1024;
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java
new file mode 100644
index 0000000..0ac4f77
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java
@@ -0,0 +1,132 @@
+/*
+ *
+ * Copyright 2002-2004 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.devstudio;
+import java.io.File;
+import java.util.Vector;
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.PrecompilingCommandLineCCompiler;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Environment;
+import net.sf.antcontrib.cpptasks.OptimizationEnum;
+
+/**
+ * An abstract base class for compilers that are basically command line
+ * compatible with Microsoft(r) C/C++ Optimizing Compiler
+ *
+ * @author Curt Arnold
+ */
+public abstract class DevStudioCompatibleCCompiler
+ extends
+ PrecompilingCommandLineCCompiler {
+ private static String[] mflags = new String[]{
+ //
+ // first four are single-threaded
+ // (runtime=static,debug=false), (..,debug=true),
+ // (runtime=dynamic,debug=true), (..,debug=false), (not supported)
+ // next four are multi-threaded, same sequence
+ "/ML", "/MLd", null, null, "/MT", "/MTd", "/MD", "/MDd"};
+ protected DevStudioCompatibleCCompiler(String command,
+ String identifierArg, boolean newEnvironment, Environment env) {
+ super(command, identifierArg, new String[]{".c", ".cc", ".cpp", ".cxx",
+ ".c++"}, new String[]{".h", ".hpp", ".inl"}, ".obj", false,
+ null, newEnvironment, env);
+ }
+ protected void addImpliedArgs(final Vector args,
+ final boolean debug,
+ final boolean multithreaded,
+ final boolean exceptions,
+ final LinkType linkType,
+ final Boolean rtti,
+ final OptimizationEnum optimization) {
+ args.addElement("/c");
+ args.addElement("/nologo");
+ if (exceptions) {
+ // FREEHEP changed /GX into /EHsc (for VC8, and backward compatible with VC7 and VC6)
+ args.addElement("/EHsc");
+ }
+ int mindex = 0;
+ if (multithreaded) {
+ mindex += 4;
+ }
+ boolean staticRuntime = linkType.isStaticRuntime();
+ if (!staticRuntime) {
+ mindex += 2;
+ }
+ if (debug) {
+ mindex += 1;
+ args.addElement("/Zi");
+ args.addElement("/Od");
+ args.addElement("/GZ");
+ args.addElement("/D_DEBUG");
+ } else {
+ if (optimization != null) {
+ if (optimization.isSize()) {
+ args.addElement("/O1");
+ }
+ if (optimization.isSpeed()) {
+ args.addElement("/O2");
+ }
+ }
+ args.addElement("/DNDEBUG");
+ }
+ String mflag = mflags[mindex];
+ if (mflag == null) {
+ throw new BuildException(
+ "multithread='false' and runtime='dynamic' not supported");
+ }
+ args.addElement(mflag);
+ if (rtti != null && rtti.booleanValue()) {
+ args.addElement("/GR");
+ }
+ }
+ protected void addWarningSwitch(Vector args, int level) {
+ DevStudioProcessor.addWarningSwitch(args, level);
+ }
+ protected CompilerConfiguration createPrecompileGeneratingConfig(
+ CommandLineCompilerConfiguration baseConfig, File prototype,
+ String lastInclude) {
+ String[] additionalArgs = new String[]{
+ "/Fp" + CUtil.getBasename(prototype) + ".pch", "/Yc"};
+ return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
+ null, true);
+ }
+ protected CompilerConfiguration createPrecompileUsingConfig(
+ CommandLineCompilerConfiguration baseConfig, File prototype,
+ String lastInclude, String[] exceptFiles) {
+ String[] additionalArgs = new String[]{
+ "/Fp" + CUtil.getBasename(prototype) + ".pch",
+ "/Yu" + lastInclude};
+ return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
+ exceptFiles, false);
+ }
+ protected void getDefineSwitch(StringBuffer buffer, String define,
+ String value) {
+ DevStudioProcessor.getDefineSwitch(buffer, define, value);
+ }
+ protected File[] getEnvironmentIncludePath() {
+ return CUtil.getPathFromEnvironment("INCLUDE", ";");
+ }
+ protected String getIncludeDirSwitch(String includeDir) {
+ return DevStudioProcessor.getIncludeDirSwitch(includeDir);
+ }
+ protected void getUndefineSwitch(StringBuffer buffer, String define) {
+ DevStudioProcessor.getUndefineSwitch(buffer, define);
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java
new file mode 100644
index 0000000..a5e4b41
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * Copyright 2002-2004 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.devstudio;
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
+/**
+ * Abstract base adapter for librarians with command line options compatible
+ * with the Microsoft(r) Library Manager
+ *
+ * @author Curt Arnold
+ */
+public abstract class DevStudioCompatibleLibrarian extends CommandLineLinker {
+ public DevStudioCompatibleLibrarian(String command, String identifierArg) {
+ super(command, identifierArg, new String[]{".obj"}, new String[0],
+ ".lib", false, null);
+ }
+ protected void addBase(long base, Vector args) {
+ }
+ protected void addFixed(Boolean fixed, Vector args) {
+ }
+ protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
+ args.addElement("/nologo");
+ }
+ protected void addIncremental(boolean incremental, Vector args) {
+ }
+ protected void addMap(boolean map, Vector args) {
+ }
+ protected void addStack(int stack, Vector args) {
+ }
+ /* (non-Javadoc)
+ * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
+ */
+ protected void addEntry(String entry, Vector args) {
+ }
+
+ protected String getCommandFileSwitch(String cmdFile) {
+ return "@" + cmdFile;
+ }
+ public File[] getLibraryPath() {
+ return new File[0];
+ }
+ public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
+ return new String[0];
+ }
+ public int getMaximumCommandLength() {
+ return 1024;
+ }
+ public String[] getOutputFileSwitch(String outFile) {
+ StringBuffer buf = new StringBuffer("/OUT:");
+ if (outFile.indexOf(' ') >= 0) {
+ buf.append('"');
+ buf.append(outFile);
+ buf.append('"');
+ } else {
+ buf.append(outFile);
+ }
+ return new String[]{buf.toString()};
+ }
+ public boolean isCaseSensitive() {
+ return false;
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java
new file mode 100644
index 0000000..8b8e8a6
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java
@@ -0,0 +1,146 @@
+/*
+ *
+ * Copyright 2002-2004 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.devstudio;
+import java.io.File;
+import java.io.IOException;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.TargetMatcher;
+import net.sf.antcontrib.cpptasks.VersionInfo;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.platforms.WindowsPlatform;
+import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
+
+/**
+ * Abstract base class for linkers that try to mimic the command line arguments
+ * for the Microsoft (r) Incremental Linker
+ *
+ * @author Curt Arnold
+ */
+public abstract class DevStudioCompatibleLinker extends CommandLineLinker {
+ public DevStudioCompatibleLinker(String command, String identifierArg,
+ String outputSuffix) {
+ super(command, identifierArg, new String[]{".obj", ".lib", ".res"},
+ new String[]{".map", ".pdb", ".lnk", ".dll"}, outputSuffix,
+ false, null);
+ }
+ protected void addBase(long base, Vector args) {
+ if (base >= 0) {
+ String baseAddr = Long.toHexString(base);
+ args.addElement("/BASE:0x" + baseAddr);
+ }
+ }
+ protected void addFixed(Boolean fixed, Vector args) {
+ if (fixed != null) {
+ if (fixed.booleanValue()) {
+ args.addElement("/FIXED");
+ } else {
+ args.addElement("/FIXED:NO");
+ }
+ }
+ }
+ protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
+ args.addElement("/NOLOGO");
+ if (debug) {
+ args.addElement("/DEBUG");
+ }
+ if (linkType.isSharedLibrary()) {
+ args.addElement("/DLL");
+ }
+ /*
+ * if(linkType.isSubsystemGUI()) {
+ * args.addElement("/SUBSYSTEM:WINDOWS"); } else {
+ * if(linkType.isSubsystemConsole()) {
+ * args.addElement("/SUBSYSTEM:CONSOLE"); } }
+ */
+ }
+ protected void addIncremental(boolean incremental, Vector args) {
+ if (incremental) {
+ args.addElement("/INCREMENTAL:YES");
+ } else {
+ args.addElement("/INCREMENTAL:NO");
+ }
+ }
+ protected void addMap(boolean map, Vector args) {
+ if (map) {
+ args.addElement("/MAP");
+ }
+ }
+ protected void addStack(int stack, Vector args) {
+ if (stack >= 0) {
+ String stackStr = Integer.toHexString(stack);
+ args.addElement("/STACK:0x" + stackStr);
+ }
+ }
+ /* (non-Javadoc)
+ * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
+ */
+ protected void addEntry(String entry, Vector args) {
+ if (entry != null) {
+ args.addElement("/ENTRY:" + entry);
+ }
+ }
+
+ public String getCommandFileSwitch(String commandFile) {
+ return "@" + commandFile;
+ }
+ public File[] getLibraryPath() {
+ return CUtil.getPathFromEnvironment("LIB", ";");
+ }
+ public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
+ StringBuffer buf = new StringBuffer();
+ String[] patterns = new String[libnames.length];
+ for (int i = 0; i < libnames.length; i++) {
+ buf.setLength(0);
+ buf.append(libnames[i]);
+ buf.append(".lib");
+ patterns[i] = buf.toString();
+ }
+ return patterns;
+ }
+ public int getMaximumCommandLength() {
+ return 1024;
+ }
+ public String[] getOutputFileSwitch(String outputFile) {
+ return new String[]{"/OUT:" + outputFile};
+ }
+ public boolean isCaseSensitive() {
+ return false;
+ }
+
+ /**
+ * Adds source or object files to the bidded fileset to
+ * support version information.
+ *
+ * @param versionInfo version information
+ * @param linkType link type
+ * @param isDebug true if debug build
+ * @param executableName name of generated executable
+ * @param objDir directory for generated files
+ * @param matcher bidded fileset
+ */
+ public void addVersionFiles(final VersionInfo versionInfo,
+ final LinkType linkType,
+ final File outputFile,
+ final boolean isDebug,
+ final File objDir,
+ final TargetMatcher matcher) throws IOException {
+ WindowsPlatform.addVersionFiles(versionInfo, linkType, outputFile, isDebug, objDir, matcher);
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java
new file mode 100644
index 0000000..bd63f42
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * Copyright 2002-2004 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.devstudio;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+/**
+ * Adapter for the Microsoft (r) Library Manager
+ *
+ * @author Curt Arnold
+ */
+public final class DevStudioLibrarian extends DevStudioCompatibleLibrarian {
+ private static final DevStudioLibrarian instance = new DevStudioLibrarian();
+ public static DevStudioLibrarian getInstance() {
+ return instance;
+ }
+ private DevStudioLibrarian() {
+ super("lib", "/bogus");
+ }
+ public Linker getLinker(LinkType type) {
+ return DevStudioLinker.getInstance().getLinker(type);
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java
new file mode 100644
index 0000000..826074b
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java
@@ -0,0 +1,44 @@
+/*
+ *
+ * Copyright 2001-2004 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.devstudio;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+/**
+ * Adapter for the Microsoft (r) Incremental Linker
+ *
+ * @author Adam Murdoch
+ * @author Curt Arnold
+ */
+public final class DevStudioLinker extends DevStudioCompatibleLinker {
+ private static final DevStudioLinker dllLinker = new DevStudioLinker(".dll");
+ private static final DevStudioLinker instance = new DevStudioLinker(".exe");
+ public static DevStudioLinker getInstance() {
+ return instance;
+ }
+ private DevStudioLinker(String outputSuffix) {
+ super("link", "/DLL", outputSuffix);
+ }
+ public Linker getLinker(LinkType type) {
+ if (type.isSharedLibrary()) {
+ return dllLinker;
+ }
+ if (type.isStaticLibrary()) {
+ return DevStudioLibrarian.getInstance();
+ }
+ return instance;
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java
new file mode 100644
index 0000000..4a7463d
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java
@@ -0,0 +1,112 @@
+/*
+ *
+ * Copyright 2002-2004 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.devstudio;
+import java.io.File;
+import java.util.Vector;
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.compiler.Processor;
+import net.sf.antcontrib.cpptasks.parser.CParser;
+import net.sf.antcontrib.cpptasks.parser.Parser;
+import org.apache.tools.ant.types.Environment;
+import net.sf.antcontrib.cpptasks.OptimizationEnum;
+
+/**
+ * Adapter for the Microsoft (r) MIDL Compiler
+ *
+ * @author Curt Arnold
+ */
+public final class DevStudioMIDLCompiler extends CommandLineCompiler {
+ private static final DevStudioMIDLCompiler instance = new DevStudioMIDLCompiler(
+ false, null);
+ public static DevStudioMIDLCompiler getInstance() {
+ return instance;
+ }
+ private DevStudioMIDLCompiler(boolean newEnvironment, Environment env) {
+ super("midl", null, new String[]{".idl", ".odl"}, new String[]{},
+ ".tlb", false, null, newEnvironment, env);
+ }
+ protected void addImpliedArgs(final Vector args,
+ final boolean debug,
+ final boolean multithreaded,
+ final boolean exceptions,
+ final LinkType linkType,
+ final Boolean rtti,
+ final OptimizationEnum optimization) {
+ }
+ protected void addWarningSwitch(Vector args, int level) {
+ DevStudioProcessor.addWarningSwitch(args, level);
+ }
+ public Processor changeEnvironment(boolean newEnvironment, Environment env) {
+ if (newEnvironment || env != null) {
+ return new DevStudioMIDLCompiler(newEnvironment, env);
+ }
+ return this;
+ }
+ /**
+ * The include parser for C will work just fine, but we didn't want to
+ * inherit from CommandLineCCompiler
+ */
+ protected Parser createParser(File source) {
+ return new CParser();
+ }
+ protected int getArgumentCountPerInputFile() {
+ return 3;
+ }
+ protected void getDefineSwitch(StringBuffer buffer, String define,
+ String value) {
+ DevStudioProcessor.getDefineSwitch(buffer, define, value);
+ }
+ protected File[] getEnvironmentIncludePath() {
+ return CUtil.getPathFromEnvironment("INCLUDE", ";");
+ }
+ protected String getIncludeDirSwitch(String includeDir) {
+ return DevStudioProcessor.getIncludeDirSwitch(includeDir);
+ }
+ protected String getInputFileArgument(File outputDir, String filename,
+ int index) {
+ switch (index) {
+ case 0 :
+ return "/tlb";
+ case 1 :
+ return new File(outputDir, getOutputFileNames(filename, null)[0])
+ .getAbsolutePath();
+ }
+ return filename;
+ }
+ public Linker getLinker(LinkType type) {
+ return DevStudioLinker.getInstance().getLinker(type);
+ }
+ public int getMaximumCommandLength() {
+ return 1024;
+ }
+ protected int getMaximumInputFilesPerCommand() {
+ return 1;
+ }
+ protected int getTotalArgumentLengthForInputFile(File outputDir,
+ String inputFile) {
+ String arg1 = getInputFileArgument(outputDir, inputFile, 0);
+ String arg2 = getInputFileArgument(outputDir, inputFile, 1);
+ String arg3 = getInputFileArgument(outputDir, inputFile, 2);
+ return arg1.length() + arg2.length() + arg3.length() + 3;
+ }
+ protected void getUndefineSwitch(StringBuffer buffer, String define) {
+ DevStudioProcessor.getUndefineSwitch(buffer, define);
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java
new file mode 100644
index 0000000..8257c09
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java
@@ -0,0 +1,90 @@
+/*
+ *
+ * Copyright 2002-2004 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.devstudio;
+import java.util.Vector;
+/**
+ * A add-in class for Microsoft Developer Studio processors
+ *
+ *
+ */
+public class DevStudioProcessor {
+ public static void addWarningSwitch(Vector args, int level) {
+ switch (level) {
+ case 0 :
+ args.addElement("/W0");
+ break;
+ case 1 :
+ args.addElement("/W1");
+ break;
+ case 2 :
+ break;
+ case 3 :
+ args.addElement("/W3");
+ break;
+ case 4 :
+ args.addElement("/W4");
+ break;
+ case 5 :
+ args.addElement("/WX");
+ break;
+ }
+ }
+ public static String getCommandFileSwitch(String cmdFile) {
+ StringBuffer buf = new StringBuffer("@");
+ if (cmdFile.indexOf(' ') >= 0) {
+ buf.append('\"');
+ buf.append(cmdFile.replace('/', '\\'));
+ buf.append('\"');
+ } else {
+ buf.append(cmdFile);
+ }
+ return buf.toString();
+ }
+ public static void getDefineSwitch(StringBuffer buffer, String define,
+ String value) {
+ buffer.append("/D");
+ buffer.append(define);
+ if (value != null && value.length() > 0) {
+ buffer.append('=');
+ buffer.append(value);
+ }
+ }
+ public static String getIncludeDirSwitch(String includeDir) {
+ return "/I" + includeDir.replace('/', '\\');
+ }
+ public static String[] getOutputFileSwitch(String outPath) {
+ StringBuffer buf = new StringBuffer("/Fo");
+ if (outPath.indexOf(' ') >= 0) {
+ buf.append('\"');
+ buf.append(outPath);
+ buf.append('\"');
+ } else {
+ buf.append(outPath);
+ }
+ String[] retval = new String[]{buf.toString()};
+ return retval;
+ }
+ public static void getUndefineSwitch(StringBuffer buffer, String define) {
+ buffer.append("/U");
+ buffer.append(define);
+ }
+ public static boolean isCaseSensitive() {
+ return false;
+ }
+ private DevStudioProcessor() {
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioProjectWriter.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioProjectWriter.java
new file mode 100644
index 0000000..94030fb
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioProjectWriter.java
@@ -0,0 +1,560 @@
+/*
+ *
+ * Copyright 2004 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.devstudio;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.antcontrib.cpptasks.CCTask;
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.TargetInfo;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
+import net.sf.antcontrib.cpptasks.ide.ProjectDef;
+import net.sf.antcontrib.cpptasks.ide.ProjectWriter;
+import org.apache.tools.ant.BuildException;
+
+/**
+ * Writes a Microsoft Visual Studio 97 or Visual Studio 6 project file.
+ *
+ * Status: Collects file list but does not pick
+ * up libraries and settings from project.
+ *
+ * @author curta
+ */
+public final class DevStudioProjectWriter
+ implements ProjectWriter {
+ /**
+ * Visual Studio version.
+ */
+ private String version;
+
+ /**
+ * Constructor.
+ * @param versionArg String Visual Studio version.
+ */
+ public DevStudioProjectWriter(final String versionArg) {
+ this.version = versionArg;
+ }
+
+ /**
+ * Writes a project definition file.
+ * @param fileName File name base, writer may append appropriate extension
+ * @param task cc task for which to write project
+ * @param projectDef project element
+ * @param files source files
+ * @param targets compilation targets
+ * @param linkTarget link target
+ * @throws IOException if error writing project file
+ */
+ public void writeProject(final File fileName,
+ final CCTask task,
+ final ProjectDef projectDef,
+ final List files,
+ final Hashtable targets,
+ final TargetInfo linkTarget) throws IOException {
+
+ //
+ // some characters are apparently not allowed in VS project names
+ // but have not been able to find them documented
+ // limiting characters to alphas, numerics and hyphens
+ StringBuffer projectNameBuf;
+ String projectName = projectDef.getName();
+ if (projectName != null) {
+ projectNameBuf = new StringBuffer(projectName);
+ } else {
+ projectNameBuf = new StringBuffer(fileName.getName());
+ }
+ for (int i = 0; i < projectNameBuf.length(); i++) {
+ final char ch = projectNameBuf.charAt(i);
+ if (!((ch >= 'a' && ch <= 'z')
+ || (ch >= 'A' && ch <= 'Z')
+ || (ch >= '0' && ch <= '9'))) {
+ projectNameBuf.setCharAt(i, '_');
+ }
+ }
+ projectName = projectNameBuf.toString();
+
+ final String basePath = fileName.getAbsoluteFile().getParent();
+
+ File dspFile = new File(fileName + ".dsp");
+ if (!projectDef.getOverwrite() && dspFile.exists()) {
+ throw new BuildException("Not allowed to overwrite project file "
+ + dspFile.toString());
+ }
+ File dswFile = new File(fileName + ".dsw");
+ if (!projectDef.getOverwrite() && dswFile.exists()) {
+ throw new BuildException("Not allowed to overwrite project file "
+ + dswFile.toString());
+ }
+
+ CommandLineCompilerConfiguration compilerConfig =
+ getBaseCompilerConfiguration(targets);
+ if (compilerConfig == null) {
+ throw new BuildException(
+ "Unable to generate Visual Studio project "
+ + "when Microsoft C++ is not used.");
+ }
+
+ Writer writer = new BufferedWriter(new FileWriter(dspFile));
+ writer.write("# Microsoft Developer Studio Project File - Name=\"");
+ writer.write(projectName);
+ writer.write("\" - Package Owner=<4>\r\n");
+ writer.write(
+ "# Microsoft Developer Studio Generated Build File, Format Version ");
+ writer.write(this.version);
+ writer.write("\r\n");
+ writer.write("# ** DO NOT EDIT **\r\n\r\n");
+ String outputType = task.getOuttype();
+ String subsystem = task.getSubsystem();
+ String configName = projectName;
+ final boolean isDebug = task.getDebug();
+ if (isDebug) {
+ configName += " - Win32 Debug";
+ } else {
+ configName += " - Win32 Release";
+ }
+ String targtype = "Win32 (x86) Dynamic-Link Library";
+ String targid = "0x0102";
+ if ("executable".equals(outputType)) {
+ if ("console".equals(subsystem)) {
+ targtype = "Win32 (x86) Console Application";
+ targid = "0x0103";
+ } else {
+ targtype = "Win32 (x86) Application";
+ targid = "0x0101";
+ }
+ } else if ("static".equals(outputType)) {
+ targtype = "Win32 (x86) Static Library";
+ targid = "0x0104";
+ }
+ writer.write("# TARGTYPE \"");
+ writer.write(targtype);
+ writer.write("\" ");
+ writer.write(targid);
+ writer.write("\r\n\r\nCFG=");
+ writer.write(configName);
+ writer.write("\r\n");
+
+ writeMessage(writer, projectName, configName, targtype);
+
+ writer.write("# Begin Project\r\n");
+ if (version.equals("6.00")) {
+ writer.write("# PROP AllowPerConfigDependencies 0\r\n");
+ }
+ writer.write("# PROP Scc_ProjName \"\"\r\n");
+ writer.write("# PROP Scc_LocalPath \"\"\r\n");
+ writer.write("CPP=cl.exe\r\n");
+ writer.write("MTL=midl.exe\r\n");
+ writer.write("RSC=rc.exe\r\n");
+ writer.write("# PROP BASE Use_MFC 0\r\n");
+
+ writer.write("# PROP BASE Use_Debug_Libraries ");
+ if (isDebug) {
+ writer.write("1\r\n");
+ } else {
+ writer.write("0\r\n");
+ }
+
+ File objDir = task.getObjdir();
+ String objDirPath = CUtil.getRelativePath(basePath, objDir);
+
+ File outFile = task.getOutfile();
+ File buildDir = outFile.getParentFile();
+ String buildDirPath = CUtil.getRelativePath(basePath, buildDir);
+
+ writer.write("# PROP BASE Output_Dir \"");
+ writer.write(buildDirPath);
+ writer.write("\"\r\n");
+ writer.write("# PROP BASE Intermediate_Dir \"");
+ writer.write(objDirPath);
+ writer.write("\"\r\n");
+ writer.write("# PROP BASE Target_Dir \"\"\r\n");
+ writer.write("# PROP Use_MFC 0\r\n");
+ writer.write("# PROP Use_Debug_Libraries ");
+ if (isDebug) {
+ writer.write("1\r\n");
+ } else {
+ writer.write("0\r\n");
+ }
+ writer.write("# PROP Output_Dir \"");
+ writer.write(buildDirPath);
+ writer.write("\"\r\n");
+ writer.write("# PROP Intermediate_Dir \"");
+ writer.write(objDirPath);
+ writer.write("\"\r\n");
+ writer.write("# PROP Target_Dir \"\"\r\n");
+ writeCompileOptions(writer, basePath, compilerConfig);
+ writer.write(
+ "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\r\n");
+ writer.write(
+ "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\r\n");
+ writer.write("# ADD BASE RSC /l 0x409 /d \"_DEBUG\"\r\n");
+ writer.write("# ADD RSC /l 0x409 /d \"_DEBUG\"\r\n");
+ writer.write("BSC32=bscmake.exe\r\n");
+ writer.write("# ADD BASE BSC32 /nologo\r\n");
+ writer.write("# ADD BSC32 /nologo\r\n");
+ writer.write("LINK32=link.exe\r\n");
+ writeLinkOptions(writer, basePath, linkTarget, targets);
+ writer.write("# Begin Target\r\n\r\n");
+ writer.write("# Name \"");
+ writer.write(configName);
+ writer.write("\"\r\n");
+
+ File[] sortedSources = getSources(files);
+
+ if (version.equals("6.00")) {
+ final String sourceFilter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat";
+ final String headerFilter = "h;hpp;hxx;hm;inl";
+ final String resourceFilter =
+ "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe";
+
+ writer.write("# Begin Group \"Source Files\"\r\n\r\n");
+ writer.write("# PROP Default_Filter \"" + sourceFilter + "\"\r\n");
+
+ for (int i = 0; i < sortedSources.length; i++) {
+ if (!isGroupMember(headerFilter, sortedSources[i])
+ && !isGroupMember(resourceFilter, sortedSources[i])) {
+ writeSource(writer, basePath, sortedSources[i]);
+ }
+ }
+ writer.write("# End Group\r\n");
+
+ writer.write("# Begin Group \"Header Files\"\r\n\r\n");
+ writer.write("# PROP Default_Filter \"" + headerFilter + "\"\r\n");
+
+ for (int i = 0; i < sortedSources.length; i++) {
+ if (isGroupMember(headerFilter, sortedSources[i])) {
+ writeSource(writer, basePath, sortedSources[i]);
+ }
+ }
+ writer.write("# End Group\r\n");
+
+ writer.write("# Begin Group \"Resource Files\"\r\n\r\n");
+ writer.write("# PROP Default_Filter \"" + resourceFilter + "\"\r\n");
+
+ for (int i = 0; i < sortedSources.length; i++) {
+ if (isGroupMember(resourceFilter, sortedSources[i])) {
+ writeSource(writer, basePath, sortedSources[i]);
+ }
+ }
+ writer.write("# End Group\r\n");
+
+ } else {
+ for (int i = 0; i < sortedSources.length; i++) {
+ writeSource(writer, basePath, sortedSources[i]);
+ }
+ }
+
+ writer.write("# End Target\r\n");
+ writer.write("# End Project\r\n");
+ writer.close();
+
+ //
+ // write workspace file
+ //
+ writer = new BufferedWriter(new FileWriter(dswFile));
+
+ writer.write("Microsoft Developer Studio Workspace File, Format Version ");
+ writer.write(version);
+ writer.write("\r\n");
+ writer.write("# WARNING: DO NOT EDIT OR DELETE");
+ writer.write(" THIS WORKSPACE FILE!\r\n\r\n");
+
+ writer.write("############################################");
+ writer.write("###################################\r\n\r\n");
+ writer.write("Project: \"" + projectName + "\"=.\\"
+ + dspFile.getName()
+ + " - Package Owner=<4>\r\n\r\n");
+
+ writer.write("Package=<5>\r\n{{{\r\n}}}\r\n\r\n");
+ writer.write("Package=<4>\r\n{{{\r\n}}}\r\n\r\n");
+ writer.write("######################################");
+ writer.write("#########################################\r\n\r\n");
+
+ writer.write("Global:\r\n\r\nPackage=<5>\r\n{{{\r\n}}}");
+ writer.write("\r\n\r\nPackage=<3>\r\n{{{\r\n}}}\r\n\r\n");
+
+ writer.write("########################################");
+ writer.write("#######################################\r\n\r\n");
+ writer.close();
+
+ }
+
+ /**
+ * Returns true if the file has an extension that appears in the group filter.
+ * @param filter String group filter
+ * @param candidate File file
+ * @return boolean true if member of group
+ */
+ private boolean isGroupMember(final String filter, final File candidate) {
+ String fileName = candidate.getName();
+ int lastDot = fileName.lastIndexOf('.');
+ if (lastDot >= 0 && lastDot < fileName.length() - 1) {
+ String extension =
+ ";" + fileName.substring(lastDot + 1).toLowerCase() + ";";
+ String semiFilter = ";" + filter + ";";
+ return semiFilter.indexOf(extension) >= 0;
+ }
+ return false;
+ }
+
+ /**
+ * Writes the entry for one source file in the project.
+ * @param writer Writer writer
+ * @param basePath String base path for project
+ * @param groupMember File project source file
+ * @throws IOException if error writing project file
+ */
+ private void writeSource(final Writer writer,
+ final String basePath,
+ final File groupMember)
+ throws IOException {
+ writer.write("# Begin Source File\r\n\r\nSOURCE=");
+ String relativePath = CUtil.getRelativePath(basePath,
+ groupMember);
+ //
+ // if relative path is just a name (hello.c) then
+ // make it .\hello.c
+ if (!relativePath.startsWith(".")
+ && relativePath.indexOf(":") < 0
+ && !relativePath.startsWith("\\")) {
+ relativePath = ".\\" + relativePath;
+ }
+ writer.write(relativePath);
+ writer.write("\r\n# End Source File\r\n");
+ }
+
+ /**
+ * Get alphabetized array of source files.
+ * @param sourceList list of source files
+ * @return File[] source files
+ */
+ private File[] getSources(final List sourceList) {
+ File[] sortedSources = new File[sourceList.size()];
+ sourceList.toArray(sortedSources);
+ Arrays.sort(sortedSources, new Comparator() {
+ public int compare(final Object o1, final Object o2) {
+ return ((File) o1).getName().compareTo(((File) o2).getName());
+ }
+ });
+ return sortedSources;
+ }
+
+ /**
+ * Writes "This is not a makefile" warning.
+ * @param writer Writer writer
+ * @param projectName String project name
+ * @param configName String configuration name
+ * @param targtype String target type
+ * @throws IOException if error writing project
+ */
+
+ private void writeMessage(final Writer writer,
+ final String projectName,
+ final String configName,
+ final String targtype) throws IOException {
+ writer.write(
+ "!MESSAGE This is not a valid makefile. ");
+ writer.write("To build this project using NMAKE,\r\n");
+ writer.write("!MESSAGE use the Export Makefile command and run\r\n");
+ writer.write("!MESSAGE \r\n");
+ writer.write("!MESSAGE NMAKE /f \"");
+ writer.write(projectName);
+ writer.write(".mak\".\r\n");
+ writer.write("!MESSAGE \r\n");
+ writer.write(
+ "!MESSAGE You can specify a configuration when running NMAKE\r\n");
+ writer.write(
+ "!MESSAGE by defining the macro CFG on the command line. ");
+ writer.write("For example:\r\n");
+ writer.write("!MESSAGE \r\n");
+ writer.write("!MESSAGE NMAKE /f \"");
+ writer.write(projectName);
+ writer.write(".mak\" CFG=\"");
+ writer.write(configName);
+ writer.write("\"\r\n");
+ writer.write("!MESSAGE \r\n");
+ writer.write("!MESSAGE Possible choices for configuration are:\r\n");
+ writer.write("!MESSAGE \r\n");
+ writer.write("!MESSAGE \"");
+ writer.write(configName);
+ writer.write("\" (based on \"");
+ writer.write(targtype);
+ writer.write("\")\r\n");
+ writer.write("!MESSAGE \r\n");
+ writer.write("\r\n");
+
+ }
+
+ /**
+ * Gets the first recognized compiler from the
+ * compilation targets.
+ * @param targets compilation targets
+ * @return representative (hopefully) compiler configuration
+ */
+ private CommandLineCompilerConfiguration
+ getBaseCompilerConfiguration(final Hashtable targets) {
+ //
+ // find first target with an DevStudio C compilation
+ //
+ CommandLineCompilerConfiguration compilerConfig = null;
+ //
+ // get the first target and assume that it is representative
+ //
+ Iterator targetIter = targets.values().iterator();
+ while (targetIter.hasNext()) {
+ TargetInfo targetInfo = (TargetInfo) targetIter.next();
+ ProcessorConfiguration config = targetInfo.getConfiguration();
+ String identifier = config.getIdentifier();
+ //
+ // for the first cl compiler
+ //
+ if (config instanceof CommandLineCompilerConfiguration) {
+ compilerConfig = (CommandLineCompilerConfiguration) config;
+ if (compilerConfig.getCompiler() instanceof DevStudioCCompiler) {
+ return compilerConfig;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Writes compiler options.
+ * @param writer Writer writer
+ * @param baseDir String base directory
+ * @param compilerConfig compiler configuration
+ * @throws IOException if error on writing project
+ */
+ private void writeCompileOptions(final Writer writer,
+ final String baseDir,
+ final CommandLineCompilerConfiguration
+ compilerConfig) throws IOException {
+ StringBuffer baseOptions = new StringBuffer(50);
+ baseOptions.append("# ADD BASE CPP");
+ StringBuffer options = new StringBuffer(50);
+ options.append("# ADD CPP");
+ File[] includePath = compilerConfig.getIncludePath();
+ for (int i = 0; i < includePath.length; i++) {
+ options.append(" /I \"");
+ String relPath = CUtil.getRelativePath(baseDir, includePath[i]);
+ options.append(relPath);
+ options.append('"');
+ }
+
+ String[] preArgs = compilerConfig.getPreArguments();
+ for (int i = 0; i < preArgs.length; i++) {
+ if (preArgs[i].startsWith("/D")) {
+ options.append(" /D ");
+ baseOptions.append(" /D ");
+ String body = preArgs[i].substring(2);
+ if (preArgs[i].indexOf('=') >= 0) {
+ options.append(body);
+ baseOptions.append(body);
+ } else {
+ options.append('"');
+ options.append(body);
+ options.append('"');
+ }
+ } else if (!preArgs[i].startsWith("/I")) {
+ options.append(" ");
+ options.append(preArgs[i]);
+ baseOptions.append(" ");
+ baseOptions.append(preArgs[i]);
+ }
+ }
+ baseOptions.append("\r\n");
+ options.append("\r\n");
+ writer.write(baseOptions.toString());
+ writer.write(options.toString());
+
+ }
+
+ /**
+ * Writes link options.
+ * @param writer Writer writer
+ * @param basePath String base path
+ * @param linkTarget TargetInfo link target
+ * @param targets Hashtable all targets
+ * @throws IOException if unable to write to project file
+ */
+ private void writeLinkOptions(final Writer writer,
+ final String basePath,
+ final TargetInfo linkTarget,
+ final Hashtable targets) throws IOException {
+
+ StringBuffer baseOptions = new StringBuffer(100);
+ StringBuffer options = new StringBuffer(100);
+ baseOptions.append("# ADD BASE LINK32");
+ options.append("# ADD LINK32");
+
+ ProcessorConfiguration config = linkTarget.getConfiguration();
+ if (config instanceof CommandLineLinkerConfiguration) {
+ CommandLineLinkerConfiguration linkConfig =
+ (CommandLineLinkerConfiguration) config;
+
+ File[] linkSources = linkTarget.getAllSources();
+ for (int i = 0; i < linkSources.length; i++) {
+ //
+ // if file was not compiled or otherwise generated
+ //
+ if (targets.get(linkSources[i].getName()) == null) {
+ String relPath = CUtil.getRelativePath(basePath, linkSources[i]);
+ //
+ // if path has an embedded space then
+ // must quote
+ if (relPath.indexOf(' ') > 0) {
+ options.append(" \"");
+ options.append(relPath);
+ options.append("\"");
+ } else {
+ options.append(' ');
+ options.append(relPath);
+ }
+ }
+ }
+ String[] preArgs = linkConfig.getPreArguments();
+ for (int i = 0; i < preArgs.length; i++) {
+ options.append(' ');
+ options.append(preArgs[i]);
+ baseOptions.append(' ');
+ baseOptions.append(preArgs[i]);
+ }
+ String[] endArgs = linkConfig.getEndArguments();
+ for (int i = 0; i < endArgs.length; i++) {
+ options.append(' ');
+ options.append(endArgs[i]);
+ baseOptions.append(' ');
+ baseOptions.append(endArgs[i]);
+ }
+ }
+ baseOptions.append("\r\n");
+ options.append("\r\n");
+ writer.write(baseOptions.toString());
+ writer.write(options.toString());
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java
new file mode 100644
index 0000000..e8c8662
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java
@@ -0,0 +1,119 @@
+/*
+ *
+ * Copyright 2002-2004 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.devstudio;
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.compiler.Processor;
+import net.sf.antcontrib.cpptasks.parser.CParser;
+import net.sf.antcontrib.cpptasks.parser.Parser;
+import net.sf.antcontrib.cpptasks.OptimizationEnum;
+
+import org.apache.tools.ant.types.Environment;
+/**
+ * Adapter for the Microsoft (r) Windows 32 Resource Compiler
+ *
+ * @author Curt Arnold
+ */
+public final class DevStudioResourceCompiler extends CommandLineCompiler {
+ private static final DevStudioResourceCompiler instance = new DevStudioResourceCompiler(
+ false, null);
+ public static DevStudioResourceCompiler getInstance() {
+ return instance;
+ }
+ private String identifier;
+ private DevStudioResourceCompiler(boolean newEnvironment, Environment env) {
+ super("rc", null, new String[]{".rc"}, new String[]{".h", ".hpp",
+ ".inl"}, ".res", false, null, newEnvironment, env);
+ }
+ protected void addImpliedArgs(final Vector args,
+ final boolean debug,
+ final boolean multithreaded,
+ final boolean exceptions,
+ final LinkType linkType,
+ final Boolean rtti,
+ final OptimizationEnum optimization) {
+ if (debug) {
+ args.addElement("/D_DEBUG");
+ } else {
+ args.addElement("/DNDEBUG");
+ }
+ }
+ protected void addWarningSwitch(Vector args, int level) {
+ }
+ public Processor changeEnvironment(boolean newEnvironment, Environment env) {
+ if (newEnvironment || env != null) {
+ return new DevStudioResourceCompiler(newEnvironment, env);
+ }
+ return this;
+ }
+ /**
+ * The include parser for C will work just fine, but we didn't want to
+ * inherit from CommandLineCCompiler
+ */
+ protected Parser createParser(File source) {
+ return new CParser();
+ }
+ protected int getArgumentCountPerInputFile() {
+ return 2;
+ }
+ protected void getDefineSwitch(StringBuffer buffer, String define,
+ String value) {
+ DevStudioProcessor.getDefineSwitch(buffer, define, value);
+ }
+ protected File[] getEnvironmentIncludePath() {
+ return CUtil.getPathFromEnvironment("INCLUDE", ";");
+ }
+ protected String getIncludeDirSwitch(String includeDir) {
+ return DevStudioProcessor.getIncludeDirSwitch(includeDir);
+ }
+ protected String getInputFileArgument(File outputDir, String filename,
+ int index) {
+ if (index == 0) {
+ String outputFileName = getOutputFileNames(filename, null)[0];
+ String fullOutputName = new File(outputDir, outputFileName)
+ .toString();
+ return "/fo" + fullOutputName;
+ }
+ return filename;
+ }
+ public Linker getLinker(LinkType type) {
+ return DevStudioLinker.getInstance().getLinker(type);
+ }
+ public int getMaximumCommandLength() {
+ return 1024;
+ }
+ protected int getMaximumInputFilesPerCommand() {
+ return 1;
+ }
+ protected int getTotalArgumentLengthForInputFile(File outputDir,
+ String inputFile) {
+ String arg1 = getInputFileArgument(outputDir, inputFile, 0);
+ String arg2 = getInputFileArgument(outputDir, inputFile, 1);
+ return arg1.length() + arg2.length() + 2;
+ }
+ protected void getUndefineSwitch(StringBuffer buffer, String define) {
+ DevStudioProcessor.getUndefineSwitch(buffer, define);
+ }
+ public String getIdentifier() {
+ return "Microsoft (R) Windows (R) Resource Compiler";
+ }
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/VisualStudioNETProjectWriter.java b/src/net/sf/antcontrib/cpptasks/devstudio/VisualStudioNETProjectWriter.java
new file mode 100644
index 0000000..9e6072c
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/VisualStudioNETProjectWriter.java
@@ -0,0 +1,409 @@
+/*
+ *
+ * Copyright 2004-2005 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.devstudio;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.antcontrib.cpptasks.CCTask;
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.TargetInfo;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
+import net.sf.antcontrib.cpptasks.ide.ProjectDef;
+import net.sf.antcontrib.cpptasks.ide.ProjectWriter;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.Serializer;
+import org.apache.xml.serialize.XMLSerializer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * Writes a Visual Studio.NET project file.
+ * (Visual Studio 5 and 6 project writer is substantially more
+* complete at this point).
+ * @author curta
+ *
+ */
+public final class VisualStudioNETProjectWriter
+ implements ProjectWriter {
+ /**
+ * Version of VisualStudio.NET.
+ */
+ private String version;
+
+ /**
+ * Constructor.
+ * @param versionArg String VisualStudio.NET version
+ */
+ public VisualStudioNETProjectWriter(final String versionArg) {
+ this.version = versionArg;
+ }
+
+ /**
+ * Writes a project definition file.
+ *
+ * @param fileName
+ * project name for file, should has .cbx extension
+ * @param task
+ * cc task for which to write project
+ * @param projectDef
+ * project element
+ * @param sources source files
+ * @param targets compilation targets
+ * @param linkTarget link target
+ * @throws IOException if I/O error
+ * @throws SAXException if XML serialization error
+ */
+ public void writeProject(final File fileName,
+ final CCTask task,
+ final ProjectDef projectDef,
+ final List sources,
+ final Hashtable targets,
+ final TargetInfo linkTarget) throws
+ IOException,
+ SAXException {
+
+ boolean isDebug = task.getDebug();
+
+ String projectName = projectDef.getName();
+ if (projectName == null) {
+ projectName = fileName.getName();
+ }
+
+
+ File dspFile = new File(fileName + ".dsp");
+ if (!projectDef.getOverwrite() && dspFile.exists()) {
+ throw new BuildException("Not allowed to overwrite project file "
+ + dspFile.toString());
+ }
+ File dswFile = new File(fileName + ".dsw");
+ if (!projectDef.getOverwrite() && dswFile.exists()) {
+ throw new BuildException("Not allowed to overwrite project file "
+ + dswFile.toString());
+ }
+
+ CommandLineCompilerConfiguration compilerConfig =
+ getBaseCompilerConfiguration(targets);
+ if (compilerConfig == null) {
+ throw new BuildException(
+ "Unable to generate Visual Studio.NET project "
+ + "when Microsoft C++ is not used.");
+ }
+
+ OutputStream outStream = new FileOutputStream(fileName + ".vcproj");
+ OutputFormat format = new OutputFormat("xml", "UTF-8", true);
+ Serializer serializer = new XMLSerializer(outStream, format);
+ ContentHandler content = serializer.asContentHandler();
+ String basePath = fileName.getParentFile().getAbsolutePath();
+ content.startDocument();
+ AttributesImpl emptyAttrs = new AttributesImpl();
+ startElement(content, "VisualStudioProject", new String[] {"ProjectType",
+ "Version", "Name", "SccProjectName", "SccLocalPath"}
+ ,
+ new String[] {"Visual C++", this.version, projectName,
+ "", ""});
+ content.startElement(null, "Platforms", "Platforms", emptyAttrs);
+ startElement(content, "Platform", new String[] {"Name"}
+ , new String[] {"Win32"});
+ content.endElement(null, "Platform", "Platform");
+ content.endElement(null, "Platforms", "Platforms");
+ content.startElement(null, "Configurations", "Configurations", emptyAttrs);
+
+ String[] configValues = new String[] {
+ "Debug|Win32",
+ ".\\Debug",
+ ".\\Debug",
+ "2",
+ "0",
+ "FALSE"};
+ if (!isDebug) {
+ configValues[0] = "Release|Win32";
+ }
+
+ startElement(content, "Configuration",
+ new String[] {"Name", "OutputDirectory",
+ "IntermediateDirectory", "ConfigurationType", "UseOfMFC",
+ "ATLMinimizeCRunTimeLibraryUsage"}
+ , configValues);
+ String[] clValues = new String[] {
+ "VCCLCompilerTool", "0", null, null,
+ "1", "2", ".\\Debug\\testdllproh.pch", ".\\Debug/",
+ ".\\Debug/", ".\\Debug/", "3", "TRUE", "4"};
+ StringBuffer includeDirs = new StringBuffer();
+ StringBuffer defines = new StringBuffer();
+ String[] args = compilerConfig.getPreArguments();
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].startsWith("/I")) {
+ includeDirs.append(args[i].substring(2));
+ includeDirs.append(';');
+ }
+ if (args[i].startsWith("/D")) {
+ defines.append(args[i].substring(2));
+ defines.append(";");
+ }
+ }
+
+ if (includeDirs.length() > 0) {
+ includeDirs.setLength(includeDirs.length() - 1);
+ }
+ if (defines.length() > 0) {
+ defines.setLength(defines.length() - 1);
+ }
+ clValues[2] = includeDirs.toString();
+ clValues[3] = defines.toString();
+
+ startElement(content, "Tool",
+ new String[] {"Name", "Optimization",
+ "AdditionalIncludeDirectories",
+ "PreprocessorDefinitions", "RuntimeLibrary",
+ "UsePrecompiledHeaders", "PrecompiledHeaderFile",
+ "AssemblerListingLocation", "ObjectFile", "WarningLevel",
+ "SuppressStartupBanner", "DebugInformationFormat"}
+ , clValues);
+ content.endElement(null, "Tool", "Tool");
+
+
+ String[] linkerValues = new String[] {"VCLinkerTool", null,
+ ".\\Debug/testdllproj.dll", "1",
+ "TRUE", "TRUE", ".\\Debug\\testdllproh.pdb", "2",
+ ".\\Debug/testdllproj.lib", "1"};
+
+ if (!isDebug) {
+ linkerValues[5] = "FALSE";
+ }
+
+ ProcessorConfiguration config = linkTarget.getConfiguration();
+ if (config instanceof CommandLineLinkerConfiguration) {
+ CommandLineLinkerConfiguration linkConfig =
+ (CommandLineLinkerConfiguration) config;
+
+ File[] linkSources = linkTarget.getAllSources();
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < linkSources.length; i++) {
+ //
+ // if file was not compiled or otherwise generated
+ //
+ if (targets.get(linkSources[i].getName()) == null) {
+ String relPath = CUtil.getRelativePath(basePath, linkSources[i]);
+ //
+ // if path has an embedded space then
+ // must quote
+ if (relPath.indexOf(' ') > 0) {
+ buf.append('\"');
+ buf.append(relPath);
+ buf.append('\"');
+ } else {
+ buf.append(relPath);
+ }
+ buf.append(';');
+ }
+ }
+ if (buf.length() > 0) {
+ buf.setLength(buf.length() - 1);
+ linkerValues[1] = buf.toString();
+ }
+ }
+
+ startElement(content, "Tool",
+ new String[] {"Name",
+ "AdditionalDependencies",
+ "OutputFile",
+ "LinkIncremental",
+ "SuppressStartupBanner",
+ "GenerateDebugInformation",
+ "ProgramDatabaseFile",
+ "SubSystem",
+ "ImportLibrary",
+ "TargetMachine"}
+ , linkerValues);
+ content.endElement(null, "Tool", "Tool");
+ content.endElement(null, "Configuration", "Configuration");
+ content.endElement(null, "Configurations", "Configurations");
+ content.startElement(null, "References", "References", emptyAttrs);
+ content.endElement(null, "References", "References");
+ content.startElement(null, "Files", "Files", emptyAttrs);
+
+
+ File[] sortedSources = new File[sources.size()];
+ sources.toArray(sortedSources);
+ Arrays.sort(sortedSources, new Comparator() {
+ public int compare(final Object o1, final Object o2) {
+ return ((File) o1).getName().compareTo(((File) o2).getName());
+ }
+ });
+
+ writeFilteredSources("Source Files",
+ "cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx",
+ basePath, sortedSources, content);
+
+ writeFilteredSources("Header Files", "h;hpp;hxx;hm;inl;inc;xsd",
+ basePath, sortedSources, content);
+
+ writeFilteredSources("Resource Files",
+ "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx",
+ basePath, sortedSources, content);
+
+ content.endElement(null, "Files", "Files");
+ content.startElement(null, "Globals", "Globals", emptyAttrs);
+ content.endElement(null, "Globals", "Globals");
+ content.endElement(null, "VisualStudioProject", "VisualStudioProject");
+ content.endDocument();
+ }
+
+ /**
+ * Writes a cluster of source files to the project.
+ * @param name name of filter
+ * @param filter file extensions
+ * @param basePath base path for files
+ * @param sortedSources array of source files
+ * @param content generated project
+ * @throws SAXException if invalid content
+ */
+ private void writeFilteredSources(final String name, final String filter,
+ final String basePath,
+ final File[] sortedSources,
+ final ContentHandler content)
+ throws SAXException {
+ AttributesImpl filterAttrs = new AttributesImpl();
+ filterAttrs.addAttribute(null, "Name", "Name", "#PCDATA", name);
+ filterAttrs.addAttribute(null, "Filter", "Filter", "#PCDATA", filter);
+ content.startElement(null, "Filter", "Filter", filterAttrs);
+
+
+ AttributesImpl fileAttrs = new AttributesImpl();
+ fileAttrs.addAttribute(null, "RelativePath", "RelativePath",
+ "#PCDATA", "");
+
+ AttributesImpl fileConfigAttrs = new AttributesImpl();
+ fileConfigAttrs.addAttribute(null, "Name", "Name",
+ "#PCDATA", "Debug|Win32");
+
+ AttributesImpl toolAttrs = new AttributesImpl();
+ toolAttrs.addAttribute(null, "Name", "Name",
+ "#PCDATA", "VCCLCompilerTool");
+ toolAttrs.addAttribute(null, "Optimization", "Optimization",
+ "#PCDATA", "0");
+ toolAttrs.addAttribute(null, "PreprocessorDefinitions",
+ "PreprocessorDefinitions", "#PCDATA",
+ "WIN32;_DEBUG;_WINDOWS;$(NoInherit}");
+
+ for (int i = 0; i < sortedSources.length; i++) {
+ if (isGroupMember(filter, sortedSources[i])) {
+ String relativePath = CUtil.getRelativePath(basePath,
+ sortedSources[i]);
+ fileAttrs.setValue(0, relativePath);
+ content.startElement(null, "File", "File", fileAttrs);
+ content.startElement(null, "FileConfiguration", "FileConfiguration",
+ fileConfigAttrs);
+ content.startElement(null, "Tool", "Tool", toolAttrs);
+ content.endElement(null, "Tool", "Tool");
+ content.endElement(null, "FileConfiguration", "FileConfiguration");
+ content.endElement(null, "File", "File");
+ }
+ }
+ content.endElement(null, "Filter", "Filter");
+
+ }
+
+ /**
+ * Returns true if the file has an extension that appears in the group filter.
+ * @param filter String group filter
+ * @param candidate File file
+ * @return boolean true if member of group
+ */
+ private boolean isGroupMember(final String filter, final File candidate) {
+ String fileName = candidate.getName();
+ int lastDot = fileName.lastIndexOf('.');
+ if (lastDot >= 0 && lastDot < fileName.length() - 1) {
+ String extension =
+ ";" + fileName.substring(lastDot + 1).toLowerCase() + ";";
+ String semiFilter = ";" + filter + ";";
+ return semiFilter.indexOf(extension) >= 0;
+ }
+ return false;
+ }
+
+
+ /**
+ * Start an element.
+ * @param content ContentHandler content handler
+ * @param tagName String tag name
+ * @param attributeNames String[] attribute names
+ * @param attributeValues String[] attribute values
+ * @throws SAXException if error writing element
+ */
+ private void startElement(final ContentHandler content,
+ final String tagName,
+ final String[] attributeNames,
+ final String[] attributeValues)
+ throws SAXException {
+ AttributesImpl attributes = new AttributesImpl();
+ for (int i = 0; i < attributeNames.length; i++) {
+ if (attributeValues[i] != null) {
+ attributes.addAttribute(null, attributeNames[i],
+ attributeNames[i], "#PCDATA", attributeValues[i]);
+ }
+ }
+ content.startElement(null, tagName, tagName, attributes);
+ }
+
+ /**
+ * Gets the first recognized compiler from the
+ * compilation targets.
+ * @param targets compilation targets
+ * @return representative (hopefully) compiler configuration
+ */
+ private CommandLineCompilerConfiguration
+ getBaseCompilerConfiguration(final Hashtable targets) {
+ //
+ // find first target with an DevStudio C compilation
+ //
+ CommandLineCompilerConfiguration compilerConfig = null;
+ //
+ // get the first target and assume that it is representative
+ //
+ Iterator targetIter = targets.values().iterator();
+ while (targetIter.hasNext()) {
+ TargetInfo targetInfo = (TargetInfo) targetIter.next();
+ ProcessorConfiguration config = targetInfo.getConfiguration();
+ String identifier = config.getIdentifier();
+ //
+ // for the first cl compiler
+ //
+ if (config instanceof CommandLineCompilerConfiguration) {
+ compilerConfig = (CommandLineCompilerConfiguration) config;
+ if (compilerConfig.getCompiler() instanceof DevStudioCCompiler) {
+ return compilerConfig;
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/src/net/sf/antcontrib/cpptasks/devstudio/package.html b/src/net/sf/antcontrib/cpptasks/devstudio/package.html
new file mode 100644
index 0000000..46a31b4
--- /dev/null
+++ b/src/net/sf/antcontrib/cpptasks/devstudio/package.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright 2004 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.
+
+-->
+</head>
+<body bgcolor="white">
+
+Adapters for Microsoft tools.
+</body>
+</html>
+