forked from genexuslabs/AzureDevOpsBuilding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAzureCICD.msbuild
135 lines (114 loc) · 5.41 KB
/
AzureCICD.msbuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<Project DefaultTargets="SHOW" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<GX_INSTALL_DIR Condition=" '$(GX_INSTALL_DIR)' == '' ">$(MSBuildThisFileDirectory)</GX_INSTALL_DIR>
<CreatedKB>1</CreatedKB>
</PropertyGroup>
<Import Project="$(GX_INSTALL_DIR)GeneXus.Tasks.targets" Condition=" Exists('$(GX_INSTALL_DIR)GeneXus.Tasks.targets') "/>
<Import Project="$(GX_INSTALL_DIR)\genexus.server.tasks.targets" Condition=" Exists('$(GX_INSTALL_DIR)GeneXus.Tasks.targets') "/>
<Import Project="$(GX_INSTALL_DIR)\Genexus.GAM.Tasks.targets" />
<Import Project="$(GX_INSTALL_DIR)\GXtest.targets" />
<PropertyGroup>
<!--Input Parameters-->
<DoUpdate>True</DoUpdate>
<!-- Server Properties -->
<ServerUrl></ServerUrl>
<ServerUsername></ServerUsername>
<ServerPassword></ServerPassword>
<ServerKbAlias></ServerKbAlias>
<VersionName></VersionName>
<!-- Working KB Properties -->
<WorkingDirectory></WorkingDirectory>
<DbaseServerInstance></DbaseServerInstance>
<CreateDbInKbFolder></CreateDbInKbFolder>
<DbaseUseIntegratedSecurity></DbaseUseIntegratedSecurity>
<DbaseServerUsername></DbaseServerUsername>
<DbaseServerPassword></DbaseServerPassword>
<DbaseName></DbaseName>
<WorkingVersion></WorkingVersion>
<WorkingEnvironment></WorkingEnvironment>
<SQLInstance></SQLInstance>
<AppDB></AppDB>
<!-- KB GAM Properties -->
<IncludeFrontendObjects></IncludeFrontendObjects>
<IncludeSDSamples></IncludeSDSamples>
<UpdateMode></UpdateMode>
<!-- Building Properties -->
<ForceRebuild Condition=" '$(ForceRebuild)' == '' ">false</ForceRebuild>
<!-- Environment Propreties -->
<!-- Testing Properties -->
<TestObjectsList></TestObjectsList>
<TestType></TestType>
<TestFilePath></TestFilePath>
</PropertyGroup>
<Target Name="SHOW" >
<Message Text=" - CreateOrUpdate" />
<Message Text=" - BuildAzure" />
</Target>
<Target Name="CreateOrUpdateKB">
<Error Message="Failed to import '$(GX_INSTALL_DIR)GeneXus.Tasks.targets'. Try setting the property GX_INSTALL_DIR to an actual GeneXus installation path." Condition=" !Exists('$(GX_INSTALL_DIR)GeneXus.Tasks.targets') " />
<ItemGroup>
<GXWFile Include="$(WorkingDirectory)\*.gxw"/>
</ItemGroup>
<CallTarget Targets="CreateKB" Condition="'@(GXWFile)'==''"/>
<CallTarget Targets="UpdateKB" Condition="'@(GXWFile)'!='' and $(DoUpdate)"/>
</Target>
<Target Name="CreateKB">
<Message Text="[GXBUILD:INFO] Creating KB '$(ServerKbAlias)' at '$(WorkingDirectory)' // SQLServer instance: $(SQLServerInstanceHost) // GXserver URI: $(KBServerUri) / GXserver User: $(GXserverUserName)" Importance="high" />
<PropertyGroup>
<KBGuid>$([System.Guid]::NewGuid())</KBGuid>
</PropertyGroup>
<CreateKnowledgeBaseFromServer
ServerKBAlias="$(ServerKbAlias)"
ServerUri="$(ServerUrl)"
Directory="$(WorkingDirectory)"
CreateDbInKbFolder="$(CreateDbInKbFolder)"
DBName="$(DbaseName)_$(KBGuid)"
ServerUserName="$(ServerUsername)"
ServerPassword="$(ServerPassword)"/>
<WriteLinesToFile
File="$(WorkingDirectory)\updateCount.txt"
Lines="1"
Overwrite="true"/>
</Target>
<Target Name="UpdateKB">
<OpenKnowledgeBase Directory="$(WorkingDirectory)"/>
<UpdateFromServer
ServerUserName="$(ServerUsername)"
ServerPassword="$(ServerPassword)"
OutputFile="$(BPUpdateLogFile)">
<Output TaskParameter="ObjectsToUpdateQuantity" PropertyName="UpdatedObjectsCount"/>
</UpdateFromServer>
<CloseKnowledgeBase/>
<WriteLinesToFile
File="$(WorkingDirectory)\updateCount.txt"
Lines="$(UpdatedObjectsCount)"
Overwrite="true"/>
</Target>
<Target Name="Build">
<OpenKnowledgeBase Directory="$(WorkingDirectory)"/>
<SetDataStoreProperty Name="Database name" Value="$(AppDB)" />
<SetDataStoreProperty Name="Server name" Value="$(SQLInstance)" />
<SetGAMOptions
IncludeFrontendObjects="$(IncludeFrontendObjects)"
IncludeSDSamples="$(IncludeSDSamples)"
UpdateMode="$(UpdateMode)" />
<BuildAll ForceRebuild="$(ForceRebuild)" CompileMains="true"/>
</Target>
<Target Name="RunTestSuite">
<OpenKnowledgeBase Directory="$(WorkingDirectory)" />
<RunTests Type="$(TestType)" TestObjects="$(testObjectsList)" AllowFailedTests="true" ContinueOnFailedBuild="True" DetailedResults="true" ServerUserName="$(ServerUsername)" ServerPassword="$(ServerPassword)">
<Output TaskParameter="ExecutedCount" PropertyName="ExecutedCount"/>
<Output TaskParameter="SuccessCount" PropertyName="SuccessCount"/>
<Output TaskParameter="ErrorCount" PropertyName="ErrorCount"/>
<Output TaskParameter="WarningCount" PropertyName="WarningCount"/>
<Output TaskParameter="SkippedCount" PropertyName="SkippedCount"/>
<Output TaskParameter="ResultsFile" PropertyName="ResultsFile"/>
</RunTests>
<JUnitExportTests ServerUserName="$(ServerUsername)" ServerPassword="$(ServerPassword)" JUnitTestFilePath="$(TestFilePath)">
<Output TaskParameter="JUnitTestFilePath" PropertyName="JUnitTestFilePathOutput"/>
</JUnitExportTests>
<CloseKnowledgeBase/>
<!-- Remove Error task if you don't desire pipeline failure upon test error. You may want to replace ErrorCount with WarningCount -->
<Error Text="Test execution failed. Check output file $(JUnitTestFilePathOutput)" Condition="$(ErrorCount) > 0" />
</Target>
</Project>