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

Header file extensions as options for C/C++ targets #6802

Merged
merged 5 commits into from Nov 27, 2018

Conversation

Projects
None yet
3 participants
@cosmicexplorer
Copy link
Contributor

cosmicexplorer commented Nov 22, 2018

Problem

The file extensions we consider "header files" for C/C++ targets are hardcoded as ('.h', '.hpp'). Additionally, we will error out on header-only ctypes_compatible_cpp_library() targets (as for C targets).

Solution

  • Create the --header-file-extensions option in the CCompileSettings and CppCompileSettings subsystems.
  • Make a debug-level log if the library undergoing compile is a header-only library before early returning.
  • Add some tests.

cosmicexplorer added some commits Nov 22, 2018

@CMLivingston
Copy link
Contributor

CMLivingston left a comment

This looks good to me, and this PR is now a blocker for our internal native diff per our offline discussion.

@cosmicexplorer

This comment has been minimized.

Copy link
Contributor

cosmicexplorer commented Nov 27, 2018

this PR is now a blocker

To clarify, this is because pants will currently raise an error when there are header-only libraries -- this PR fixes that.

cosmicexplorer added some commits Nov 27, 2018

@cosmicexplorer cosmicexplorer merged commit ca9405c into pantsbuild:master Nov 27, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

object_files_product = context.products.get(ObjectFiles)
object_files_for_target = self._retrieve_single_product_at_target_base(object_files_product, c)
# Test that no object files were produced.

This comment has been minimized.

@jsirois

jsirois Nov 27, 2018

Member

Thanks Danny - this is a much better test!

This comment has been minimized.

@cosmicexplorer

cosmicexplorer Nov 27, 2018

Contributor

I think so too! I swear to you that I prevaricated for at least an hour about adding tests based on matching info logs and moved forward only to unblock myself from that particular indecision. I am planning to take your comment on the other PR #6800 and make a (concise!) followup issue to fix this in the integration tests from that PR.

cosmicexplorer added a commit that referenced this pull request Nov 28, 2018

Header file extensions as options for C/C++ targets (#6802)
### Problem

The file extensions we consider "header files" for C/C++ targets are hardcoded as `('.h', '.hpp')`. Additionally, we will error out on header-only `ctypes_compatible_cpp_library()` targets (as for C targets).

### Solution

- Create the `--header-file-extensions` option in the CCompileSettings and CppCompileSettings subsystems.
- Make a debug-level log if the library undergoing compile is a header-only library before early returning.
- Add some tests.

cosmicexplorer added a commit that referenced this pull request Nov 29, 2018

Header file extensions as options for C/C++ targets (#6802)
### Problem

The file extensions we consider "header files" for C/C++ targets are hardcoded as `('.h', '.hpp')`. Additionally, we will error out on header-only `ctypes_compatible_cpp_library()` targets (as for C targets).

### Solution

- Create the `--header-file-extensions` option in the CCompileSettings and CppCompileSettings subsystems.
- Make a debug-level log if the library undergoing compile is a header-only library before early returning.
- Add some tests.

cosmicexplorer added a commit that referenced this pull request Dec 1, 2018

Header file extensions as options for C/C++ targets (#6802)
### Problem

The file extensions we consider "header files" for C/C++ targets are hardcoded as `('.h', '.hpp')`. Additionally, we will error out on header-only `ctypes_compatible_cpp_library()` targets (as for C targets).

### Solution

- Create the `--header-file-extensions` option in the CCompileSettings and CppCompileSettings subsystems.
- Make a debug-level log if the library undergoing compile is a header-only library before early returning.
- Add some tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment