diff options
author | darius42 <[email protected]> | 2007-08-22 21:08:36 +0000 |
---|---|---|
committer | darius42 <[email protected]> | 2007-08-22 21:08:36 +0000 |
commit | b8f9c2efe5a0b11db7a644b20b7d311da0cd02fa (patch) | |
tree | 85828395e66542aa9d031601dfee1ba8b5be593d | |
parent | c48b163f7332a86faaa42b7e962fb166206ca7e5 (diff) |
Update for bug 1715475. Extended the file types that will be bid on by the CC, aCC, and xlC compilers so that it will include '.s' files.
git-svn-id: file:///home/sven/projects/JOGL/temp/ant-contrib/svn/ant-contrib-code/cpptasks/trunk@139 32d7a393-a5a9-423c-abd3-5d954feb1f2f
7 files changed, 273 insertions, 13 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java index e556e6b..b978f67 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java @@ -1,6 +1,6 @@ /* * - * Copyright 2001-2004 The Ant-Contrib project + * Copyright 2001-2007 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. @@ -31,8 +31,13 @@ import org.apache.tools.ant.types.Environment; * @author Curt Arnold */ public final class aCCCompiler extends GccCompatibleCCompiler { - private static final aCCCompiler instance = new aCCCompiler("aCC", false, - null); + private final static String[] headerExtensions = new String[]{".h", ".hpp", + ".inl"}; + private final static String[] sourceExtensions = new String[]{".c", ".cc", + ".cxx", ".cpp", ".c++", ".i", ".s"}; + + private static final aCCCompiler instance = new aCCCompiler("aCC", + sourceExtensions, headerExtensions, false, null); /** * Gets singleton instance of this class */ @@ -45,8 +50,11 @@ public final class aCCCompiler extends GccCompatibleCCompiler { * Private constructor. Use GccCCompiler.getInstance() to get singleton * instance of this class. */ - private aCCCompiler(String command, boolean newEnvironment, Environment env) { - super(command, "-help", false, null, newEnvironment, env); + private aCCCompiler(String command, String[] sourceExtensions, + String[] headerExtensions, boolean newEnvironment, + Environment env) { + super(command, "-help", sourceExtensions, headerExtensions, false, + null, newEnvironment, env); } public void addImpliedArgs(Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java index 56b7674..781b6de 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java @@ -30,8 +30,13 @@ import org.apache.tools.ant.types.Environment; * @author Curt Arnold */ public final class VisualAgeCCompiler extends GccCompatibleCCompiler { + private final static String[] headerExtensions = new String[]{".h", ".hpp", + ".inl"}; + private final static String[] sourceExtensions = new String[]{".c", ".cc", + ".cxx", ".cpp", ".i", ".s"}; + private static final VisualAgeCCompiler instance = new VisualAgeCCompiler( - "xlC", false, null); + "xlC", sourceExtensions, headerExtensions, false, null); /** * Gets singleton instance of this class */ @@ -44,9 +49,11 @@ public final class VisualAgeCCompiler extends GccCompatibleCCompiler { * Private constructor. Use getInstance() to get singleton instance of this * class. */ - private VisualAgeCCompiler(String command, boolean newEnvironment, + private VisualAgeCCompiler(String command, String[] sourceExtensions, + String[] headerExtensions, boolean newEnvironment, Environment env) { - super(command, "-help", false, null, newEnvironment, env); + super(command, "-help", sourceExtensions, headerExtensions, false, + null, newEnvironment, env); } public void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java index 2c37eff..2212871 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java @@ -1,6 +1,6 @@ /* * - * Copyright 2001-2004 The Ant-Contrib project + * Copyright 2001-2007 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. @@ -29,7 +29,13 @@ import net.sf.antcontrib.cpptasks.OptimizationEnum; * @author Curt Arnold */ public final class ForteCCCompiler extends GccCompatibleCCompiler { - private static final ForteCCCompiler instance = new ForteCCCompiler("CC"); + private final static String[] headerExtensions = new String[]{".h", ".hpp", + ".inl"}; + private final static String[] sourceExtensions = new String[]{".c", ".cc", + ".cxx", ".cpp", ".c++", ".i", ".s"}; + + private static final ForteCCCompiler instance = new ForteCCCompiler("CC", + sourceExtensions, headerExtensions); /** * Gets singleton instance of this class */ @@ -42,8 +48,10 @@ public final class ForteCCCompiler extends GccCompatibleCCompiler { * Private constructor. Use ForteCCCompiler.getInstance() to get singleton * instance of this class. */ - private ForteCCCompiler(String command) { - super(command, "-V", false, null, false, null); + private ForteCCCompiler(String command, String[] sourceExtensions, + String[] headerExtensions) { + super(command, "-V", sourceExtensions, headerExtensions, false, null, + false, null); } public void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/test/java/net/sf/antcontrib/cpptasks/TestAllClasses.java b/src/test/java/net/sf/antcontrib/cpptasks/TestAllClasses.java index de6c491..e85fe27 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/TestAllClasses.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/TestAllClasses.java @@ -1,6 +1,6 @@ /* * - * Copyright 2002-2004 The Ant-Contrib project + * Copyright 2002-2007 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. @@ -56,5 +56,8 @@ public class TestAllClasses extends TestSuite { addTestSuite(net.sf.antcontrib.cpptasks.gcc.TestAbstractArLibrarian.class); addTestSuite(net.sf.antcontrib.cpptasks.gcc.TestGccLinker.class); addTestSuite(net.sf.antcontrib.cpptasks.gcc.TestGccLinker.class); + addTestSuite(net.sf.antcontrib.cpptasks.sun.TestForteCCCompiler.class); + addTestSuite(net.sf.antcontrib.cpptasks.hp.TestaCCCompiler.class); + addTestSuite(net.sf.antcontrib.cpptasks.ibm.TestVisualAgeCCompiler.class); } } diff --git a/src/test/java/net/sf/antcontrib/cpptasks/hp/TestaCCCompiler.java b/src/test/java/net/sf/antcontrib/cpptasks/hp/TestaCCCompiler.java new file mode 100644 index 0000000..073463e --- /dev/null +++ b/src/test/java/net/sf/antcontrib/cpptasks/hp/TestaCCCompiler.java @@ -0,0 +1,93 @@ +/* + * + * Copyright 2002-2007 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.hp; +import java.util.Vector; + +import junit.framework.TestCase; + +import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; +/** + * Test HP aCC compiler adapter + * + */ +// TODO Since aCCCompiler extends GccCompatibleCCompiler, this test +// should probably extend TestGccCompatibleCCompiler. +public class TestaCCCompiler extends TestCase { + public TestaCCCompiler(String name) { + super(name); + } + public void testBidC() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.c")); + } + public void testBidCpp() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.C")); + } + public void testBidCpp2() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cc")); + } + public void testBidCpp3() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.CC")); + } + public void testBidCpp4() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cxx")); + } + public void testBidCpp5() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.CXX")); + } + public void testBidCpp6() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cpp")); + } + public void testBidCpp7() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.CPP")); + } + public void testBidCpp8() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.c++")); + } + public void testBidCpp9() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.C++")); + } + public void testBidPreprocessed() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.i")); + } + public void testBidAssembly() { + aCCCompiler compiler = aCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.s")); + } +} diff --git a/src/test/java/net/sf/antcontrib/cpptasks/ibm/TestVisualAgeCCompiler.java b/src/test/java/net/sf/antcontrib/cpptasks/ibm/TestVisualAgeCCompiler.java new file mode 100644 index 0000000..62a513e --- /dev/null +++ b/src/test/java/net/sf/antcontrib/cpptasks/ibm/TestVisualAgeCCompiler.java @@ -0,0 +1,68 @@ +/* + * + * Copyright 2002-2007 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.ibm; +import java.util.Vector; + +import junit.framework.TestCase; + +import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; +/** + * Test IBM Visual Age compiler adapter + * + */ +// TODO Since VisualAgeCCompiler extends GccCompatibleCCompiler, this test +// should probably extend TestGccCompatibleCCompiler. +public class TestVisualAgeCCompiler extends TestCase { + public TestVisualAgeCCompiler(String name) { + super(name); + } + public void testBidC() { + VisualAgeCCompiler compiler = VisualAgeCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.c")); + } + public void testBidCpp() { + VisualAgeCCompiler compiler = VisualAgeCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.C")); + } + public void testBidCpp2() { + VisualAgeCCompiler compiler = VisualAgeCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cc")); + } + public void testBidCpp3() { + VisualAgeCCompiler compiler = VisualAgeCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cxx")); + } + public void testBidCpp4() { + VisualAgeCCompiler compiler = VisualAgeCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cpp")); + } + public void testBidPreprocessed() { + VisualAgeCCompiler compiler = VisualAgeCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.i")); + } + public void testBidAssembly() { + VisualAgeCCompiler compiler = VisualAgeCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.s")); + } +} diff --git a/src/test/java/net/sf/antcontrib/cpptasks/sun/TestForteCCCompiler.java b/src/test/java/net/sf/antcontrib/cpptasks/sun/TestForteCCCompiler.java new file mode 100644 index 0000000..0fa3297 --- /dev/null +++ b/src/test/java/net/sf/antcontrib/cpptasks/sun/TestForteCCCompiler.java @@ -0,0 +1,73 @@ +/* + * + * Copyright 2002-2007 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.sun; +import java.util.Vector; + +import junit.framework.TestCase; + +import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; +/** + * Test Sun Forte compiler adapter + * + */ +// TODO Since ForteCCCompiler extends GccCompatibleCCompiler, this test +// should probably extend TestGccCompatibleCCompiler. +public class TestForteCCCompiler extends TestCase { + public TestForteCCCompiler(String name) { + super(name); + } + public void testBidC() { + ForteCCCompiler compiler = ForteCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.c")); + } + public void testBidCpp() { + ForteCCCompiler compiler = ForteCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.C")); + } + public void testBidCpp2() { + ForteCCCompiler compiler = ForteCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cc")); + } + public void testBidCpp3() { + ForteCCCompiler compiler = ForteCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cxx")); + } + public void testBidCpp4() { + ForteCCCompiler compiler = ForteCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.cpp")); + } + public void testBidCpp5() { + ForteCCCompiler compiler = ForteCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.c++")); + } + public void testBidPreprocessed() { + ForteCCCompiler compiler = ForteCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.i")); + } + public void testBidAssembly() { + ForteCCCompiler compiler = ForteCCCompiler.getInstance(); + assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler + .bid("foo.s")); + } +} |