-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional precompiling of build script #646
Comments
Yes we thought about a precompile mode. PullRequests are very welcome. |
I'm trying to determine how to make precompiled build script executable being able to load assemblies referenced in original build script when executable is executed on Microsoft .NET runtime (i.e. without possibility to use MONO_PATH). Unfortunately, I don't have access to Windows machine for experiments and don't have any prior .NET knowledge, so I need help. After scanning web for relevant information, I found that Microsoft runtime hasn't equivalent of MONO_PATH (there is DEVPATH, but it requires editing of It seems like Microsoft runtime just doesn't provide official way for aiding it in searching of arbitrary assembly on disk without prior knowledge of assembly version and assembly type (whether it's strong-named or weak-named). I think, it's only possible to put executable ( Is there any other way? |
So far, I'm continuing to collect information necessary for creating cross-platform PR (as I don't have any prior .NET ecosystem/infrastructure knowledge). My <configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="packages/FAKE/tools;build/CustomFakeTask"/>
</assemblyBinding>
</runtime>
</configuration> So, There is Microsoft knowledge base article 837908: "How to load an assembly at runtime that is located in a folder that is not the bin folder of the application". It describes three methods: using GAC, using However using So creating Contents of Also, usage of |
I have been doing experiments on saving the AssemblyBuilder that FSI generates to disk. It requires a small change to FSharp.Compiler.Service, but the implementation on the FAKE side looks to be quite clean. After running let assemBuilder = session.DynamicAssembly :?> System.Reflection.Emit.AssemblyBuilder
assemBuilder.Save("FSI-ASSEMBLY.dll") Then, save that to a cache location(.fake/build.dll perhaps), along with a crc32 hash of the script files used to compile. Then on next run, check if that cache assembly exists, do a fresh crc32 hash of build.fsx and any That would eliminate any need to muck around with the compiler. The is dependent on fsharp/fsharp-compiler-docs#365 getting accepted. |
I've tried to precompile build script into executable and found that running executable saves me about 5-7 seconds. Build script isn't being changed often, so i'd like to see option
--precompile-build-script=<path_to_executable>
with approximately following behavior (in some pseudocode):Right now I'm using external script for precompiling.
It's necessary to use
#I
in build script to letfsharpc
find FAKE libs without passing any option to compiler:Then this script should work (create it in the same dir as build script named
build.fsx
, compiled executable is placed inbuild/
subdirectory):When build script includes
RunTargetOrDefault "TargetName"
, running executable will invoke default target. FAKE options are passed to executable as environment variables:The text was updated successfully, but these errors were encountered: