Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added error message if there are multiple jars in the candidate and b… #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/python/benchUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1488,12 +1488,15 @@ def getAntClassPath(checkout):

# We use the jar file for core to leverage the MR JAR
core_jar_file = None
jars_found = 0
for filename in os.listdir('%s/lucene/build/core' % path):
if reCoreJar.match(filename) is not None:
core_jar_file = '%s/lucene/build/core/%s' % (path, filename)
break
jars_found += 1
if core_jar_file is None:
raise RuntimeError('can\'t find core JAR file in %s' % ('%s/lucene/build/core' % path))
if jars_found > 1:
raise RuntimeError('Found %d jars in %s, please only include 1 jar file' % (jars_found,'%s/lucene/build/core' % path))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change message to Found %d jars in "%s"; please run "gradle clean" to clean up or so?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually just realized in this code path the build.gradle file wouldn't exist (see other comment). So then wouldn't gradle clean not work?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH, yes, then suggest ant clean here and gradle clean in the other code path? Or vice/versa :)


cp.append(core_jar_file)
cp.append('%s/lucene/build/core/classes/test' % path)
Expand Down Expand Up @@ -1536,12 +1539,15 @@ def getClassPath(checkout):

# We use the jar file for core to leverage the MR JAR
core_jar_file = None
jars_found = 0
for filename in os.listdir('%s/lucene/core/build/libs' % path):
if reCoreJar.match(filename) is not None:
core_jar_file = '%s/lucene/core/build/libs/%s' % (path, filename)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh, why is this path different from the above path! Why are we doing this (differently!) in two places?

Copy link
Contributor Author

@mdmarshmallow mdmarshmallow Dec 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line in getClassPath line 1535:

  if not os.path.exists(os.path.join(path, 'build.gradle')):
    return getAntClassPath(checkout)

The top path is in getAntClassPath, and the bottom is getClassPath

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK this is actually dead-ish code now, but let's leave it since sometimes we do go back and (try to) run luceneutil on older Lucene releases.

break
jars_found += 1
if core_jar_file is None:
raise RuntimeError('can\'t find core JAR file in %s' % ('%s/lucene/core/build/libs' % path))
if jars_found > 1:
raise RuntimeError('Found %d jars in "%s"; please run "gradle clean" to clean up' % (jars_found,'%s/lucene/build/core/libs' % path))

cp.append(core_jar_file)
cp.append('%s/lucene/core/build/classes/java/test' % path)
Expand Down