react-native-builder-bob
react-native-builder-bob copied to clipboard
Support React Native Windows - C++/WinRT and C# templates with Example
This pull request closes #69
It delivers the full support of React Native Windows project's templates for both C# and C++ languages. Example project is configured as C# application.
Following changes were implemented:
- Additional questions and options in the index.ts file for Windows support
- package.json extended with react-native-windows: v0.63.4
- C++/WinRT project templates for both native module and native UI component
- C# project templates for both native module and native UI component
- README updated with the information about Windows support
- Example application provided with the Windows solution (.sln)
The 4 new project templates created in the Bob project are created as a 0.63.x projects with React Native Windows dependency already added to the solution configuration. None of the scaffolded projects use the precompiled headers. All headers required for implementation are included where they are required.
NOTE: Each language has its project's GUID being the same across native module and native UI component.
All projects are provided with the most basic source code file, which should be a starting point for a further implementation. Though they are basic and do nothing, they still compile successfully for each project. Those files and classes they implement are named according to the type of project selected. These basic modules/component are already registered in the ReactPackageProvider.
Please see the short presentation of the full template creation looks like (C# is taken as an example, but the procedure is of course the same for C++/WinRT):
For some more explanations please check the commit messages.
Love seeing the support for Windows apps being added. Main piece of feedback is that the project files and the code that the template RNW CLI produce, change over time. That is to say, an app created for 0.63 RNW will have different project/code files as 0.64 RNW. We expect we will continue to iterate on the template code and project files as we continue to evolve the platform. Sometimes we also update the template files/projects to backport a severe bugfix.
So ideally react-native-builder-bob wouldn't carry these files itself and instead just call the RNW CLI (or somehow "suck up" the files that RNW CLI uses for each version).
@jonthysell to review too
@asklar You've got the point - creating the project through the CLI would prevent us from updating the template and track backports. On the other hand current solution allows to do some customizations to the scaffolded solution, also whole system (each language, platform) is done like this so there's no confusion for a future maintainer, I also believe that the amount of changes required to be done to implement CLI for Windows only would be bigger than the current solution. Of course, the other side of a coin is that the XML file can be more confusing than command line, but I'm aware of that and to be honest I'm willing to keep on maintaining that.
But I see no problem in keeping your opinion in mind, so perhaps whole system will be based on CLI, not just Windows.
Yes I can see your point; I wouldn't want Windows to be the odd one out that's different : ) I just worry about how RNBB will be able to keep up/know about changes to the templates, but if you guys are comfortable signing up to keep this maintained then I am not concerned :)
@asklar What just came to my mind is that there's one main concern about CLI-based approach:
react-native-windows-init have the --projectType
flag which determines whether exe or dll will be created, but if it's the native module or native UI component is determined only by the files and the implementation of the project. So there would be no possibility to create those two separately.
I'm glad that we agree about the current approach, but CLI-based approach should be something to think about once it's possible for each platfrom and environment.
@asklar @jonthysell Did you take a chance to take a look at .vcxproj and .csproj files? These are essential for the Builder Bob tool to work correctly and your expertise is most valuable here.
What's the state of this? @BartoszKlonowski
@jahead We are still waiting for the review and will only merge this with an approval of an owner: @satya164
@satya164 do you have some time for you to review this?
@BartoszKlonowski can you rebase this PR on top of main if you get some time this week? then I'll have time to review and merge this.
looking forward to this
Closing due to inactivity. I'd like to figure out a different way to support other platforms without adding the code to this repo.