diff --git a/upstream/build_tor_macos.py b/upstream/build_tor_macos.py
index e3f7ceaff09342ba8d6fb9b31cfa9f121d2b5e2c..ab9cdd181c034798589cb01bae4130126a440ce3 100755
--- a/upstream/build_tor_macos.py
+++ b/upstream/build_tor_macos.py
@@ -5,7 +5,7 @@ from subprocess import check_call
 import hashlib
 
 import utils
-from utils import get_version, get_build_versions, reset_time, \
+from utils import get_version, get_build_versions, reset_time, create_sources_jar \
     get_sources_file_name, get_output_dir, get_sha256, pack, create_pom_file
 from pathlib import Path
 import tarfile
@@ -34,7 +34,7 @@ def setup():
     check_call(['git', 'submodule', 'update'], cwd=Path(BUILD_DIR))
 
     # create sources jar before building
-    jar_name = create_sources_jar(versions)
+    jar_name = create_sources_jar(versions, PLATFORM)
 
     return versions, jar_name
 
@@ -95,29 +95,6 @@ def package_macos(versions, jar_name):
         sha256hash = get_sha256(file)
         print("%s: %s" % (file, sha256hash))
 
-
-def create_sources_jar(versions):
-    output_dir = get_output_dir(PLATFORM)
-    jar_files = []
-    for root, dir_names, filenames in os.walk(BUILD_DIR):
-        for f in filenames:
-            if '/.git' in root:
-                continue
-            jar_files.append(os.path.join(root, f))
-    for file in jar_files:
-        reset_time(file, versions)
-    jar_name = get_sources_file_name(versions, PLATFORM)
-    jar_path = os.path.abspath(jar_name)
-    rel_paths = [os.path.relpath(f, BUILD_DIR) for f in sorted(jar_files)]
-    # create jar archive with first files
-    jar_step = 5000
-    check_call(['jar', 'cf', jar_path] + rel_paths[0:jar_step], cwd=BUILD_DIR)
-    # add subsequent files in steps, because the command line can't handle all at once
-    for i in range(jar_step, len(rel_paths), jar_step):
-        check_call(['jar', 'uf', jar_path] + rel_paths[i:i + jar_step], cwd=BUILD_DIR)
-    return jar_name
-
-
 def compare_output_with_upstream(versions):
     compare_with_upstream(versions, "aarch64")
     compare_with_upstream(versions, "x86_64")