Skip to content

Enable Build/CI with Mono - #1703

Merged
dsyme merged 80 commits into
dotnet:masterfrom
dsyme:travis
Nov 6, 2016
Merged

Enable Build/CI with Mono#1703
dsyme merged 80 commits into
dotnet:masterfrom
dsyme:travis

Conversation

@dsyme

@dsyme dsyme commented Nov 4, 2016

Copy link
Copy Markdown
Contributor

This enables a build of this repo using Mono. Initially I've been testing using Travis - we should move to .Jenkins, perhaps as part of this PR.

  • Use FSharp.Compiler.Tools nuget package as LKG (like fsharp/fsharp)
  • Update init-tools.cmd and init-tools.sh to be the latest from the .NET Core repos.
  • There are a bunch of simplifications and extra checking in FSharpSource,targets
  • Some of the key signing logic has Mono-compat implementations
  • Removed use of tuple structs from the compiler code (this was done when initially updating the LKG. I eventually updated the LKG to one that actually supports tuple structs, but the uses of the feature aren't needed in the compiler code, so I'll remove them in any case)
  • Remove the awful CustomCopyLocal and subst.exe. We can work out how to implement a copy-and-substitute at a later point.
  • Project files on Mono need to use
   <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>

instead of

    <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
  • CoreCLR bits are not built on Mono though the PR includes some preliminary changes in that direction.

We do some things differently on Linux/Mono:

  • UseMicroBuild is off
  • UseSourceLink is off
  • UseGatherBinaries is off
  • AddVsSdkAttributesToSomeCoreComponents is off
  • The define CROSS_PLATFORM_COMPILER is set when building for Mono to workaround a couple of limitations in Mono. The code is written in a way so that it is valid to set it on Windows too, but we don't CI that.

One odd de-capitalization change was needed in init-tools.sh to use microsoft.dotnet.buildtools instead of Microsoft.DotNet.BuildTools since the Linux package gets the former name

@dsyme

dsyme commented Nov 5, 2016

Copy link
Copy Markdown
Contributor Author

@vasily-kirichenko We were missing a BUILD_NET40=1, see this change to build.sh. We can somehow start to unify build.sh and build.cmd logic now to avoid this sort of thing.

Artifacts should be under Debug

@dsyme

dsyme commented Nov 5, 2016

Copy link
Copy Markdown
Contributor Author

We're no longer green on Travis:

                Executing: /home/travis/build/dsyme/visualfsharp/src/fsharp/FSharp.Compiler-proto/../../../packages/FSharp.Compiler.Tools.4.0.1.19/tools/fsi.exe --exec /home/travis/build/dsyme/visualfsharp/src/scripts/fssrgen.fsx "/home/travis/build/dsyme/visualfsharp/src/fsharp/FSComp.txt" "obj/Proto/net40/FSComp.fs"  "obj/Proto/net40/FSComp.resx" 
                args = [|"/home/travis/build/dsyme/visualfsharp/src/scripts/fssrgen.fsx";
                  "/home/travis/build/dsyme/visualfsharp/src/fsharp/FSComp.txt";
                  "obj/Proto/net40/FSComp.fs"; "obj/Proto/net40/FSComp.resx"|]
                /home/travis/build/dsyme/visualfsharp/src/fsharp/FSComp.txt(0): error : An exception occurred when processing
@dsyme

dsyme commented Nov 5, 2016

Copy link
Copy Markdown
Contributor Author

Travis is green again see "travis" branch here https://travis-ci.org/dsyme/visualfsharp/branches

@forki

forki commented Nov 5, 2016

Copy link
Copy Markdown
Contributor

+1,324 −21,315 to make it work on mono.

giphy

@dsyme

dsyme commented Nov 5, 2016

Copy link
Copy Markdown
Contributor Author

@forki Mostly the LKG going. But using FSharp.Compiler.Tools has also uncovered a few problems, especially on Mono (executable bits not set, using F# Interactive scripts on Mono causes codegen failures for some variations on fssrgen.fsx). I'll try to capture those as issues.

@dsyme

dsyme commented Nov 5, 2016

Copy link
Copy Markdown
Contributor Author
@dsyme
dsyme merged commit 66b5179 into dotnet:master Nov 6, 2016
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Jan 26, 2022
This enables a build of this repo using Mono. 

- Use FSharp.Compiler.Tools nuget package as LKG (like fsharp/fsharp)
- Update init-tools.cmd and init-tools.sh to be the latest from the .NET Core repos.
- There are a bunch of simplifications and extra checking in FSharpSource,targets
- Some of the key signing logic has Mono-compat implementations
- Removed use of tuple structs from the compiler code (this was done when initially updating the LKG. I eventually updated the LKG to one that actually supports tuple structs, but the uses of the feature aren't needed in the compiler code, so I'll remove them in any case)
- Adjust CustomCopyLocal and remove subst.exe. We can work out how to implement a copy-and-substitute at a later point.
- Project files on Mono need to use
   <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
instead of

    <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
CoreCLR bits are not built on Mono though the PR includes some preliminary changes in that direction.

We do some things differently on Linux/Mono:

- UseMicroBuild is off
- UseSourceLink is off
- UseGatherBinaries is off
- AddVsSdkAttributesToSomeCoreComponents is off

The define CROSS_PLATFORM_COMPILER is set when building for Mono to workaround a couple of limitations in Mono. The code is written in a way so that it is valid to set it on Windows too, but we don't CI that.

One odd de-capitalization change was needed in init-tools.sh to use microsoft.dotnet.buildtools instead of Microsoft.DotNet.BuildTools since the Linux package gets the former name

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

Labels

None yet

6 participants