Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,24 @@ Plan your task:

Always run the core command. Always verify exit codes. No assumptions.

## 1. Core Command
## 1. Build
```
./build.sh -c Release --testcoreclr
dotnet build FSharp.sln -c Release
```
Non‑zero → classify & stop.

## 2. Bootstrap (Failure Detection Only)
Two-phase build. No separate bootstrap command.
Early proto/tool errors (e.g. "Error building tools") → `BootstrapFailure` (capture key lines). Stop.
## 2. Test
```
dotnet test tests/FSharp.Compiler.ComponentTests -c Release
dotnet test tests/FSharp.Compiler.Service.Tests -c Release
```

## 3. Build Failure
Proto ok but solution build fails → `BuildFailure`.
Capture exit code, ≤15 error lines (`error FS`, `error F#`, `error MSB`), binlog path: `artifacts/log/Release/Build.*.binlog`.
Do not proceed to tests.

## 4. Tests
Core command runs CoreCLR tests:
## 4. Tests (Full Suite)
Additional CoreCLR tests:
- FSharp.Test.Utilities
- FSharp.Compiler.ComponentTests
- FSharp.Compiler.Service.Tests
- FSharp.Compiler.Private.Scripting.UnitTests
- FSharp.Build.UnitTests
- FSharp.Core.UnitTests
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,12 @@ jobs:
# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore the compiler service solution
env:
CI: false
run: ./build.sh -c Release --verbosity quiet || true
- name: Restore the language server solution
env:
CI: false
run: dotnet build ./LSPSolutionSlim.sln -c Release --verbosity quiet || true
- name: Restore dotnet tools
env:
CI: false
run: dotnet tool restore
- name: Restore
run: |
dotnet restore FSharp.sln || true
dotnet restore LSPSolutionSlim.sln || true
dotnet tool restore || true
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project>
<Import Project="eng/targets/Bootstrap.targets" Condition="'$(DISABLE_ARCADE)' != 'true'" />
<Import Project="FSharpBuild.Directory.Build.targets" Condition = " '$(FSharpTestCompilerVersion)' == '' "/>
<Import Project="FSharpTests.Directory.Build.targets" Condition = " '$(FSharpTestCompilerVersion)' != '' "/>
<Import Project="CoordinateXliff.targets" Condition = " '$(FSharpBuildAssemblyFile)' != '' and '$(XliffTasksAssembly)' != '' "/>
Expand Down
92 changes: 92 additions & 0 deletions eng/targets/Bootstrap.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<Project>

<!--
Bootstrap.targets

Automatically builds the bootstrap compiler when needed for FSharp.sln.

Goals:
- dotnet build FSharp.sln works without scripts
- Bootstrap runs automatically on first build (if missing)
- Bootstrap errors surface as proper MSBuild errors
- Bootstrap output is silent on success
- Skips bootstrap when not needed (Proto config, SDK compiler mode, etc.)
-->

<PropertyGroup>
<!-- Bootstrap output directory -->
<BootstrapDir>$(ArtifactsDir)Bootstrap\</BootstrapDir>

<!-- Bootstrap tool paths -->
<FsLexBootstrapPath>$(BootstrapDir)fslex\fslex.dll</FsLexBootstrapPath>
<FsYaccBootstrapPath>$(BootstrapDir)fsyacc\fsyacc.dll</FsYaccBootstrapPath>
<FscBootstrapPath>$(BootstrapDir)fsc\fsc.dll</FscBootstrapPath>

<!-- Skip bootstrap when:
- Configuration is Proto (we ARE the bootstrap)
- DisableCompilerRedirection is true (user wants SDK compiler)
- BUILDING_USING_DOTNET is true (FSharp.Compiler.Service.sln uses SDK compiler)
- MSBuildProjectDirectory is under artifacts (test/temp projects, build outputs)
-->
<_SkipBootstrap Condition="'$(Configuration)' == 'Proto'">true</_SkipBootstrap>
<_SkipBootstrap Condition="'$(DisableCompilerRedirection)' == 'true'">true</_SkipBootstrap>
<_SkipBootstrap Condition="'$(BUILDING_USING_DOTNET)' == 'true'">true</_SkipBootstrap>
<_SkipBootstrap Condition="$(MSBuildProjectDirectory.StartsWith('$(ArtifactsDir)'))">true</_SkipBootstrap>
</PropertyGroup>

<!--
Target: _CheckBootstrapNeeded

Runs before Restore and Build to check if bootstrap compiler exists.
If any of the bootstrap tools are missing, triggers bootstrap build.
-->
<Target Name="_CheckBootstrapNeeded"
BeforeTargets="Restore;Build"
Condition="'$(_SkipBootstrap)' != 'true'">

<PropertyGroup>
<_BootstrapNeeded>false</_BootstrapNeeded>
<_BootstrapNeeded Condition="!Exists('$(FsLexBootstrapPath)')">true</_BootstrapNeeded>
<_BootstrapNeeded Condition="!Exists('$(FsYaccBootstrapPath)')">true</_BootstrapNeeded>
<_BootstrapNeeded Condition="!Exists('$(FscBootstrapPath)')">true</_BootstrapNeeded>
</PropertyGroup>

<CallTarget Targets="_RunBootstrap" Condition="'$(_BootstrapNeeded)' == 'true'" />
</Target>

<!--
Target: _RunBootstrap

Builds the bootstrap compiler by publishing proto.proj.
Uses minimal verbosity for clean CI logs.
On failure, emits MSBuild error that stops the build.
-->
<Target Name="_RunBootstrap">
<Message Text="Building bootstrap compiler..." Importance="high" />

<Exec Command="dotnet publish &quot;$(RepoRoot)proto.proj&quot; -c Proto -v:minimal"
IgnoreExitCode="true"
ConsoleToMSBuild="true">
<Output TaskParameter="ExitCode" PropertyName="_BootstrapExitCode" />
</Exec>

<Error Text="Bootstrap build failed. Check output above."
Condition="'$(_BootstrapExitCode)' != '0'" />

<Message Text="Bootstrap complete."
Importance="high"
Condition="'$(_BootstrapExitCode)' == '0'" />
</Target>

<!--
Target: RebuildBootstrap

Public target to force rebuild of bootstrap compiler.
Usage: dotnet build /t:RebuildBootstrap
-->
<Target Name="RebuildBootstrap">
<RemoveDir Directories="$(BootstrapDir)" />
<CallTarget Targets="_RunBootstrap" />
</Target>

</Project>
1 change: 1 addition & 0 deletions proto.proj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<RootDir Condition="'$(RootDir)'==''">Bootstrap</RootDir>
<NETCORE_ENGINEERING_TELEMETRY>Bootstrap</NETCORE_ENGINEERING_TELEMETRY>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading