Skip to content

Add InjectBundleContent target #3821

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

Merged
merged 3 commits into from
Dec 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .ado/templates/e2e-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,7 @@ jobs:
command: restore
restoreSolution: packages/E2ETest/windows/ReactUWPTestApp.sln
verbosityRestore: Detailed # Options: quiet, normal, detailed

- task: CmdLine@2
displayName: Create bundle
inputs:
script: yarn run bundle
workingDirectory: packages/E2ETest


- task: CmdLine@2
displayName: run-windows
inputs:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "Avoid app crash because content is not bundled for the first time",
"packageName": "react-native-windows",
"email": "licanhua@live.com",
"commit": "703f7d4f116abbb7d40d74681f40e9d8d0a036ce",
"date": "2019-12-30T20:16:46.912Z"
}
16 changes: 10 additions & 6 deletions vnext/PropertySheets/Bundle.Cpp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)\Bundle.Common.targets"/>

<ItemGroup Condition="'$(UseBundle)' == 'true' and '$(BundleContent)' != '' and '$(BundleContentRoot)' != '' ">
<None Include="$(BundleContent)">
<Link>$(BundleContentRoot)\%(RecursiveDir)%(Filename)%(Extension)</Link>
<DeploymentContent>true</DeploymentContent>
</None>
</ItemGroup>
<Target Name="InjectBundleContent" BeforeTargets="PrepareForBuild" AfterTargets="MakeBundle">
<ItemGroup Condition="'$(UseBundle)' == 'true' and '$(BundleContent)' != '' and '$(BundleContentRoot)' != '' ">
<BundleContentToBePackaged Include="$(BundleContent)" />
<None Include="@(BundleContentToBePackaged)">
<Link>$(BundleContentRoot)\%(RecursiveDir)%(Filename)%(Extension)</Link>
<DeploymentContent>true</DeploymentContent>
</None>
</ItemGroup>
</Target>

<ItemDefinitionGroup Condition=" '$(UseBundle)' == 'true' ">
<ClCompile>
<PreprocessorDefinitions>BUNDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
12 changes: 7 additions & 5 deletions vnext/PropertySheets/Bundle.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)\Bundle.Common.targets"/>

<ItemGroup Condition="'$(UseBundle)' == 'true' and '$(BundleContent)' != ''">
<Content Include="$(BundleContent)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Target Name="InjectBundleContent" BeforeTargets="PrepareForBuild" AfterTargets="MakeBundle">
<ItemGroup Condition="'$(UseBundle)' == 'true' and '$(BundleContent)' != ''">
<Content Include="$(BundleContent)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Target>
</Project>