|
| 1 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 2 | + |
| 3 | + <!-- Owen.Build: the GENERIC Owen build host (OX-01, docs/notes/owen-extension-alpha-preregistration.md, |
| 4 | + spec/OwenExtension.md). |
| 5 | +
|
| 6 | + It exists because the host has to be a PackageReference (Owen.Cli is a DotnetTool |
| 7 | + package and NuGet refuses one as a reference, NU1212) and because every extension must |
| 8 | + share ONE copy of the extractor and the Rust core. It knows no extension: extensions |
| 9 | + declare themselves with an <OwenExtensionDescriptor> item and depend on this package. |
| 10 | +
|
| 11 | + Payload: tools/net8.0/any/ is the publish closure of OwnSharp.Cli — the very program the |
| 12 | + Owen.Cli tool is (`owen`), with the bundled extractor and rust-core/<platform>/own-cli — |
| 13 | + minus the vendored Python core, which the Rust engine never touches. build/ and |
| 14 | + buildTransitive/ carry the targets that run `owen build-check` after every build. |
| 15 | +
|
| 16 | + Pack it with the platform cores staged exactly as for Owen.Cli: |
| 17 | + dotnet pack frontend/roslyn/Owen.Build -c Release -p:OwenRustCoreDir=/abs/staged --> |
| 18 | + <PropertyGroup> |
| 19 | + <!-- no assembly of its own: the TFM only lets an extension project reference this one --> |
| 20 | + <TargetFramework>netstandard2.0</TargetFramework> |
| 21 | + <IncludeBuildOutput>false</IncludeBuildOutput> |
| 22 | + <NoWarn>$(NoWarn);NU5128;NU5100</NoWarn> |
| 23 | + <IsPackable>true</IsPackable> |
| 24 | + <PackageId>Owen.Build</PackageId> |
| 25 | + <!-- the host version an extension's `requires.host` is checked against; it is the |
| 26 | + version of the program it packs (OwnSharp.Cli <Version>) and must stay equal to it --> |
| 27 | + <Version>0.1.0</Version> |
| 28 | + <Description>Owen build host: runs Owen (the Roslyn extractor and the Rust analysis core it ships) on every build for the Owen extensions a project references, and reports findings as ordinary build diagnostics.</Description> |
| 29 | + <Authors>PhysShell</Authors> |
| 30 | + <PackageProjectUrl>https://github.com/PhysShell/Own.NET</PackageProjectUrl> |
| 31 | + <RepositoryUrl>https://github.com/PhysShell/Own.NET</RepositoryUrl> |
| 32 | + <RepositoryType>git</RepositoryType> |
| 33 | + <PackageTags>owen;static-analysis;msbuild;ownership;lifetime</PackageTags> |
| 34 | + <PackageReadmeFile>README.md</PackageReadmeFile> |
| 35 | + <DevelopmentDependency>false</DevelopmentDependency> |
| 36 | + <EnableDefaultCompileItems>false</EnableDefaultCompileItems> |
| 37 | + </PropertyGroup> |
| 38 | + |
| 39 | + <Import Project="..\OwenRustCore.props" /> |
| 40 | + |
| 41 | + <ItemGroup> |
| 42 | + <None Include="build\Owen.Build.props" Pack="true" PackagePath="build" /> |
| 43 | + <None Include="build\Owen.Build.targets" Pack="true" PackagePath="build" /> |
| 44 | + <None Include="build\Owen.Build.props" Pack="true" PackagePath="buildTransitive" /> |
| 45 | + <None Include="build\Owen.Build.targets" Pack="true" PackagePath="buildTransitive" /> |
| 46 | + <None Include="README.md" Pack="true" PackagePath="\" /> |
| 47 | + </ItemGroup> |
| 48 | + |
| 49 | + <PropertyGroup> |
| 50 | + <_OwenHostStage>$(MSBuildProjectDirectory)/$(BaseIntermediateOutputPath)host-stage/</_OwenHostStage> |
| 51 | + </PropertyGroup> |
| 52 | + |
| 53 | + <!-- A host package without the engine would install an Owen that cannot analyse. --> |
| 54 | + <Target Name="OwenBuildNeedsCore" BeforeTargets="GenerateNuspec"> |
| 55 | + <Error Condition="'$(OwenRustCoreDir)' == ''" |
| 56 | + Text="Owen.Build must be packed with -p:OwenRustCoreDir=<staged platform cores>: the host runs the Rust core and has no other engine." /> |
| 57 | + </Target> |
| 58 | + |
| 59 | + <Target Name="OwenBuildPayload" BeforeTargets="_GetPackageFiles" DependsOnTargets="OwenRustCoreInventory" |
| 60 | + Condition="'$(OwenRustCoreDir)' != ''"> |
| 61 | + <RemoveDir Directories="$(_OwenHostStage)" /> |
| 62 | + <MSBuild Projects="..\OwnSharp.Cli\OwnSharp.Cli.csproj" Targets="Restore;Publish" |
| 63 | + Properties="Configuration=$(Configuration);PublishDir=$(_OwenHostStage);OwenRustCoreDir=$(OwenRustCoreDir);_OwenRestoreNonce=host" /> |
| 64 | + <ItemGroup> |
| 65 | + <!-- minus the vendored Python core (Owen.Cli's publish puts its *.py at the root) and |
| 66 | + the symbols. NuGet appends each file's RecursiveDir to a folder PackagePath, so the |
| 67 | + layout under tools/ is the publish layout, rust-core/<platform>/ included. --> |
| 68 | + <_OwenHostFiles Include="$(_OwenHostStage)**/*" Exclude="$(_OwenHostStage)*.py;$(_OwenHostStage)**/*.pdb;$(_OwenHostStage)ownsharp;$(_OwenHostStage)ownsharp-extract;$(_OwenHostStage)*.exe" /> |
| 69 | + <None Include="@(_OwenHostFiles)" Pack="true" PackagePath="tools/net8.0/any/" Visible="false" /> |
| 70 | + </ItemGroup> |
| 71 | + <Error Condition="!Exists('$(_OwenHostStage)ownsharp.dll') or !Exists('$(_OwenHostStage)ownsharp-extract.dll')" |
| 72 | + Text="Owen.Build: the host publish closure is incomplete (no ownsharp.dll / ownsharp-extract.dll under $(_OwenHostStage))." /> |
| 73 | + </Target> |
| 74 | + |
| 75 | +</Project> |
0 commit comments