Use `ant -diagnostics` instead of `realpath` to get ANT_HOME
- Dominant language
- Java
- Stars
- 10
- Forks
- 42
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 1
Description
In the makefile of stf, this parts of code is trying to define the ANT_HOME
```
ANT_BINDIR:=$(dir $(firstword $(shell $(WHICH) ant$(BAT) 2>$(NULL))))
$(warning $(WHICH) ant$(BAT) 2>$(NULL) returned)
$(warning $(ANT_BINDIR))
ifneq (,$(ANT_BINDIR))
ANT_BINDIR:=$(realpath $(ANT_BINDIR)$(D)ant$(BAT))
ANT_HOME:=$(abspath $(ANT_BINDIR)$(D)..$(D)..)
$(warning ANT_BINDIR set to $(ANT_BINDIR))
$(warning ANT_HOME set to $(ANT_HOME))
$(warning Found $(ANT_BINDIR), will start build with $(ANT_LAUNCHER). Run make configure to install the required ant version 1.10.1 or follow the prereq install instructions in build$(D)build.md)
```
However, this part of code doesn't work as expected on RHEL7
**RHEL7:**
```
> makefile:174: ANT_HOME not set, looking in /tmp/svttemp/git/stf/../../systemtest_prereqs/apache-ant-1.10.1
> makefile:178: Cannot find /tmp/svttemp/git/stf/../../systemtest_prereqs/apache-ant-1.10.1/lib/ant-launcher.jar, looking for ant on the PATH
> makefile:194: which ant 2>/dev/null returned
> makefile:195: /usr/bin/
> makefile:199: ANT_BINDIR set to /usr/bin/ant
> makefile:200: ANT_HOME set to /usr
> makefile:201: Found /usr/bin/ant, will start build with /usr/lib/ant-launcher.jar. Run make configure to install the required ant version 1.10.1 or follow the prereq install instructions in build/build.md
$ make -version
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
```
**Ubuntu16:**
```
> makefile:174: ANT_HOME not set, looking in /tmp/svttemp/git/stf/../../systemtest_prereqs/apache-ant-1.10.1
> makefile:178: Cannot find /tmp/svttemp/git/stf/../../systemtest_prereqs/apache-ant-1.10.1/lib/ant-launcher.jar, looking for ant on the PATH
> makefile:194: which ant 2>/dev/null returned
> makefile:195: /usr/bin/
> makefile:199: ANT_BINDIR set to /usr/share/ant/bin/ant
> makefile:200: ANT_HOME set to /usr/share/ant
> makefile:201: Found /usr/share/ant/bin/ant, will start build with /usr/share/ant/lib/ant-launcher.jar. Run make configure to install the required ant version 1.10.1 or follow the prereq install instructions in build/build.md
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
```
Instead of using `realpath` in the makefile, is using `ant -diagnostics` a proper approach to get the correct ant.home? For example
```
root@113fe7939c9b:~/systemtest_prereqs# ant -diagnostics | grep "ant.home" -m 1 --max-count=1 | cut -d ':' -f 2
/usr/share/ant
root@113fe7939c9b:~/systemtest_prereqs#
```
There should be a same way on Windows to parse the `ant -diagnostics` result to get the real ant.home
Contributor guide
Research direction
Start in the makefile around lines 174-201 and compare how ANT_HOME is derived on RHEL7 and Ubuntu16. Investigate the reported ant -diagnostics output, including the Windows equivalent, then verify that the selected ANT_HOME resolves the expected ant-launcher.jar across the mentioned platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100