diff --git a/README.md b/README.md index a7ebd27..ea16092 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,14 @@ If you're creating an inline task that wants to inherit from AsyncTask, use the as a template: ```xml - + - + + properties) + { + if (uiThreadId == Thread.CurrentThread.ManagedThreadId) + { +#pragma warning disable 618 + Log.LogTelemetry(eventName, properties); + return; +#pragma warning restore 618 + } + + var data = new TelemetryEventArgs() { + EventName = eventName, + Properties = properties + }; + EnqueueMessage(telemetryMessageQueue, data, telemetryDataAvailable); + } + public void LogMessage(string message) => LogMessage(message, importance: MessageImportance.Normal); public void LogMessage(string message, params object[] messageArgs) => LogMessage(string.Format(message, messageArgs)); @@ -277,6 +297,7 @@ protected void WaitForCompletion() errorDataAvailable, warningDataAvailable, customDataAvailable, + telemetryDataAvailable, taskCancelled, completed, }; @@ -333,6 +354,11 @@ protected void WaitForCompletion() BuildEngine.LogCustomEvent(e); }, customDataAvailable); break; + case WaitHandleIndex.TelemetryDataAvailable: + LogInternal(telemetryMessageQueue, (e) => { + BuildEngine5.LogTelemetry(e.EventName, e.Properties); + }, telemetryDataAvailable); + break; case WaitHandleIndex.TaskCancelled: Cancel(); cts.Cancel(); @@ -357,6 +383,7 @@ private enum WaitHandleIndex ErrorDataAvailable, WarningDataAvailable, CustomDataAvailable, + TelemetryDataAvailable, TaskCancelled, Completed, } diff --git a/Xamarin.Build.AsyncTask/Readme.txt b/Xamarin.Build.AsyncTask/Readme.txt index 9e057bb..7a858ae 100644 --- a/Xamarin.Build.AsyncTask/Readme.txt +++ b/Xamarin.Build.AsyncTask/Readme.txt @@ -5,13 +5,14 @@ If you're creating a custom task library, just inherit from Xamarin.Build.AsyncT If you're creating an inline task that wants to inherit from AsyncTask, use the following as a template: - + - + + - + - - - + + () {{"Property", "Value"}}); return base.Execute(); } diff --git a/Xamarin.Build.AsyncTask/Xamarin.Build.AsyncTask.csproj b/Xamarin.Build.AsyncTask/Xamarin.Build.AsyncTask.csproj index 5b3fa85..4c3cd3a 100644 --- a/Xamarin.Build.AsyncTask/Xamarin.Build.AsyncTask.csproj +++ b/Xamarin.Build.AsyncTask/Xamarin.Build.AsyncTask.csproj @@ -11,7 +11,7 @@ $(PackageId) $(PackageId) - Supports MSBuild 14+. + Supports MSBuild 17+. Microsoft microsoft xamarin $([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)Readme.txt')) @@ -29,8 +29,8 @@ - - + + all @@ -47,7 +47,7 @@ - + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ed1cf4e..01a16e4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -69,6 +69,10 @@ extends: & dotnet build Xamarin.Build.AsyncTask\Xamarin.Build.AsyncTask.csproj -c Release -bl:$(LogDirectory)\Release.binlog displayName: build libraries errorActionPreference: stop + - powershell: | + & dotnet build Xamarin.Build.AsyncTask\Xamarin.Build.AsyncTask.csproj -c Release -t:Test -bl:$(LogDirectory)\Test.binlog + displayName: test libraries + errorActionPreference: stop - powershell: | & dotnet pack Xamarin.Build.AsyncTask\Xamarin.Build.AsyncTask.csproj -c Release -bl:$(LogDirectory)\PackRelease.binlog displayName: pack NuGet