build.xml: refactor "noExe check" to remove duplication