ionide / fstoml

Lightweight TOML based F# project file
MIT License
36 stars 7 forks source link

Minimal spec #1

Open alfonsogarciacaro opened 8 years ago

alfonsogarciacaro commented 8 years ago

We need a minimal spec to start working on. I guess it should include:

cloudRoutine commented 8 years ago

I don't think author should be included

The <name> <assemblyname> and <rootnamespace> properties can all be filled using the filename

myproject1.fstoml generates myproject1.fsproj

I think we should start with

Krzysztof-Cieslak commented 8 years ago

Dll references

This is bit... more complex.

There are at least 3 important types of references in MsBuild:

  1. GAC references (just saying System.Xml)
  2. Dll references (exact relative path to dll file - that's how NuGet packages are added [but also local non-NuGeted libraries)
  3. Project references (path to fsproj and GUID (!) [again optional from MsBuild point of view, required by VS])

I guess we could also add Package references (just saying Newtonsoft.Json) which would be resolved internally by Paket

Author (optional)

I would go with Author (preferably list of Authors), would also add optional git repository link... but it's not something super important to be fair.

I'd also think about adding description, project version etc - we could generate not only fsproj but also AssemblyConfig.fs [and maybe one day we won't need those ;) ]

cloudRoutine commented 8 years ago

@Krzysztof-Cieslak i'm not talking about <ProjectReference>, only GAC and relative path <Reference>

We don't have to worry about adding package references to the fstoml file initially. We can just use paket the same way we normally would. We just need to generate the fsproj and then run paket install on a fresh clone.

Krzysztof-Cieslak commented 8 years ago

We don't have to worry about adding package references to the fstoml file initially. We can just use paket the same way we normally would. We just need to generate the fsproj and then run paket install on a fresh clone.

Too be honest it sounds like half-baked solution, don't see any reason to skip it out for now - we can simply depend on Paket.Core library and resolve those references without running additional paket install

cloudRoutine commented 8 years ago

I wasn't saying that should be the ultimate goal for handling package references, we're talking about the bare minimum to get it running.

Unless you plan on implementing it yourself, don't expect to see it in the first version :stuck_out_tongue_winking_eye:

alfonsogarciacaro commented 8 years ago

So something like this would work?

[info]
fstoml-version = "0.0.1"
fsharpcore-version = "4.1"
target = "library"
references = [
  "node_modules/fable-core/Fable.Core.dll"
]
files = [
  "File1.fs",
  "File2.fs"
]

Questions:

cloudRoutine commented 8 years ago

rough example

fstomlVersion   = '0.0.1.0'
name            = "project name"
assemblyName    = "project name"
rootNamespace   = "project name"
projectGuid     = "bb0c6f01-5e57-4575-a498-5de850d9fa6c"
outputType      = "Library"
FSharpCore      = "4.4.0.0"
TargetFramework = "netcore-1.6"

Files = [
    { None = "paket.references" },
    { Compile = "src/file.fs" },
    { Compile = "src/file2.fs", Link = "src/uselessLink.fs" },
    { Compile = "src/file3.fs", Sig = "src/file3.fsi" },
    { None    = "src/script.fsx", Private = true },
]   

References = [
    { Include = "System" },
    { Include = "FSharp.Core" },
    { Include = "Fable.Core" },
]

ProjectReferences = [
    { Name = Arg, Project = "f3d0b372-3af7-49d9-98ed-5a78e9416098", Private = true }
]

[ Config ] 
# keys defined in config apply to all descendents, 
# but can be overwritten in nested tables 

Tailcalls = true
WarningsAsErrors = true

[ Config.Debug ]
    Constants = [ 'DEBUG', 'FABLE' ]
    DebugSymbols = true
    DebugType = 'full'
    Optimize = false
    NoWarn = [52, 40]
    OtherFlags = [ '--warnon:1182' ]

[ Config.Debug.x86 ]
    OutputPath = "bin/Debug/x86"

[ Config.Debug.x64 ]
    OutputPath = "bin/Debug/x64"

[ Config.Release ]
    Constants = [ 'RELEASE', 'FABLE' ]
    DebugSymbols = false
    DebugType = 'pdb'
    Optimize = true

[ Config.Release.x86 ]
    OutputPath = "bin/Release/x86"

[ Config.Release.x64 ]
    OutputPath = "bin/Release/x64"
Krzysztof-Cieslak commented 8 years ago
References = [
    { Include = "System" },
    { Include = "FSharp.Core" },
    { Include = "Fable.Core" },
]

do we need use Include = "stuff" ? I don't think there are other types of references, are there?


Also, as much of config as possible should have sane defaults, maybe something like:

Tailcalls = true
WarningsAsErrors = true

[ Config.Debug ]
 Constants = [ 'DEBUG']
    DebugSymbols = true
    DebugType = 'full'
    Optimize = false
[ Config.Debug.x86 ]
    OutputPath = "bin/Debug/x86"

[ Config.Debug.x64 ]
    OutputPath = "bin/Debug/x64"

[ Config.Release ]
    Constants = [ 'RELEASE' ]
    DebugSymbols = false
    DebugType = 'pdb'
    Optimize = true

[ Config.Release.x86 ]
    OutputPath = "bin/Release/x86"

[ Config.Release.x64 ]
    OutputPath = "bin/Release/x64"

This way we could really simplify file for most usages.

cloudRoutine commented 8 years ago

we do need the Include, because there's also HintPath CopyLocal SpecificVersion Name (we probably won't use name)

I would like to use at least a simple form of substitution, %(platform), that'll simplify it even more

[Config]
OutputPath = "%(Configuration)/%(Platform)"
Krzysztof-Cieslak commented 8 years ago

we do need the Include, because there's also HintPath CopyLocal SpecificVersion Name (we probably won't use name)

Right, forgot about that, my bad.

alfonsogarciacaro commented 8 years ago

I'd like also to have the defaults. For Fable projects ideally it should be possible to to have configs with little more than the list of files and a couple of references.

cloudRoutine commented 8 years ago

yea there'll be defaults, just like there are with fsproj