-
Notifications
You must be signed in to change notification settings - Fork 905
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: ignore commented lines when finding libraryName #2542
Conversation
512ef69
to
cd6e58a
Compare
IMHO we should not merge this. The CLI logic is already complicated trying to regex the libraries build logic, we should instead simplify libraries rather than making CLI attempt to parse every possible scenario |
Yes, I also disagree with having complex processing in the CLI. However, from the perspective of managing a library, I don’t think it's necessary to know the detailed workings of auto-linking within react-native. |
@cortinico My library is scheduled for a patch, so I’m not strongly pushing for this change. I believe the purpose of having an interop layer in the React Native ecosystem is to give community libraries sufficient time to prepare for the transition. There may or may not be libraries like mine among them, but if there are, it’s the app developers—not the library maintainers—who will be affected. I wanted to prevent this from causing difficult-to-trace CMake build errors and significant time loss for the app developers using these libraries. Please feel free to decide! |
Developers can also use the |
Of course, that’s true—if you know what the problem is.. In my case, however, I had to trace through several steps to understand the root cause: how auto-linking is handled, where it’s recognized as a new architecture module, which files are used to retrieve this list, and which scripts extract these files.. (the real issue is that the code with the developer's intent behaves implicitly in unintended ways due to the CLI.) And those most affected by these issues and engaged in troubleshooting are likely to be users of libraries that are not actively maintained, rather than the maintainers themselves. |
cd6e58a
to
7bfbdef
Compare
Agree. Yet introducing the comment filtering for only one of the property parsing rather than all of them will be even more disrupting/confusing for users. |
Oh... I just noticed that there are a lot of utility functions like Rather than making it more complex by applying the same patch to all functions, it might be more helpful to make the issue easier to find by documenting. Thank you for the review! |
Summary:
This PR modifies the
findLibraryName
function to ignore lines that are commented out when searching forlibraryName
.The library I maintain previously had
libraryName
commented out to prepare for support of the new architecture.Now that the new architecture is enabled by default, during testing for the interop layer, this comment caused an issue where, despite being on the old architecture, the autolinking process treated it as a target for cmake.
As a result, the Android build fails.
In conclusion, while removing the comment resolves the issue, it was quite challenging to trace back from the CMake and Gradle errors all the way to the CLI config extraction to identify the comment as the cause. This could potentially lead to issues for others, so I'm implementing this fix.
Test Plan:
findLibraryName
function.libraryName
is found correctly, ignoring commented lines.Checklist
resolves #2545