Skip to content

Commit

Permalink
Moving built-in toolsets into Main. Refactor build to output scripts …
Browse files Browse the repository at this point in the history
…and packages to build output locations on both build and publish steps.
  • Loading branch information
brdeyo committed Aug 19, 2024
1 parent a0fa6f7 commit d18a5b9
Show file tree
Hide file tree
Showing 136 changed files with 94 additions and 9,885 deletions.
1 change: 0 additions & 1 deletion .buildenv/BuildEnv.props
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
-->
<PropertyGroup>
<IntermediateOutputPath>$(BuildIntermediatesPath)\$(Configuration)\$(Platform)\$(MSBuildProjectName)\</IntermediateOutputPath>
<IntDir>$(IntermediateOutputPath)</IntDir>
</PropertyGroup>

<!--
Expand Down
4 changes: 3 additions & 1 deletion .buildenv/BuildEnv.targets
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@
<Message Text="RepoPath : '$(RepoPath)'" Importance="High" />
<Message Text="RepoScriptsPath : '$(RepoScriptsPath)'" Importance="High" />
<Message Text="RepoToolsetsPath : '$(RepoToolsetsPath)'" Importance="High" />
<Message Text="BaseIntermediateOutputPath : '$(BaseIntermediateOutputPath)'" Importance="High" />
<Message Text="BaseOutputPath : '$(BaseOutputPath)'" Importance="High" />
<Message Text="OutputPath : '$(OutputPath)'" Importance="High" />
<Message Text="OutDir : '$(OutDir)'" Importance="High" />
<Message Text="BaseIntermediateOutputPath : '$(BaseIntermediateOutputPath)'" Importance="High" />
<Message Text="IntermediateOutputPath : '$(IntermediateOutputPath)'" Importance="High" />
<Message Text="IntDir : '$(IntDir)'" Importance="High" />
<Message Text="PublishDir : '$(PublishDir)'" Importance="High" />
<Message Text="TargetName : '$(TargetName)'" Importance="High" />
<Message Text="TargetDir : '$(TargetDir)'" Importance="High" />
<Message Text="TargetPath : '$(TargetPath)'" Importance="High" />
Expand Down
2 changes: 0 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ set TrimFlag="-p:PublishTrimmed=true"
set TrimFlag=""
if /i "%~1" == "noTrim" set TrimFlag=""

call %VCSolutionDir%\build-stage-packaging-tools.cmd && echo: || Goto :Error

echo:
echo [Building Source Code] VirtualClient %VCBuildVersion%
echo -------------------------------------------------------
Expand Down

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/VirtualClient/VirtualClient.Contracts/PlatformSpecifics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected PlatformSpecifics(PlatformID platform, Architecture architecture, stri
/// <summary>
/// The directory for file/content upload notifications (e.g. /logs/contentuploads).
/// </summary>
public string ContentUploadsDirectory { get; }
public string ContentUploadsDirectory { get; internal set; }

/// <summary>
/// The CPU architecture (e.g. x64, arm64).
Expand All @@ -98,22 +98,22 @@ protected PlatformSpecifics(PlatformID platform, Architecture architecture, stri
/// <summary>
/// The directory where log files are are written.
/// </summary>
public string LogsDirectory { get; }
public string LogsDirectory { get; internal set; }

/// <summary>
/// The directory where packages are stored.
/// </summary>
public string PackagesDirectory { get; }
public string PackagesDirectory { get; internal set; }

/// <summary>
/// The directory where profiles are stored.
/// </summary>
public string ProfilesDirectory { get; }
public string ProfilesDirectory { get; internal set; }

/// <summary>
/// The directory where profiles downloaded are stored.
/// </summary>
public string ProfileDownloadsDirectory { get; }
public string ProfileDownloadsDirectory { get; internal set; }

/// <summary>
/// The OS platform (e.g. Windows, Unix).
Expand All @@ -129,18 +129,18 @@ protected PlatformSpecifics(PlatformID platform, Architecture architecture, stri
/// <summary>
/// The directory where scripts related to workloads exist.
/// </summary>
public string ScriptsDirectory { get; }
public string ScriptsDirectory { get; internal set; }

/// <summary>
/// The directory where state objects are stored.
/// </summary>
public string StateDirectory { get; }
public string StateDirectory { get; internal set; }

/// <summary>
/// True to standardize paths using Unix-style conventions (e.g. forward slashes '/')
/// only. When 'true' all paths (including Windows-formatted) will use forward slashes.
/// </summary>
public bool UseUnixStylePathsOnly { get; }
public bool UseUnixStylePathsOnly { get; internal set; }

/// <summary>
/// Returns the platform + architecture name used by the Virtual Client to represent a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
</ItemGroup>

<PropertyGroup>
<OutDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Repo.props))\out</OutDir>
<PackageOutDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Repo.props))\out</PackageOutDir>
<NuspecProperties>
BinDir=$(OutDir)\bin;BinConfigDir=$(OutDir)\bin\$(Configuration);PackagingSourceDir=.;ToolsOutDir=$(OutDir)\tools;Version=$(Version)
BinDir=$(OutDir)\bin;BinConfigDir=$(PackageOutDir)\bin\$(Configuration);PackagingSourceDir=.;ToolsOutDir=$(PackageOutDir)\tools;Version=$(Version)
</NuspecProperties>
</PropertyGroup>

Expand Down
72 changes: 40 additions & 32 deletions src/VirtualClient/VirtualClient.Main/VirtualClient.Main.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<RunAnalyzers>false</RunAnalyzers>
<NoWarn>CA1416,NU5100,NU5118,NU5128,SA1118,NU5110,NU5111,IL2026,IL2104,IL2072</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<BuildPropertyOutput>true</BuildPropertyOutput>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,51 +27,58 @@
<ProjectReference Include="..\VirtualClient.Monitors\VirtualClient.Monitors.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Scripts\Kusto\EventHub\TableMappings.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Scripts\Kusto\EventHub\Tables.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<!--
This prevents having ALL profiles published to the win-x64, win-arm64, linux-x64 and linux-arm64 directories
during the publish phase. We DO NOT want all profiles in each of those directories because certain profiles and
corresponding workloads cannot support both operating systems.
Below we have targets that copy the relevant profiles to the target platform/arch folders based upon the
supported operating system.
-->
<None Update="profiles\*.json" CopyToOutputDirectory="Always" CopyToPublishDirectory="Never" />
</ItemGroup>


<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

<Target Name="PublishProfiles" AfterTargets="Publish">

<!--
Sets the target publish directory. In practice, this should be the same as the output path as there
is no need to duplicate the build output into a separate directory. The build output directory and
publish directory are the same.
-->
<Target Name="SetPublishDirectory" BeforeTargets="Build">
<PropertyGroup>
<PublishDir>$(OutputPath)</PublishDir>
</PropertyGroup>
</Target>

<!--
Copies the profiles into the target output directory.
-->
<Target Name="CopyProfilesToOutputDirectory" AfterTargets="Build">
<ItemGroup>
<ProfileFiles Include="profiles\*.json" />
<ProfileFiles Include="profiles\*.*" />
</ItemGroup>
<Copy SourceFiles="@(ProfileFiles)" DestinationFiles="@(ProfileFiles->'$(OutputPath)publish\profiles\%(Filename)%(Extension)')" />

<Copy SourceFiles="@(ProfileFiles)" DestinationFiles="@(ProfileFiles->'$(OutputPath)profiles\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

<!--
Copies "built-in" packages into the target output directory. These packages contain toolsets that
we carry with a VC build so that they never need to be downloaded. In practice these are typically
toolsets that are used often by the platform runtime itself or across numerous workload or monitoring
components.
-->
<Target Name="CopyPackagesToOutputDirectory" AfterTargets="Build">
<ItemGroup>
<PackageFiles Include="packages\**\*.*" />
<PackageFiles Include="packages\**\$(RuntimeIdentifier)\**\*.*" Condition="'$(RuntimeIdentifier)' != ''" />
<VcpkgFiles Include="packages\**\*.vcpkg" />
</ItemGroup>

<Copy SourceFiles="@(PackageFiles)" DestinationFiles="@(PackageFiles->'$(OutputPath)packages\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(VcpkgFiles)" DestinationFiles="@(VcpkgFiles->'$(OutputPath)packages\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

<!--
Copy the script/content files into the target runtime publish directory.
Copies script/content files into the target output directory.
-->
<Target Name="CopyInScriptsToPublishDirectory" AfterTargets="Publish">
<Target Name="CopyScriptsToOutputDirectory" AfterTargets="Build">
<ItemGroup>
<ScriptFiles Include="$(RepoPath)\out\scripts\**\*.*" />
</ItemGroup>

<Copy Condition="'$(RuntimeIdentifier)' != ''" SourceFiles="@(ScriptFiles)" DestinationFiles="@(ScriptFiles->'$(OutputPath)publish\scripts\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(ScriptFiles)" DestinationFiles="@(ScriptFiles->'$(OutputPath)scripts\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Module.props))\Module.props" />
Expand Down
1 change: 0 additions & 1 deletion src/VirtualClient/VirtualClient.Packaging/any/README.txt

This file was deleted.

Loading

0 comments on commit d18a5b9

Please sign in to comment.