Skip to content

Commit

Permalink
Cherry pick branch 'genexuslabs:Issue201688' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabrina Juarez Garcia authored and Beta Bot committed Jan 20, 2025
1 parent cf13851 commit fbfee62
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 52 deletions.
5 changes: 0 additions & 5 deletions src/AzureFunctions/createpackage.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@
<APIRestSupport Condition="'@(API->'.')' != ''">true</APIRestSupport>
</PropertyGroup>

<GenerateAzFunctionConfigsHttp Condition="%(Object.selected) == 'true' AND %(Object.IsRest)=='true' AND $(AZURE_FUNCTIONS_TRIGGER_TYPE) == 'http'"

YamlFile = "$(OpenAPIDefinitionOutputFile)"
DeployFullPath="$(DeployFullPath)" />

<PropertyGroup>
<IntegratedSecurityEnabled Condition= "$(AZURE_FUNCTIONS_GAM_CONNECTION_KEY) != ''">true</IntegratedSecurityEnabled>
<IntegratedSecurityEnabled Condition= "$(AZURE_FUNCTIONS_GAM_CONNECTION_KEY) == ''">false</IntegratedSecurityEnabled>
Expand Down
17 changes: 0 additions & 17 deletions src/AzureFunctions/http/Directory.Build.targets

This file was deleted.

79 changes: 49 additions & 30 deletions src/Common/Azure/azurefunctions-create-NETpackage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
<Target Name="CreateNETPackage" DependsOnTargets="ValidatePackaging;NETpackageZipDeploy" Condition="'$(NETGenerator)' == 'true'"/>

<Target Name="TransformMVCToAzureFunctions" Condition="'$(NETGenerator)' == 'true' AND '$(AZURE_FUNCTIONS_TRIGGER_TYPE)' == 'http'">
<!-- Transform MVC of rest services to Azure functions -->
<Message Text="Convert MVC Services to Azure Functions..." Importance="high" />

<Message Text="Converting controller-based web APIs to Azure functions..." Importance="high" />
<GenerateAzHTTPFunctionFromMVC
serviceSourcePath="$(DeploySrcWebPath)"
/>
serviceSourcePath="$(DeploySrcWebPath)"/>
</Target>

<Target Name="AddAzureHandlersSources" Condition="'$(DeployType)'=='SOURCES' AND '$(NETGenerator)' == 'true'" DependsOnTargets="TransformMVCToAzureFunctions">

<Message Text="Adding Azure Functions Handlers sources to $(DeploymentUnit).sln" Importance="high" ></Message>

<Copy SourceFiles="@(AzureFunctionsRootSrc)"
Expand All @@ -39,6 +39,49 @@
<Exec Command="dotnet sln $(DeploymentUnit).sln add &quot;$(DeploySrcBuildPath)/GeneXus.Deploy.AzureFunctions.Handlers/GeneXus.Deploy.AzureFunctions.Handlers.csproj&quot;" WorkingDirectory="$(DeploySrcBuildPath)" />
</Target>

<Target Name="SetupHttpFunctionsProject" Condition="'$(NETGenerator)' == 'true' AND '$(AZURE_FUNCTIONS_TRIGGER_TYPE)' == 'http'" DependsOnTargets="TransformMVCToAzureFunctions" >

<Message Text="Adding Azure Functions Handlers sources to $(DeploymentUnit).sln" Importance="high" ></Message>

<Copy SourceFiles="@(AzureFunctionsRootSrc)"
DestinationFolder="$(DeployFullPath)/src/build/GeneXus.Deploy.AzureFunctions.Handlers/%(RecursiveDir)" SkipUnchangedFiles="true" />

<Copy SourceFiles="$(DeployAppDir)/functions.metadata"
DestinationFolder="$(DeployFullPath)/src/build/GeneXus.Deploy.AzureFunctions.Handlers" SkipUnchangedFiles="true" Condition="Exists('$(DeployAppDir)/functions.metadata')"/>

<Exec Command="dotnet sln $(DeploymentUnit).sln add &quot;$(DeploySrcBuildPath)/GeneXus.Deploy.AzureFunctions.Handlers/GeneXus.Deploy.AzureFunctions.Handlers.csproj&quot;" WorkingDirectory="$(DeploySrcBuildPath)" />

<CallTarget Targets="ProcessDeploySolution" />
</Target>

<Target Name="BuildAzureHandlersSourcesHTTP" Condition="'$(DeployType)' != 'SOURCES' AND '$(NETGenerator)' == 'true' AND '$(AZURE_FUNCTIONS_TRIGGER_TYPE)' == 'http'" DependsOnTargets="SetupHttpFunctionsProject">

<PropertyGroup>
<HttpSupport Condition="'$(AZURE_FUNCTIONS_TRIGGER_TYPE)' == 'http'">true</HttpSupport>
</PropertyGroup>

<Exec Command="dotnet build &quot;$(DeployFullPath)/src/build/$(DeploymentUnit).sln&quot; -c Release --force -p:DebugType=None --output &quot;$(DeployFullPath)\bin&quot; -p:CosmosDBSupport=$(CosmosDBSupport) -p:TimerSupport=$(TimerSupport) -p:AzureQueueSupport=$(AzureQueueSupport) -p:ServiceBusSupport=$(ServiceBusSupport) -p:HttpSupport=$(HttpSupport) -p:BlobSupport=$(BlobSupport) -p:EventGridSupport=$(EventGridSupport)" WorkingDirectory="$(DeploySrcBuildPath)" ConsoleToMSBuild="true"/>

<Delete Files="$(DeployFullPath)/bin/local.settings.json" Condition="Exists('$(DeployFullPath)/bin/local.settings.json')" />

</Target>

<Target Name="ProcessDeploySolution">

<Message Text="Re-structuring the solution to implement Azure functions.." Importance="high" />

<SetupAzureFuncDeploymentSln
DeploySolutionPath = "$(DeploySrcBuildPath)"
DeploySrcWebDirectory = "$(DeploySrcWebPath)">
<Output TaskParameter="ProjectFiles" ItemName="ProjectFiles" />
</SetupAzureFuncDeploymentSln>

<Exec Command="dotnet add &quot;$(DeploySrcBuildPath)/GeneXus.Deploy.AzureFunctions.Handlers/GeneXus.Deploy.AzureFunctions.Handlers.csproj&quot; reference &quot;$(DeploySrcBuildPath)/GeneXus.Programs.Common/GeneXus.Programs.Common.csproj&quot;" WorkingDirectory="$(DeploySrcBuildPath)" ConsoleToMSBuild="true"/>

<Exec Command="dotnet sln $(DeploymentUnit).sln remove %(ProjectFiles.Identity)" WorkingDirectory="$(DeploySrcBuildPath)" ConsoleToMSBuild="true"/>

</Target>

<Target Name="BuildAzureHandlersSources" Condition="'$(DeployType)'!='SOURCES' AND '$(NETGenerator)' == 'true' AND '$(AZURE_FUNCTIONS_TRIGGER_TYPE)' != 'http'">

<PropertyGroup>
Expand All @@ -56,36 +99,12 @@
<Copy SourceFiles="$(SourcePath)\Directory.build.props"
DestinationFolder="$(DeploySrcBuildPath)" SkipUnchangedFiles="true" />

<Exec Command="dotnet build &quot;GeneXus.Deploy.AzureFunctions.Handlers\$(AzureFunctionsHandlerProject)&quot; -c Release --force -p:DebugType=None --output &quot;$(DeployFullPath)\bin&quot; -p:CosmosDBSupport=$(CosmosDBSupport) -p:TimerSupport=$(TimerSupport) -p:AzureQueueSupport=$(AzureQueueSupport) -p:ServiceBusSupport=$(ServiceBusSupport) -p:HttpSupport=$(HttpSupport) -p:BlobSupport=$(BlobSupport) -p:EventGridSupport=$(EventGridSupport)" WorkingDirectory="$(DeploySrcBuildPath)" ConsoleToMSBuild="true"/>
<Exec Command="dotnet build &quot;GeneXus.Deploy.AzureFunctions.Handlers\$(AzureFunctionsHandlerProject)&quot; -c Release --force -p:DebugType=None -p:OutputPath=&quot;$(DeployFullPath)\bin&quot; -p:CosmosDBSupport=$(CosmosDBSupport) -p:TimerSupport=$(TimerSupport) -p:AzureQueueSupport=$(AzureQueueSupport) -p:ServiceBusSupport=$(ServiceBusSupport) -p:HttpSupport=$(HttpSupport) -p:BlobSupport=$(BlobSupport) -p:EventGridSupport=$(EventGridSupport)" WorkingDirectory="$(DeploySrcBuildPath)" ConsoleToMSBuild="true"/>

<Delete Files="$(DeployFullPath)\bin\local.settings.json" Condition="Exists('$(DeployFullPath)\bin\local.settings.json')" />

</Target>

<Target Name="BuildAzureHandlersSourcesHTTP" Condition="'$(DeployType)' != 'SOURCES' AND '$(NETGenerator)' == 'true' AND '$(AZURE_FUNCTIONS_TRIGGER_TYPE)' == 'http'" DependsOnTargets="TransformMVCToAzureFunctions">

<PropertyGroup>
<HttpSupport Condition="'$(AZURE_FUNCTIONS_TRIGGER_TYPE)' == 'http'">true</HttpSupport>
</PropertyGroup>

<Copy SourceFiles="@(AzureFunctionsRootSrc)"
DestinationFolder="$(DeployFullPath)/src/build/GeneXus.Deploy.AzureFunctions.Handlers/%(RecursiveDir)" SkipUnchangedFiles="true" />

<Copy SourceFiles="$(DeployAppDir)/functions.metadata"
DestinationFolder="$(DeployFullPath)/src/build/GeneXus.Deploy.AzureFunctions.Handlers" SkipUnchangedFiles="true" />

<Exec Command="dotnet sln $(DeploymentUnit).sln add &quot;$(DeploySrcBuildPath)/GeneXus.Deploy.AzureFunctions.Handlers/GeneXus.Deploy.AzureFunctions.Handlers.csproj&quot;" WorkingDirectory="$(DeploySrcBuildPath)" />

<!--Add dependencies to project-->
<Copy SourceFiles = "$(GX_PROGRAM_DIR)\DeploymentTargets\AzureFunctions\http\Directory.Build.targets"
DestinationFolder= "$(DeployFullPath)/src/build"/>

<Exec Command="dotnet build &quot;$(DeployFullPath)/src/build/$(DeploymentUnit).sln&quot; -c Release --force -p:DebugType=None -p:CosmosDBSupport=$(CosmosDBSupport) -p:TimerSupport=$(TimerSupport) -p:AzureQueueSupport=$(AzureQueueSupport) -p:ServiceBusSupport=$(ServiceBusSupport) -p:HttpSupport=$(HttpSupport) -p:BlobSupport=$(BlobSupport) -p:EventGridSupport=$(EventGridSupport)" WorkingDirectory="$(DeploySrcBuildPath)" ConsoleToMSBuild="true"/>

<Delete Files="$(DeployFullPath)/bin/local.settings.json" Condition="Exists('$(DeployFullPath)/bin/local.settings.json')" />

</Target>


<Target Name="GenerateSources" Condition = "'$(NETGenerator)' == 'true'">

Expand Down Expand Up @@ -166,7 +185,7 @@
/>
</Target>

<Target Name="PrepareDeploy" DependsOnTargets="GenerateSources;GenerateConfigs;RedisSupport;AddAzureHandlersSources;BuildAzureHandlersSources;BuildAzureHandlersSourcesHTTP;UpdateHostJsonFile" Condition="'$(NETGenerator)' == 'true'">
<Target Name="PrepareDeploy" DependsOnTargets="GenerateSources;GenerateConfigs;RedisSupport;AddAzureHandlersSources;BuildAzureHandlersSources;SetupHttpFunctionsProject;BuildAzureHandlersSourcesHTTP;UpdateHostJsonFile" Condition="'$(NETGenerator)' == 'true'">

<Message Text="Adding required files to the deploy...(this may take a while)" Importance="high"/>

Expand Down

0 comments on commit fbfee62

Please sign in to comment.