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

Feature request: Expose sets of library files and directories needed for the compiler #1092

Open
ianfixes opened this issue Dec 1, 2020 · 4 comments
Assignees
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@ianfixes
Copy link

ianfixes commented Dec 1, 2020

Feature request

Continuing discussion from #1013 (comment)

Part of unit test compilation in arduino_ci involves determining which files and directories from a library should be presented to the compiler. I assume that arduino-cli already has logic to determine this same information, so I'm hopeful that it's as simple as exposing that behind a command or two.

This would eliminate any possible gaps in compiler behavior between the unit test compiler and the official one, especially if the behavior changes.

Best Solution

All compilation information

{
  "common_flags": [
    "-std=c++0x",
    "-O1"
  ],
  "dependencies": [
    "SomeDependency"
  ],
  "include_dirs": [
    "/path/to/library/src"
  ],
  "include_dirs_recursive": [
    "/path/to/library/src",
    "/path/to/SomeDependency/src"
  ],
  "source_files": [
    "/path/to/library/src/hello.cpp"
  ],
  "source_files_recursive": [
    "/path/to/library/src/hello.cpp",
    "/path/to/SomeDependency/src/hi.cpp"
  ]
}

Next Best Solution

Authoritative information I can use to implement my own logic

{
  "flat_layout": true,
  "base_directory": "/path/to/library/src"
}
@umbynos
Copy link
Contributor

umbynos commented Nov 25, 2022

Hi @ianfixes, we added a similar feature in the new versions of the CLI:

$ arduino-cli compile -b arduino:samd:mkrwifi1010 /home/umberto/Arduino/libraries/ArduinoOTA/examples/WiFi101_OTA
Sketch uses 26484 bytes (10%) of program storage space. Maximum is 262144 bytes.
Global variables use 3920 bytes (11%) of dynamic memory, leaving 28848 bytes for local variables. Maximum is 32768 bytes.

Used library Version Path                                                                        
SPI          1.0     /home/umberto/.arduino15/packages/arduino/hardware/samd/1.8.13/libraries/SPI
WiFiNINA     1.8.13  /home/umberto/Arduino/libraries/WiFiNINA                                    
ArduinoOTA   1.0.9   /home/umberto/Arduino/libraries/ArduinoOTA                                  

Used platform Version Path                                                          
arduino:samd  1.8.13  /home/umberto/.arduino15/packages/arduino/hardware/samd/1.8.13

It prints more info with the --format json

@umbynos umbynos added the status: waiting for information More information must be provided before work can proceed label Nov 25, 2022
@ianfixes
Copy link
Author

I'm taking a look at this now as part of Arduino-CI/arduino_ci#334

@ianfixes
Copy link
Author

I genuinely appreciate the response, and I'm grateful for the attention being paid to this issue. That said, after reviewing the behavior in 0.29.0 I believe your #1092 (comment) misses 2 aspects of the original feature request:

  1. Must return data before the compiler is invoked, not after. If the compilation fails, it doesn't look like arduino-cli will say anything about provides_includes in the JSON.
  2. the output you posted shows the extra libraries that were used in the sketch, but I'm interested in the local sources for all files in the library being compiled.

The purpose of my request is to be able to ask a library which source files (according to the proper application of the library spec) must be passed to the compiler.

@ianfixes
Copy link
Author

Could we get the status: waiting for information label removed, or is there additional info needed?

@per1234 per1234 added topic: code Related to content of the project itself and removed status: waiting for information More information must be provided before work can proceed labels Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

5 participants