summaryrefslogtreecommitdiffstats
path: root/lib/ant/bin
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ant/bin')
-rw-r--r--lib/ant/bin/ant.cmd92
-rw-r--r--lib/ant/bin/antenv.cmd99
-rw-r--r--lib/ant/bin/envset.cmd130
-rw-r--r--lib/ant/bin/runrc.cmd59
4 files changed, 380 insertions, 0 deletions
diff --git a/lib/ant/bin/ant.cmd b/lib/ant/bin/ant.cmd
new file mode 100644
index 000000000..4bb903f5f
--- /dev/null
+++ b/lib/ant/bin/ant.cmd
@@ -0,0 +1,92 @@
+/*
+ Copyright 2003-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Run ant
+*/
+
+'@echo off'
+parse arg mode envarg '::' antarg
+
+if mode\='.' & mode\='..' & mode\='/' then do
+ envarg = mode envarg
+ mode = ''
+end
+
+if antarg = '' then do
+ antarg = envarg
+ envarg = ''
+end
+
+x = setlocal()
+
+env="OS2ENVIRONMENT"
+antenv = _getenv_('antenv')
+if _testenv_() = 0 then interpret 'call "' || antenv || '"' '"' || envarg || '"'
+
+if mode = '' then mode = _getenv_('ANT_MODE' '..')
+if mode \= '/' then do
+ runrc = _getenv_('runrc')
+ antrc = _getenv_('antrc' 'antrc.cmd')
+ if mode = '..' then mode = '-r'
+ else mode = ''
+ interpret 'call "' || runrc || '"' antrc '"' || mode || '"'
+end
+
+if _testenv_() = 0 then do
+ say 'Ant environment is not set properly'
+ x = endlocal()
+ exit 16
+end
+
+settings = '-Dant.home=' || ANT_HOME '-Djava.home=' || JAVA_HOME
+
+java = _getenv_('javacmd' 'java')
+opts = value('ANT_OPTS',,env)
+args = value('ANT_ARGS',,env)
+lcp = value('LOCALCLASSPATH',,env)
+cp = value('CLASSPATH',,env)
+if value('ANT_USE_CP',,env) \= '' then do
+ if lcp \= '' & right(lcp, 1) \= ';' then lcp = lcp || ';'
+ lcp = lcp || cp
+ 'SET CLASSPATH='
+end
+if lcp\='' then lcp = '-classpath' lcp
+
+cmd = java opts lcp '-jar' ANT_HOME ||'\lib\ant-launcher.jar' settings args antarg
+launcher = stream(ANT_HOME ||'\lib\ant-launcher.jar', 'C', 'query exists')
+if launcher = '' then entry = 'org.apache.tools.ant.Main'
+else entry = 'org.apache.tools.ant.launch.Launcher'
+java opts lcp entry settings args antarg
+
+x = endlocal()
+
+return rc
+
+_testenv_: procedure expose env ANT_HOME JAVA_HOME
+ANT_HOME = value('ANT_HOME',,env)
+if ANT_HOME = '' then return 0
+JAVA_HOME = value('JAVA_HOME',,env)
+if JAVA_HOME = '' then return 0
+cp = translate(value('CLASSPATH',,env))
+if pos(translate(ANT_HOME), cp) = 0 then return 0
+if pos(translate(JAVA_HOME), cp) = 0 then return 0
+return 1
+
+_getenv_: procedure expose env
+parse arg envar default
+if default = '' then default = envar
+var = value(translate(envar),,env)
+if var = '' then var = default
+return var
diff --git a/lib/ant/bin/antenv.cmd b/lib/ant/bin/antenv.cmd
new file mode 100644
index 000000000..b9b0db467
--- /dev/null
+++ b/lib/ant/bin/antenv.cmd
@@ -0,0 +1,99 @@
+/*
+ Copyright 2003-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Ant environment
+*/
+
+'@echo off'
+call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
+call SysLoadFuncs
+
+/* Prepare the parameters for later use */
+parse arg argv
+mode = ''
+args = ''
+opts = ''
+cp = ''
+lcp = ''
+
+do i = 1 to words(argv)
+ param = word(argv, i)
+ select
+ when param='-lcp' then mode = 'l'
+ when param='-cp' | param='-classpath' then mode = 'c'
+ when abbrev('-opts', param, 4) then mode = 'o'
+ when abbrev('-args', param, 4) then mode = 'a'
+ otherwise
+ select
+ when mode = 'a' then args = space(args param, 1)
+ when mode = 'c' then cp = space(cp param, 1)
+ when mode = 'l' then lcp = space(lcp param, 1)
+ when mode = 'o' then opts = space(opts param, 1)
+ otherwise
+ say 'Option' param 'ignored'
+ end
+ end
+end
+
+env="OS2ENVIRONMENT"
+antconf = _getenv_('antconf' 'antconf.cmd')
+runrc = _getenv_('runrc')
+interpret 'call "' || runrc || '"' '"' || antconf || '"' 'ETC'
+ANT_HOME = value('ANT_HOME',,env)
+JAVA_HOME = value('JAVA_HOME',,env)
+classpath = value('CLASSPATH',,env)
+classes = stream(JAVA_HOME || "\lib\classes.zip", "C", "QUERY EXISTS")
+if classes \= '' then classpath = prepend(classpath classes)
+classes = stream(JAVA_HOME || "\lib\tools.jar", "C", "QUERY EXISTS")
+if classes \= '' then classpath = prepend(classpath classes)
+
+classpath = prepend(classpath ANT_HOME || '\lib\ant-launcher.jar')
+'SET CLASSPATH=' || classpath
+
+/* Setting classpathes, options and arguments */
+envset = _getenv_('envset')
+if cp\='' then interpret 'call "' || envset || '"' '"; CLASSPATH"' '"' || cp || '"'
+if lcp\='' then interpret 'call "' || envset || '"' '"; LOCALCLASSPATH"' '"' || lcp || '"'
+if opts\='' then interpret 'call "' || envset || '"' '"-D ANT_OPTS"' '"' || opts || '"'
+if args\='' then interpret 'call "' || envset || '"' '"ANT_ARGS"' '"' || args || '"'
+
+exit 0
+
+addpath: procedure
+parse arg path elem
+if elem = '' then do
+ if path\='' & right(path, 1)\=';' then path = path || ';'
+ return path
+end
+if substr(path, length(path)) = ';' then glue = ''
+else glue = ';'
+if pos(translate(elem), translate(path)) = 0 then path = path || glue || elem || ';'
+return path
+
+prepend: procedure
+parse arg path elem
+if elem = '' then do
+ if path\='' & right(path, 1)\=';' then path = path || ';'
+ return path
+end
+if pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path
+return path
+
+_getenv_: procedure expose env
+parse arg envar default
+if default = '' then default = envar
+var = value(translate(envar),,env)
+if var = '' then var = default
+return var
diff --git a/lib/ant/bin/envset.cmd b/lib/ant/bin/envset.cmd
new file mode 100644
index 000000000..cb91d8733
--- /dev/null
+++ b/lib/ant/bin/envset.cmd
@@ -0,0 +1,130 @@
+/*
+
+ Copyright 2003-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+SET environment variables
+First optional parameter:
+ ; parameters are considered parts of a path variable, semicolons are
+ appended to each element if not already present
+ -D parameters are properties for Java or Makefile etc., -D will be
+ prepended and the parameters will be separated by a space
+ =D the same as above but equal sign is not required
+ , parameters should be comma separated in the environment variable
+ - parameters should be separated by the next parameter
+ Other values mean that the first parameter is missing and the environment
+ variable will be set to the space separated parameters
+
+Second parameter: name of the environment variable
+
+Next parameters: values
+; implies that the equal sign is considered a part of the parameter and is
+not interpreted
+
+-D requires parameters in the form name=value. If the equal sign is not found,
+the parameters are changed to name=expanded_name
+
+Other options have optional equal sign. If it is found, only the part after
+the equal sign will be oprionally expanded.
+
+If the parameter is the minus sign, the next parameter will not be expanded.
+If the parameter is a single dot, it will be replaced with the value of the
+environment variable as it existed before envset was invoked.
+
+For other parameters the batch looks for the environment variable with the
+same name (in uppercase). If it is found, it forms the expanded_name. If
+the environment variable with such a name does not exist, the expanded_name
+will hold the parameter name without case conversion.
+*/
+
+parse arg mode envar args
+
+equal = 0
+sep = ' '
+
+/* Parse command line parameters */
+select
+ when mode='-' then do
+ sep = envar
+ parse var args envar args
+ end
+ when mode=';' then do
+ sep = ''
+ equal = -1
+ end
+ when mode='-D' then equal = 1
+ when mode='=D' then mode = '-D'
+ when mode=',' then sep = ','
+otherwise
+ args = envar args
+ envar = mode
+ mode = ''
+end
+
+env = 'OS2ENVIRONMENT'
+envar = translate(envar)
+orig = value(envar,,env)
+newval = ''
+expand = 1
+
+/* for each parameter... */
+do i = 1 to words(args)
+ if expand > 0 & word(args, i) = '-' then expand = 0
+ else call addval word(args, i)
+end
+
+/* Optionally enclose path variable by quotes */
+if mode = ';' & pos(' ', newval) > 0 then newval = '"' || newval || '"'
+
+/* Set the new value, 'SET' cannot be used since it does not allow '=' */
+x = value(envar, newval, env)
+exit 0
+
+addval: procedure expose sep equal orig expand newval mode env
+parse arg var
+
+if var = '.' then expvar = orig
+else do
+ if equal >= 0 then do
+ parse var var name '=' val
+ if val = '' then var = name
+ else var = val
+ end
+ if expand = 0 then expvar = var
+ else expvar = value(translate(var),,env)
+ if expvar = '' then expvar = var
+ if equal >= 0 then do
+ if val = '' then do
+ parse var expvar key '=' val
+ if val <> '' then name = key
+ else do
+ if equal > 0 then val = key
+ else name = key
+ end
+ end
+ else val = expvar
+ if pos(' ', val) > 0 | pos('=', val) > 0 then val = '"' || val || '"'
+ if val = '' then expvar = name
+ else expvar = name || '=' || val
+ end
+ if mode = '-D' then expvar = '-D' || expvar
+ if mode = ';' then do
+ if right(expvar, 1) <> ';' then expvar = expvar || ';'
+ end
+end
+
+if newval = '' then newval = expvar
+else newval = newval || sep || expvar
+expand = 1
+return
diff --git a/lib/ant/bin/runrc.cmd b/lib/ant/bin/runrc.cmd
new file mode 100644
index 000000000..0337a80a2
--- /dev/null
+++ b/lib/ant/bin/runrc.cmd
@@ -0,0 +1,59 @@
+/*
+ Copyright 2003-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Run RC file, name is in the first arg, second arg is either PATH
+ ENV or -r or nothing
+*/
+
+parse arg name path rest
+
+if name = '' then do
+ say 'RC file name is missing'
+ exit 1
+end
+
+if rest \= '' then do
+ say 'Too many parameters'
+ exit 1
+end
+
+call runit name path
+exit 0
+
+runit: procedure
+parse arg name path dir
+
+if path \= '' & path \= '-r' then do
+ dir = value(translate(path),,'OS2ENVIRONMENT')
+ if dir = '' then return
+ dir = translate(dir, '\', '/') /* change UNIX-like path to OS/2 */
+end
+
+if dir = '' then dir = directory()
+
+if path = '-r' then do /* recursive call */
+ subdir = filespec('path', dir)
+ if subdir \= '\' then do
+ subdir = left(subdir, length(subdir)-1)
+ call runit name path filespec('drive', dir) || subdir
+ end
+end
+
+/* Look for the file and run it */
+if right(dir, 1) \= '\' then dir = dir || '\'
+rcfile = stream(dir || name, 'c', 'query exists')
+if rcfile \= '' then interpret 'call "' || rcfile || '"'
+
+return