Skip to content
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

Add stj bultin #11056

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/Tasks.UnitTests/RoslynCodeTaskFactory_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using VerifyTests;
using VerifyXunit;
using Xunit;

using Xunit.Abstractions;
using static VerifyXunit.Verifier;

#nullable disable
Expand All @@ -34,11 +34,15 @@ public class RoslynCodeTaskFactory_Tests

private readonly VerifySettings _verifySettings;

public RoslynCodeTaskFactory_Tests()
private readonly ITestOutputHelper _testOutputHelper;

public RoslynCodeTaskFactory_Tests(ITestOutputHelper testOutputHelper)
{
_testOutputHelper = testOutputHelper;
UseProjectRelativeDirectory("TaskFactorySource");

_verifySettings = new();
_verifySettings.UniqueForRuntime();
_verifySettings.ScrubLinesContaining("Runtime Version:");
}

Expand Down Expand Up @@ -76,6 +80,7 @@ public void InlineTaskWithAssemblyPlatformAgnostic()

</Project>
");

string output = RunnerUtilities.ExecMSBuild(inlineTask.Path, out bool success);
success.ShouldBeTrue(output);
output.ShouldContain("Alpha.GetString");
Expand All @@ -102,6 +107,8 @@ public void InlineTaskWithAssembly()
<Import Project=""$(MSBuildBinPath)\Microsoft.CSharp.targets"" />
</Project>
");

_testOutputHelper.WriteLine($"AssemblyProj: {assemblyProj.Path}, {assemblyProj.ToString()}");
TransientTestFile csFile = env.CreateFile(folder, "Class1.cs", @"
using System;

Expand All @@ -113,7 +120,7 @@ public static string ToPrint() {
}
}
");
string output = RunnerUtilities.ExecMSBuild(assemblyProj.Path + $" /p:OutDir={Path.Combine(folder.Path, "subFolder")} /restore", out bool success);
string output = RunnerUtilities.ExecMSBuild(assemblyProj.Path + $" /p:OutDir={Path.Combine(folder.Path, "subFolder")} /restore", out bool success, _testOutputHelper);
success.ShouldBeTrue(output);

TransientTestFile inlineTask = env.CreateFile(folder, "5106.proj", @$"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace InlineTask
{
using Microsoft.Build.Utilities;

public class HelloWorld : Task
{
public override bool Execute()
{
Log.LogMessage("Hello, world!");
return !Log.HasLoggedErrors;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace InlineTask
{
using Microsoft.Build.Utilities;

public class HelloWorld : Task
{
public override bool Execute()
{
Log.LogMessage("Hello, world!");
return !Log.HasLoggedErrors;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace InlineCode {
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Memory;


public class MyInlineTask : Microsoft.Build.Utilities.Task {

private bool _Success = true;

public virtual bool Success {
get {
return _Success;
}
set {
_Success = value;
}
}

public override bool Execute() {
int x = 0;
return Success;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace InlineCode {
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Memory;


public class MyInlineTask : Microsoft.Build.Utilities.Task {

private bool _Success = true;

public virtual bool Success {
get {
return _Success;
}
set {
_Success = value;
}
}

public override bool Execute() {
int x = 0;
return Success;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace InlineCode {
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Memory;


public class MyInlineTask : Microsoft.Build.Utilities.Task {

private string _Parameter1;

public virtual string Parameter1 {
get {
return _Parameter1;
}
set {
_Parameter1 = value;
}
}

private string _Parameter2;

public virtual string Parameter2 {
get {
return _Parameter2;
}
set {
_Parameter2 = value;
}
}

private string _Parameter3;

public virtual string Parameter3 {
get {
return _Parameter3;
}
set {
_Parameter3 = value;
}
}

private Microsoft.Build.Framework.ITaskItem _Parameter4;

public virtual Microsoft.Build.Framework.ITaskItem Parameter4 {
get {
return _Parameter4;
}
set {
_Parameter4 = value;
}
}

private Microsoft.Build.Framework.ITaskItem[] _Parameter5;

public virtual Microsoft.Build.Framework.ITaskItem[] Parameter5 {
get {
return _Parameter5;
}
set {
_Parameter5 = value;
}
}

private bool _Success = true;

public virtual bool Success {
get {
return _Success;
}
set {
_Success = value;
}
}

public override bool Execute() {
int x = 0;
return Success;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace InlineCode {
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Memory;


public class MyInlineTask : Microsoft.Build.Utilities.Task {

public override bool Execute() { int x = 0; return true; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace InlineCode {
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Memory;


public class MyInlineTask : Microsoft.Build.Utilities.Task {

public override bool Execute() { int x = 0; return true; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

1F214E27A13F432B9397F1733BC55929
9111DC29B0064E6994A68CFE465404D4
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports Microsoft.Build.Framework
Imports Microsoft.Build.Utilities
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Memory
Imports System.Text
Imports System.Text.Json

Namespace InlineCode

Public Class MyInlineTask
Inherits Microsoft.Build.Utilities.Task

Private _Success As Boolean = true

Public Overridable Property Success() As Boolean
Get
Return _Success
End Get
Set
_Success = value
End Set
End Property

Public Overrides Function Execute() As Boolean
Dim x = 0
Return Success
End Function
End Class
End Namespace
Loading
Loading