Skip to content

Json library update and Xcode15 #5681

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

Merged
merged 69 commits into from
Jun 18, 2024
Merged

Json library update and Xcode15 #5681

merged 69 commits into from
Jun 18, 2024

Conversation

gearama
Copy link
Contributor

@gearama gearama commented May 30, 2024

closes #5670
Updated json library
Updated macos tests to ver 14
Readmes have been touched with add/remove spaces at the end to trigger all Ci pipelines in order to run all tests to verify the json library behaves as expected

Ran all the CI pipelines , since i have to revert the readme files i paste the result here

image

Pull Request Checklist

Please leverage this checklist as a reminder to address commonly occurring feedback when submitting a pull request to make sure your PR can be reviewed quickly:

See the detailed list in the contributing guide.

  • C++ Guidelines
  • Doxygen docs
  • Unit tests
  • No unwanted commits/changes
  • Descriptive title/description
    • PR is single purpose
    • Related issue listed
  • Comments in source
  • No typos
  • Update changelog
  • Not work-in-progress
  • External references or docs updated
  • Self review of PR done
  • Any breaking changes?

danieljurek and others added 6 commits May 30, 2024 11:44
The code within the `mocked_transport_adapter_test.hpp` file, specifically within the `Azure::Security::KeyVault::Keys` namespace, has been updated. The `#if defined(_MSC_VER)` preprocessor directive along with its associated `#pragma warning(push)` and `#pragma warning(disable : 4996)` directives have been removed. The corresponding `#pragma warning(pop)` directive has also been removed. The lines of code that were between these preprocessor directives remain unchanged. These changes remove specific compiler warning suppressions for MSVC compilers, but do not alter the functional behavior of the code.
@gearama
Copy link
Contributor Author

gearama commented Jun 7, 2024

/azp run cpp - core

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gearama
Copy link
Contributor Author

gearama commented Jun 7, 2024

Ah, I also think we probably should update sdk/core/azure-core/test/nlohmann-json-test/*.

As @antkmsft mentioned, we should definitely keep the source and tests versions in-sync, so an update of the nlohmann json source should be together with the test update as well.
Please address this before merging, at the very least. I'll try to review the rest, tomorrow, but would like some help in making reviewing this change easier. What should we focus on?

I'd like to make sure that the existing tests run with the newer json library, to be honest. If there are any breaking changes in the nlohmann implementation, the old tests will start failing, but the new tests would have accounted for any breaking changes.

Since our implementation was built around the old implementation, we should keep the old tests for at least the first iteration of this PR.

Once the PR is in and we've run at least a single nightly build on the new implementation with the old tests, we should integrate the new tests.

Basically, we start by using the old tests to help ensure that the new json library won't break us, then switch to the new tests to ensure that if we have tests covering any new additions to the library.

while i would agree with you there are api changes in the internal impl of the tests , the old ones don't compile properly , thus i had to update.

As mentioned in the description i ran all the CI pipelines that IMHO cover most if not all of the public interface , thus the functionality out of it that we use is covered , if we want to run some coverage tools to determine dead code in the json that we don't use that i would like to do to remove unneeded functionality, only that future updates would be harder to perform as we would need to determine what we removed and where it is and get rid of them again.

We can talk about it more monday, i did not bring this up thursday as that meeting was too clogged with go lang issues :)

@LarryOsterman
Copy link
Member

We can talk about it more monday, i did not bring this up thursday as that meeting was too clogged with go lang issues :)

So be it. I was hoping to avoid doing even more work to update the tests, but if the existing tests break, so be it.

@gearama gearama requested a review from ahsonkhan June 7, 2024 21:00
@antkmsft
Copy link
Member

antkmsft commented Jun 7, 2024

Reminder, in case this got lost -

Sorry, I just found two more macros that I missed, but that should be it! - JSON_NO_IO and JSON_TEST_KEEP_MACROS.

I can now see JSON_NO_IO prefixed, but the JSON_TEST_KEEP_MACROS is still unprefixed.

@gearama
Copy link
Contributor Author

gearama commented Jun 11, 2024

Reminder, in case this got lost -

Sorry, I just found two more macros that I missed, but that should be it! - JSON_NO_IO and JSON_TEST_KEEP_MACROS.

I can now see JSON_NO_IO prefixed, but the JSON_TEST_KEEP_MACROS is still unprefixed.

done, apologies , i somehow missed that

Copy link
Member

@antkmsft antkmsft left a comment

Choose a reason for hiding this comment

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

Re-approving, looks good - thank you!, I think we should merge it. Plus, we've just made all the monthly releases.

@gearama
Copy link
Contributor Author

gearama commented Jun 13, 2024

/azp run cpp - core

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ahsonkhan
Copy link
Contributor

ahsonkhan commented Jun 13, 2024

Just to understand, how come we remove INCLUDE_NLOHMANN_JSON_HPP_ instead of renaming it? It's probably right, so not suggesting we do something else, but trying to understand the rationale. Does it fail to compile with it?

image

Copy link
Contributor

@ahsonkhan ahsonkhan left a comment

Choose a reason for hiding this comment

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

I eye-balled the diff between nlohmann json and our vendored copy, and it looks reasonable.

Seems like most of the changes are covered by:

  • Adding the _azure_ prefix to macros
  • Modifying the namespaces
  • Clang-format formatting

Thanks for updating the library, @gearama!

@antkmsft
Copy link
Member

@ahsonkhan, similar to #5681 (comment).
More, the pattern,

#ifndef X_HPP_INCLUDED
#define X_HPP_INCLUDED

// header file contents

#endif 

it is called "include guard". It is basically the same as

#pragma once

// header file contents

It is in our guidelines for C++ to use #pragma once instead of include guards.
Formally, #pragmas are not standardized, but practically, every C++ compiler implements it.

This is maybe not so often the case with C compilers, BTW, especially maybe for some exotic embedded platforms, which is why in Embedded C repo, we were using include guards and not pragmas.

@antkmsft
Copy link
Member

antkmsft commented Jun 13, 2024

@gearama, could you please drop all the occurrences of

/*!
@brief namespace for Niels Lohmann
@see
https://github.com/nlohmann
@since version 1.0.0
*/

?

The reason is that I used doxygen to generate docs, and what it does is that it ends up attaching namespace for Niels Lohmann as a description for Azure namespace (not the Azure::Core::Json::_internal).

@gearama
Copy link
Contributor Author

gearama commented Jun 13, 2024

/azp run cpp - core

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gearama gearama merged commit 0b5b5ac into main Jun 18, 2024
115 checks passed
@gearama gearama deleted the osx-matrix branch June 18, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure to build with Xcode 15.0.1
6 participants