2 Licensed to the Apache Software Foundation (ASF) under one or more
\r
3 contributor license agreements. See the NOTICE file distributed with
\r
4 this work for additional information regarding copyright ownership.
\r
5 The ASF licenses this file to You under the Apache License, Version 2.0
\r
6 (the "License"); you may not use this file except in compliance with
\r
7 the License. You may obtain a copy of the License at
\r
9 http://www.apache.org/licenses/LICENSE-2.0
\r
11 Unless required by applicable law or agreed to in writing, software
\r
12 distributed under the License is distributed on an "AS IS" BASIS,
\r
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 See the License for the specific language governing permissions and
\r
15 limitations under the License.
\r
21 parse arg mode envarg '::' antarg
\r
23 if mode\='.' & mode\='..' & mode\='/' then do
\r
24 envarg = mode envarg
\r
28 if antarg = '' then do
\r
35 env="OS2ENVIRONMENT"
\r
36 antenv = _getenv_('antenv')
\r
37 if _testenv_() = 0 then interpret 'call "' || antenv || '"' '"' || envarg || '"'
\r
39 if mode = '' then mode = _getenv_('ANT_MODE' '..')
\r
40 if mode \= '/' then do
\r
41 runrc = _getenv_('runrc')
\r
42 antrc = _getenv_('antrc' 'antrc.cmd')
\r
43 if mode = '..' then mode = '-r'
\r
45 interpret 'call "' || runrc || '"' antrc '"' || mode || '"'
\r
48 if _testenv_() = 0 then do
\r
49 say 'Ant environment is not set properly'
\r
54 settings = '-Dant.home=' || ANT_HOME '-Djava.home=' || JAVA_HOME
\r
56 java = _getenv_('javacmd' 'java')
\r
57 opts = value('ANT_OPTS',,env)
\r
58 args = value('ANT_ARGS',,env)
\r
59 lcp = value('LOCALCLASSPATH',,env)
\r
60 cp = value('CLASSPATH',,env)
\r
61 if value('ANT_USE_CP',,env) \= '' then do
\r
62 if lcp \= '' & right(lcp, 1) \= ';' then lcp = lcp || ';'
\r
66 if lcp\='' then lcp = '-classpath' lcp
\r
68 cmd = java opts lcp '-jar' ANT_HOME ||'\lib\ant-launcher.jar' settings args antarg
\r
69 launcher = stream(ANT_HOME ||'\lib\ant-launcher.jar', 'C', 'query exists')
\r
70 if launcher = '' then entry = 'org.apache.tools.ant.Main'
\r
71 else entry = 'org.apache.tools.ant.launch.Launcher'
\r
72 java opts lcp entry settings args antarg
\r
78 _testenv_: procedure expose env ANT_HOME JAVA_HOME
\r
79 ANT_HOME = value('ANT_HOME',,env)
\r
80 if ANT_HOME = '' then return 0
\r
81 JAVA_HOME = value('JAVA_HOME',,env)
\r
82 if JAVA_HOME = '' then return 0
\r
83 cp = translate(value('CLASSPATH',,env))
\r
84 if pos(translate(ANT_HOME), cp) = 0 then return 0
\r
85 if pos(translate(JAVA_HOME), cp) = 0 then return 0
\r
88 _getenv_: procedure expose env
\r
89 parse arg envar default
\r
90 if default = '' then default = envar
\r
91 var = value(translate(envar),,env)
\r
92 if var = '' then var = default
\r