-
Notifications
You must be signed in to change notification settings - Fork 11
Add WriteProgress and OpenProgress methods #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| namespace JetBrains.TeamCity.ServiceMessages.Tests.Write.Specials | ||
| { | ||
| using NUnit.Framework; | ||
| using ServiceMessages.Write.Special; | ||
| using ServiceMessages.Write.Special.Impl.Writer; | ||
|
|
||
| [TestFixture] | ||
| public class TeamCityProgressWriterTest : TeamCityWriterBaseTest<ITeamCityProgressWriter> | ||
| { | ||
| protected override ITeamCityProgressWriter Create(IServiceMessageProcessor proc) | ||
| { | ||
| return new TeamCityProgressWriter(proc); | ||
| } | ||
|
|
||
| [Test] | ||
| public void TestProgressMessage() | ||
| { | ||
| DoTest(x => x.WriteProgress("aaaa"), "##teamcity[progressMessage 'aaaa']"); | ||
| } | ||
|
|
||
| [Test] | ||
| public void OpenProgressBlock() | ||
| { | ||
| DoTest(x => x.OpenProgress("aaaa").Dispose(), | ||
| "##teamcity[progressStart 'aaaa']", | ||
| "##teamcity[progressFinish 'aaaa']"); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace JetBrains.TeamCity.ServiceMessages.Write.Special | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using System; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <para> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Use <see cref="WriteProgress"/> method to add progress message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <pre> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// ##teamcity[progressMessage '<message text>' ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </pre> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </para> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <para> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Use <see cref="OpenProgress"/> method to add progress message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <pre>##teamcity[progressStart '<message>']</pre> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <pre>##teamcity[progressFinish '<message>']</pre> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// on writer dispose. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </para> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <para> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// http://confluence.jetbrains.net/display/TCD18/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingMessagesForBuildLog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </para> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+23
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A couple of remarks:
I suggest something like this:
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, the documentation link in my previous comment was wrong. I have edited the comment to include the correct link. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <remarks> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Implementation is not thread-safe. Create an instance for each thread instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </remarks> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public interface ITeamCityProgressWriter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Writes normal message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about "Writes a single progress message"? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <param name="message">text</param> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void WriteProgress([NotNull] string message); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Generates start flow message and returns disposable object to close flow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about "Writes a progress start message and returns a disposable object that writes a progress finish message on dispose"? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <returns></returns> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IDisposable OpenProgress(string message); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| namespace JetBrains.TeamCity.ServiceMessages.Write.Special.Impl.Writer | ||
| { | ||
| using System; | ||
|
|
||
| public class TeamCityProgressWriter : BaseWriter, ITeamCityProgressWriter | ||
| { | ||
| public TeamCityProgressWriter(IServiceMessageProcessor target) | ||
| : base(target) | ||
| { | ||
| if (target == null) throw new ArgumentNullException(nameof(target)); | ||
| } | ||
|
|
||
| public void WriteProgress(string message) | ||
| { | ||
| if (message == null) throw new ArgumentNullException(nameof(message)); | ||
| PostMessage(new ValueServiceMessage("progressMessage", message)); | ||
| } | ||
|
|
||
| public IDisposable OpenProgress(string message) | ||
| { | ||
| if (message == null) throw new ArgumentNullException(nameof(message)); | ||
| PostMessage(new ValueServiceMessage("progressStart", message)); | ||
| return new DisposableDelegate(() => PostMessage(new ValueServiceMessage("progressFinish", message))); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please share the reasoning behind adding new targets? As far as I understand,
netstandard1.3should cover all the frameworks that are covered by the added targets. Maybe some targets can even be removed, asnetcoreapp1.0;netcoreapp2.0;netcoreapp3.0seem redundant here.I'm not sure what we should do with the target frameworks and I'm interested in hearing your opinion.