Pass list of references via temp file for resolve-dependencies and build commands
This commit is contained in:
parent
18b9a70dbe
commit
e5d78f8886
|
|
@ -15,9 +15,9 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
|
||||||
"Path to the HTML Page containing the Blazor bootstrap script tag.",
|
"Path to the HTML Page containing the Blazor bootstrap script tag.",
|
||||||
CommandOptionType.SingleValue);
|
CommandOptionType.SingleValue);
|
||||||
|
|
||||||
var references = command.Option("--reference",
|
var referencesFile = command.Option("--references",
|
||||||
"The path from the _bin folder to a given referenced dll file (typically just the dll name)",
|
"The path to a file that lists the paths to given referenced dll files",
|
||||||
CommandOptionType.MultipleValue);
|
CommandOptionType.SingleValue);
|
||||||
|
|
||||||
var embeddedResourcesFile = command.Option("--embedded-resources",
|
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)",
|
"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)",
|
||||||
|
|
@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
|
||||||
command.OnExecute(() =>
|
command.OnExecute(() =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(mainAssemblyPath.Value) ||
|
if (string.IsNullOrEmpty(mainAssemblyPath.Value) ||
|
||||||
!clientPage.HasValue() || !references.HasValue() || !outputPath.HasValue())
|
!clientPage.HasValue() || !referencesFile.HasValue() || !outputPath.HasValue())
|
||||||
{
|
{
|
||||||
command.ShowHelp(command.Name);
|
command.ShowHelp(command.Name);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -45,6 +45,10 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var referencesSources = referencesFile.HasValue()
|
||||||
|
? File.ReadAllLines(referencesFile.Value())
|
||||||
|
: Array.Empty<string>();
|
||||||
|
|
||||||
var embeddedResourcesSources = embeddedResourcesFile.HasValue()
|
var embeddedResourcesSources = embeddedResourcesFile.HasValue()
|
||||||
? File.ReadAllLines(embeddedResourcesFile.Value())
|
? File.ReadAllLines(embeddedResourcesFile.Value())
|
||||||
: Array.Empty<string>();
|
: Array.Empty<string>();
|
||||||
|
|
@ -52,7 +56,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
|
||||||
IndexHtmlWriter.UpdateIndex(
|
IndexHtmlWriter.UpdateIndex(
|
||||||
clientPage.Value(),
|
clientPage.Value(),
|
||||||
mainAssemblyPath.Value,
|
mainAssemblyPath.Value,
|
||||||
references.Values.ToArray(),
|
referencesSources,
|
||||||
embeddedResourcesSources,
|
embeddedResourcesSources,
|
||||||
linkerEnabledFlag.HasValue(),
|
linkerEnabledFlag.HasValue(),
|
||||||
outputPath.Value());
|
outputPath.Value());
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using Microsoft.Extensions.CommandLineUtils;
|
using Microsoft.Extensions.CommandLineUtils;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
|
namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
|
||||||
|
|
@ -10,9 +11,9 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
|
||||||
{
|
{
|
||||||
public static void Command(CommandLineApplication command)
|
public static void Command(CommandLineApplication command)
|
||||||
{
|
{
|
||||||
var references = command.Option("--reference",
|
var referencesFile = command.Option("--references",
|
||||||
"Full path to a referenced assembly file",
|
"The path to a file that lists the paths to given referenced dll files",
|
||||||
CommandOptionType.MultipleValue);
|
CommandOptionType.SingleValue);
|
||||||
|
|
||||||
var baseClassLibrary = command.Option("--base-class-library",
|
var baseClassLibrary = command.Option("--base-class-library",
|
||||||
"Full path to a directory in which BCL assemblies can be found",
|
"Full path to a directory in which BCL assemblies can be found",
|
||||||
|
|
@ -36,9 +37,13 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var referencesSources = referencesFile.HasValue()
|
||||||
|
? File.ReadAllLines(referencesFile.Value())
|
||||||
|
: Array.Empty<string>();
|
||||||
|
|
||||||
RuntimeDependenciesResolver.ResolveRuntimeDependencies(
|
RuntimeDependenciesResolver.ResolveRuntimeDependencies(
|
||||||
mainAssemblyPath.Value,
|
mainAssemblyPath.Value,
|
||||||
references.Values.ToArray(),
|
referencesSources,
|
||||||
baseClassLibrary.Values.ToArray(),
|
baseClassLibrary.Values.ToArray(),
|
||||||
outputPath.Value());
|
outputPath.Value());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@
|
||||||
<FileWrites Include="@(BlazorItemOutput->'%(TargetOutputPath)')" />
|
<FileWrites Include="@(BlazorItemOutput->'%(TargetOutputPath)')" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="_BlazorTrackResolveReferencesDidRun" AfterTargets="ResolveReferences">
|
<Target Name="_BlazorTrackResolveReferencesDidRun" AfterTargets="ResolveReferences">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- So we know we can trust @(ReferenceCopyLocalPaths) later -->
|
<!-- So we know we can trust @(ReferenceCopyLocalPaths) later -->
|
||||||
<_BlazorResolveReferencesDidRun>true</_BlazorResolveReferencesDidRun>
|
<_BlazorResolveReferencesDidRun>true</_BlazorResolveReferencesDidRun>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="_BlazorBuildReport"
|
<Target Name="_BlazorBuildReport"
|
||||||
|
|
@ -199,7 +199,7 @@
|
||||||
|
|
||||||
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.copylocal.txt -->
|
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.copylocal.txt -->
|
||||||
<BlazorLocalReferencesOutputPath>$(BlazorIntermediateOutputPath)inputs.copylocal.txt</BlazorLocalReferencesOutputPath>
|
<BlazorLocalReferencesOutputPath>$(BlazorIntermediateOutputPath)inputs.copylocal.txt</BlazorLocalReferencesOutputPath>
|
||||||
|
|
||||||
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.linkerswitch.cache -->
|
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.linkerswitch.cache -->
|
||||||
<BlazorBuildLinkerSwitchInputsCache>$(BlazorIntermediateOutputPath)inputs.linkerswitch.cache</BlazorBuildLinkerSwitchInputsCache>
|
<BlazorBuildLinkerSwitchInputsCache>$(BlazorIntermediateOutputPath)inputs.linkerswitch.cache</BlazorBuildLinkerSwitchInputsCache>
|
||||||
|
|
||||||
|
|
@ -236,6 +236,9 @@
|
||||||
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.index.cache -->
|
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.index.cache -->
|
||||||
<BlazorBuildIndexInputsCache>$(BlazorIntermediateOutputPath)inputs.index.cache</BlazorBuildIndexInputsCache>
|
<BlazorBuildIndexInputsCache>$(BlazorIntermediateOutputPath)inputs.index.cache</BlazorBuildIndexInputsCache>
|
||||||
|
|
||||||
|
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/embedded.resources.txt -->
|
||||||
|
<BlazorReferencesConfigFilePath>$(BlazorIntermediateOutputPath)references.txt</BlazorReferencesConfigFilePath>
|
||||||
|
|
||||||
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/embedded.resources.txt -->
|
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/embedded.resources.txt -->
|
||||||
<BlazorEmbeddedResourcesConfigFilePath>$(BlazorIntermediateOutputPath)embedded.resources.txt</BlazorEmbeddedResourcesConfigFilePath>
|
<BlazorEmbeddedResourcesConfigFilePath>$(BlazorIntermediateOutputPath)embedded.resources.txt</BlazorEmbeddedResourcesConfigFilePath>
|
||||||
|
|
||||||
|
|
@ -279,7 +282,7 @@
|
||||||
File="$(BlazorBuildCommonInputsCache)"
|
File="$(BlazorBuildCommonInputsCache)"
|
||||||
Overwrite="True"
|
Overwrite="True"
|
||||||
WriteOnlyWhenDifferent="True" />
|
WriteOnlyWhenDifferent="True" />
|
||||||
|
|
||||||
<WriteLinesToFile
|
<WriteLinesToFile
|
||||||
Lines="@(_BlazorDependencyInput)"
|
Lines="@(_BlazorDependencyInput)"
|
||||||
File="$(BlazorLocalReferencesOutputPath)"
|
File="$(BlazorLocalReferencesOutputPath)"
|
||||||
|
|
@ -389,9 +392,9 @@
|
||||||
Overwrite="True"
|
Overwrite="True"
|
||||||
WriteOnlyWhenDifferent="True" />
|
WriteOnlyWhenDifferent="True" />
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<FileWrites Include="$(BlazorBuildLinkerInputsCache)" />
|
<FileWrites Include="$(BlazorBuildLinkerInputsCache)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|
@ -472,10 +475,10 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_CollectResolvedAssembliesDependsOn>
|
<_CollectResolvedAssembliesDependsOn>
|
||||||
_ResolveBlazorApplicationAssemblies;
|
_ResolveBlazorApplicationAssemblies;
|
||||||
_ReadResolvedBlazorApplicationAssemblies;
|
_ReadResolvedBlazorApplicationAssemblies;
|
||||||
_IntermediateCopyBlazorApplicationAssemblies;
|
_IntermediateCopyBlazorApplicationAssemblies;
|
||||||
_TouchBlazorApplicationAssemblies
|
_TouchBlazorApplicationAssemblies
|
||||||
</_CollectResolvedAssembliesDependsOn>
|
</_CollectResolvedAssembliesDependsOn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
@ -509,14 +512,18 @@
|
||||||
@(_BlazorDependencyInput)"
|
@(_BlazorDependencyInput)"
|
||||||
Outputs="$(BlazorResolvedAssembliesOutputPath)"
|
Outputs="$(BlazorResolvedAssembliesOutputPath)"
|
||||||
>
|
>
|
||||||
<ItemGroup>
|
|
||||||
<_DependenciesParameter Include="@(_BlazorDependencyInput->'--reference "%(Identity)"')" />
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<_ReferencesArg Condition="'@(_BlazorDependencyInput)' != ''">--references "$(BlazorReferencesConfigFilePath)"</_ReferencesArg>
|
||||||
<_BclParameter>--base-class-library "$(MonoBaseClassLibraryPath)" --base-class-library "$(MonoBaseClassLibraryFacadesPath)"</_BclParameter>
|
<_BclParameter>--base-class-library "$(MonoBaseClassLibraryPath)" --base-class-library "$(MonoBaseClassLibraryFacadesPath)"</_BclParameter>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Exec Command="$(BlazorBuildExe) resolve-dependencies "@(IntermediateAssembly->'%(FullPath)')" @(_DependenciesParameter, ' ') $(_BclParameter) --output "$(BlazorResolvedAssembliesOutputPath)"" />
|
<WriteLinesToFile
|
||||||
|
File="$(BlazorReferencesConfigFilePath)"
|
||||||
|
Lines="@(_BlazorDependencyInput)"
|
||||||
|
Overwrite="true" />
|
||||||
|
|
||||||
|
<Exec Command="$(BlazorBuildExe) resolve-dependencies "@(IntermediateAssembly->'%(FullPath)')" $(_ReferencesArg) $(_BclParameter) --output "$(BlazorResolvedAssembliesOutputPath)"" />
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|
@ -600,16 +607,22 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_LinkerEnabledFlag Condition="'$(_BlazorShouldLinkApplicationAssemblies)' != ''">--linker-enabled</_LinkerEnabledFlag>
|
<_LinkerEnabledFlag Condition="'$(_BlazorShouldLinkApplicationAssemblies)' != ''">--linker-enabled</_LinkerEnabledFlag>
|
||||||
|
<_ReferencesArg Condition="'@(_AppReferences)' != ''">--references "$(BlazorReferencesConfigFilePath)"</_ReferencesArg>
|
||||||
<_EmbeddedResourcesArg Condition="'@(_UnlinkedAppReferencesPaths)' != ''">--embedded-resources "$(BlazorEmbeddedResourcesConfigFilePath)"</_EmbeddedResourcesArg>
|
<_EmbeddedResourcesArg Condition="'@(_UnlinkedAppReferencesPaths)' != ''">--embedded-resources "$(BlazorEmbeddedResourcesConfigFilePath)"</_EmbeddedResourcesArg>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<WriteLinesToFile
|
||||||
|
File="$(BlazorReferencesConfigFilePath)"
|
||||||
|
Lines="@(_AppReferences)"
|
||||||
|
Overwrite="true" />
|
||||||
|
|
||||||
<WriteLinesToFile
|
<WriteLinesToFile
|
||||||
Condition="'@(_UnlinkedAppReferencesPaths)' != ''"
|
Condition="'@(_UnlinkedAppReferencesPaths)' != ''"
|
||||||
File="$(BlazorEmbeddedResourcesConfigFilePath)"
|
File="$(BlazorEmbeddedResourcesConfigFilePath)"
|
||||||
Lines="@(_UnlinkedAppReferencesPaths)"
|
Lines="@(_UnlinkedAppReferencesPaths)"
|
||||||
Overwrite="true" />
|
Overwrite="true" />
|
||||||
|
|
||||||
<Exec Command="$(BlazorBuildExe) build @(IntermediateAssembly) --html-page "$(BlazorIndexHtml)" @(_AppReferences->'--reference "%(Identity)"', ' ') $(_EmbeddedResourcesArg) $(_LinkerEnabledFlag) --output "$(BlazorIndexHtmlOutputPath)"" />
|
<Exec Command="$(BlazorBuildExe) build @(IntermediateAssembly) --html-page "$(BlazorIndexHtml)" $(_ReferencesArg) $(_EmbeddedResourcesArg) $(_LinkerEnabledFlag) --output "$(BlazorIndexHtmlOutputPath)"" />
|
||||||
|
|
||||||
<ItemGroup Condition="Exists('$(BlazorIndexHtmlOutputPath)')">
|
<ItemGroup Condition="Exists('$(BlazorIndexHtmlOutputPath)')">
|
||||||
<_BlazorIndex Include="$(BlazorIndexHtmlOutputPath)" />
|
<_BlazorIndex Include="$(BlazorIndexHtmlOutputPath)" />
|
||||||
|
|
@ -627,4 +640,4 @@
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue