Skip to content

Commit

Permalink
Rework referenced projects protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
javiercn committed Aug 4, 2021
1 parent 7398815 commit d9244e4
Show file tree
Hide file tree
Showing 14 changed files with 926 additions and 576 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- Static web assets defaults -->
<StaticWebAssetBasePath Condition="'$(StaticWebAssetBasePath)' == ''">/</StaticWebAssetBasePath>
<StaticWebAssetProjectMode Condition="'$(StaticWebAssetProjectMode)' == ''">Root</StaticWebAssetProjectMode>
<StaticWebAssetsPublishTarget>ComputeFilesToPublish</StaticWebAssetsPublishTarget>
<StaticWebAssetsGetPublishAssetsTargets>ComputeFilesToPublish;GetCurrentProjectPublishStaticWebAssetItems</StaticWebAssetsGetPublishAssetsTargets>
<StaticWebAssetsAdditionalPublishProperties>$(StaticWebAssetsAdditionalPublishProperties);BuildProjectReferences=false;ResolveAssemblyReferencesFindRelatedSatellites=true;_PublishingBlazorWasmProject=true</StaticWebAssetsAdditionalPublishProperties>
<StaticWebAssetsAdditionalPublishPropertiesToRemove>$(StaticWebAssetsAdditionalPublishPropertiesToRemove);NoBuild;RuntimeIdentifier</StaticWebAssetsAdditionalPublishPropertiesToRemove>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Copyright (c) .NET Foundation. All rights reserved.

<PropertyGroup>
<ResolveStaticWebAssetsInputsDependsOn>$(ResolveStaticWebAssetsInputsDependsOn);_AddServiceWorkerAssets</ResolveStaticWebAssetsInputsDependsOn>
<CopyStaticWebAssetsToPublishDirectoryDependsOn>$(CopyStaticWebAssetsToPublishDirectoryDependsOn);_WritePublishServiceWorkerAssetsManifest</CopyStaticWebAssetsToPublishDirectoryDependsOn>
<CopyStaticWebAssetsToOutputFolderDependsOn>$(CopyStaticWebAssetsToOutputFolderDependsOn);_WriteBuildServiceWorkerAssetsManifest</CopyStaticWebAssetsToOutputFolderDependsOn>
<GenerateComputedPublishStaticWebAssetsDependsOn>$(GenerateComputedPublishStaticWebAssetsDependsOn);_WritePublishServiceWorkerAssetsManifest</GenerateComputedPublishStaticWebAssetsDependsOn>
<GenerateComputedBuildStaticWebAssetsDependsOn>$(GenerateComputedBuildStaticWebAssetsDependsOn);_WriteBuildServiceWorkerAssetsManifest</GenerateComputedBuildStaticWebAssetsDependsOn>
</PropertyGroup>

<Target Name="_AddServiceWorkerAssets" DependsOnTargets="_ComputeServiceWorkerAssets">
Expand Down Expand Up @@ -108,13 +108,22 @@ Copyright (c) .NET Foundation. All rights reserved.

</Target>

<Target Name="_WriteBuildServiceWorkerAssetsManifest" DependsOnTargets="_ComputeServiceWorkerAssets">
<Target Name="_WriteBuildServiceWorkerAssetsManifest" DependsOnTargets="ResolveStaticWebAssetsInputs">

<ItemGroup>
<_BuildAssetsForManifest Include="@(StaticWebAsset)" Condition="'%(AssetTraitName)' != 'BlazorServiceWorker' and '%(AssetRole)' != 'Alternative' and '%(AssetKind)' != 'Publish' and Exists('%(Identity)')" />
<_BuildAssetsForManifest Include="@(StaticWebAsset->'%(OriginalItemSpec)')" Condition="'%(AssetTraitName)' != 'BlazorServiceWorker' and '%(AssetRole)' != 'Alternative' and '%(AssetKind)' != 'Publish' and !Exists('%(Identity)')" />
<_BuildAssetsForManifestCandidate Include="@(StaticWebAsset)" Condition="'%(AssetTraitName)' != 'BlazorServiceWorker' and '%(AssetRole)' != 'Alternative' and Exists('%(Identity)')" />
<_BuildAssetsForManifestCandidate Include="@(StaticWebAsset->'%(OriginalItemSpec)')" Condition="'%(AssetTraitName)' != 'BlazorServiceWorker' and '%(AssetRole)' != 'Alternative' and !Exists('%(Identity)')" />
</ItemGroup>

<ComputeStaticWebAssetsForCurrentProject
Assets="@(_BuildAssetsForManifestCandidate)"
ProjectMode="$(StaticWebAssetProjectMode)"
AssetKind="Build"
Source="$(PackageId)"
>
<Output TaskParameter="StaticWebAssets" ItemName="_BuildAssetsForManifest" />
</ComputeStaticWebAssetsForCurrentProject>

<ComputeStaticWebAssetsTargetPaths Assets="@(_BuildAssetsForManifest)" PathPrefix="$(StaticWebAssetBasePath)" UseAlternatePathDirectorySeparator="true">
<Output TaskParameter="AssetsWithTargetPath" ItemName="_BuildAssetsForManifestWithTargetPath" />
</ComputeStaticWebAssetsTargetPaths>
Expand Down Expand Up @@ -157,19 +166,28 @@ Copyright (c) .NET Foundation. All rights reserved.

</Target>

<Target Name="_WritePublishServiceWorkerAssetsManifest" DependsOnTargets="_ComputeServiceWorkerAssets;LoadStaticWebAssetsPublishManifest" AfterTargets="GenerateStaticWebAssetsPublishManifest">
<Target Name="_WritePublishServiceWorkerAssetsManifest" DependsOnTargets="_ComputeServiceWorkerAssets;LoadStaticWebAssetsPublishManifest">

<ItemGroup>
<_PublishAssetsForManifest Include="@(StaticWebAsset)" Condition="'%(AssetTraitName)' != 'BlazorServiceWorker' and '%(AssetRole)' != 'Alternative'" />
<_PublishAssetsForManifestCandidate Include="@(StaticWebAsset)" Condition="'%(AssetTraitName)' != 'BlazorServiceWorker' and '%(AssetRole)' != 'Alternative'" />
</ItemGroup>

<ComputeStaticWebAssetsForCurrentProject
Assets="@(_PublishAssetsForManifestCandidate)"
ProjectMode="$(StaticWebAssetProjectMode)"
AssetKind="Publish"
Source="$(PackageId)"
>
<Output TaskParameter="StaticWebAssets" ItemName="_PublishAssetsForManifest" />
</ComputeStaticWebAssetsForCurrentProject>

<ComputeStaticWebAssetsTargetPaths Assets="@(_PublishAssetsForManifest)" PathPrefix="$(StaticWebAssetBasePath)" UseAlternatePathDirectorySeparator="true">
<Output TaskParameter="AssetsWithTargetPath" ItemName="_AssetsForManifestWithTargetPath" />
<Output TaskParameter="AssetsWithTargetPath" ItemName="_PublishAssetsForManifestWithTargetPath" />
</ComputeStaticWebAssetsTargetPaths>

<ItemGroup>
<_ServiceWorkItem Include="@(_AssetsForManifestWithTargetPath)">
<AssetUrl>%(_AssetsForManifestWithTargetPath.TargetPath)</AssetUrl>
<_ServiceWorkItem Include="@(_PublishAssetsForManifestWithTargetPath)">
<AssetUrl>%(_PublishAssetsForManifestWithTargetPath.TargetPath)</AssetUrl>
</_ServiceWorkItem>
<_PublishServiceWorkerFile Include="@(StaticWebAsset)" Condition="'%(AssetKind)' == 'Publish' And '%(AssetTraitName)' == 'BlazorServiceWorker' And '%(AssetTraitValue)' == 'ServiceWorkerJs'" />
</ItemGroup>
Expand Down
14 changes: 6 additions & 8 deletions src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.ScopedCss.targets
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ Integration with static web assets:
_AddScopedCssBundles;
</ResolveStaticWebAssetsInputsDependsOn>

<CopyStaticWebAssetsToOutputFolderDependsOn>
$(CopyStaticWebAssetsToOutputFolderDependsOn);
<GenerateComputedBuildStaticWebAssetsDependsOn>
$(GenerateComputedBuildStaticWebAssetsDependsOn);
_ResolveBundlingConfiguration;
_GenerateScopedCssFiles;
BundleScopedCssFiles;
</CopyStaticWebAssetsToOutputFolderDependsOn>
</GenerateComputedBuildStaticWebAssetsDependsOn>

</PropertyGroup>

Expand All @@ -75,10 +75,10 @@ Integration with static web assets:
_AddGeneratedScopedCssFiles;
</ResolveStaticWebAssetsInputsDependsOn>

<CopyStaticWebAssetsToOutputFolderDependsOn>
<GenerateComputedBuildStaticWebAssetsDependsOn>
_GenerateScopedCssFiles;
$(CopyStaticWebAssetsToOutputFolderDependsOn);
</CopyStaticWebAssetsToOutputFolderDependsOn>
$(GenerateComputedBuildStaticWebAssetsDependsOn);
</GenerateComputedBuildStaticWebAssetsDependsOn>

</PropertyGroup>

Expand All @@ -90,8 +90,6 @@ Integration with static web assets:
<_ScopedCssExtension>.rz.scp.css</_ScopedCssExtension>
</PropertyGroup>

<Target Name="_PrepareForScopedCss" DependsOnTargets="$(_PrepareForScopedCssDependsOn)" />

<Target Name="ResolveScopedCssInputs">
<!--
Gathers input source files for Razor component generation. This is a separate target so that we can avoid
Expand Down
Loading

0 comments on commit d9244e4

Please sign in to comment.