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

Support Apple's Swift Package Manager #4010

Merged
merged 5 commits into from
Oct 21, 2023

Conversation

aleksproger
Copy link
Contributor

@aleksproger aleksproger commented Apr 14, 2023

Reason

  • Main way to develop under Apple's platforms is using SPM

Changes

  • Added Package.swift
  • Added _SwiftPackageManagerFile.cpp to single_include/nlohmann in order SPM to see it as a C++ source file
  • Added .build to .gitignore

Context

  • SPM is a package manager for Swift and C-based languages. It is the main way to develop under Apple's platforms. It is also used to build Swift packages for Linux.
  • Adding support for SPM will significantly simplify usage of this library for Apple platforms

[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]


Pull request checklist

Read the Contribution Guidelines for detailed information.

  • Changes are described in the pull request, or an existing issue is referenced.
  • The test suite compiles and runs without error.
  • Code coverage is 100%. Test cases can be added by editing the test suite.
  • The source code is amalgamated; that is, after making changes to the sources in the include/nlohmann directory, run make amalgamate to create the single-header files single_include/nlohmann/json.hpp and single_include/nlohmann/json_fwd.hpp. The whole process is described here.

Please don't

  • The C++11 support varies between different compilers and versions. Please note the list of supported compilers. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with #ifdefs or other means.
  • Specifically, I am aware of compilation problems with Microsoft Visual Studio (there even is an issue label for this kind of bug). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
  • Please refrain from proposing changes that would break JSON conformance. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.
  • Please do not open pull requests that address multiple issues.

@aleksproger aleksproger force-pushed the feature/sapitskiy/spm-support branch 2 times, most recently from cf86d06 to f435b5e Compare April 14, 2023 09:59
@coveralls
Copy link

coveralls commented Apr 14, 2023

Coverage Status

coverage: 100.0%. remained the same when pulling b87c908 on aleksproger:feature/sapitskiy/spm-support into edffad0 on nlohmann:develop.

@aleksproger
Copy link
Contributor Author

@nlohmann may you please re-trigger Ubuntu workflows?
I see some of those failed, but suppose it should be flakinesses.

@nlohmann
Copy link
Owner

No, there is an issue with the CI right now.

@aleksproger aleksproger force-pushed the feature/sapitskiy/spm-support branch 2 times, most recently from 610941c to d58f4d0 Compare May 26, 2023 05:35
@aleksproger
Copy link
Contributor Author

@nlohmann may you trigger this one? As the CI now in a good state.

@nlohmann nlohmann added the please rebase Please rebase your branch to origin/develop label Jun 11, 2023
@nlohmann
Copy link
Owner

Please update to the latest develop to have a fixed CI.

Aleksei added 2 commits June 19, 2023 07:28
**Reason**
- Main way to develop under Apple's platforms is using SPM

**Changes**
- Added Package.swift
- Added _SwiftPackageManagerFile.cpp to single_include/nlohmann in order SPM to see it as a C++ source file
- Added .build to .gitignore

**Context**
- SPM is a package manager for Swift and C-based languages. It is the main way to develop under Apple's platforms. It is also used to build Swift packages for Linux.
@aleksproger aleksproger force-pushed the feature/sapitskiy/spm-support branch from d58f4d0 to 3843444 Compare June 19, 2023 04:29
@aleksproger
Copy link
Contributor Author

@nlohmann rebased PR, have a look

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file really needed? I don’t like adding source files to this folder.

Copy link
Contributor Author

@aleksproger aleksproger Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't be needed if I'll bump the SwiftPM version to 5.9 which is shipped with Xcode 15.0 (the most recent one which is still in beta now and will be officially released in a month or so).
It could be fine as there are no SwiftPM users of your repo at all right now. And will allow users to use it with SwiftPM, but only beginning with the latest development tools. Which maybe fine keeping in mind that Apple pushes developers on the freshest releases. So, if you have no objections it's a way to get rid of this annoying file.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that Xcode 15 is released, can you update the MR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sure, will do it soon

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries - I made you wait for several months...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that Xcode 15 is released, can you update the MR?

@nlohmann nlohmann removed the please rebase Please rebase your branch to origin/develop label Oct 4, 2023
@aleksproger
Copy link
Contributor Author

@nlohmann minGW checks have failed. May you retry or this is some persistent failure?

@nlohmann
Copy link
Owner

nlohmann commented Oct 5, 2023

It is fixed on the latest develop branch. Please update, it should work now.

@aleksproger
Copy link
Contributor Author

@nlohmann trigger CI, please

@aleksproger
Copy link
Contributor Author

@nlohmann trigger CI once again please
I had to update the PR, as I noticed deprecation warnings for and bumped the supported platforms for watchOS, tvOS
Otherwise it's good to merge and passed all the checks in previous iteration.

@richardtop
Copy link

Looking forward to getting this merged!

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@nlohmann nlohmann added this to the Release 3.11.3 milestone Oct 21, 2023
@nlohmann nlohmann merged commit 58d6aa5 into nlohmann:develop Oct 21, 2023
110 checks passed
@nlohmann
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants