@@ -463,7 +463,14 @@ let createFableDir (opts: CrackerOptions) =
463463
464464 fableDir
465465
466- let copyDirIfDoesNotExist ( source : string ) ( target : string ) =
466+ // Replace the .fsproj extension with .fableproj for files in fable_modules
467+ // We do this to avoid conflicts with other F# tooling that scan for .fsproj files
468+ let changeFsprojToFableproj ( path : string ) =
469+ if path.EndsWith( " .fsproj" ) then
470+ IO.Path.ChangeExtension( path, Naming.fableProjExt)
471+ else path
472+
473+ let copyDirIfDoesNotExist replaceFsprojExt ( source : string ) ( target : string ) =
467474 if isDirectoryEmpty target then
468475 IO.Directory.CreateDirectory( target) |> ignore
469476 if IO.Directory.Exists source |> not then
@@ -472,8 +479,10 @@ let copyDirIfDoesNotExist (source: string) (target: string) =
472479 let target = target.TrimEnd( '/' , '\\' )
473480 for dirPath in IO.Directory.GetDirectories( source, " *" , IO.SearchOption.AllDirectories) do
474481 IO.Directory.CreateDirectory( dirPath.Replace( source, target)) |> ignore
475- for newPath in IO.Directory.GetFiles( source, " *.*" , IO.SearchOption.AllDirectories) do
476- IO.File.Copy( newPath, newPath.Replace( source, target), true )
482+ for fromPath in IO.Directory.GetFiles( source, " *.*" , IO.SearchOption.AllDirectories) do
483+ let toPath = fromPath.Replace( source, target)
484+ let toPath = if replaceFsprojExt then changeFsprojToFableproj toPath else toPath
485+ IO.File.Copy( fromPath, toPath, true )
477486
478487let copyFableLibraryAndPackageSources ( opts : CrackerOptions ) ( pkgs : FablePackage list ) =
479488 let fableLibDir = createFableDir opts
@@ -501,15 +510,16 @@ let copyFableLibraryAndPackageSources (opts: CrackerOptions) (pkgs: FablePackage
501510
502511 Log.verbose( lazy ( " fable-library: " + fableLibrarySource))
503512 let fableLibraryTarget = IO.Path.Combine( fableLibDir, " fable-library" + " ." + Literals.VERSION)
504- copyDirIfDoesNotExist fableLibrarySource fableLibraryTarget
513+ copyDirIfDoesNotExist false fableLibrarySource fableLibraryTarget
505514 fableLibraryTarget
506515
507516 let pkgRefs =
508517 pkgs |> List.map ( fun pkg ->
509518 let sourceDir = IO.Path.GetDirectoryName( pkg.FsprojPath)
510519 let targetDir = IO.Path.Combine( fableLibDir, pkg.Id + " ." + pkg.Version)
511- copyDirIfDoesNotExist sourceDir targetDir
512- { pkg with FsprojPath = IO.Path.Combine( targetDir, IO.Path.GetFileName( pkg.FsprojPath)) })
520+ copyDirIfDoesNotExist true sourceDir targetDir
521+ let fsprojFile = IO.Path.GetFileName( pkg.FsprojPath) |> changeFsprojToFableproj
522+ { pkg with FsprojPath = IO.Path.Combine( targetDir, fsprojFile) })
513523
514524 fableLibraryPath, pkgRefs
515525
0 commit comments