Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Pass list of embedded resources candidate assemblies via temp file in intermediate dir #561

Merged
merged 1 commit into from
Apr 13, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.IO;
using Microsoft.Extensions.CommandLineUtils;

namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
Expand All @@ -18,9 +19,9 @@ public static void Command(CommandLineApplication command)
"The path from the _bin folder to a given referenced dll file (typically just the dll name)",
CommandOptionType.MultipleValue);

var embeddedResourcesSources = command.Option("--embedded-resources-source",
"The path to an assembly that may contain embedded resources (typically a referenced assembly in its pre-linked state)",
CommandOptionType.MultipleValue);
var embeddedResourcesFile = command.Option("--embedded-resources",
"The path to a file that lists the paths of .NET assemblies that may contain embedded resources (typically, referenced assemblies in their pre-linked states)",
CommandOptionType.SingleValue);

var outputPath = command.Option("--output",
"Path to the output file",
Expand All @@ -44,11 +45,15 @@ public static void Command(CommandLineApplication command)

try
{
var embeddedResourcesSources = embeddedResourcesFile.HasValue()
? File.ReadAllLines(embeddedResourcesFile.Value())
: Array.Empty<string>();

IndexHtmlWriter.UpdateIndex(
clientPage.Value(),
mainAssemblyPath.Value,
references.Values.ToArray(),
embeddedResourcesSources.Values.ToArray(),
embeddedResourcesSources,
linkerEnabledFlag.HasValue(),
outputPath.Value());
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.index.cache -->
<BlazorBuildIndexInputsCache>$(BlazorIntermediateOutputPath)inputs.index.cache</BlazorBuildIndexInputsCache>

<!-- /obj/<<configuration>>/<<targetframework>>/blazor/embedded.resources.txt -->
<BlazorEmbeddedResourcesConfigFilePath>$(BlazorIntermediateOutputPath)embedded.resources.txt</BlazorEmbeddedResourcesConfigFilePath>

</PropertyGroup>

<PropertyGroup Label="Final output paths">
Expand Down Expand Up @@ -597,9 +600,16 @@
</ItemGroup>
<PropertyGroup>
<_LinkerEnabledFlag Condition="'$(_BlazorShouldLinkApplicationAssemblies)' != ''">--linker-enabled</_LinkerEnabledFlag>
<_EmbeddedResourcesArg Condition="'@(_UnlinkedAppReferencesPaths)' != ''">--embedded-resources &quot;$(BlazorEmbeddedResourcesConfigFilePath)&quot;</_EmbeddedResourcesArg>
</PropertyGroup>

<Exec Command="$(BlazorBuildExe) build @(IntermediateAssembly) --html-page &quot;$(BlazorIndexHtml)&quot; @(_AppReferences->'--reference &quot;%(Identity)&quot;', ' ') @(_UnlinkedAppReferencesPaths->'--embedded-resources-source &quot;%(Identity)&quot;', ' ') $(_LinkerEnabledFlag) --output &quot;$(BlazorIndexHtmlOutputPath)&quot;" />
<WriteLinesToFile
Condition="'@(_UnlinkedAppReferencesPaths)' != ''"
File="$(BlazorEmbeddedResourcesConfigFilePath)"
Lines="@(_UnlinkedAppReferencesPaths)"
Overwrite="true" />

<Exec Command="$(BlazorBuildExe) build @(IntermediateAssembly) --html-page &quot;$(BlazorIndexHtml)&quot; @(_AppReferences->'--reference &quot;%(Identity)&quot;', ' ') $(_EmbeddedResourcesArg) $(_LinkerEnabledFlag) --output &quot;$(BlazorIndexHtmlOutputPath)&quot;" />

<ItemGroup Condition="Exists('$(BlazorIndexHtmlOutputPath)')">
<_BlazorIndex Include="$(BlazorIndexHtmlOutputPath)" />
Expand Down