Skip to content

Commit 48f98c4

Browse files
committed
Add output when skipping deps detection for precompiled libs
1 parent cc0e4c1 commit 48f98c4

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

legacy/builder/constants/constants.go

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const MSG_BOOTLOADER_FILE_MISSING = "Bootloader file specified but missing: {0}"
8989
const MSG_BUILD_OPTIONS_CHANGED = "Build options changed, rebuilding all"
9090
const MSG_CANT_FIND_SKETCH_IN_PATH = "Unable to find {0} in {1}"
9191
const MSG_FQBN_INVALID = "{0} is not a valid fully qualified board name. Required format is targetPackageName:targetPlatformName:targetBoardName."
92+
const MSG_SKIP_PRECOMPILED_LIBRARY = "Skipping dependencies detection for precompiled library {0}"
9293
const MSG_FIND_INCLUDES_FAILED = "Error while detecting libraries included by {0}"
9394
const MSG_LIB_LEGACY = "(legacy)"
9495
const MSG_LIBRARIES_MULTIPLE_LIBS_FOUND_FOR = "Multiple libraries were found for \"{0}\""

legacy/builder/container_find_includes.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,12 @@ func findIncludesUntilDone(ctx *types.Context, cache *includeCache, sourceFile t
318318
}
319319

320320
if library, ok := sourceFile.Origin.(*libraries.Library); ok {
321-
if library.Precompiled == true && library.PrecompiledWithSources == true {
321+
if library.Precompiled && library.PrecompiledWithSources {
322322
// Fully precompiled libraries should have no dependencies
323323
// to avoid ABI breakage
324+
if ctx.Verbose {
325+
ctx.GetLogger().Println(constants.LOG_LEVEL_DEBUG, constants.MSG_SKIP_PRECOMPILED_LIBRARY, library.Name)
326+
}
324327
return nil
325328
}
326329
}

test/test_compile.py

+39
Original file line numberDiff line numberDiff line change
@@ -594,3 +594,42 @@ def test_compile_with_custom_libraries(run_command, copy_sketch):
594594
# This compile command has been taken from this issue:
595595
# https://github.com/arduino/arduino-cli/issues/973
596596
assert run_command(f"compile --libraries {first_lib},{second_lib} -b {fqbn} {sketch_path}")
597+
598+
599+
def test_compile_with_precompiled_library(run_command, data_dir):
600+
assert run_command("update")
601+
602+
assert run_command("core install arduino:[email protected]")
603+
fqbn = "arduino:samd:mkrzero"
604+
605+
# Install precompiled library
606+
# For more information see:
607+
# https://arduino.github.io/arduino-cli/latest/library-specification/#precompiled-binaries
608+
assert run_command('lib install "BSEC Software [email protected]"')
609+
sketch_folder = Path(data_dir, "libraries", "BSEC_Software_Library", "examples", "basic")
610+
611+
# Compile and verify dependencies detection for fully precompiled library is not skipped
612+
result = run_command(f"compile -b {fqbn} {sketch_folder} -v")
613+
assert result.ok
614+
assert "Skipping dependencies detection for precompiled library BSEC Software Library" not in result.stdout
615+
616+
617+
def test_compile_with_fully_precompiled_library(run_command, data_dir):
618+
assert run_command("update")
619+
620+
assert run_command("core install arduino:[email protected]")
621+
fqbn = "arduino:mbed:nano33ble"
622+
623+
# Install fully precompiled library
624+
# For more information see:
625+
# https://arduino.github.io/arduino-cli/latest/library-specification/#precompiled-binaries
626+
assert run_command("lib install [email protected]")
627+
sketch_folder = Path(data_dir, "libraries", "Arduino_TensorFlowLite", "examples", "hello_world")
628+
629+
# Install example dependency
630+
# assert run_command("lib install Arduino_LSM9DS1")
631+
632+
# Compile and verify dependencies detection for fully precompiled library is skipped
633+
result = run_command(f"compile -b {fqbn} {sketch_folder} -v")
634+
assert result.ok
635+
assert "Skipping dependencies detection for precompiled library Arduino_TensorFlowLite" in result.stdout

0 commit comments

Comments
 (0)