Skip to content

Commit

Permalink
Add temporary logging
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlizarraga committed Dec 22, 2024
1 parent 6347c5f commit 6562433
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions java/src/main/java/ai/onnxruntime/OnnxRuntime.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ static synchronized void init() throws IOException {
if (loaded) {
return;
}
// TODO: Remove
logger.setLevel(Level.FINE);

tempDirectory = Files.createTempDirectory("onnxruntime-java");
try {
libraryDirPathProperty = System.getProperty(ONNXRUNTIME_NATIVE_PATH);
Expand Down
19 changes: 19 additions & 0 deletions tools/ci_build/github/android/build_aar_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def _build_aar(args):

subprocess.run(abi_build_command, env=temp_env, shell=False, check=True, cwd=REPO_DIR)

# TODO: Remove
abi_build_dir_files = os.listdir(abi_build_dir)

Check warning

Code scanning / lintrunner

RUFF/F841 Warning

Local variable abi\_build\_dir\_files is assigned to but never used.
See https://docs.astral.sh/ruff/rules/unused-variable

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable abi_build_dir_files is not used.
print("[REMOVE]: {abi_build_dir=} contents:")
print(abi_jnilibs_dir_files)

Check failure

Code scanning / lintrunner

RUFF/F821 Error

Undefined name abi\_jnilibs\_dir\_files.
See https://docs.astral.sh/ruff/rules/undefined-name

# create symbolic links for libonnxruntime.so and libonnxruntime4j_jni.so
# to jnilibs/[abi] for later compiling the aar package
abi_jnilibs_dir = os.path.join(jnilibs_dir, abi)
Expand All @@ -139,8 +144,15 @@ def _build_aar(args):
# add double check with os.path.islink
if os.path.exists(target_lib_name) or os.path.islink(target_lib_name):
os.remove(target_lib_name)
print(f"[REMOVE]: Making sym link from {os.path.join(abi_build_dir, build_config, lib_name)} to "
f"{target_lib_name}")
os.symlink(os.path.join(abi_build_dir, build_config, lib_name), target_lib_name)

# TODO: Remove
abi_jnilibs_dir_files = os.listdir(abi_jnilibs_dir)
print("[REMOVE]: {abi_jnilibs_dir=} contents:")
print(abi_jnilibs_dir_files)

# copy executables for each abi, in case we want to publish those as well
# some of them might not exist, e.g., if we skip building the tests
abi_exe_dir = os.path.join(exe_dir, abi)
Expand All @@ -150,12 +162,19 @@ def _build_aar(args):
for exe_name in execs_to_copy:
src_exe_path = os.path.join(abi_build_dir, build_config, exe_name)
if not os.path.exists(src_exe_path):
print(f"[REMOVE]: Source exe path does not exist: {src_exe_path}")
continue

os.makedirs(abi_exe_dir, exist_ok=True)
dest_exe_path = os.path.join(abi_exe_dir, exe_name)
print(f"[REMOVE]: Copying {src_exe_path} to {dst_exe_path}")

Check failure

Code scanning / lintrunner

RUFF/F821 Error

Undefined name dst\_exe\_path.
See https://docs.astral.sh/ruff/rules/undefined-name
shutil.copyfile(src_exe_path, dest_exe_path)

# TODO: Remove
abi_exe_dir_files = os.listdir(abi_exe_dir)
print("[REMOVE]: {abi_exe_dir=} contents:")
print(abi_exe_dir_files)

# we only need to define the header files path once
if not header_files_path:
header_files_path = os.path.join(abi_build_dir, build_config, "android", "headers")
Expand Down

0 comments on commit 6562433

Please sign in to comment.