Skip to content

Commit

Permalink
WIP: call nuget restore
Browse files Browse the repository at this point in the history
On legacy non-Windows platforms use make.fsx for build,
that will download nuget and call nuget restore.
  • Loading branch information
webwarrior-ws committed Jan 12, 2023
1 parent ddae982 commit b683357
Show file tree
Hide file tree
Showing 12 changed files with 316 additions and 45 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ jobs:
- name: configure
run: ./configure.sh
- name: build in DEBUG mode
run: make
run: fsharpi --define:LEGACY_FRAMEWORK scripts/make.fsx
- name: run unit tests
run: fsharpi --define:LEGACY_FRAMEWORK scripts/runUnitTests.fsx

Expand Down Expand Up @@ -255,7 +255,7 @@ jobs:
- name: configure
run: ./configure.sh
- name: build in DEBUG mode
run: make
run: fsharpi --define:LEGACY_FRAMEWORK scripts/make.fsx
- name: run unit tests
run: fsharpi --define:LEGACY_FRAMEWORK scripts/runUnitTests.fsx

Expand Down Expand Up @@ -353,7 +353,7 @@ jobs:
- name: configure
run: ./configure.sh
- name: build in DEBUG mode
run: make
run: fsharpi --define:LEGACY_FRAMEWORK scripts/make.fsx
- name: run unit tests
run: fsharpi --define:LEGACY_FRAMEWORK scripts/runUnitTests.fsx

Expand Down Expand Up @@ -395,7 +395,7 @@ jobs:
- name: configure
run: ./configure.sh
- name: build in DEBUG mode
run: make
run: fsharpi --define:LEGACY_FRAMEWORK scripts/make.fsx
- name: run unit tests
run: fsharpi --define:LEGACY_FRAMEWORK scripts/runUnitTests.fsx

Expand Down
40 changes: 21 additions & 19 deletions fsx-legacy.sln
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsdk", "Fsdk\Fsdk-legacy.fsproj", "{4634F264-784E-42DA-B5A1-FE72125DEAFC}"
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsdk-legacy", "Fsdk\Fsdk-legacy.fsproj", "{4634F264-784E-42DA-B5A1-FE72125DEAFC}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "fsxc", "fsxc\fsxc-legacy.fsproj", "{56DA5F03-8F7F-44AB-B692-5A24DB134A8B}"
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "fsxc-legacy", "fsxc\fsxc-legacy.fsproj", "{56DA5F03-8F7F-44AB-B692-5A24DB134A8B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{8E1108BE-590F-4C6D-8496-A8AAEB8594D8}"
ProjectSection(SolutionItems) = preProject
Tools\bump.fsx = Tools\bump.fsx
Tools\replace.fsx = Tools\replace.fsx
Tools\safeRun.fsx = Tools\safeRun.fsx
Tools\nugetPush.fsx = Tools\nugetPush.fsx
Tools\fsi.bat = Tools\fsi.bat
Tools\gitPush1by1.fsx = Tools\gitPush1by1.fsx
Tools\nugetPush.fsx = Tools\nugetPush.fsx
Tools\replace.fsx = Tools\replace.fsx
Tools\safeRun.fsx = Tools\safeRun.fsx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{848BC281-2B17-47DC-B24E-9BD27B013D02}"
ProjectSection(SolutionItems) = preProject
test\test.fs = test\test.fs
test\test.fsx = test\test.fsx
test\testRefLib.fsx = test\testRefLib.fsx
test\testRefLibOutsideCurrentFolder.fsx = test\testRefLibOutsideCurrentFolder.fsx
test\testFsiCommandLineArgs.fsx = test\testFsiCommandLineArgs.fsx
test\testIfDef.fsx = test\testIfDef.fsx
test\testProcess.fsx = test\testProcess.fsx
test\testProcessConcurrency.fsx = test\testProcessConcurrency.fsx
test\testProcessConcurrencySample.fsx = test\testProcessConcurrencySample.fsx
test\testTsv.fsx = test\testTsv.fsx
test\testProcess.fsx = test\testProcess.fsx
test\testProcessSample.fsx = test\testProcessSample.fsx
test\testRefLib.fsx = test\testRefLib.fsx
test\testRefLibOutsideCurrentFolder.fsx = test\testRefLibOutsideCurrentFolder.fsx
test\testRefNugetLib.fsx = test\testRefNugetLib.fsx
test\testFsiCommandLineArgs.fsx = test\testFsiCommandLineArgs.fsx
test\testIfDef.fsx = test\testIfDef.fsx
test\testRefNugetLibNewFormat.fsx = test\testRefNugetLibNewFormat.fsx
test\testRefNugetLibNewFormatWithVersion.fsx = test\testRefNugetLibNewFormatWithVersion.fsx
test\testTsv.fsx = test\testTsv.fsx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DBAE02AB-5972-403C-B18B-ED1DFE362054}"
ProjectSection(SolutionItems) = preProject
scripts\build.sh = scripts\build.sh
.github\workflows\CI.yml = .github\workflows\CI.yml
compileFSharpScripts.fsx = compileFSharpScripts.fsx
configure.sh = configure.sh
Makefile = Makefile
scripts\fsx.bat = scripts\fsx.bat
scripts\install.sh = scripts\install.sh
launcher.fsx = launcher.fsx
scripts\build.sh = scripts\build.sh
scripts\launcher.sh = scripts\launcher.sh
compileFSharpScripts.fsx = compileFSharpScripts.fsx
make.bat = make.bat
scripts\make.fsx = scripts\make.fsx
.github\workflows\CI.yml = .github\workflows\CI.yml
Makefile = Makefile
scripts\runTests.fsx = scripts\runTests.fsx
scripts\fsx.bat = scripts\fsx.bat
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsdk.Tests", "Fsdk.Tests\Fsdk.Tests-legacy.fsproj", "{43BA7E25-975B-4DF9-B274-EEF6C806C1D0}"
Expand All @@ -75,4 +74,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7CEE0192-68F5-495E-B914-5B554D01A3D7}
EndGlobalSection
EndGlobal
31 changes: 12 additions & 19 deletions fsx.sln
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1703.8
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "fsxc", "fsxc\fsxc.fsproj", "{9E754152-E69A-4DB9-B23A-3B72C189FF5A}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsxc", "fsxc\fsxc.fsproj", "{9E754152-E69A-4DB9-B23A-3B72C189FF5A}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsdk", "Fsdk\Fsdk.fsproj", "{B532D664-2864-4532-9673-3E52DD363BB9}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Fsdk", "Fsdk\Fsdk.fsproj", "{B532D664-2864-4532-9673-3E52DD363BB9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{17C46E45-4C73-4981-9EE4-686675C2DDBB}"
ProjectSection(SolutionItems) = preProject
scripts\build.sh = scripts\build.sh
.github\workflows\CI.yml = .github\workflows\CI.yml
compileFSharpScripts.fsx = compileFSharpScripts.fsx
configure.sh = configure.sh
Makefile = Makefile
scripts\fsx.bat = scripts\fsx.bat
scripts\install.sh = scripts\install.sh
launcher.fsx = launcher.fsx
scripts\build.sh = scripts\build.sh
scripts\launcher.sh = scripts\launcher.sh
compileFSharpScripts.fsx = compileFSharpScripts.fsx
make.bat = make.bat
scripts\make.fsx = scripts\make.fsx
.github\workflows\CI.yml = .github\workflows\CI.yml
Makefile = Makefile
scripts\runTests.fsx = scripts\runTests.fsx
scripts\fsx.bat = scripts\fsx.bat
scripts\runUnitTests.fsx = scripts\runUnitTests.fsx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C51659D1-9E99-4C52-A7E4-DCD12922AE73}"
Expand All @@ -29,6 +30,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C51659D1-9
test\test.fsx = test\test.fsx
test\testFsiCommandLineArgs.fsx = test\testFsiCommandLineArgs.fsx
test\testIfDef.fsx = test\testIfDef.fsx
test\testLegacyFx.fsx = test\testLegacyFx.fsx
test\testNonLegacyFx.fsx = test\testNonLegacyFx.fsx
test\testProcess.fsx = test\testProcess.fsx
test\testProcessConcurrency.fsx = test\testProcessConcurrency.fsx
test\testProcessConcurrencySample.fsx = test\testProcessConcurrencySample.fsx
Expand All @@ -39,19 +42,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C51659D1-9
test\testRefNugetLibNewFormat.fsx = test\testRefNugetLibNewFormat.fsx
test\testRefNugetLibNewFormatWithVersion.fsx = test\testRefNugetLibNewFormatWithVersion.fsx
test\testTsv.fsx = test\testTsv.fsx
test\testLegacyFx.fsx = test\testLegacyFx.fsx
test\testNonLegacyFx.fsx = test\testNonLegacyFx.fsx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{FD764CDA-F880-4954-BA6C-1FC678D64988}"
ProjectSection(SolutionItems) = preProject
Tools\bump.fsx = Tools\bump.fsx
Tools\replace.fsx = Tools\replace.fsx
Tools\safeRun.fsx = Tools\safeRun.fsx
Tools\nugetPush.fsx = Tools\nugetPush.fsx
Tools\fsi.bat = Tools\fsi.bat
Tools\gitPush1by1.fsx = Tools\gitPush1by1.fsx
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Fsdk.Tests", "Fsdk.Tests\Fsdk.Tests.fsproj", "{43BA7E25-975B-4DF9-B274-EEF6C806C1D0}"
EndProject
Expand Down
73 changes: 70 additions & 3 deletions scripts/make.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,67 @@ let FindBuildTool() : string * string =
match Misc.GuessPlatform() with
| Misc.Platform.Linux
| Misc.Platform.Mac ->
failwith
"cannot find buildTool because this script is not ready for Unix yet"
let buildConfigFileName = "build.config"

let buildConfigContents =
let buildConfig =
Path.Combine(RootDir.FullName, buildConfigFileName)
|> FileInfo

if not(buildConfig.Exists) then
let configureLaunch =
match Misc.GuessPlatform() with
| Misc.Platform.Windows -> ".\\configure.bat"
| _ -> "./configure.sh"

Console.Error.WriteLine(
sprintf
"ERROR: configure hasn't been run yet, run %s first"
configureLaunch
)

Environment.Exit 1

let configFileLines = File.ReadAllLines buildConfig.FullName

let skipBlankLines line =
not <| String.IsNullOrWhiteSpace line

let splitLineIntoKeyValueTuple(line: string) =
let pair =
line.Split([| '=' |], StringSplitOptions.RemoveEmptyEntries)

if pair.Length <> 2 then
failwithf
"All lines in '%s' must conform to key=value format, but got: '%s'. All lines: \n%s"
buildConfigFileName
line
(File.ReadAllText buildConfig.FullName)

pair.[0], pair.[1]

let buildConfigContents =
configFileLines
|> Array.filter skipBlankLines
|> Array.map splitLineIntoKeyValueTuple
|> Map.ofArray

buildConfigContents

let maybeBuildTool = Map.tryFind "BuildTool" buildConfigContents

match maybeBuildTool with
| None ->
failwith
"A BuildTool should have been chosen by the configure script, please report this bug"
| Some "dotnet" ->
#if LEGACY_FRAMEWORK
failwith
"'dotnet' shouldn't be the build tool when using legacy framework, please report this bug"
#endif
"dotnet", "build"
| Some otherBuildTool ->
otherBuildTool, String.Empty
| Misc.Platform.Windows ->
#if !LEGACY_FRAMEWORK
"dotnet", "build"
Expand Down Expand Up @@ -156,6 +215,9 @@ let JustBuild binaryConfig =
#else
let solFile = "fsx-legacy.sln"

if not NugetExe.Exists then
Network.DownloadNugetExe NugetExe

Network.RunNugetCommand
NugetExe
(sprintf "restore %s" solFile)
Expand All @@ -179,7 +241,12 @@ let MakeAll() =
buildConfig

let programFiles =
Environment.GetEnvironmentVariable "ProgramW6432" |> DirectoryInfo
let programFilesPath = Environment.GetEnvironmentVariable "ProgramW6432"

if isNull programFilesPath then // hack for unix platforms so that script doesn't crash
DirectoryInfo "/"
else
DirectoryInfo programFilesPath

let fsxInstallationDir =
Path.Combine(programFiles.FullName, "fsx") |> DirectoryInfo
Expand Down
1 change: 1 addition & 0 deletions test/errProp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Binary file added test/lib/test2.dll
Binary file not shown.
104 changes: 104 additions & 0 deletions test/test1.deps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"test1/1.0.0": {
"dependencies": {
"FSharp.Core": "7.0.0",
"NETStandard.Library": "2.0.3"
},
"runtime": {
"test1.dll": {}
}
},
"FSharp.Core/7.0.0": {
"runtime": {
"lib/netstandard2.0/FSharp.Core.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.56703"
}
},
"resources": {
"lib/netstandard2.0/cs/FSharp.Core.resources.dll": {
"locale": "cs"
},
"lib/netstandard2.0/de/FSharp.Core.resources.dll": {
"locale": "de"
},
"lib/netstandard2.0/es/FSharp.Core.resources.dll": {
"locale": "es"
},
"lib/netstandard2.0/fr/FSharp.Core.resources.dll": {
"locale": "fr"
},
"lib/netstandard2.0/it/FSharp.Core.resources.dll": {
"locale": "it"
},
"lib/netstandard2.0/ja/FSharp.Core.resources.dll": {
"locale": "ja"
},
"lib/netstandard2.0/ko/FSharp.Core.resources.dll": {
"locale": "ko"
},
"lib/netstandard2.0/pl/FSharp.Core.resources.dll": {
"locale": "pl"
},
"lib/netstandard2.0/pt-BR/FSharp.Core.resources.dll": {
"locale": "pt-BR"
},
"lib/netstandard2.0/ru/FSharp.Core.resources.dll": {
"locale": "ru"
},
"lib/netstandard2.0/tr/FSharp.Core.resources.dll": {
"locale": "tr"
},
"lib/netstandard2.0/zh-Hans/FSharp.Core.resources.dll": {
"locale": "zh-Hans"
},
"lib/netstandard2.0/zh-Hant/FSharp.Core.resources.dll": {
"locale": "zh-Hant"
}
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
"NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
}
}
},
"libraries": {
"test1/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"FSharp.Core/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-UcPaa9FW4civPrXL059dEa6Pk8ZMfllEf9RRcChv0reBLnM1WfcXXn7pW357FxGb+CUosq0W93TevJQ6z8G93g==",
"path": "fsharp.core/7.0.0",
"hashPath": "fsharp.core.7.0.0.nupkg.sha512"
},
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
"NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"path": "netstandard.library/2.0.3",
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
}
}
}
Binary file added test/test1.dll
Binary file not shown.
Binary file added test/test1.pdb
Binary file not shown.
Loading

1 comment on commit b683357

@knocte
Copy link
Member

@knocte knocte commented on b683357 Jan 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@webwarrior-ws you have erroneously pushed binary files here, please remove them (and next time use git gui command to make sure you know what you're committing, visually)

Please sign in to comment.