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

Don't archive preexisting archives if commandline is too long #1140

Merged
merged 2 commits into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions legacy/builder/phases/linker.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths
properties := buildProperties.Clone()
archives := paths.NewPathList()
for _, object := range objectFiles {
if object.HasSuffix(".a") {
archives.Add(object)
continue
}
archive := object.Parent().Join("objs.a")
if !archives.Contains(archive) {
archives.Add(archive)
Expand Down
22 changes: 22 additions & 0 deletions test/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,3 +594,25 @@ def test_compile_with_custom_libraries(run_command, copy_sketch):
# This compile command has been taken from this issue:
# https://github.com/arduino/arduino-cli/issues/973
assert run_command(f"compile --libraries {first_lib},{second_lib} -b {fqbn} {sketch_path}")


def test_compile_with_archives_and_long_paths(run_command):
# Creates config with additional URL to install necessary core
url = "http://arduino.esp8266.com/stable/package_esp8266com_index.json"
assert run_command(f"config init --dest-dir . --additional-urls {url}")

# Init the environment explicitly
assert run_command("update")

# Install core to compile
assert run_command("core install esp8266:esp8266")

# Install test library
assert run_command("lib install ArduinoIoTCloud")

result = run_command("lib examples ArduinoIoTCloud --format json")
assert result.ok
lib_output = json.loads(result.stdout)
sketch_path = Path(lib_output[0]["library"]["install_dir"], "examples", "ArduinoIoTCloud-Advanced")

assert run_command(f"compile -b esp8266:esp8266:huzzah {sketch_path}")