Skip to content

Conversation

@acoates-ms
Copy link
Contributor

@acoates-ms acoates-ms commented Apr 14, 2020

Fixes #4276

The default template creates a bundle file when doing a release build ready for the store. But that bundle is a debug bundle. This updates our bundle options in Bundle.props to align with the customization available on android in the default react-native gradle build.
https://github.com/facebook/react-native/blob/894f6b3e744679769ba0f6b83bae89354f0f1914/react.gradle#L170

Also updated the project file of the template to correctly handle react-native-windows being hoisted

Microsoft Reviewers: Open in CodeFlow

@acoates-ms acoates-ms requested a review from a team as a code owner April 14, 2020 18:47
@acoates-ms acoates-ms added the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Apr 14, 2020
@ghost
Copy link

ghost commented Apr 14, 2020

Hello @acoates-ms!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)\Bundle.props"/>

Copy link
Member

Choose a reason for hiding this comment

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

props are supposed to be Imported by the app project. The idea is in the app project you'd do

Import props

override/add your own properties

Import targets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@asklar
I moved some things around. But I'm not 100% sure this is correct. Should the BundleCommand be defined in the props file at all? Or should it just be moved into the targets file? The way it currently is, if you're overriding something like BundleEntryFile you have to do it before you import the props, which is not how you described it above.

Copy link
Member

@asklar asklar left a comment

Choose a reason for hiding this comment

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

🕐

@ghost ghost added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Apr 15, 2020
@ghost ghost removed the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Apr 15, 2020
Copy link
Member

@asklar asklar left a comment

Choose a reason for hiding this comment

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

main 3 pieces of feedback:

  • include props early in the project (before propertygroups are defined)
  • make sure ProjectDir is defined in cmdline msbuild scenarios too not just VS
  • see if you can unify Bundle.targets and Bundle.cpp.targets. I think even if you combine the two, it'd be fine, the C# properties would get picked up by the C# projects and the C++ properties by the C++ projects

<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version>
<Version>6.2.10</Version>
Copy link
Member

Choose a reason for hiding this comment

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

unrelated?

<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.props" />
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.targets" />
Copy link
Member

Choose a reason for hiding this comment

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

here in this C# project we use Bundle.targets but in C++ we use Bundle.cpp.targets. Why the difference? Can we just use one targets file and if we need to have different behavior it can figure it out for us?

npx --no-install yarn run bundle-cpp
</BundleCommand>
</PropertyGroup>
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.props" />
Copy link
Member

Choose a reason for hiding this comment

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

normally you'd put all the imported props files before any propertygroup. I think this is the same end result in this case as you don't seem to be overwriting/overriding anything in the bundle.props, but it'd be worth sticking to the layout

</ItemGroup>

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.props" />
Copy link
Member

Choose a reason for hiding this comment

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

move up before targets (really before the first PropertyGroup)

<BundleContent Condition = " '$(BundleContent)' == '' and '$(BundleContentRoot)' != '' ">$(BundleContentRoot)\**\*</BundleContent>

<!-- Root directory where bundle assets will be copied to, be sure to update BundleContent if you change this -->
<BundleContentRoot Condition=" '$(BundleContentRoot)' == '' ">$([MSBuild]::NormalizePath('$(ProjectDir)\Bundle'))</BundleContentRoot>
Copy link
Member

Choose a reason for hiding this comment

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

I think ProjectDir is a VS thing whereas MSBuildProjectDirectory is the MSBuild property - are you seeing this work on the command line too?

@ghost ghost merged commit 5c98e23 into microsoft:master Apr 21, 2020
@acoates-ms acoates-ms deleted the releasebundle branch April 21, 2020 04:41
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The release bundle builds should have --dev false flag

2 participants