Skip to content

Commit

Permalink
Fixed Fable library import for precompiled inline funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
ncave committed Sep 26, 2022
1 parent 0211f48 commit b249843
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Fable.Cli/bin/Debug/net5.0/fable.dll",
"program": "${workspaceFolder}/src/Fable.Cli/bin/Debug/net6.0/fable.dll",
"args": ["watch", "--cwd", "src/quicktest", "--exclude", "Fable.Core", "--noCache", "--runScript"],
"cwd": "${workspaceFolder}",
"stopAtEntry": true,
Expand Down Expand Up @@ -45,7 +45,7 @@
"name": "Run Fable.Cli",
"type": "coreclr",
"request": "launch",
"program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net5.0/fable.dll",
"program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net6.0/fable.dll",
"args": ["watch", "--exclude", "Fable.Core"],
"cwd": "${workspaceRoot}/src/quicktest",
"stopAtEntry": false,
Expand Down Expand Up @@ -99,7 +99,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net5.0/fable.dll",
"program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net6.0/fable.dll",
"args": ["--outDir", "${workspaceRoot}/../fable-test", "--fableLib", "../../Fable/build/fable-library-rust", "--exclude", "Fable.Core", "--lang", "Rust", "--noCache"],
"cwd": "${workspaceRoot}/../fable-test",
"stopAtEntry": false,
Expand All @@ -110,7 +110,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net5.0/fable.dll",
"program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net6.0/fable.dll",
"args": ["--outDir", "${workspaceRoot}/build/tests/Rust", "--exclude", "Fable.Core", "--lang", "Rust", "--noCache"],
"cwd": "${workspaceRoot}/tests/Rust",
"stopAtEntry": false,
Expand All @@ -121,7 +121,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net5.0/fable.dll",
"program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net6.0/fable.dll",
"args": ["--outDir", "${workspaceRoot}/build/fable-library-rust/src", "--fableLib", ".", "--exclude", "Fable.Core", "--lang", "Rust", "--noCache", "--define", "FABLE_LIBRARY"],
"cwd": "${workspaceRoot}/src/fable-library-rust/src",
"stopAtEntry": false,
Expand Down
4 changes: 3 additions & 1 deletion src/Fable.Transforms/State.fs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ type CompilerImpl(currentFile, project: Project, options, fableLibraryDir: strin

member _.WillPrecompileInlineFunction(file) =
let fableLibraryDir =
Path.Combine(Path.GetDirectoryName(currentFile), fableLibraryDir)
if Path.isRelativePath fableLibraryDir then
Path.Combine(Path.GetDirectoryName(currentFile), fableLibraryDir)
else fableLibraryDir
|> Path.getRelativeFileOrDirPath false file true
CompilerImpl(file, project, options, fableLibraryDir, ?outDir=outDir, ?outType=outType,
?watchDependencies=watchDependencies, logs=logs, isPrecompilingInlineFunction=true)
Expand Down
4 changes: 2 additions & 2 deletions src/fable-standalone/test/bench-compiler/app.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module Fable.Compiler.App
open Fable.Compiler.Platform
open Fable.Compiler.ProjectParser

let getMetadataDir(): string = "../../../fable-metadata/lib/"
let getFableLibDir(): string = "../../../../build/fable-library"
let getMetadataDir(): string = __SOURCE_DIRECTORY__ + "/../../../fable-metadata/lib/"
let getFableLibDir(): string = __SOURCE_DIRECTORY__ + "/../../../../build/fable-library"
let getVersion(): string = ".next"
let initFable (): Fable.Standalone.IFableManager = Fable.Standalone.Main.init ()

Expand Down
2 changes: 1 addition & 1 deletion src/fable-standalone/test/bench-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"benchmark-es": "node out-node/app.js bench-compiler.fsproj out-node2 --benchmark",

"compile-native": "dotnet publish -c Release -r win-x64",
"native": "cd . && \"bin/Release/net5.0/win-x64/native/bench-compiler\"",
"native": "cd . && \"bin/Release/net6.0/win-x64/native/bench-compiler\"",
"build-native": "npm run native bench-compiler.fsproj out-node",
"build-test-native": "npm run native ../../../../../fable-test/fable-test.fsproj out-test",
"build-tests-native": "npm run native ../../../../tests/Js/Main/Fable.Tests.fsproj out-tests",
Expand Down

0 comments on commit b249843

Please sign in to comment.