Skip to content

Commit 501ea31

Browse files
authored
Merge pull request #11404 from igfoo/igfoo/build_refactor
Kotlin build system: Refactor jar-finder
2 parents f2897f5 + 2d92cee commit 501ea31

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

java/kotlin-extractor/build.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,17 @@ def get_gradle_lib_folder():
147147
return gradle_home + '/lib'
148148

149149

150-
def find_jar(path, pattern):
151-
result = glob.glob(path + '/' + pattern + '*.jar')
152-
if len(result) == 0:
153-
raise Exception('Cannot find jar file %s under path %s' %
154-
(pattern, path))
155-
return result
150+
def find_jar(path, base):
151+
fn = path + '/' + base + '.jar'
152+
if not os.path.isfile(fn):
153+
raise Exception('Cannot find jar file at %s' % fn)
154+
return fn
156155

157156

158-
def patterns_to_classpath(path, patterns):
157+
def bases_to_classpath(path, bases):
159158
result = []
160-
for pattern in patterns:
161-
result += find_jar(path, pattern)
159+
for base in bases:
160+
result.append(find_jar(path, base))
162161
return os.path.pathsep.join(result)
163162

164163

@@ -174,8 +173,8 @@ def transform_to_embeddable(srcs):
174173

175174

176175
def compile(jars, java_jars, dependency_folder, transform_to_embeddable, output, build_dir, current_version):
177-
classpath = patterns_to_classpath(dependency_folder, jars)
178-
java_classpath = patterns_to_classpath(dependency_folder, java_jars)
176+
classpath = bases_to_classpath(dependency_folder, jars)
177+
java_classpath = bases_to_classpath(dependency_folder, java_jars)
179178

180179
tmp_src_dir = build_dir + '/temp_src'
181180

0 commit comments

Comments
 (0)