Skip to content
Merged
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
17 changes: 10 additions & 7 deletions build-test.yml → .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ on:
push:
branches:
- main
- master
- feature/**
pull_request:
branches:
- main
- master
- feature/**

- '**' # run on all PR source/target branches
jobs:
build-and-test:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
Expand Down
8 changes: 1 addition & 7 deletions Microsoft.Azure.Functions.Worker.Extensions.OpenAPI.CLI.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.3.11312.210 d18.3
VisualStudioVersion = 18.3.11312.210
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A1CB6B0E-9E97-4823-910B-735DB69B1931}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -24,12 +24,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Functions.W
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Functions.Sample", "samples\Azure.Functions.Sample\Azure.Functions.Sample.csproj", "{1C36899F-F81E-41BC-991E-E716ACCF3697}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{B735769C-B6C8-4A6E-BA1A-C806CF27FFE0}"
ProjectSection(SolutionItems) = preProject
build-test.yml = build-test.yml
.github\workflows\publish-nuget.yml = .github\workflows\publish-nuget.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec ContinueOnError="True" Command="dotnet azfuncopenapi.dll --project ../../../ --output ../../../" WorkingDirectory="$(OutputPath)">
<Exec ContinueOnError="True" Command="dotnet azfuncopenapi.dll --project ../../../ --configuration $(Configuration) --output ../../../" WorkingDirectory="$(OutputPath)">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
<Message Importance="high" Text="$(OutputOfExec)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Xml;

namespace Microsoft.Azure.Functions.Worker.Extensions.OpenApi.CLI.Extensions
Expand All @@ -12,39 +11,42 @@ public static class ProjectPathExtensions

public static string TrimProjectPath(this string path)
{
var filePath = !Path.IsPathFullyQualified(path)
? $"{Environment.CurrentDirectory.TrimEnd(DirectorySeparator)}{DirectorySeparator}{path}"
: path;
var normalizedPath = Path.GetFullPath(path);

return new DirectoryInfo(filePath).FullName.TrimEnd(DirectorySeparator);
return normalizedPath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
}

public static string GetCsProjFileName(this string path)
{
var filePath = !Path.IsPathFullyQualified(path)
? $"{Environment.CurrentDirectory.TrimEnd(DirectorySeparator)}{DirectorySeparator}{path}"
: path;
var normalizedPath = Path.GetFullPath(path);
var directoryName = Path.GetFileName(normalizedPath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));

var segments = new DirectoryInfo(filePath).FullName.Split(new[]
{
DirectorySeparator
}, StringSplitOptions.RemoveEmptyEntries);

return $"{segments.Last()}.csproj";
return $"{directoryName}.csproj";
}

public static string GetProjectDllFileName(this string projectPath, string csprojFileName)
{
var doc = new XmlDocument();
var normalizedProjectPath = projectPath
.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)
.Replace('/', Path.DirectorySeparatorChar);

doc.Load($"{projectPath}{DirectorySeparator}{csprojFileName}");
var csprojFullPath = Path.GetFullPath(Path.Combine(normalizedProjectPath, csprojFileName));

var elements = doc.GetElementsByTagName(nameof(AssemblyName));
var doc = new XmlDocument
{
XmlResolver = null
};

using (var stream = new FileStream(csprojFullPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
doc.Load(stream);
}

var elements = doc.GetElementsByTagName(nameof(System.Reflection.AssemblyName));
var dllName = elements?.Cast<XmlNode>()?.FirstOrDefault()?.InnerText;

return string.IsNullOrWhiteSpace(dllName)
? csprojFileName.Replace(".csproj", ".dll")
? csprojFileName.Replace(".csproj", ".dll", StringComparison.OrdinalIgnoreCase)
: $"{dllName}.dll";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,22 @@
<AssemblyName>azfuncopenapi</AssemblyName>
<RootNamespace>Microsoft.Azure.Functions.Worker.Extensions.OpenApi.CLI</RootNamespace>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>1.0.3-alpha</Version>
<PackageId>Microsoft.Azure.Functions.Worker.Extensions.OpenApi.CLI</PackageId>
<Title>Microsoft.Azure.Functions.Worker.Extensions.OpenApi</Title>
<Summary>This package helps render OpenAPI document on build.</Summary>
<Description>This package helps render OpenAPI document on build</Description>

</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cocona" Version="2.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenApi" Version="1.6.0" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<None Include="build\**" Pack="True" PackagePath="build\" />
</ItemGroup>



</Project>

This file was deleted.

This file was deleted.

Loading