forked from Azure/bicep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Clean and added Publish support to MSBuild package (Azure#10618)
- Loading branch information
Showing
19 changed files
with
257 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Console.WriteLine("Hello, World!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- | ||
Do not include this project in the solution. It is intended to validate our MSBuild task. | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Pickup latest available packages (including prerelease) from local feed configured in NuGet.config. | ||
--> | ||
<ItemGroup> | ||
<PackageReference Include="Azure.Bicep.CommandLine.$(RuntimeSuffix)" Version="*-*" /> | ||
<PackageReference Include="Azure.Bicep.MSBuild" Version="*-*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Bicep Include="empty.bicep"/> | ||
</ItemGroup> | ||
</Project> | ||
|
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions
6
src/Bicep.MSBuild.E2eTests/examples/simpleMultiTarget/multitarget-mitigation.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<!-- Mitigation for https://github.com/microsoft/MSBuildSdks/issues/155 --> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.CrossTargeting.targets" Condition="$(IsCrossTargetingBuild) == 'true'" /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="$(IsCrossTargetingBuild) != 'true'" /> | ||
</Project> |
3 changes: 3 additions & 0 deletions
3
src/Bicep.MSBuild.E2eTests/examples/simpleMultiTarget/passthrough.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
param one string | ||
|
||
output two string = one |
24 changes: 24 additions & 0 deletions
24
src/Bicep.MSBuild.E2eTests/examples/simpleMultiTarget/simpleMultiTarget.proj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- | ||
Do not include this project in the solution. It is intended to validate our MSBuild task. | ||
--> | ||
<Project Sdk="Microsoft.Build.NoTargets"> | ||
<PropertyGroup> | ||
<!-- Ensure the package supports multi-targeting --> | ||
<TargetFrameworks>net7.0;net472</TargetFrameworks> | ||
<LanguageTargets>$(MSBuildThisFileDirectory)\multitarget-mitigation.targets</LanguageTargets> <!-- https://github.com/microsoft/MSBuildSdks/issues/155 --> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Pickup latest available packages (including prerelease) from local feed configured in NuGet.config. | ||
--> | ||
<ItemGroup> | ||
<PackageReference Include="Azure.Bicep.CommandLine.$(RuntimeSuffix)" Version="*-*" /> | ||
<PackageReference Include="Azure.Bicep.MSBuild" Version="*-*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Bicep Include="passthrough.bicep"/> | ||
<Bicep Include="empty.bicep"/> | ||
<Bicep Include="subdir\theAnswer.bicep"/> | ||
</ItemGroup> | ||
</Project> |
4 changes: 4 additions & 0 deletions
4
src/Bicep.MSBuild.E2eTests/examples/simpleMultiTarget/subdir/theAnswer.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
var theAnswer = 42 | ||
|
||
// need to output var to prevent linter warning | ||
output outint int = theAnswer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { Example } from "./example"; | ||
|
||
describe("msbuild", () => { | ||
it("should build and clean a c# project with Bicep files", () => { | ||
const example = new Example("csharp", "csharp.csproj"); | ||
example.cleanProjectDir(); | ||
|
||
const buildResult = example.build(); | ||
expect(buildResult.stderr).toBe(""); | ||
|
||
example.expectFile("bin/Debug/net7.0/csharp.dll"); | ||
const templateRelativePath = "bin/Debug/net7.0/empty.json"; | ||
example.expectTemplate(templateRelativePath); | ||
|
||
const cleanResult = example.clean(); | ||
expect(cleanResult.stderr).toBe(""); | ||
example.expectNoFile(templateRelativePath); | ||
|
||
example.cleanProjectDir(); | ||
|
||
example.publish(null); | ||
expect(buildResult.stderr).toBe(""); | ||
|
||
// both build and publish outputs should be present | ||
example.expectTemplate(templateRelativePath); | ||
example.expectTemplate("bin/Debug/net7.0/publish/empty.json"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { Example } from "./example"; | ||
|
||
describe("msbuild", () => { | ||
it("should build project without bicep file successfully", () => { | ||
const example = new Example("empty"); | ||
example.cleanProjectDir(); | ||
|
||
const result = example.build(); | ||
|
||
expect(result.stderr).toBe(""); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/Bicep.MSBuild.E2eTests/src/simpleMultiTargeting.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { Example } from "./example"; | ||
|
||
describe("msbuild", () => { | ||
it("should build a multi-targeting project with default output paths successfully", () => { | ||
const example = new Example("simpleMultiTarget"); | ||
example.cleanProjectDir(); | ||
|
||
const buildResult = example.build(); | ||
expect(buildResult.stderr).toBe(""); | ||
|
||
example.expectTemplate("bin/Debug/net7.0/empty.json"); | ||
example.expectTemplate("bin/Debug/net7.0/passthrough.json"); | ||
example.expectTemplate("bin/Debug/net7.0/theAnswer.json"); | ||
|
||
example.expectTemplate("bin/Debug/net472/empty.json"); | ||
example.expectTemplate("bin/Debug/net472/passthrough.json"); | ||
example.expectTemplate("bin/Debug/net472/theAnswer.json"); | ||
|
||
const cleanResult = example.clean(); | ||
expect(cleanResult.stderr).toBe(""); | ||
|
||
example.expectNoFile("bin/Debug/net7.0/empty.json"); | ||
example.expectNoFile("bin/Debug/net7.0/passthrough.json"); | ||
example.expectNoFile("bin/Debug/net7.0/theAnswer.json"); | ||
|
||
example.expectNoFile("bin/Debug/net472/empty.json"); | ||
example.expectNoFile("bin/Debug/net472/passthrough.json"); | ||
example.expectNoFile("bin/Debug/net472/theAnswer.json"); | ||
|
||
const publishResult = example.publish("net472"); | ||
expect(publishResult.stderr).toBe(""); | ||
|
||
example.expectNoFile("bin/Debug/net7.0/publish/empty.json"); | ||
example.expectNoFile("bin/Debug/net7.0/publish/passthrough.json"); | ||
example.expectNoFile("bin/Debug/net7.0/publish/theAnswer.json"); | ||
|
||
example.expectTemplate("bin/Debug/net472/publish/empty.json"); | ||
example.expectTemplate("bin/Debug/net472/publish/passthrough.json"); | ||
example.expectTemplate("bin/Debug/net472/publish/theAnswer.json"); | ||
}); | ||
}); |
Oops, something went wrong.