File tree Expand file tree Collapse file tree 5 files changed +49
-17
lines changed
integrationtests/i002425-dotnet-cli-tool-works/before/.config
src/test/Fake.Core.IntegrationTests Expand file tree Collapse file tree 5 files changed +49
-17
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "version" : 1 ,
3+ "isRoot" : true ,
4+ "tools" : {}
5+ }
Original file line number Diff line number Diff line change @@ -151,7 +151,8 @@ let version =
151151 None)
152152 |> Seq.append [ 0 I ]
153153 |> Seq.max
154- [ PreReleaseSegment.AlphaNumeric " local" ; PreReleaseSegment.Numeric ( currentVer + 1 I) ], " "
154+ let d = System.DateTime.Now
155+ [ PreReleaseSegment.AlphaNumeric " local" ; PreReleaseSegment.Numeric ( currentVer + 1 I) ], d.ToString( " yyyy-MM-dd_HHmm" )
155156
156157 let semVer = SemVer.parse release.NugetVersion
157158 let prerelease =
Original file line number Diff line number Diff line change @@ -8,31 +8,16 @@ open Expecto
88open Fake.Core .IntegrationTests .TestHelpers
99open System.Diagnostics
1010
11- let dotnetSdk = lazy DotNet.install DotNet.Versions.FromGlobalJson
12-
1311let dllPath = System.IO.Path.GetDirectoryName ( System.Reflection.Assembly.GetExecutingAssembly() .Location)
1412
1513let runProjectRaw noBuild proj args =
16- let options = dotnetSdk.Value ( DotNet.Options.Create())
17-
18- let dir = System.IO.Path.GetDirectoryName options.DotNetCliPath
19- let oldPath =
20- options
21- |> Process.getEnvironmentVariable " PATH"
22-
2314 [
2415 yield " run"
2516 if noBuild then yield " --no-build"
2617 yield ! [ " --project" ; proj; " --" ]
2718 yield ! args |> Args.fromWindowsCommandLine |> Seq.toList
2819 ]
29- |> CreateProcess.fromRawCommand options.DotNetCliPath
30- |> CreateProcess.withEnvironment ( options.Environment |> Map.toList)
31- |> CreateProcess.setEnvironmentVariable " PATH" (
32- match oldPath with
33- | Some oldPath -> sprintf " %s%c%s " dir System.IO.Path.PathSeparator oldPath
34- | None -> dir)
35- |> CreateProcess.withWorkingDirectory options.WorkingDirectory
20+ |> runDotNetRaw
3621
3722let runProject noBuild f proj args =
3823 runProjectRaw noBuild proj args
Original file line number Diff line number Diff line change @@ -8,11 +8,13 @@ open System.IO
88open System.Diagnostics
99open Newtonsoft.Json
1010open Newtonsoft.Json .Linq
11+ open Fake.Core
1112
1213let fail s = Expect.isTrue s false
1314let ignProc = ignore< Fake.Core.ProcessResult>
1415
1516
17+
1618type Declaration =
1719 { File : string
1820 Line : int
@@ -32,10 +34,29 @@ type Target =
3234 Declaration : Declaration
3335 Description : string }
3436
37+ let getInfoVersion () =
38+ let attr = typeof< Fake.Core.Process.ProcessList>. Assembly.GetCustomAttributes( typeof< System.Reflection.AssemblyInformationalVersionAttribute>, false )
39+ match attr |> Seq.tryHead with
40+ | Some (:? Reflection.AssemblyInformationalVersionAttribute as attr) -> attr.InformationalVersion
41+ | None -> failwithf " Could not retrieve version"
3542
3643[<Tests>]
3744let tests =
3845 testList " Fake.Core.IntegrationTests" [
46+ //testCase "fake-cli local tool works" <| fun _ ->
47+ // // dotnet tool install --version 5.19.0-alpha.local.1 fake-cli --add-source /e/Projects/FAKE/release/dotnetcore/
48+ // let res =
49+ // [
50+ // yield! ["tool"; "install"]
51+ // yield! [ "--version"; getInfoVersion () ]
52+ // yield "fake-cli"
53+ // yield! ["--add-source" ]
54+ // ]
55+ // |> runDotNetRaw
56+ // |> CreateProcess.withWorkingDirectory ""
57+ // |> Proc.run
58+ // ()
59+
3960 testCase " no dependencies hello world and casing #2314" <| fun _ ->
4061 let result =
4162 if Paket.Utils.isWindows then
Original file line number Diff line number Diff line change 22module Fake.Core.IntegrationTests.TestHelpers
33
44open Fake.Core
5+ open Fake.DotNet
56open Fake.IO
67open Fake.IO .FileSystemOperators
78open System
@@ -21,6 +22,25 @@ type TestDir =
2122 eprintf " Failed to delete '%s ': %O " x.Dir e
2223 ()
2324
25+ let dotnetSdk = lazy DotNet.install DotNet.Versions.FromGlobalJson
26+
27+ let runDotNetRaw args =
28+ let options = dotnetSdk.Value ( Fake.DotNet.DotNet.Options.Create())
29+
30+ let dir = System.IO.Path.GetDirectoryName options.DotNetCliPath
31+ let oldPath =
32+ options
33+ |> Process.getEnvironmentVariable " PATH"
34+
35+ args
36+ |> CreateProcess.fromRawCommand options.DotNetCliPath
37+ |> CreateProcess.withEnvironment ( options.Environment |> Map.toList)
38+ |> CreateProcess.setEnvironmentVariable " PATH" (
39+ match oldPath with
40+ | Some oldPath -> sprintf " %s%c%s " dir System.IO.Path.PathSeparator oldPath
41+ | None -> dir)
42+ |> CreateProcess.withWorkingDirectory options.WorkingDirectory
43+
2444let createTestDir () =
2545 let testFile = Path.combine ( Path.GetTempPath ()) ( Path.GetRandomFileName ())
2646 Directory.CreateDirectory( testFile)
You can’t perform that action at this time.
0 commit comments