You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

antenv.cmd 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. Copyright 2003-2004 The Apache Software Foundation
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. Ant environment
  13. */
  14. '@echo off'
  15. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  16. call SysLoadFuncs
  17. /* Prepare the parameters for later use */
  18. parse arg argv
  19. mode = ''
  20. args = ''
  21. opts = ''
  22. cp = ''
  23. lcp = ''
  24. do i = 1 to words(argv)
  25. param = word(argv, i)
  26. select
  27. when param='-lcp' then mode = 'l'
  28. when param='-cp' | param='-classpath' then mode = 'c'
  29. when abbrev('-opts', param, 4) then mode = 'o'
  30. when abbrev('-args', param, 4) then mode = 'a'
  31. otherwise
  32. select
  33. when mode = 'a' then args = space(args param, 1)
  34. when mode = 'c' then cp = space(cp param, 1)
  35. when mode = 'l' then lcp = space(lcp param, 1)
  36. when mode = 'o' then opts = space(opts param, 1)
  37. otherwise
  38. say 'Option' param 'ignored'
  39. end
  40. end
  41. end
  42. env="OS2ENVIRONMENT"
  43. antconf = _getenv_('antconf' 'antconf.cmd')
  44. runrc = _getenv_('runrc')
  45. interpret 'call "' || runrc || '"' '"' || antconf || '"' 'ETC'
  46. ANT_HOME = value('ANT_HOME',,env)
  47. JAVA_HOME = value('JAVA_HOME',,env)
  48. classpath = value('CLASSPATH',,env)
  49. classes = stream(JAVA_HOME || "\lib\classes.zip", "C", "QUERY EXISTS")
  50. if classes \= '' then classpath = prepend(classpath classes)
  51. classes = stream(JAVA_HOME || "\lib\tools.jar", "C", "QUERY EXISTS")
  52. if classes \= '' then classpath = prepend(classpath classes)
  53. classpath = prepend(classpath ANT_HOME || '\lib\ant-launcher.jar')
  54. 'SET CLASSPATH=' || classpath
  55. /* Setting classpathes, options and arguments */
  56. envset = _getenv_('envset')
  57. if cp\='' then interpret 'call "' || envset || '"' '"; CLASSPATH"' '"' || cp || '"'
  58. if lcp\='' then interpret 'call "' || envset || '"' '"; LOCALCLASSPATH"' '"' || lcp || '"'
  59. if opts\='' then interpret 'call "' || envset || '"' '"-D ANT_OPTS"' '"' || opts || '"'
  60. if args\='' then interpret 'call "' || envset || '"' '"ANT_ARGS"' '"' || args || '"'
  61. exit 0
  62. addpath: procedure
  63. parse arg path elem
  64. if elem = '' then do
  65. if path\='' & right(path, 1)\=';' then path = path || ';'
  66. return path
  67. end
  68. if substr(path, length(path)) = ';' then glue = ''
  69. else glue = ';'
  70. if pos(translate(elem), translate(path)) = 0 then path = path || glue || elem || ';'
  71. return path
  72. prepend: procedure
  73. parse arg path elem
  74. if elem = '' then do
  75. if path\='' & right(path, 1)\=';' then path = path || ';'
  76. return path
  77. end
  78. if pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path
  79. return path
  80. _getenv_: procedure expose env
  81. parse arg envar default
  82. if default = '' then default = envar
  83. var = value(translate(envar),,env)
  84. if var = '' then var = default
  85. return var