Skip to content

Commit

Permalink
Revert "Enable deploy sources for .NET generator (#62)"
Browse files Browse the repository at this point in the history
This reverts commit 5a31f03.
  • Loading branch information
claudiamurialdo committed Feb 9, 2023
1 parent 5a31f03 commit 3bc932f
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 100 deletions.
5 changes: 5 additions & 0 deletions src/AzureFunctions/createpackage.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<PropertyGroup Condition="'$(GENERATOR)' == '.NET Core' or '$(GENERATOR)' == '.NET'">
<UploadSource>$(DeployFullPath)</UploadSource>
<DeploymentTargetBinPath>$(GX_PROGRAM_DIR)\DeploymentTargets\AzureFunctions\AzFunctionFiles\bin</DeploymentTargetBinPath>
<DeploymentTargetAzfunctPath>$(GX_PROGRAM_DIR)\DeploymentTargets\AzureFunctions\AzFunctionFiles\bin\.azurefunctions</DeploymentTargetAzfunctPath>
<DeploymentTargetRuntimesPath>$(GX_PROGRAM_DIR)\DeploymentTargets\AzureFunctions\AzFunctionFiles\bin\runtimes</DeploymentTargetRuntimesPath>
</PropertyGroup>

<ItemGroup>
<AzureFunctionsRootDeps Include = "$(DeploymentTargetBinPath)\**\*.*" />
<AzureFunctionsFolderDeps Include = "$(DeploymentTargetAzfunctPath)\**\*.*" />
<AzureFunctionsRuntimesDeps Include = "$(DeploymentTargetRuntimesPath)\**\*.*" />

</ItemGroup>

<Target Name="CreatePackage" DependsOnTargets="ValidatePackaging;ZipDeploy" />
Expand Down
93 changes: 37 additions & 56 deletions src/AzureServerless/createpackage.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<PropertyGroup Condition="'$(GENERATOR)' == '.NET Core' or '$(GENERATOR)' == '.NET'">
<UploadSource>$(DeployFullPath)</UploadSource>
<DeploymentTargetBinPath>$(GX_PROGRAM_DIR)\DeploymentTargets\AzureServerless\AzFunctionFiles\bin</DeploymentTargetBinPath>
<DeploymentTargetSrcPath>$(GX_PROGRAM_DIR)\DeploymentTargets\AzureServerless\AzFunctionFiles\src</DeploymentTargetSrcPath>
<SourceFiles Condition="'$(DeployType)'=='SOURCES'" >true</SourceFiles>
<DeploySrcBuildPath>$(DeployFullPath)\src\build</DeploySrcBuildPath>
<DeploymentTargetAzfunctionsPath>$(GX_PROGRAM_DIR)\DeploymentTargets\AzureServerless\AzFunctionFiles\bin\.azurefunctions</DeploymentTargetAzfunctionsPath>
<DeploymentTargetRuntimesPath>$(GX_PROGRAM_DIR)\DeploymentTargets\AzureServerless\AzFunctionFiles\bin\runtimes</DeploymentTargetRuntimesPath>
</PropertyGroup>

<ItemGroup>
<AzureFunctionsRootDeps Include = "$(DeploymentTargetBinPath)\**\*.*" />
<AzureFunctionsRootSrc Include = "$(DeploymentTargetSrcPath)\**\*.*" />
<AzureFunctionsFolderDeps Include = "$(DeploymentTargetAzfunctionsPath)\**\*.*" />
<AzureFunctionsRuntimesDeps Include = "$(DeploymentTargetRuntimesPath)\**\*.*" />
</ItemGroup>

<Target Name="CreatePackage" DependsOnTargets="ZipDeploy" />
Expand All @@ -31,7 +31,7 @@
<GenerateAzFunctionConfigsHttp

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

<PropertyGroup>
<IntegratedSecurityEnabled Condition= "$(AZURE_SERVERLESS_GAM_CONNECTION_KEY) != ''">true</IntegratedSecurityEnabled>
Expand All @@ -42,74 +42,59 @@
AzureDeploy = "AzureServerless"
BaseServiceRoute = "rest"
IntegratedSecurityEnabled = "$(IntegratedSecurityEnabled)"
DeployFullPath = "$(DeployAppDir)" />
DeployFullPath = "$(DeployFullPath)" />

</Target>

<Target Name="PrepareDeploy" DependsOnTargets="GenerateConfigs;RedisSupport;BuildAzureBinaries;CopyAzureBinaries" >
<Target Name="PrepareDeploy" DependsOnTargets="GenerateConfigs;RedisSupport" >
<Message Text="Adding required files to the deploy...(this may take a while)" Importance="high"/>

<ItemGroup>
<ConfigResources Include="$(DeployAppDir)\*.svc" />
<ConfigResources Include="$(DeployAppDir)\Images.txt" Condition="Exists('$(DeployAppDir)\Images.txt')"/>
<ConfigResources Include="$(DeployAppDir)\log.config" Condition="Exists('$(DeployAppDir)\log.config')"/>
<ConfigResources Include="$(DeployAppDir)\log.console.config" Condition="Exists('$(DeployAppDir)\log.console.config')"/>
<ConfigResources Include="$(DeployAppDir)\GeneXus.services" Condition ="Exists('$(DeployAppDir)\GeneXus.services')" />
<ConfigResources Include="$(DeployAppDir)\functions.metadata" />
<ConfigResources Include="$(DeployAppDir)\azureflag.json" Condition ="Exists('$(DeployAppDir)\azureflag.json')" />
<ConfigResources Include="$(DeployAppDir)\appsettings.json" />
<ConfigResources Include="$(DeployAppDir)\CloudServices.config" Condition ="Exists('$(DeployAppDir)\CloudServices.config')" />
<ConfigResources Include="$(DeployFullPath)\*.svc" />
<ConfigResources Include="$(DeployFullPath)\Images.txt" Condition="Exists('$(DeployFullPath)\Images.txt')"/>
<ConfigResources Include="$(DeployFullPath)\log.config" Condition="Exists('$(DeployFullPath)\log.config')"/>
<ConfigResources Include="$(DeployFullPath)\log.console.config" Condition="Exists('$(DeployFullPath)\log.console.config')"/>
<ConfigResources Include="$(DeployFullPath)\GeneXus.services" Condition ="Exists('$(DeployFullPath)\GeneXus.services')" />
<ConfigResources Include="$(DeployFullPath)\functions.metadata" />
<ConfigResources Include="$(DeployFullPath)\azureflag.json" Condition ="Exists('$(DeployFullPath)\azureflag.json')" />
<ConfigResources Include="$(DeployFullPath)\appsettings.json" />
<ConfigResources Include="$(DeployFullPath)\CloudServices.config" Condition ="Exists('$(DeployFullPath)\CloudServices.config')" />
</ItemGroup>

<ItemGroup>
<Modules Include="@(Object -> '%(Module)')" />
<ModuleDirs Include="%(Modules.Identity)" />
<ModuleRelativePath Include="@(ModuleDirs->Replace('.', '\'))" />
<ModuleRelativePathLower Include="@(ModuleRelativePath->ToLower())" />
<ModuleFiles Include="$(DeployAppDir)\%(ModuleRelativePathLower.Identity)\**\*.*" Condition="%(ModuleRelativePathLower.Identity) != ''" >
<ModuleFiles Include="$(DeployFullPath)\%(ModuleRelativePathLower.Identity)\**\*.*" Condition="%(ModuleRelativePathLower.Identity) != ''" >
<RelativePath>%(ModuleRelativePathLower.Identity)</RelativePath>
</ModuleFiles>
</ItemGroup>

<Copy SourceFiles="@(ModuleFiles)" DestinationFiles="@(ModuleFiles -> '$(DeployAppDir)\bin\%(RelativePath)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(ModuleFiles)" DestinationFiles="@(ModuleFiles -> '$(DeployFullPath)\bin\%(RelativePath)\%(RecursiveDir)%(Filename)%(Extension)')" />

<ItemGroup>
<CacheMetadata Include="$(DeployAppDir)\Metadata\TableAccess\*.*" Condition="Exists('$(DeployAppDir)\Metadata\TableAccess')"/>
<CacheMetadata Include="$(DeployFullPath)\Metadata\TableAccess\*.*" Condition="Exists('$(DeployFullPath)\Metadata\TableAccess')"/>
</ItemGroup>

<ItemGroup>
<PrivateDirectory Include="$(DeployAppDir)\private\*.*" Condition="Exists('$(DeployAppDir)\private')"/>
<PrivateDirectory Include="$(DeployFullPath)\private\*.*" Condition="Exists('$(DeployFullPath)\private')"/>
</ItemGroup>

<Copy SourceFiles="@(CacheMetadata)"
DestinationFiles="@(CacheMetadata -> '$(DeployAppDir)\bin\Metadata\TableAccess\%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
DestinationFiles="@(CacheMetadata -> '$(DeployFullPath)\bin\Metadata\TableAccess\%(Filename)%(Extension)')" SkipUnchangedFiles="true" />

<Copy SourceFiles="@(PrivateDirectory)"
DestinationFiles="@(PrivateDirectory -> '$(DeployAppDir)\bin\private\%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
DestinationFiles="@(PrivateDirectory -> '$(DeployFullPath)\bin\private\%(Filename)%(Extension)')" SkipUnchangedFiles="true" />

<Copy SourceFiles="@(AzureFunctionsRootDeps)"
DestinationFolder="$(DeployFullPath)\bin\%(RecursiveDir)" SkipUnchangedFiles="true"/>

<Copy SourceFiles="@(ConfigResources)"
DestinationFiles="@(ConfigResources -> '$(DeployAppDir)\bin\%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
DestinationFiles="@(ConfigResources -> '$(DeployFullPath)\bin\%(Filename)%(Extension)')" SkipUnchangedFiles="true" />

</Target>

<Target Name="BuildAzureBinaries" Condition="'$(SourceFiles)'=='true'">
<Message Text="Adding AzureFunctions 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" />

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

<Target Name="CopyAzureBinaries" Condition="'$(SourceFiles)'!='true'">
<Copy SourceFiles="@(AzureFunctionsRootDeps)"
DestinationFolder="$(DeployAppDir)\bin\%(RecursiveDir)" SkipUnchangedFiles="true"/>
</Target>


<Target Name="RedisSupport" Condition="'$(AZURE_SERVERLESS_SESSION_STATE_PROVIDER)' == 'Redis' AND '$(AZURE_SERVERLESS_SESSION_PROVIDER_ADDRESS)' != ''">

<Message Text="Enabling Redis support" Importance="high"/>
Expand All @@ -118,10 +103,10 @@
<RedisSessionTemplate Include="$(GX_PROGRAM_DIR)\DeploymentTargets\AzureServerless\redis\$(GENERATOR)\*.*"/>
</ItemGroup>

<Copy SourceFiles="@(RedisSessionTemplate)" DestinationFolder="$(DeployAppDir)" Condition="'$(AZURE_SERVERLESS_SESSION_STATE_PROVIDER)' == 'Redis'"/>
<Copy SourceFiles="@(RedisSessionTemplate)" DestinationFolder="$(DeployFullPath)" Condition="'$(AZURE_SERVERLESS_SESSION_STATE_PROVIDER)' == 'Redis'"/>

<ItemGroup>
<CSRedis Include="$(DeployAppDir)\CloudServices.redis.config"/>
<CSRedis Include="$(DeployFullPath)\CloudServices.redis.config"/>
</ItemGroup>

<CallTarget Targets="UpdateRedisCS" />
Expand All @@ -131,8 +116,8 @@
</XmlPeek>

<ItemGroup>
<DestinationCS Include="$(DeployAppDir)\CloudServices.config"/>
<OriginalCS Include="$(DeployAppDir)\CloudServices.config"/>
<DestinationCS Include="$(DeployFullPath)\CloudServices.config"/>
<OriginalCS Include="$(DeployFullPath)\CloudServices.config"/>
</ItemGroup>

<PropertyGroup>
Expand All @@ -149,22 +134,22 @@
<Target Name="UpdateRedisCS" Condition="'$(AZURE_SERVERLESS_SESSION_STATE_PROVIDER)' == 'Redis' AND '$(AZURE_SERVERLESS_SESSION_PROVIDER_ADDRESS)' != ''">

<XmlPoke
XmlInputPath="$(DeployAppDir)\CloudServices.redis.config"
XmlInputPath="$(DeployFullPath)\CloudServices.redis.config"
Value="$(AZURE_SERVERLESS_SESSION_PROVIDER_ADDRESS)"
Query="Services/Service/Properties/Property[Name='SESSION_PROVIDER_ADDRESS']/Value" />

<XmlPoke Condition = "$(AZURE_SERVERLESS_SESSION_PROVIDER_PASSWORD) != ''"
XmlInputPath="$(DeployAppDir)\CloudServices.redis.config"
XmlInputPath="$(DeployFullPath)\CloudServices.redis.config"
Value="$(AZURE_SERVERLESS_SESSION_PROVIDER_PASSWORD)"
Query="Services/Service/Properties/Property[Name='SESSION_PROVIDER_PASSWORD']/Value" />

<XmlPoke Condition = "$(AZURE_SERVERLESS_SESSION_PROVIDER_INSTANCE_NAME) != ''"
XmlInputPath="$(DeployAppDir)\CloudServices.redis.config"
XmlInputPath="$(DeployFullPath)\CloudServices.redis.config"
Value="$(AZURE_SERVERLESS_SESSION_PROVIDER_INSTANCE_NAME)"
Query="Services/Service/Properties/Property[Name='SESSION_PROVIDER_INSTANCE_NAME']/Value" />

<XmlPoke Condition = "$(AZURE_SERVERLESS_SESSION_TIMEOUT) != ''"
XmlInputPath="$(DeployAppDir)\CloudServices.redis.config"
XmlInputPath="$(DeployFullPath)\CloudServices.redis.config"
Value="$(AZURE_SERVERLESS_SESSION_TIMEOUT)"
Query="Services/Service/Properties/Property[Name='SESSION_PROVIDER_SESSION_TIMEOUT']/Value" />
</Target>
Expand All @@ -186,16 +171,12 @@
</Target>

<Target Name="ZipDeploy" DependsOnTargets = "PrepareDeploy">
<CreateItem Include="$(DeployAppDir)\bin\**\*.*;DeployFullPath\src\**\*.*" Condition="'$(SourceFiles)'=='true'">
<Output ItemName="ZipFiles" TaskParameter="Include"/>
</CreateItem>
<Zip ZipFileName="$(DeployFileFullPath)\$(ProjectName)_$(AZURE_SERVERLESS_FUNCTION_NAME).zip" WorkingDirectory="$(DeployFullPath)" Files="@(ZipFiles)" Condition="'$(SourceFiles)'=='true'"/>

<CreateItem Include="$(DeployAppDir)\bin\**\*.*;" Condition="'$(SourceFiles)'!='true'">
<CreateItem Include="$(DeployFullPath)\bin\**\*.*" >
<Output ItemName="ZipFiles" TaskParameter="Include"/>
</CreateItem>
<Zip ZipFileName="$(DeployFileFullPath)\$(ProjectName)_$(AZURE_SERVERLESS_FUNCTION_NAME).zip" WorkingDirectory="$(DeployFullPath)\bin" Files="@(ZipFiles)" Condition="'$(SourceFiles)'!='true'"/>
<Zip ZipFileName="$(DeployFileFullPath)\$(ProjectName)_$(AZURE_SERVERLESS_FUNCTION_NAME).zip" WorkingDirectory="$(DeployFullPath)\bin" Files="@(ZipFiles)" />
<Message Text="Application successfully Packaged to be uploaded to Azure : $(DeployFileFullPath)\$(ProjectName)_$(AZURE_SERVERLESS_FUNCTION_NAME).zip" Importance="high"/>

</Target>

</Project>
8 changes: 1 addition & 7 deletions src/AzureServerless/deploy.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<Import Project= "createpackage.msbuild" Condition = "'$(CreateCloudPackage)' == 'true'" />
<Import Project="$(GXDeployFileProject)" Condition = "'$(CreateCloudPackage)' == '' or '$(CreateCloudPackage)' == 'false'"/>

<Target Name = "ValidateAndPackage" DependsOnTargets="ValidateDeployAzure;CreateCloudPackage"/>

<Target Name = "CreateCloudPackage">
<CallTarget Targets="CreatePackage" Condition = "'$(CreateCloudPackage)' == 'true'"/>
</Target>
Expand All @@ -30,12 +28,8 @@
</Exec>
<Error Text= "Error publishing to Azure Functions: $(OUTPUT_MESSAGE)" Condition = "'$(OUTPUT_MESSAGE)' != 'ServiceError: Unknown error' AND '$(AZ_EXIT_CODE)' == '1'" />
</Target>

<Target Name="Deploy" DependsOnTargets="DeploySources;DeployBinaries" />

<Target Name="DeploySources" DependsOnTargets="CreateCloudPackage" Condition="'$(DeployType)'=='SOURCES'"/>

<Target Name="DeployBinaries" DependsOnTargets="ValidateDeployAzure;CreateCloudPackage;AzLogin;AzPublish" Condition="'$(DeployType)'!='SOURCES'">
<Target Name="Deploy" DependsOnTargets="ValidateDeployAzure;CreateCloudPackage;AzLogin;AzPublish">
<Message Text="Deploying to Azure functions finished successfully." Condition="'$(AZ_EXIT_CODE)' == '0' Or '$(OUTPUT_MESSAGE)' == 'ServiceError: Unknown error'" Importance="high"/>

<!-- Define App Settings for GAM connection -->
Expand Down
44 changes: 7 additions & 37 deletions src/Local/Properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,13 @@
<Description>Local Settings</Description>
<Type>Main</Type>
<Childs>
<Group>
<Id>JavaSourcePackageSettings</Id>
<Name>Java Source Package Settings</Name>
<Description>Source Package Settings for Java</Description>
<Type>Main</Type>
<Childs>

<Prop>
<Id>USE_APPSERVER_DATASOURCE</Id>
<Name>Use Application Server Datasource</Name>
<Description>Set to true if the Application Server already has a Datasource defined.</Description>
<Type>Boolean</Type>
<Default>false</Default>
</Prop>
<Prop>
<Id>GENERATE_MAVEN_POM</Id>
<Name>Generate Maven pom file</Name>
<Description>Generate Maven compilation pom.xml file</Description>
<Type>Boolean</Type>
<Default>false</Default>
</Prop>
<Prop>
<Id>MAVEN_LIB_PATH</Id>
<Name>Maven path for local libs</Name>
<Description>Maven path from where the local libs (jars) will be taken</Description>
<Type>Text</Type>
<Default>${basedir}/src/main/webapp/WEB-INF/lib/</Default>
</Prop>
<Prop>
<Id>MAVEN_VERSION</Id>
<Name>Maven file version</Name>
<Description>Version for the generated Maven file</Description>
<Type>Text</Type>
<Default>1.0-SNAPSHOT</Default>
</Prop>
</Childs>
</Group>
<Prop>
<Id>USE_APPSERVER_DATASOURCE</Id>
<Name>Use Application Server Datasource</Name>
<Description>Set to true if the Application Server already has a Datasource defined.</Description>
<Type>Boolean</Type>
<Default>false</Default>
</Prop>
</Childs>
</Group>
</Object>
Expand Down
19 changes: 19 additions & 0 deletions src/LocalSources/Definition.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<DeploymentTarget>
<Id>LOCAL_SOURCES</Id>
<Name>Local (sources)</Name>
<Version>1.0</Version>
<Description>Deploy source files to a local folder.</Description>
<DeployMsbuild>deploy.msbuild</DeployMsbuild>
<DeployMsbuildTarget>Deploy</DeployMsbuildTarget>
<AvoidPackageOnly>true</AvoidPackageOnly>
<FeatureFlag>localsources.deploy</FeatureFlag>
<ResolverFactory>Genexus.Deployment.LocalSourcesResolvers.ResolverFactory</ResolverFactory>
<Languages>
<Language Id="12"/>
<!--
<Language Id="15"/>
<Language Id="41"/>
-->
</Languages>
<PropertiesDefinitions>Properties.xml</PropertiesDefinitions>
</DeploymentTarget>
34 changes: 34 additions & 0 deletions src/LocalSources/Properties.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Object id="LOCAL_SOURCES">
<Group>
<Id>Local_Sources</Id>
<Name>Local Sources Settings</Name>
<Description>Local Sources Settings</Description>
<Type>Main</Type>
<Childs>
<Prop>
<Id>GENERATE_MAVEN_POM</Id>
<Name>Generate Maven pom file</Name>
<Description>Generate Maven compilation pom.xml file</Description>
<Type>Boolean</Type>
<Default>false</Default>
</Prop>
<Prop>
<Id>MAVEN_LIB_PATH</Id>
<Name>Maven path for local libs</Name>
<Description>Maven path from where the local libs (jars) will be taken</Description>
<Type>Text</Type>
<Default>${basedir}/src/main/webapp/WEB-INF/lib/</Default>
</Prop>
<Prop>
<Id>MAVEN_VERSION</Id>
<Name>Maven file version</Name>
<Description>Version for the generated Maven file</Description>
<Type>Text</Type>
<Default>1.0-SNAPSHOT</Default>
</Prop>
</Childs>
</Group>
</Object>
</Content>
File renamed without changes.

0 comments on commit 3bc932f

Please sign in to comment.