Source Code Cross Referenced for VisualBasicCompile.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » dotnet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs.optional.dotnet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:
019:        package org.apache.tools.ant.taskdefs.optional.dotnet;
020:
021:        import org.apache.tools.ant.BuildException;
022:
023:        /**
024:         * This task compiles Visual Basic.NET source into executables or modules.
025:         * The task requires vbc.exe on the execute path, unless it or an equivalent
026:         * program is specified in the <tt>executable</tt> parameter
027:         *
028:         * <p>
029:         * All parameters are optional: &lt;vbc/&gt; should suffice to produce a debug
030:         * build of all *.vb files.
031:         *
032:         * <p>
033:
034:         * The task is a directory based task, so attributes like
035:         * <tt>includes=&quot;**\/*.vb&quot;</tt> and
036:         * <tt>excludes=&quot;broken.vb&quot;</tt> can be used to control
037:         * the files pulled in. By default,
038:         * all *.vb files from the project folder down are included in the command.
039:         * When this happens the destFile -if not specified-
040:         * is taken as the first file in the list, which may be somewhat hard to control.
041:         Specifying the output file with <tt>destfile</tt> is prudent.
042:         </p>
043:         <p>
044:         * Also, dependency checking only works if destfile is set.
045:         *
046:         * <p>For historical reasons the pattern
047:         * <code>**</code><code>/*.vb</code> is preset as includes list and
048:         * you can not override it with an explicit includes attribute.  Use
049:         * nested <code>&lt;src&gt;</code> elements instead of the basedir
050:         * attribute if you need more control.</p>
051:         *
052:         * As with &lt;csc&gt; nested <tt>src</tt> filesets of source,
053:         * reference filesets, definitions and resources can be provided.
054:         *
055:         * <p>
056:         * Example
057:         * </p>
058:         * <pre>&lt;vbc
059:         *   optimize=&quot;true&quot;
060:         *   debug=&quot;false&quot;
061:         *   warnLevel=&quot;4&quot;
062:         *   targetType=&quot;exe&quot;
063:         *   definitions=&quot;RELEASE&quot;
064:         *   excludes=&quot;src/unicode_class.vb&quot;
065:         *   mainClass = &quot;MainApp&quot;
066:         *   destFile=&quot;NetApp.exe&quot;
067:         *   optionExplicit=&quot;true&quot;
068:         *   optionCompare=&quot;text&quot;
069:         *   references="System.Xml,System.Web.Xml"
070:         *   &gt;
071:         *          &lt;reference file="${testCSC.dll}" /&gt;
072:         *          &lt;define name="RELEASE" /&gt;
073:         *          &lt;define name="DEBUG" if="debug.property"/&gt;
074:         *          &lt;define name="def3" unless="def2.property"/&gt;
075:         *   &lt;/vbc&gt;
076:         </pre>
077:         * @ant.task    name="vbc" category="dotnet"
078:         */
079:
080:        public class VisualBasicCompile extends DotnetCompile {
081:
082:            /**
083:             * Compiler option to remove integer checks. Default: false.
084:             */
085:            private boolean removeIntChecks = false;
086:
087:            /**
088:             * Require explicit declaration of variables? Default: false.
089:             */
090:            private boolean optionExplicit = false;
091:
092:            /**
093:             * Enforce strict language semantics? Default: false.
094:             */
095:            private boolean optionStrict = false;
096:
097:            /**
098:             * Whether to compare strings as "text" or "binary". Default: "binary".
099:             */
100:            private String optionCompare;
101:
102:            /**
103:             * Root namespace for all type declarations.
104:             */
105:            private String rootNamespace;
106:
107:            /**
108:             * Declare global imports fornamespaces in referenced metadata files.
109:             */
110:            private String imports;
111:
112:            /**
113:             * Constructor for VisualBasicCompile.
114:             */
115:            public VisualBasicCompile() {
116:                clear();
117:            }
118:
119:            /**
120:             *  reset all contents.
121:             */
122:            public void clear() {
123:                super .clear();
124:                imports = null;
125:                rootNamespace = null;
126:                optionCompare = null;
127:                optionExplicit = false;
128:                optionStrict = false;
129:                removeIntChecks = false;
130:                setExecutable("vbc");
131:            }
132:
133:            /**
134:             *  get the argument or null for no argument needed
135:             *  This is overridden from DotnetCompile.java because VBC uses
136:             *  "/win32resource:" rather than "/win32res:"
137:             *
138:             *@return    The Win32Res Parameter to CSC
139:             */
140:            protected String getWin32ResParameter() {
141:                if (getWin32Res() != null) {
142:                    return "/win32resource:" + getWin32Res().toString();
143:                } else {
144:                    return null;
145:                }
146:            }
147:
148:            /**
149:             * Whether to remove integer checks. Default false.
150:             * @param  flag  on/off flag
151:             */
152:            public void setRemoveIntChecks(boolean flag) {
153:                removeIntChecks = flag;
154:            }
155:
156:            /**
157:             * Get the flag for removing integer checks.
158:             * @return    true if flag is turned on
159:             */
160:            public boolean getRemoveIntChecks() {
161:                return removeIntChecks;
162:            }
163:
164:            /**
165:             * Form the option string for removeIntChecks.
166:             * @return The parameter string.
167:             */
168:            public String getRemoveIntChecksParameter() {
169:                return "/removeintchecks" + (removeIntChecks ? "+" : "-");
170:            }
171:
172:            /**
173:             * Whether to require explicit declaration of variables.
174:             * @param  flag  on/off flag
175:             */
176:            public void setOptionExplicit(boolean flag) {
177:                optionExplicit = flag;
178:            }
179:
180:            /**
181:             * Get the flag for whether to require explicit declaration of variables.
182:             *@return    true if flag is turned on
183:             */
184:            public boolean getOptionExplicit() {
185:                return optionExplicit;
186:            }
187:
188:            /**
189:             * Form the option string for optionExplicit..
190:             * @return The parameter string.
191:             */
192:            public String getOptionExplicitParameter() {
193:                return "/optionexplicit" + (optionExplicit ? "+" : "-");
194:            }
195:
196:            /**
197:             * Enforce strict language semantics.
198:             * @param  flag  on/off flag
199:             */
200:            public void setOptionStrict(boolean flag) {
201:                optionStrict = flag;
202:            }
203:
204:            /**
205:             * Get the flag for whether to enforce strict language semantics.
206:             * @return    true if flag is turned on
207:             */
208:            public boolean getOptionStrict() {
209:                return optionStrict;
210:            }
211:
212:            /**
213:             * For the option string for optionStrict.
214:             * @return The parameter string.
215:             */
216:            public String getOptionStrictParameter() {
217:                return "/optionstrict" + (optionStrict ? "+" : "-");
218:            }
219:
220:            /**
221:             * Specifies the root namespace for all type declarations.
222:             * @param rootNamespace a root namespace.
223:             */
224:            public void setRootNamespace(String rootNamespace) {
225:                this .rootNamespace = rootNamespace;
226:            }
227:
228:            /**
229:             * Get the root namespace.
230:             * @return  the root namespace.
231:             */
232:            public String getRootNamespace() {
233:                return this .rootNamespace;
234:            }
235:
236:            /**
237:             * Form the option string for rootNamespace.
238:             * @return  the root namespace option string.
239:             */
240:            protected String getRootNamespaceParameter() {
241:                if (rootNamespace != null && rootNamespace.length() != 0) {
242:                    return "/rootnamespace:" + rootNamespace;
243:                } else {
244:                    return null;
245:                }
246:            }
247:
248:            /**
249:             * Declare global imports for namespaces in referenced metadata files.
250:             * @param imports the imports string
251:             */
252:            public void setImports(String imports) {
253:                this .imports = imports;
254:            }
255:
256:            /**
257:             * Get global imports for namespaces in referenced metadata files.
258:             * @return  the imports string.
259:             */
260:            public String getImports() {
261:                return this .imports;
262:            }
263:
264:            /**
265:             * Format the option for imports.
266:             * @return  the formatted import option.
267:             */
268:            protected String getImportsParameter() {
269:                if (imports != null && imports.length() != 0) {
270:                    return "/imports:" + imports;
271:                } else {
272:                    return null;
273:                }
274:            }
275:
276:            /**
277:             * Specify binary- or text-style string comparisons. Defaults
278:             * to "binary"
279:             * @param optionCompare the option compare style. "text" | "binary".
280:             */
281:            public void setOptionCompare(String optionCompare) {
282:                if ("text".equalsIgnoreCase(optionCompare)) {
283:                    this .optionCompare = "text";
284:                } else {
285:                    this .optionCompare = "binary";
286:                }
287:            }
288:
289:            /**
290:             * "binary" or "text" for the string-comparison style.
291:             * @return  the option compare style.
292:             */
293:            public String getOptionCompare() {
294:                return this .optionCompare;
295:            }
296:
297:            /**
298:             * Format the option for string comparison style.
299:             * @return  The formatted option.
300:             */
301:            protected String getOptionCompareParameter() {
302:                if (optionCompare != null
303:                        && "text".equalsIgnoreCase(optionCompare)) {
304:                    return "/optioncompare:text";
305:                } else {
306:                    return "/optioncompare:binary";
307:                }
308:            }
309:
310:            /**
311:             * implement VBC commands
312:             * @param command the command to set arguements on.
313:             */
314:            protected void addCompilerSpecificOptions(NetCommand command) {
315:                command.addArgument(getRemoveIntChecksParameter());
316:                command.addArgument(getImportsParameter());
317:                command.addArgument(getOptionExplicitParameter());
318:                command.addArgument(getOptionStrictParameter());
319:                command.addArgument(getRootNamespaceParameter());
320:                command.addArgument(getOptionCompareParameter());
321:            }
322:
323:            /**
324:             * Get the delimiter that the compiler uses between references.
325:             * For example, c# will return ";"; VB.NET will return ","
326:             * @return The string delimiter for the reference string.
327:             */
328:            public String getReferenceDelimiter() {
329:                return ",";
330:            }
331:
332:            /**
333:             * Get the extension of filenames to compile.
334:             * @return The string extension of files to compile.
335:             */
336:            public String getFileExtension() {
337:                return "vb";
338:            }
339:
340:            /** {@inheritDoc} */
341:            protected void createResourceParameter(NetCommand command,
342:                    DotnetResource resource) {
343:                resource.getParameters(getProject(), command, false);
344:            }
345:
346:            /**
347:             * validation code
348:             * @throws  BuildException  if validation failed
349:             */
350:            protected void validate() throws BuildException {
351:                super .validate();
352:                if (getDestFile() == null) {
353:                    throw new BuildException("DestFile was not specified");
354:                }
355:            }
356:        }
ww__w___.__j__a__va2_s.___co_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.