Skip to content

Make the build system works on Unix #1489

Open
@MangelMaxime

Description

@MangelMaxime

Hello,

instead of reporting #1488 I wanted to try to contribute to WebSharper like I did in the past.

However, I am facing a big issue.

It seems like WebShaper cannot be contributed from Unix in its current state.

Issues I am facing:

Running /build.sh on a fresh repo doesn't work

❯ ./build.sh 
Tool 'paket' (version '9.0.2') was restored. Available commands: paket

Restore was successful.
Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0
Updating group wsbuild in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/paket.dependencies
Resolving dependency graph for group wsbuild...
Total time taken: 4 milliseconds
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-fake does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

A workaround is to run dotnet tool install fake-cli but then when running it I get this error:

Tool 'paket' (version '9.0.2') was restored. Available commands: paket
Tool 'fake-cli' (version '6.1.3') was restored. Available commands: fake

Restore was successful.
Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0
Updating group wsbuild in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/paket.dependencies
Resolving dependency graph for group wsbuild...
Total time taken: 2 milliseconds
Consider adding your dependencies via `#r` dependencies, for example add '#r "paket: nuget FSharp.Core //"'.
See https://fake.build/guide/fake-modules.html for details. 
If you know what you are doing you can silence this warning by setting the environment variable 'FAKE_ALLOW_NO_DEPENDENCIES' to 'true'
Updating group Main in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/.fake/build.fsx/paket.dependencies
Resolving dependency graph...
Updated packages:
  Group: Main
    - FSharp.Core: 9.0.300 (added)
Starting full restore process.
Starting task 'DotNet:version': running dotnet --version
9.0.203
Finished (Success) 'DotNet:version' in 00:00:00.1544063
Starting task 'DotNet:version': running dotnet --version
9.0.106
Finished (Success) 'DotNet:version' in 00:00:00.0761988
No exact match of product releases 9.0.203 found.
No product release found for 9.0.203. Maybe a pre-release? Returning all the versions.
No exact match of product releases 9.0.106 found.
No product release found for 9.0.106. Maybe a pre-release? Returning all the versions.
Could not load types of compiled script:
 - Could not load file or assembly 'Fake.DotNet.Cli, Version=6.1.3.0, Culture=neutral, PublicKeyToken=null'. General Exception (0x80131500)
 - Could not load file or assembly 'Mono.Cecil, Version=0.11.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e'. General Exception (0x80131500)
 - Could not load file or assembly 'Fake.JavaScript.Npm, Version=6.1.3.0, Culture=neutral, PublicKeyToken=null'. General Exception (0x80131500)
 - Could not load file or assembly 'Fake.JavaScript.Npm, Version=6.1.3.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

 - Could not load file or assembly 'Fake.Core.Target, Version=6.1.3.0, Culture=neutral, PublicKeyToken=null'. General Exception (0x80131500)
 - Could not load file or assembly 'Paket.Core, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null'. General Exception (0x80131500)
 - Could not load file or assembly 'Fake.Core.Target, Version=6.1.3.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

[MORE SIMILAR WARNING]

 - Could not load file or assembly 'Fake.Core.Target, Version=6.1.3.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

Script reported an error:
-> FileNotFoundException: Could not load file or assembly 'Fake.Core.Target, Version=6.1.3.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
   
Hint: To further diagnose the problem you can run fake in verbose mode `fake -v run ...` or set the 'FAKE_DETAILED_ERRORS' environment variable to 'true'
Warning: Paket resolved a FSharp.Core with version '9.0.0.0', but fake runs with a version of '8.0.0.0'. This is not supported.
Please either lock the version via 'nuget FSharp.Core <nuget-version>' or upgrade fake.
Read https://github.com/fsharp/FAKE/issues/2001 for details.
Hint: The fake-runner has not been updated for at least 6 months. Please consider upgrading to get latest bugfixes, improved suggestions and F# features.
Performance:
 - Cli parsing: 112 milliseconds
 - Packages: 727 milliseconds
   - Resolver: 559 milliseconds (1 runs)
      - Runtime: 32 milliseconds
      - Blocked (retrieving package details): 65 milliseconds (1 times)
      - Blocked (retrieving package versions): 461 milliseconds (1 times)
   - Disk IO: 17 milliseconds
   - Average Request Time: 155 milliseconds
   - Number of Requests: 2
   - Creating Runtime Graph: 1 millisecond
   - Retrieve Assembly List: 640 milliseconds
 - Script compiling: 6 seconds
 - Script analyzing: 145 milliseconds
 - Script running: 0 milliseconds
 - Script cleanup: 0 milliseconds
 - Runtime: 7 seconds

So I tried to skip using FAKE by running dotnet fsi build.fsx but now it is complaining because it seems like some project are Windows specifics...

❯ dotnet fsi build.fsx 
.> "git" tag --merged (In: false, Out: true, Err: true)
.> "git" rev-parse HEAD (In: false, Out: true, Err: true)
938f3080e496379dfd35d2652835fb52a0460021
.> "git" rev-parse refs/tags/10.0.0.581-beta1 (In: false, Out: true, Err: true)
a6001be735e573fdf3bf8ef75f874cb0c2229d4e
==== Building project v10.0.0.582-beta1 ====
run Build
Building project with version: LocalBuild
Shortened DependencyGraph for Target Build:
<== Build
   <== Prepare
      <== WS-GenAssemblyInfo
         <== WS-Update
            <== WS-Clean
               <== WS-Stop
      <== WS-Restore

The running order is:
Group - 1
  - WS-Stop
Group - 2
  - WS-Clean
Group - 3
  - WS-Update
Group - 4
  - WS-Restore
  - WS-GenAssemblyInfo
Group - 5
  - Prepare
Group - 6
  - Build
Starting target 'WS-Stop'
Finished (Success) 'WS-Stop' in 00:00:00.0126667
Starting target 'WS-Clean'
Finished (Success) 'WS-Clean' in 00:00:00.0096616
Starting target 'WS-Update'
/home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements> "dotnet"  paket update -g test (In: false, Out: false, Err: false)
Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0
Updating group test in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/paket.dependencies
Resolving dependency graph for group test...
Installing into projects:
Created dependency graph (210 packages in total)
F# project /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/src/sitelets/WebSharper.AspNetCore/WebSharper.AspNetCore.fsproj does not reference FSharp.Core.
Package FSharp.Core is referenced through multiple groups in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/tests/WebSharper.Compiler.FSharp.Tests/WebSharper.Compiler.FSharp.Tests.fsproj (inspect lockfile for details). To resolve this warning use a single group for this project to get a unified dependency resolution or use conditions on the groups.
Package System.Buffers is referenced through multiple groups in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/tests/WebSharper.Compiler.FSharp.Tests/WebSharper.Compiler.FSharp.Tests.fsproj (inspect lockfile for details). To resolve this warning use a single group for this project to get a unified dependency resolution or use conditions on the groups.
Package System.Collections.Immutable is referenced through multiple groups in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/tests/WebSharper.Compiler.FSharp.Tests/WebSharper.Compiler.FSharp.Tests.fsproj (inspect lockfile for details). To resolve this warning use a single group for this project to get a unified dependency resolution or use conditions on the groups.
Package System.Memory is referenced through multiple groups in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/tests/WebSharper.Compiler.FSharp.Tests/WebSharper.Compiler.FSharp.Tests.fsproj (inspect lockfile for details). To resolve this warning use a single group for this project to get a unified dependency resolution or use conditions on the groups.
Package System.Numerics.Vectors is referenced through multiple groups in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/tests/WebSharper.Compiler.FSharp.Tests/WebSharper.Compiler.FSharp.Tests.fsproj (inspect lockfile for details). To resolve this warning use a single group for this project to get a unified dependency resolution or use conditions on the groups.
Package System.Reflection.Metadata is referenced through multiple groups in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/tests/WebSharper.Compiler.FSharp.Tests/WebSharper.Compiler.FSharp.Tests.fsproj (inspect lockfile for details). To resolve this warning use a single group for this project to get a unified dependency resolution or use conditions on the groups.
Package System.Runtime.CompilerServices.Unsafe is referenced through multiple groups in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/tests/WebSharper.Compiler.FSharp.Tests/WebSharper.Compiler.FSharp.Tests.fsproj (inspect lockfile for details). To resolve this warning use a single group for this project to get a unified dependency resolution or use conditions on the groups.
Package FSharp.Core is referenced through multiple groups in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/tests/WebSharper.Core.JavaScript.Tests/WebSharper.Core.JavaScript.Tests.fsproj (inspect lockfile for details). To resolve this warning use a single group for this project to get a unified dependency resolution or use conditions on the groups.
Calling dotnet restore on WebSharper.Compiler.sln
/home/mmangel/.dotnet/sdk/9.0.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(107,5): error NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true.

Restore failed with 1 error(s) in 3.9s
Total time taken: 1 second
Paket failed with
-> dotnet restore "WebSharper.Compiler.sln" failed
Finished (Failed) 'WS-Update' in 00:00:07.0757772

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target               Duration
------               --------
WS-Stop              00:00:00.0110515
WS-Clean             00:00:00.0095808
WS-Update            00:00:07.0757040   (dotnet paket update failed)
WS-Restore           00:00:00           (skipped)
WS-GenAssemblyInfo   00:00:00           (skipped)
Prepare              00:00:00           (skipped)
Build                00:00:00           (skipped)
Total:               00:00:07.1302384
Status:              Failure
---------------------------------------------------------------------
Fake.Core.BuildFailedException: Target 'WS-Update' failed.
 ---> System.AggregateException: One or more errors occurred. (dotnet paket update failed)
 ---> System.Exception: dotnet paket update failed
   at [email protected](TargetParameter _arg3) in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/paket-files/wsbuild/github.com/dotnet-websharper/build-script/WebSharper.Fake.fsx:line 328
   at Fake.Core.TargetModule.runSimpleInternal(TargetContext context, Target target) in D:\a\FAKE\FAKE\src\app\Fake.Core.Target\Target.fs:line 371
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at Fake.Core.TargetModule.raiseIfError(OptionalTargetContext context) in D:\a\FAKE\FAKE\src\app\Fake.Core.Target\Target.fs:line 1319
   at Fake.Core.TargetModule.runOrDefaultWithArguments(String defaultTarget) in D:\a\FAKE\FAKE\src\app\Fake.Core.Target\Target.fs:line 1542
   at <StartupCode$FSI_0005>.$FSI_0005.main@() in /home/mmangel/Workspaces/Github/dotnet-websharper/core/string-builder-improvements/build.fsx:line 311
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Stopped due to error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions