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

fix!: resolve issue with relative paths during linking #284

Merged
merged 3 commits into from
Mar 24, 2025

Conversation

Dw9
Copy link
Contributor

@Dw9 Dw9 commented Feb 17, 2025

Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

LGTM.

Searching through usages on library_dirs: https://github.com/search?type=code&q=library_dirs+path%253A*.gyp. It seems to me there are relative paths in library_dirs in the wild that will be break by this change. I think this PR should be released as a breaking change.

@legendecas legendecas changed the title fix: resolve issue with relative paths during linking fix!: resolve issue with relative paths during linking Feb 17, 2025
@Dw9 Dw9 closed this Feb 22, 2025
@Dw9 Dw9 reopened this Feb 25, 2025
@legendecas
Copy link
Member

legendecas commented Feb 25, 2025

Would you mind updating the list in the document https://github.com/nodejs/gyp-next/blob/main/docs/InputFormatReference.md#pathname-relativization as well?

library_dirs is suffixed with _dirs, should be treated as pathnames and be included in pathname relativization. As it is built-in config key, I believe it is better to explicitly list it here.

Thank you!

@legendecas
Copy link
Member

legendecas commented Feb 28, 2025

Seems like we don't have tests on this, but it will be great if you can update these generators as well to keep them in align.

@Dw9
Copy link
Contributor Author

Dw9 commented Mar 2, 2025

hi~@legendecas; I'm not very familiar with the project and don't know how to test with cmake/nanja/msvc. Could you please advise on how to make modifications?

@Dw9
Copy link
Contributor Author

Dw9 commented Mar 17, 2025

hi~ any updates here

@legendecas
Copy link
Member

Generators can be tested with option --format, like gyp -f ninja.

Setting up the integration test in #285.

@legendecas
Copy link
Member

@Dw9 would you mind rebasing this on top of the main branch and update the integration tests? Thank you! From what's been captured in the integration test, updating make is sufficient, as both ninja and cmake handle the library_dirs correctly.

link_directories( ../../mylib

@Dw9
Copy link
Contributor Author

Dw9 commented Mar 21, 2025

Tested locally. All good.Thank you for your work! @legendecas

@Dw9
Copy link
Contributor Author

Dw9 commented Mar 21, 2025

CI build failed in Python tests 😅

@cclauss
Copy link
Contributor

cclauss commented Mar 21, 2025

@legendecas Perhaps assert_file() needs to do a more line-by-line diff to make the output is more readable.

def assert_file(self, actual, expected) -> None:

@legendecas
Copy link
Member

Would you mind updating the integration test? like

@Dw9
Copy link
Contributor Author

Dw9 commented Mar 21, 2025

Thank you for your guidance and patience. @legendecas

@Dw9
Copy link
Contributor Author

Dw9 commented Mar 21, 2025

gyp-next git:(main) pytest -vv
======================================================================== test session starts =========================================================================
platform darwin -- Python 3.12.4, pytest-7.4.4, pluggy-1.0.0 -- /opt/anaconda3/bin/python
cachedir: .pytest_cache
rootdir: /Users/weishao/WorkSpace/node-gyp/gyp-next
plugins: anyio-4.8.0, hydra-core-1.3.2
collected 36 items

pylib/gyp/MSVSSettings_test.py::TestSequenceFunctions::testConvertToMSBuildSettings_actual <- ../gyp/pylib/gyp/MSVSSettings_test.py PASSED                     [  2%]
pylib/gyp/MSVSSettings_test.py::TestSequenceFunctions::testConvertToMSBuildSettings_empty <- ../gyp/pylib/gyp/MSVSSettings_test.py PASSED                      [  5%]
pylib/gyp/MSVSSettings_test.py::TestSequenceFunctions::testConvertToMSBuildSettings_full_synthetic <- ../gyp/pylib/gyp/MSVSSettings_test.py PASSED             [  8%]
pylib/gyp/MSVSSettings_test.py::TestSequenceFunctions::testConvertToMSBuildSettings_minimal <- ../gyp/pylib/gyp/MSVSSettings_test.py PASSED                    [ 11%]
pylib/gyp/MSVSSettings_test.py::TestSequenceFunctions::testConvertToMSBuildSettings_warnings <- ../gyp/pylib/gyp/MSVSSettings_test.py PASSED                   [ 13%]
pylib/gyp/MSVSSettings_test.py::TestSequenceFunctions::testValidateMSBuildSettings_settings <- ../gyp/pylib/gyp/MSVSSettings_test.py PASSED                    [ 16%]
pylib/gyp/MSVSSettings_test.py::TestSequenceFunctions::testValidateMSVSSettings_settings <- ../gyp/pylib/gyp/MSVSSettings_test.py PASSED                       [ 19%]
pylib/gyp/MSVSSettings_test.py::TestSequenceFunctions::testValidateMSVSSettings_tool_names <- ../gyp/pylib/gyp/MSVSSettings_test.py PASSED                     [ 22%]
pylib/gyp/common_test.py::TestTopologicallySorted::test_Cycle <- ../gyp/pylib/gyp/common_test.py PASSED                                                        [ 25%]
pylib/gyp/common_test.py::TestTopologicallySorted::test_Valid <- ../gyp/pylib/gyp/common_test.py PASSED                                                        [ 27%]
pylib/gyp/common_test.py::TestGetFlavor::test_GetCrossCompilerPredefines <- ../gyp/pylib/gyp/common_test.py PASSED                                             [ 30%]
pylib/gyp/common_test.py::TestGetFlavor::test_param <- ../gyp/pylib/gyp/common_test.py PASSED                                                                  [ 33%]
pylib/gyp/common_test.py::TestGetFlavor::test_platform_default <- ../gyp/pylib/gyp/common_test.py PASSED                                                       [ 36%]
pylib/gyp/easy_xml_test.py::TestSequenceFunctions::test_EasyXml_complex <- ../gyp/pylib/gyp/easy_xml_test.py PASSED                                            [ 38%]
pylib/gyp/easy_xml_test.py::TestSequenceFunctions::test_EasyXml_escaping <- ../gyp/pylib/gyp/easy_xml_test.py PASSED                                           [ 41%]
pylib/gyp/easy_xml_test.py::TestSequenceFunctions::test_EasyXml_pretty <- ../gyp/pylib/gyp/easy_xml_test.py PASSED                                             [ 44%]
pylib/gyp/easy_xml_test.py::TestSequenceFunctions::test_EasyXml_simple <- ../gyp/pylib/gyp/easy_xml_test.py PASSED                                             [ 47%]
pylib/gyp/easy_xml_test.py::TestSequenceFunctions::test_EasyXml_simple_with_attributes <- ../gyp/pylib/gyp/easy_xml_test.py PASSED                             [ 50%]
pylib/gyp/input_test.py::TestFindCycles::test_big_cycle <- ../gyp/pylib/gyp/input_test.py PASSED                                                               [ 52%]
pylib/gyp/input_test.py::TestFindCycles::test_cycle_self_reference <- ../gyp/pylib/gyp/input_test.py PASSED                                                    [ 55%]
pylib/gyp/input_test.py::TestFindCycles::test_cycle_two_nodes <- ../gyp/pylib/gyp/input_test.py PASSED                                                         [ 58%]
pylib/gyp/input_test.py::TestFindCycles::test_no_cycle_dag <- ../gyp/pylib/gyp/input_test.py PASSED                                                            [ 61%]
pylib/gyp/input_test.py::TestFindCycles::test_no_cycle_empty_graph <- ../gyp/pylib/gyp/input_test.py PASSED                                                    [ 63%]
pylib/gyp/input_test.py::TestFindCycles::test_no_cycle_line <- ../gyp/pylib/gyp/input_test.py PASSED                                                           [ 66%]
pylib/gyp/input_test.py::TestFindCycles::test_two_cycles <- ../gyp/pylib/gyp/input_test.py PASSED                                                              [ 69%]
pylib/gyp/xcode_emulation_test.py::TestXcodeSettings::test_GetCflags <- ../gyp/pylib/gyp/xcode_emulation_test.py PASSED                                        [ 72%]
pylib/gyp/xcode_emulation_test.py::TestXcodeSettings::test_GetLdflags <- ../gyp/pylib/gyp/xcode_emulation_test.py PASSED                                       [ 75%]
pylib/gyp/generator/msvs_test.py::TestSequenceFunctions::test_GetLibraries <- ../gyp/pylib/gyp/generator/msvs_test.py PASSED                                   [ 77%]
pylib/gyp/generator/ninja_test.py::TestPrefixesAndSuffixes::test_BinaryNamesLinux <- ../gyp/pylib/gyp/generator/ninja_test.py PASSED                           [ 80%]
pylib/gyp/generator/ninja_test.py::TestPrefixesAndSuffixes::test_BinaryNamesWindows <- ../gyp/pylib/gyp/generator/ninja_test.py PASSED                         [ 83%]
pylib/gyp/generator/ninja_test.py::TestPrefixesAndSuffixes::test_GenerateCompileDBWithNinja <- ../gyp/pylib/gyp/generator/ninja_test.py PASSED                 [ 86%]
pylib/gyp/generator/xcode_test.py::TestEscapeXcodeDefine::test_Escaping <- ../gyp/pylib/gyp/generator/xcode_test.py PASSED                                     [ 88%]
pylib/gyp/generator/xcode_test.py::TestEscapeXcodeDefine::test_InheritedRemainsUnescaped <- ../gyp/pylib/gyp/generator/xcode_test.py PASSED                    [ 91%]
test/integration_test.py::TestGyp::test_cmake PASSED                                                                                                           [ 94%]
test/integration_test.py::TestGyp::test_make PASSED                                                                                                            [ 97%]
test/integration_test.py::TestGyp::test_ninja PASSED                                                                                                           [100%]

========================================================================= 36 passed in 0.99s =========================================================================

@Dw9
Copy link
Contributor Author

Dw9 commented Mar 21, 2025

ci is green now.😄

Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

Thanks!

@legendecas legendecas merged commit a2d7439 into nodejs:main Mar 24, 2025
40 checks passed
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.

None yet

3 participants