809N/A/*
809N/A Licensed to the Apache Software Foundation (ASF) under one or more
809N/A contributor license agreements. See the NOTICE file distributed with
809N/A this work for additional information regarding copyright ownership.
809N/A The ASF licenses this file to You under the Apache License, Version 2.0
809N/A (the "License"); you may not use this file except in compliance with
809N/A the License. You may obtain a copy of the License at
809N/A
809N/A http://www.apache.org/licenses/LICENSE-2.0
809N/A
809N/A Unless required by applicable law or agreed to in writing, software
809N/A distributed under the License is distributed on an "AS IS" BASIS,
809N/A WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
809N/A See the License for the specific language governing permissions and
809N/A limitations under the License.
809N/A
809N/A Run ant
809N/A*/
809N/A
809N/A'@echo off'
809N/Aparse arg mode envarg '::' antarg
809N/A
809N/Aif mode\='.' & mode\='..' & mode\='/' then do
809N/A envarg = mode envarg
809N/A mode = ''
809N/Aend
809N/A
809N/Aif antarg = '' then do
809N/A antarg = envarg
809N/A envarg = ''
809N/Aend
809N/A
809N/Ax = setlocal()
809N/A
809N/Aenv="OS2ENVIRONMENT"
809N/Aantenv = _getenv_('antenv')
809N/Aif _testenv_() = 0 then interpret 'call "' || antenv || '"' '"' || envarg || '"'
809N/A
809N/Aif mode = '' then mode = _getenv_('ANT_MODE' '..')
809N/Aif mode \= '/' then do
809N/A runrc = _getenv_('runrc')
809N/A antrc = _getenv_('antrc' 'antrc.cmd')
809N/A if mode = '..' then mode = '-r'
809N/A else mode = ''
809N/A interpret 'call "' || runrc || '"' antrc '"' || mode || '"'
809N/Aend
809N/A
809N/Aif _testenv_() = 0 then do
809N/A say 'Ant environment is not set properly'
809N/A x = endlocal()
809N/A exit 16
809N/Aend
809N/A
809N/Asettings = '-Dant.home=' || ANT_HOME '-Djava.home=' || JAVA_HOME
809N/A
809N/Ajava = _getenv_('javacmd' 'java')
809N/Aopts = value('ANT_OPTS',,env)
809N/Aargs = value('ANT_ARGS',,env)
809N/Alcp = value('LOCALCLASSPATH',,env)
809N/Acp = value('CLASSPATH',,env)
809N/Aif value('ANT_USE_CP',,env) \= '' then do
809N/A if lcp \= '' & right(lcp, 1) \= ';' then lcp = lcp || ';'
809N/A lcp = lcp || cp
809N/A 'SET CLASSPATH='
809N/Aend
809N/Aif lcp\='' then lcp = '-classpath' lcp
809N/A
809N/Acmd = java opts lcp '-jar' ANT_HOME ||'\lib\ant-launcher.jar' settings args antarg
809N/Alauncher = stream(ANT_HOME ||'\lib\ant-launcher.jar', 'C', 'query exists')
809N/Aif launcher = '' then entry = 'org.apache.tools.ant.Main'
809N/Aelse entry = 'org.apache.tools.ant.launch.Launcher'
809N/Ajava opts lcp entry settings args antarg
809N/A
809N/Ax = endlocal()
809N/A
809N/Areturn rc
809N/A
809N/A_testenv_: procedure expose env ANT_HOME JAVA_HOME
809N/AANT_HOME = value('ANT_HOME',,env)
809N/Aif ANT_HOME = '' then return 0
809N/AJAVA_HOME = value('JAVA_HOME',,env)
809N/Aif JAVA_HOME = '' then return 0
809N/Acp = translate(value('CLASSPATH',,env))
809N/Aif pos(translate(ANT_HOME), cp) = 0 then return 0
809N/Aif pos(translate(JAVA_HOME), cp) = 0 then return 0
809N/Areturn 1
809N/A
809N/A_getenv_: procedure expose env
809N/Aparse arg envar default
809N/Aif default = '' then default = envar
809N/Avar = value(translate(envar),,env)
809N/Aif var = '' then var = default
809N/Areturn var