1 18 19 package org.apache.tools.ant.taskdefs.optional.dotnet; 20 21 import org.apache.tools.ant.BuildException; 22 23 24 80 81 public class VisualBasicCompile extends DotnetCompile { 82 83 86 private boolean removeIntChecks = false; 87 88 91 private boolean optionExplicit = false; 92 93 96 private boolean optionStrict = false; 97 98 101 private String optionCompare; 102 103 106 private String rootNamespace; 107 108 111 private String imports; 112 113 116 public VisualBasicCompile() { 117 clear(); 118 } 119 120 123 public void clear() { 124 super.clear(); 125 imports = null; 126 rootNamespace = null; 127 optionCompare = null; 128 optionExplicit = false; 129 optionStrict = false; 130 removeIntChecks = false; 131 setExecutable("vbc"); 132 } 133 134 141 protected String getWin32ResParameter() { 142 if (getWin32Res() != null) { 143 return "/win32resource:" + getWin32Res().toString(); 144 } else { 145 return null; 146 } 147 } 148 149 153 public void setRemoveIntChecks(boolean flag) { 154 removeIntChecks = flag; 155 } 156 157 161 public boolean getRemoveIntChecks() { 162 return removeIntChecks; 163 } 164 165 169 public String getRemoveIntChecksParameter() { 170 return "/removeintchecks" + (removeIntChecks ? "+" : "-"); 171 } 172 173 177 public void setOptionExplicit(boolean flag) { 178 optionExplicit = flag; 179 } 180 181 185 public boolean getOptionExplicit() { 186 return optionExplicit; 187 } 188 189 193 public String getOptionExplicitParameter() { 194 return "/optionexplicit" + (optionExplicit ? "+" : "-"); 195 } 196 197 201 public void setOptionStrict(boolean flag) { 202 optionStrict = flag; 203 } 204 205 209 public boolean getOptionStrict() { 210 return optionStrict; 211 } 212 213 217 public String getOptionStrictParameter() { 218 return "/optionstrict" + (optionStrict ? "+" : "-"); 219 } 220 221 222 226 public void setRootNamespace(String rootNamespace) { 227 this.rootNamespace = rootNamespace; 228 } 229 230 231 235 public String getRootNamespace() { 236 return this.rootNamespace; 237 } 238 239 240 244 protected String getRootNamespaceParameter() { 245 if (rootNamespace != null && rootNamespace.length() != 0) { 246 return "/rootnamespace:" + rootNamespace; 247 } else { 248 return null; 249 } 250 } 251 252 253 257 public void setImports(String imports) { 258 this.imports = imports; 259 } 260 261 262 266 public String getImports() { 267 return this.imports; 268 } 269 270 271 275 protected String getImportsParameter() { 276 if (imports != null && imports.length() != 0) { 277 return "/imports:" + imports; 278 } else { 279 return null; 280 } 281 } 282 283 284 289 public void setOptionCompare(String optionCompare) { 290 if ("text".equalsIgnoreCase(optionCompare)) { 291 this.optionCompare = "text"; 292 } else { 293 this.optionCompare = "binary"; 294 } 295 } 296 297 298 302 public String getOptionCompare() { 303 return this.optionCompare; 304 } 305 306 310 protected String getOptionCompareParameter() { 311 if (optionCompare != null && "text".equalsIgnoreCase(optionCompare)) { 312 return "/optioncompare:text"; 313 } else { 314 return "/optioncompare:binary"; 315 } 316 } 317 318 322 protected void addCompilerSpecificOptions(NetCommand command) { 323 command.addArgument(getRemoveIntChecksParameter()); 324 command.addArgument(getImportsParameter()); 325 command.addArgument(getOptionExplicitParameter()); 326 command.addArgument(getOptionStrictParameter()); 327 command.addArgument(getRootNamespaceParameter()); 328 command.addArgument(getOptionCompareParameter()); 329 } 330 331 336 public String getReferenceDelimiter() { 337 return ","; 338 } 339 340 341 342 346 public String getFileExtension() { 347 return "vb"; 348 } 349 350 351 protected void createResourceParameter(NetCommand command, DotnetResource resource) { 352 resource.getParameters(getProject(), command, false); 353 } 354 355 359 protected void validate() 360 throws BuildException { 361 super.validate(); 362 if (getDestFile() == null) { 363 throw new BuildException("DestFile was not specified"); 364 } 365 } 366 } 367 | Popular Tags |