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
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/out/bin/Azure.Functions.Cli/debug_net8.0/func.dll",
"program": "${workspaceFolder}/out/bin/Azure.Functions.Cli/debug/func.dll",
"env": {
"CLI_DEBUG": "1"
},
Expand Down
17 changes: 17 additions & 0 deletions Azure.Functions.Cli.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.Cli.TestFra
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.Cli.E2E.Tests", "test\Cli\Func.E2E.Tests\Azure.Functions.Cli.E2E.Tests.csproj", "{D61226F6-3472-32C7-16F5-F07705F779CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoZipTool", "src\GoZipTool\GoZipTool.csproj", "{7849148F-F156-4FAD-8087-3ADF22785A4B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cli", "Cli", "{4FC405F4-CF0B-4CD6-8555-A93AF42A27E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.Cli.Unit.Tests", "test\Cli\Func.Unit.Tests\Azure.Functions.Cli.Unit.Tests.csproj", "{BBCC9C23-0594-4F5F-8604-B4E032EFC8DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -63,6 +69,14 @@ Global
{D61226F6-3472-32C7-16F5-F07705F779CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D61226F6-3472-32C7-16F5-F07705F779CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D61226F6-3472-32C7-16F5-F07705F779CE}.Release|Any CPU.Build.0 = Release|Any CPU
{7849148F-F156-4FAD-8087-3ADF22785A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7849148F-F156-4FAD-8087-3ADF22785A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7849148F-F156-4FAD-8087-3ADF22785A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7849148F-F156-4FAD-8087-3ADF22785A4B}.Release|Any CPU.Build.0 = Release|Any CPU
{BBCC9C23-0594-4F5F-8604-B4E032EFC8DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBCC9C23-0594-4F5F-8604-B4E032EFC8DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBCC9C23-0594-4F5F-8604-B4E032EFC8DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBCC9C23-0594-4F5F-8604-B4E032EFC8DE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -77,6 +91,9 @@ Global
{0333D5B6-B628-4605-A51E-D0AEE4C3F1FC} = {5F51C958-39C0-4E0C-9165-71D0BCE647BC}
{3A8E1907-E3A2-1CE0-BA8B-805B655FAF09} = {6EE1D011-2334-44F2-9D41-608B969DAE6D}
{D61226F6-3472-32C7-16F5-F07705F779CE} = {6EE1D011-2334-44F2-9D41-608B969DAE6D}
{7849148F-F156-4FAD-8087-3ADF22785A4B} = {5F51C958-39C0-4E0C-9165-71D0BCE647BC}
{4FC405F4-CF0B-4CD6-8555-A93AF42A27E8} = {6EE1D011-2334-44F2-9D41-608B969DAE6D}
{BBCC9C23-0594-4F5F-8604-B4E032EFC8DE} = {4FC405F4-CF0B-4CD6-8555-A93AF42A27E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FA1E01D6-A57B-4061-A333-EDC511D283C0}
Expand Down
15 changes: 11 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,25 @@ To install the required dotnet packages navigate into the repository root and ru

## Compiling the CLI Tools

To build the project run `cd src/Azure.Functions.Cli; dotnet build` (note navigating into the src directory is required due to the test suite currently failing to compile on non-windows environments - see below)
To build the project run `dotnet build` from the root of the repository. This will build the project and all of its dependencies.
The output will be placed in the `out/bin/Azure.Functions.Cli/debug` directory.

`dotnet run --project src/Cli/func <command>` will run the CLI tool from the source directory.

### Running against a function app

To test this project against a local function app you can run from that function app's directory

`dotnet run --project PATH_TO_FUNCTIONS_CLI/src/Azure.Functions.Cli start`
- `cd myTestFunctionApp`
- `dotnet run --project PATH_TO_FUNCTIONS_CLI/src/Cli/func <command>`

where PATH_TO_FUNCTIONS_CLI is the absolute or relative path to the root of this repository.

Or you can add `out/bin/Azure.Functions.Cli/debug/func` to your `PATH` environment variable and run the command from anywhere.

- `export PATH=$PATH:/path/to/Azure.Functions.Cli/out/bin/Azure.Functions.Cli/debug/func`
- `func <command>`

### Running the Test Suite

- Build the solution `dotnet build Azure.Functions.Cli.sln`
Expand Down Expand Up @@ -64,5 +73,3 @@ Before we can accept your pull-request you'll need to sign a [Contribution Licen
When your pull-request is created, we classify it. If the change is trivial, i.e. you just fixed a typo, then the PR is labelled with `cla-not-required`. Otherwise it's classified as `cla-required`. In that case, the system will also also tell you how you can sign the CLA. Once you signed a CLA, the current and all future pull-requests will be labelled as `cla-signed`. Signing the CLA might sound scary but it's actually super simple and can be done in less than a minute.

Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. Note that all code submissions will be rigorously reviewed and tested by the Azure Functions Core Tools team, and only those that meet the bar for both quality and design/roadmap appropriateness will be merged into the source.

Path: /opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.7030/templates
23 changes: 14 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<Project>
<!-- paths -->
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<RepoEngRoot>$(RepoRoot)eng/</RepoEngRoot>
<RepoSrcRoot>$(RepoRoot)src/</RepoSrcRoot>
<RepoTestRoot>$(RepoRoot)test/</RepoTestRoot>
</PropertyGroup>

<!-- artifacts -->
<PropertyGroup>
Expand All @@ -15,5 +8,17 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<Import Project="$(RepoEngRoot)Directory.Build.Common.props" />
</Project>

<!-- paths -->
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<EngRoot>$(RepoRoot)eng/</EngRoot>
<EngBuildRoot>$(EngRoot)build/</EngBuildRoot>
<EngResourceRoot>$(EngRoot)res/</EngResourceRoot>
<SrcRoot>$(RepoRoot)src/</SrcRoot>
<TestRoot>$(RepoRoot)test/</TestRoot>
</PropertyGroup>

<Import Project="$(EngBuildRoot)Engineering.props" />

</Project>
6 changes: 4 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)eng/build/Cli.Build.targets" />
</Project>

<Import Project="$(EngBuildRoot)Engineering.targets" />

</Project>
6 changes: 4 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<Import Project="$(RepoEngRoot)Directory.Packages.props" />
</Project>
<Import Project="$(EngBuildRoot)Packages.props" />

</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Azure Functions Logo](https://raw.githubusercontent.com/Azure/azure-functions-core-tools/refs/heads/main/publish-scripts/npm/assets/azure-functions-logo-color-raster.png)
![Azure Functions Logo](https://raw.githubusercontent.com/Azure/azure-functions-core-tools/refs/heads/main/eng/res/functions.png)

|Branch|Status|
|---|---|
Expand Down
9 changes: 2 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ COPY *.props .
COPY stylecop.json .
COPY .editorconfig .
COPY NuGet.Config .
COPY tools/ tools/
COPY eng/*.props eng/
COPY src/*.props src/
COPY eng/ eng/
COPY src/Cli/func src/Cli/func
COPY AzureFunctions-CLI.ico .
COPY eng/scripts/download-templates.ps1 .
COPY src/GoZipTool src/GoZipTool

ARG TARGET_RUNTIME=linux-x64
RUN dotnet publish src/Cli/func /p:BuildNumber="9999" /p:CommitHash="N/A" -o /cli -c Release -f net8.0 --self-contained -r ${TARGET_RUNTIME}

RUN pwsh ./download-templates.ps1 -OutputPath "/cli"

FROM ${SDK_IMAGE} AS runtime

WORKDIR /cli
Expand Down
4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ The default func runtime being built by the `Dockerfile` is linux x64.
- When you want to kill the container, run: `docker-compose down`

> [!IMPORTANT]
> If you are using a Mac with Apple silicon (M1, M2, etc.), you will need to use the `--platform linux/arm64`
> flag when building the image for non-ARM RIDs. You can also set this in the docker-compose file.
> If you are using a Mac with Apple silicon (M1, M2, etc.), you will need to use the `--platform linux/amd64`
> flag when building the image for non-ARM RIDs (e.g. linux-x64). You can also set this in the docker-compose file.

### Testing Different Runtimes

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
dockerfile: docker/Dockerfile
args:
TARGET_RUNTIME: linux-x64
# platform: linux/arm64 # Uncomment if you are on a Mac with Apple silicon for non-ARM RID builds
# platform: linux/amd64 # Uncomment if you are on a Mac with Apple silicon for non-ARM RID builds
container_name: func-cli
image: func-cli
ports:
Expand Down
40 changes: 0 additions & 40 deletions eng/build/Cli.Build.targets

This file was deleted.

43 changes: 15 additions & 28 deletions eng/Directory.Build.Common.props → eng/build/Engineering.props
Original file line number Diff line number Diff line change
@@ -1,38 +1,13 @@
<Project>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<!-- Common library and package properties -->
<PropertyGroup>
<Company>Microsoft Corporation</Company>
<Authors>Microsoft</Authors>
<Title>Azure Functions CLI</Title>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<RepositoryUrl>https://github.com/Azure/azure-functions-core-tools</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
<ApplicationIcon>$(RepoRoot)AzureFunctions-CLI.ico</ApplicationIcon>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>

<PropertyGroup>
<ContinuousIntegrationBuild>false</ContinuousIntegrationBuild>
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true'">true</ContinuousIntegrationBuild>
<CI>$(ContinuousIntegrationBuild)</CI>
</PropertyGroup>

<PropertyGroup>
<!-- Always suppress these warnings -->
<NoWarn>$(NoWarn);NU1507;NU1701;NU5118;SA0001</NoWarn>
<WarningsNotAsErrors>$(WarningsNotAsErrors);NU1901;NU1902;NU1903</WarningsNotAsErrors>
<WarningsNotAsErrors>$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU5123</WarningsNotAsErrors>

<!-- Nuget audit as warnings only, even in TreatWarningsAsErrors. -->
<!-- Except for in CI, critical will fail the build. -->
<WarningsNotAsErrors Condition="'$(CI)' != 'true'">$(WarningsNotAsErrors);NU1904</WarningsNotAsErrors>
<WarningsNotAsErrors Condition="'$(CI)' == 'false'">$(WarningsNotAsErrors);NU1904</WarningsNotAsErrors>
<WarningsAsErrors Condition="'$(CI)' == 'true'">$(WarningsAsErrors);NU1904</WarningsAsErrors>

<!-- TreatWarningsAsErrors true only on CI -->
Expand All @@ -43,6 +18,15 @@
<NuGetAuditMode>all</NuGetAuditMode> <!-- audit transitive dependencies. -->
</PropertyGroup>

<PropertyGroup>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigDevFile>true</GenerateRuntimeConfigDevFile><!-- https://github.com/dotnet/runtime/issues/54684 -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is referencing an issue that has been closed as resolved (and opened in the context of .NET 6). Still applicable?

<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
Expand All @@ -51,4 +35,7 @@
<ItemGroup>
<AdditionalFiles Include="$(RepoRoot)stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>

<Import Project="$(MSBuildThisFileDirectory)Release.props" />

</Project>
7 changes: 7 additions & 0 deletions eng/build/Engineering.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<Import Project="$(MSBuildThisFileDirectory)RepositoryInfo.targets" />
<Import Project="$(MSBuildThisFileDirectory)ZipPublish.targets" />
<Import Project="$(MSBuildThisFileDirectory)Release.targets" />

</Project>
28 changes: 28 additions & 0 deletions eng/build/Minified.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project>

<!-- Workers to delete in minified builds -->
<ItemGroup Condition="'$(IsMinified)' == 'true'">
<_LanguageWorkers Include="$(PublishDir)workers\python" />
<_LanguageWorkers Include="$(PublishDir)workers\java" />
<_LanguageWorkers Include="$(PublishDir)workers\powershell" />
<_LanguageWorkers Include="$(PublishDir)workers\node" />
</ItemGroup>

<!-- Remove worker directories from minified builds -->
<!-- Cannot remove entire directory due to this bug: https://github.com/Azure/azure-functions-core-tools/issues/2380 -->
<Target Name="RemoveLanguageWorkersForMin" AfterTargets="Publish" BeforeTargets="PrepareZipArtifacts" Condition="'$(RuntimeIdentifier)' != ''">
<Message Importance="low" Text="Removing language workers for minified build..." />
<RemoveDir Directories="@(_LanguageWorkers)" />
</Target>

<!-- Write artifactsconfig.json for minified builds -->
<Target Name="WriteArtifactsConfig" AfterTargets="RemoveLanguageWorkersForMin" Condition="'$(RuntimeIdentifier)' != ''">
<Message Importance="low" Text="Creating artifactsconfig.json for minified build..." />
<WriteLinesToFile
File="$(PublishDir)artifactsconfig.json"
Lines='{"minifiedVersion": true}'
Overwrite="true"
Encoding="UTF-8" />
</Target>

</Project>
11 changes: 9 additions & 2 deletions eng/Directory.Packages.props → eng/build/Packages.props
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<Project>

<!-- common -->
<ItemGroup>
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Colors.Net" Version="1.1.0" />
<PackageVersion Include="WindowsAzure.Storage" Version="9.3.1" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
</ItemGroup>

<!-- abstractions-->
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.2" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.25071.2" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta5.25306.101" />
</ItemGroup>

<!-- func -->
<ItemGroup>
<PackageVersion Include="Autofac" Version="4.6.2" />
Expand All @@ -29,6 +32,7 @@
<!-- Transitive dependency -->
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<!-- workers -->
<ItemGroup>
<PackageVersion Include="Microsoft.Azure.Functions.JavaWorker" Version="2.19.1" />
Expand All @@ -38,10 +42,12 @@
<PackageVersion Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.4206" />
<PackageVersion Include="Microsoft.Azure.Functions.PythonWorker" Version="4.37.0" />
</ItemGroup>

<!-- host -->
<ItemGroup>
<PackageVersion Include="Microsoft.NETCore.DotNetAppHost" Version="8.0.8" />
</ItemGroup>

<!-- test projects -->
<ItemGroup>
<PackageVersion Include="Azure.Data.Tables" Version="12.9.0" />
Expand All @@ -61,4 +67,5 @@
<PackageVersion Include="Microsoft.NET.Sdk.Functions" Version="4.5.0" />
<PackageVersion Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.8.2" />
</ItemGroup>
</Project>

</Project>
Loading
Loading