Skip to content

Investigate ExcludeFromSourceBuild not working in dotnet/runtime #1825

Open

Description

#1820 tried to exclude R2RDump from source-build, but it still got restored and its dependencies were still prebuilts.

I suspect that the new static restore might not be evaluating the projects the same way as they used to, preventing the ExcludeFromSourceBuild property from working. I haven't looked very far into it, but I wonder if maybe the problem is that it isn't checking DotNetBuildFromSource in the environment and we need to pass it in as a command, since RestoreTaskEx is called something like this (newlines for clarity):

"/src/.dotnet/dotnet"
"/src/.dotnet/sdk/5.0.100-preview.8.20417.9/NuGet.Build.Tasks.Console.dll"
"CleanupAssetsForUnsupportedProjects=True;
  NoCache=True;
  Recursive=True"
"/src/.dotnet/sdk/5.0.100-preview.8.20417.9/MSBuild.dll"
"/src/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/Build.proj"
"ContinuousIntegrationBuild=true;
  Configuration=Release;
  RepoRoot=/src/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/;
  Rebuild=false;
  Test=false;
  Pack=false;
  IntegrationTest=false;
  PerformanceTest=false;
  RuntimeConfiguration=Release;
  Subset=clr.tools+clr.runtime+clr.corelib+clr.nativecorelib+clr.packages;
  TargetArchitecture=x64;
  CMakeArgs=;
  MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0;
  PackagesDir=/src/packages/restored/;
  PackageRid=centos.7-x64;
  NoPgoOptimize=true;
  KeepNativeSymbols=true;
  RuntimeOS=centos.7;
  DotNetPackageVersionPropsPath=/src/artifacts/obj/x64/Release/PackageVersions.props;
  DotNetRestoreSourcePropsPath=/src/artifacts/obj/x64/Release/RestoreSources.props;
  VersionsPropsPath=/src/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/eng/Versions.props;
  DisableWarnForInvalidRestoreProjects=true;
  __BuildPhase=SolutionRestore;
  _NETCORE_ENGINEERING_TELEMETRY=Restore;
  MSBuildRestoreSessionId=4d351d66-a832-485b-8465-698ff0f49b17;
  RestoreUseStaticGraphEvaluation=true;
  ExcludeRestorePackageImports=true"

It should have access the the env vars, though, so that might be a red herring.

It might just be that RestoreTaskEx uses a completely new execution flow and doesn't care when Arcade tries to blank out the usual restore Targets.

Perhaps a way around this is to add to CollectPackageReferences and remove out all package refs? (I believe RestoreTaskEx will specifically evaluate this target because it's where a lot of custom refs happen.)

The current surefire workaround is to stop using ExcludeFromSourceBuild for now and instead make more heavy-handed and perhaps unmergeable patches.

Related-seeming issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-infraSource-build infrastructure and reportingarea-patch-removalRemoving patches for contributing repos from source-build

    Type

    No type

    Projects

    • Status

      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions