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 =
151
151
None)
152
152
|> Seq.append [ 0 I ]
153
153
|> 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" )
155
156
156
157
let semVer = SemVer.parse release.NugetVersion
157
158
let prerelease =
Original file line number Diff line number Diff line change @@ -8,31 +8,16 @@ open Expecto
8
8
open Fake.Core .IntegrationTests .TestHelpers
9
9
open System.Diagnostics
10
10
11
- let dotnetSdk = lazy DotNet.install DotNet.Versions.FromGlobalJson
12
-
13
11
let dllPath = System.IO.Path.GetDirectoryName ( System.Reflection.Assembly.GetExecutingAssembly() .Location)
14
12
15
13
let 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
-
23
14
[
24
15
yield " run"
25
16
if noBuild then yield " --no-build"
26
17
yield ! [ " --project" ; proj; " --" ]
27
18
yield ! args |> Args.fromWindowsCommandLine |> Seq.toList
28
19
]
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
36
21
37
22
let runProject noBuild f proj args =
38
23
runProjectRaw noBuild proj args
Original file line number Diff line number Diff line change @@ -8,11 +8,13 @@ open System.IO
8
8
open System.Diagnostics
9
9
open Newtonsoft.Json
10
10
open Newtonsoft.Json .Linq
11
+ open Fake.Core
11
12
12
13
let fail s = Expect.isTrue s false
13
14
let ignProc = ignore< Fake.Core.ProcessResult>
14
15
15
16
17
+
16
18
type Declaration =
17
19
{ File : string
18
20
Line : int
@@ -32,10 +34,29 @@ type Target =
32
34
Declaration : Declaration
33
35
Description : string }
34
36
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"
35
42
36
43
[<Tests>]
37
44
let tests =
38
45
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
+
39
60
testCase " no dependencies hello world and casing #2314" <| fun _ ->
40
61
let result =
41
62
if Paket.Utils.isWindows then
Original file line number Diff line number Diff line change 2
2
module Fake.Core.IntegrationTests.TestHelpers
3
3
4
4
open Fake.Core
5
+ open Fake.DotNet
5
6
open Fake.IO
6
7
open Fake.IO .FileSystemOperators
7
8
open System
@@ -21,6 +22,25 @@ type TestDir =
21
22
eprintf " Failed to delete '%s ': %O " x.Dir e
22
23
()
23
24
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
+
24
44
let createTestDir () =
25
45
let testFile = Path.combine ( Path.GetTempPath ()) ( Path.GetRandomFileName ())
26
46
Directory.CreateDirectory( testFile)
You can’t perform that action at this time.
0 commit comments