Skip to content

Commit

Permalink
Try to fix #3244
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsogarciacaro committed Oct 31, 2022
1 parent db4836d commit f749760
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/Fable.Cli/ProjectCracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,14 @@ let getProjectOptionsFromProjectFile =

let analyzer = manager.GetProject(projFile)
// If the project targets multiple frameworks, multiple results will be returned
// For now we just take the first one
// For now we just take the first one with non-empty command
let result =
match analyzer.Build() |> Seq.toList with
| result::_ -> result
// TODO: Get Buildalyzer errors from the log
| [] -> $"Cannot parse {projFile}" |> Fable.FableError |> raise
analyzer.Build()
|> Seq.tryFind (fun r -> String.IsNullOrEmpty(r.Command) |> not)
|> function
| Some result -> result
// TODO: Get Buildalyzer errors from the log
| None -> $"Cannot parse {projFile}" |> Fable.FableError |> raise
let projDir = IO.Path.GetDirectoryName(projFile)
let projOpts =
// result.CompilerArguments doesn't seem to work well in Linux
Expand All @@ -431,13 +433,13 @@ let getProjectOptionsFromProjectFile =
/// As we'll merge this later with other projects we'll only take the sources and
/// the references, checking if some .dlls correspond to Fable libraries
let fullCrack (opts: CrackerOptions): CrackedFsproj =
// if not opts.NoRestore then
// Process.runSync (IO.Path.GetDirectoryName projFile) "dotnet" [
// "restore"
// IO.Path.GetFileName projFile
// for constant in opts.FableOptions.Define do
// $"-p:{constant}=true"
// ] |> ignore
if not opts.NoRestore then
Process.runSync (IO.Path.GetDirectoryName opts.ProjFile) "dotnet" [
"restore"
IO.Path.GetFileName opts.ProjFile
for constant in opts.FableOptions.Define do
$"-p:{constant}=true"
] |> ignore

let projOpts, projRefs, msbuildProps =
getProjectOptionsFromProjectFile opts opts.ProjFile
Expand Down

0 comments on commit f749760

Please sign in to comment.