Summary:
This mirrors the clang-format config used by fbsource to Yoga.
They are pretty similar, except for an annoying habit where Yoga's previous forced small functions in headers to be a a single line, so you would get a combination of multiline and single line functions next to each other which are hard to read. That is what motivated this change.
It also enforces header ordering (yay). I don't think we have any side-effect causing headers, so this should be safe.
Reviewed By: yungsters
Differential Revision: D49248994
fbshipit-source-id: 66998395e7c0158ff9d9fb1bee44e8401bdd8f21
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1369
X-link: https://github.com/facebook/react-native/pull/39370
This fixes const-correctness of callbacks (e.g. not letting a logger function modify nodes during layout). This helps us to continue to fix const-correctness issues inside of Yoga.
This change is breaking to the public API, since it requires a change in signature passed to Yoga.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D49130714
fbshipit-source-id: 4305f8882d89f296e45b78497a51716a0dbb3b2d
Summary:
X-link: https://github.com/facebook/react-native/pull/39291
Pull Request resolved: https://github.com/facebook/yoga/pull/1359
This enables clang warnings around potentially unsafe conversions, such as those with mismatched signedness, or ones which may lead to truncation.
This should catch issues in local development which create errors for MSVC (e.g. Dash), who's default `/W3` includes warnings akin to `-Wshorten-64-to-32`.
This full set of warnings here is a tad spammy, but probably more useful than not.
Changelog: [Internal]
Reviewed By: yungsters
Differential Revision: D48954777
fbshipit-source-id: 1ccc07b99d09d1c2d428158149698ffd04025605
Summary:
X-link: https://github.com/facebook/react-native/pull/37349
Pull Request resolved: https://github.com/facebook/yoga/pull/1288
Fixes https://github.com/facebook/yoga/issues/1283
New versions of CMake add "policies" which control how the build system acts wrt breaking changes. By default, CMake will emulate the behavior of the version specified in `cmake_minimum_required`.
Setting a policy to true (to opt into new behavior where `cmake_minimum_required` is lower than the current version) seems actually just error out on the old versions.
Googling around, apparently the way I should be doing this is to specify `<policy_max>` as part of `cmake_minimum_required `. https://gitlab.kitware.com/cmake/cmake/-/issues/20392
This should I think use new policies introduced up to 3.26 (what we test on right now), while letting 3.13 be the minimum.
Reviewed By: cortinico
Differential Revision: D45724864
fbshipit-source-id: 120cc2015a043605e7c07ef0459667643a4284b7
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1294
X-link: https://github.com/facebook/react-native/pull/37383
Add -Wextra to the build, and fixup some more instances of -Wunused-parameter that it sufaces which were not automatically fixable.
Reviewed By: javache
Differential Revision: D45772846
fbshipit-source-id: 29bf71006f63161521fe5869c3a7d8bf7aae9c81
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1217
This updates the CMake build present for being able to share options, fixing up flags, etc. A GTest build is added as well, along with a script and VSCode debug target so that OSS contributors can very easily run and debug tests on any OS.
Note that this isn't completely done (need to revise Windows, Mac, documentation), but should be finished enough otherwise for review.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D42406686
fbshipit-source-id: 95e7ba5e4751c496a171785490e85cf0097fa839
Summary: This change applies all Arcanist recommended lint changes, which amounts to changing copyright headers and some cases of whitespace changes.
Reviewed By: yungsters
Differential Revision: D40060899
fbshipit-source-id: b62f9472e6ef58a3fc3d22eed661578a2635cb1f
Summary:
`/*` is the standard throughout open source code. For example, Firefox uses single /*: https://hg.mozilla.org/mozilla-central/file/21d22b2f541258d3d1cf96c7ba5ad73e96e616b5/gfx/ipc/CompositorWidgetVsyncObserver.cpp#l3
In addition, Rust considers `/**` to be a doc comment (similar to Javadoc) and having such a comment at the beginning of the file causes `rustc` to barf.
Note that some JavaScript tooling requires `/**`. This is OK since JavaScript files were not covered by the linter in the first place, but it would be good to have that tooling fixed too.
Reviewed By: zertosh
Differential Revision: D15640366
fbshipit-source-id: b4ed4599071516364d6109720750d6a43304c089
Summary: This change drops the year from the copyright headers and the LICENSE file.
Reviewed By: yungsters
Differential Revision: D9727774
fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
Summary: There were a few missing prototypes and a -Wshadow violation. Merged YGBenchmark.h into YGBenchmark.c, added static where needed, fixed shadow violation.
Reviewed By: davidaurelio
Differential Revision: D8793124
fbshipit-source-id: c4b2dd348c38aa599169b5e9bea543c172439432
Summary: Several of dependencies and tests in repository are missing (e.g. because we don't support building certain library for MacOSX). Clean up those mistakes.
Differential Revision: D7625433
fbshipit-source-id: 332b7ff7eaed82cb52f459921f1ae67b702a1636
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.
find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.
Reviewed By: TheSavior, yungsters
Differential Revision: D7007050
fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
Summary: This renames the core C api to use the new Yoga branding.
Differential Revision: D4259190
fbshipit-source-id: 26c8b356ca464d4304f5f9dc4192bff10cea2dc9
Summary: It was always a mistake to have a measure function here but the recent addition of an assertion made us notice it.
Reviewed By: splhack
Differential Revision: D4156754
fbshipit-source-id: 98fcea6e233cb4f5706ebca37028c8d67edb4c09
Summary: Add a more complex benchmark which actually take a couple milliseconds to perform. This makes it easier to see if optimizations have any effect. More styles should be added later to make sure the benchmarks covers most of the csslayout code.
Reviewed By: gkassabli
Differential Revision: D4101780
fbshipit-source-id: 6bdf703edfbe64c47c77e04ef1ca946f4b75d093
Summary: To perform some JNI optimizations for java we need a reference to the node in the measure function. This updates the API to provide the whole node as input instead of just the context.
Reviewed By: javache
Differential Revision: D4081544
fbshipit-source-id: d49679025cea027cf7b8482898de0a01fe0f9d40
Summary: sleeping in the measure function was done to ensure we were not regressing in double measure calls. This was before we have CSSLayoutMeasureCacheTest though. Let's switch over benchmark to purely benchmark the algorithm and not simulate measure time.
Reviewed By: swolchok
Differential Revision: D4078186
fbshipit-source-id: e1c16806b3c8714e223e1cfcb6c43846f8f6bbb2
Summary: buck rules are not meant to be in the root buck file but instead next to source files. This diff moves benchmark rule into benchmark folder.
Reviewed By: lucasr
Differential Revision: D3992992
fbshipit-source-id: 34782ff73bbd5b799d83d0f01b553bfab928f1df