1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant.taskdefs.compilers;
  18. import org.apache.tools.ant.BuildException;
  19. import org.apache.tools.ant.Project;
  20. import org.apache.tools.ant.types.Commandline;
  21. /**
  22. * The implementation of the sj compiler.
  23. * Uses the defaults for DefaultCompilerAdapter
  24. *
  25. * @since Ant 1.4
  26. */
  27. public class Sj extends DefaultCompilerAdapter {
  28. /**
  29. * Performs a compile using the sj compiler from Symantec.
  30. */
  31. public boolean execute() throws BuildException {
  32. attributes.log("Using symantec java compiler", Project.MSG_VERBOSE);
  33. Commandline cmd = setupJavacCommand();
  34. String exec = getJavac().getExecutable();
  35. cmd.setExecutable(exec == null ? "sj" : exec);
  36. int firstFileName = cmd.size() - compileList.length;
  37. return
  38. executeExternalCompile(cmd.getCommandline(), firstFileName) == 0;
  39. }
  40. }