项目作者: 71

项目描述 :
Strip all references to FSharp.Core from a .NET assembly at compile-time, using Fody.
高级语言: F#
项目地址: git://github.com/71/Feather.git
创建时间: 2018-06-08T17:47:14Z
项目社区:https://github.com/71/Feather

开源协议:MIT License

下载


Feather.Fody

Feather strips all references to FSharp.Core
from any .NET assembly, by either removing useless attributes and methods or by
replacing them with built-in equivalents.

Feather works fully at compile-time (using Fody), and thus
does not require any runtime dependency.

Therefore, Feather can be used to code in F#, while having outputs assembly that do not
require any extra dependencies, and can thus be used directly within C# projects without
requiring FSharp.Core.

It is currently a work in progress. Right now, all references to FSharp.Core are merely
removed; no equivalent function calls are used.

Installing

The NuGet package has not been published yet. However, as soon as it will be online, the
following will apply to the installation process of Feather.

Add a dependency to your project:

  1. <ItemGroup>
  2. <PackageReference Include="Feather.Fody" Version="0.1.0" ></PackageReference>
  3. </ItemGroup>

Then, install the Feather weaver by creating a FodyWeavers.xml file and setting its content
to:

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Weavers>
  3. <Feather ></Feather>
  4. </Weavers>

Process

See the implementation issue for progress details.

Testing

A test assembly is available in the Feather.TestAssembly directory,
and contains many declarations that make use of F#-specific features.

This assembly is modified by Feather.Fody on compilation, and should then
lose all its references to FSharp.Core.

The Feather.Tests projects finally ensures that both these statements are true:

  • Feather.TestAssembly.dll does not contain any reference to FSharp.Core.
  • Feather.TestAssembly.dll can be loaded, and works flawlessly.

Contributing

Adding tests

  1. Add test cases to Feather.TestAssembly.
  2. Make sure they work after removal of all F# references in Feather.Tests.

Adding replacements

  1. Grab dnSpy to analyze output assemblies.
  2. Find a common pattern or specific use.
  3. Implement a replacement in ModuleWeaver.cs.