This repository was archived by the owner on Jul 18, 2024. It is now read-only.
File tree 3 files changed +31
-8
lines changed
CSharpInteractive.HostApi
Samples/MySampleLib/Build
3 files changed +31
-8
lines changed Original file line number Diff line number Diff line change 2
2
.idea /
3
3
** /bin
4
4
** /obj
5
-
6
5
* .user
7
6
.teamcity /target /
8
7
.reports /
9
- .packages
8
+ .packages
9
+ .publish
Original file line number Diff line number Diff line change @@ -97,7 +97,6 @@ public IStartInfo GetStartInfo(IHost host)
97
97
. AddNotEmptyArgs ( Project )
98
98
. WithWorkingDirectory ( WorkingDirectory )
99
99
. WithVars ( Vars . ToArray ( ) )
100
- . AddMSBuildLoggers ( host , Verbosity )
101
100
. AddTestLoggers ( host , Loggers )
102
101
. AddArgs (
103
102
( "--settings" , Settings ) ,
@@ -130,6 +129,11 @@ public IStartInfo GetStartInfo(IHost host)
130
129
. AddProps ( "-p" , Props . ToArray ( ) )
131
130
. AddArgs ( Args . ToArray ( ) ) ;
132
131
132
+ if ( string . IsNullOrWhiteSpace ( Project ) || Path . GetExtension ( Project ) . ToLowerInvariant ( ) != ".dll" )
133
+ {
134
+ cmd = cmd . AddMSBuildLoggers ( host , Verbosity ) ;
135
+ }
136
+
133
137
var runSettings = RunSettings . Select ( i => $ "{ i . name } ={ i . value } ") . ToArray ( ) ;
134
138
if ( runSettings . Any ( ) )
135
139
{
Original file line number Diff line number Diff line change 1
- using HostApi ;
1
+ using System . Web ;
2
+ using HostApi ;
2
3
using Microsoft . Extensions . DependencyInjection ;
3
4
using NuGet . Versioning ;
4
5
62
63
. Build ( )
63
64
. EnsureSuccess ( ) ;
64
65
65
- foreach ( var warn in buildResult . Warnings )
66
+ foreach ( var warn in buildResult . Warnings
67
+ . Where ( warn => Path . GetFileName ( warn . File ) == "Calculator.cs" )
68
+ . Select ( warn => $ "{ warn . Code } ({ warn . LineNumber } :{ warn . ColumnNumber } )")
69
+ . Distinct ( ) )
66
70
{
67
- Info ( $ "{ warn . State } { warn . Code } : { warn . File } ({ warn . LineNumber } :{ warn . ColumnNumber } )") ;
71
+ await new HttpClient ( ) . GetAsync (
72
+ "https://api.telegram.org/bot7102686717:AAEHw7HZinme_5kfIRV7TwXK4Xql9WPPpM3/sendMessage?chat_id=878745093&text=" +
73
+ HttpUtility . UrlEncode ( warn ) ) ;
68
74
}
69
75
70
- // Asynchronous wayD
76
+ var publishDir = Path . GetFullPath ( ".publish" ) ;
77
+ new DotNetPublish ( )
78
+ . WithConfiguration ( configuration ) . WithNoLogo ( true ) . WithNoBuild ( true )
79
+ . WithFramework ( "net8.0" ) . WithOutput ( publishDir )
80
+ . Build ( )
81
+ . EnsureSuccess ( ) ;
82
+
83
+ var test = new DotNetTest ( )
84
+ . WithWorkingDirectory ( publishDir )
85
+ . WithProject ( "MySampleLib.Tests.dll" ) ;
86
+
87
+ test . Build ( ) . EnsureSuccess ( ) ;
88
+
89
+ // Asynchronous way
71
90
var cts = new CancellationTokenSource ( ) ;
72
91
await new DotNetTest ( )
73
92
. WithConfiguration ( configuration )
77
96
{
78
97
if ( i . TestResult is { State : TestState . Failed } )
79
98
{
80
- // cts.Cancel();
99
+ cts . Cancel ( ) ;
81
100
}
82
101
} , cts . Token )
83
102
. EnsureSuccess ( ) ;
You can’t perform that action at this time.
0 commit comments