Skip to content

Commit 95e1984

Browse files
Prepare release script
1 parent 98398cb commit 95e1984

7 files changed

Lines changed: 49 additions & 5 deletions

File tree

kratos.gid/kratos.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ proc Kratos::InitGlobalVariables {dir} {
167167
# Is using files modules
168168
set kratos_private(UseFiles) 0
169169
# Variables from the problemtype definition (kratos.xml)
170-
array set kratos_private [ReadProblemtypeXml [file join $kratos_private(Path) kratos.xml] Infoproblemtype {Name Version MinimumGiDVersion MaximumGiDVersion}]
170+
array set kratos_private [ReadProblemtypeXml [file join $kratos_private(Path) kratos.xml] Infoproblemtype {Name Version MinimumGiDVersion MaximumGiDVersion Production}]
171171

172172
variable namespaces
173173
set namespaces [list ]

kratos.gid/kratos.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Program>
55
<Name>Kratos</Name>
66
<Version>10.3.0</Version>
7+
<Production>0</Production>
78
<ExecutableVersion></ExecutableVersion>
89
<MinimumGiDVersion>16.1.10d</MinimumGiDVersion>
910
<MaximumGiDVersion>17.99.99d</MaximumGiDVersion>

kratos.gid/scripts/Applications.tcl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ proc apps::isPublic {appId} {
209209
return [$app isPublic]
210210
}
211211

212+
proc apps::isProductionAvailable {appId} {
213+
set app [getAppById $appId]
214+
if {$app eq ""} {return 0}
215+
if {$::Kratos::kratos_private(Production) eq "0"} {return 1}
216+
# W "Checking if app $appId is production ready = [$app isProductionReady]"
217+
return [$app isProductionReady]
218+
}
219+
212220
proc apps::CheckElemState {elem inputid {arg ""} } {
213221
variable activeApp
214222

@@ -227,7 +235,7 @@ oo::class create App {
227235
variable writeCustomEvent
228236
variable writeValidateEvent
229237
variable prefix
230-
variable release
238+
variable production_ready
231239
variable is_tool
232240

233241
variable properties
@@ -244,6 +252,7 @@ oo::class create App {
244252
variable public
245253
variable is_tool
246254
variable properties
255+
variable production_ready
247256

248257
set name $n
249258
set publicname $n
@@ -263,6 +272,7 @@ oo::class create App {
263272
set prefix ""
264273
set public 0
265274
set is_tool 0
275+
set production_ready 0
266276

267277
set properties [dict create ]
268278
apps::LoadAppProperties [self]
@@ -302,6 +312,8 @@ oo::class create App {
302312

303313
method setPublic {v} {variable public; set public $v}
304314
method isPublic { } {variable public; return $public}
315+
method setProductionReady {v} {variable production_ready; set production_ready $v}
316+
method isProductionReady { } {variable production_ready; return $production_ready}
305317

306318
method setIsTool {v} {variable is_tool; set is_tool $v}
307319
method isTool { } {variable is_tool; return $is_tool}

kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ proc spdAux::CreateInitialApplicationsWindow {} {
4343
set col 0
4444
set row 0
4545
foreach appname $appspn appid $appsid {
46-
if {[apps::isPublic $appid]} {
46+
if {[apps::isPublic $appid] && [apps::isProductionAvailable $appid] } {
47+
# W "Application $appid is public and production available"
4748
set img [::apps::getImgFrom $appid]
4849
ttk::button $w.applications.img$appid -image $img -command [list apps::setActiveApp $appid]
4950
ttk::label $w.applications.text$appid -text $appname

kratos.gid/scripts/spdAuxiliar.tcl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ proc spdAux::processAppIncludes { root } {
127127
if {[$elem hasAttribute "public"]} {set public [$elem getAttribute "public"]}
128128
set app [apps::NewApp $appid $pn $prefix]
129129
$app setPublic $public
130+
131+
# set the app as production ready if the attribute is present
132+
if {[$elem hasAttribute "production"] && [$elem getAttribute "production"] eq "1"} {
133+
# W "Setting app $appid as production ready = [$elem getAttribute "production"]"
134+
$app setProductionReady 1
135+
} else {
136+
# W "Setting app $appid as production ready = 0"
137+
$app setProductionReady 0
138+
}
139+
130140
if {[$elem hasAttribute "is_tool"] } {$app setIsTool [$elem getAttribute "is_tool"]}
131141

132142
if {$active} {

tools/create-release.bat

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ set VERSION=10.3.0
66
@REM git branch %BRANCH%
77
@REM git checkout %BRANCH%
88

9+
@REM check if docker is on
10+
docker --version > NUL 2>&1
11+
if %errorlevel% neq 0 (
12+
echo "Docker is not installed or not running. Please install Docker and try again."
13+
exit /b 1
14+
)
915

10-
git tag -f Release-%version%
11-
git push --tags --force
1216

1317
@REM run python prepare-release-files.py
1418
python prepare-release-files.py
1519

20+
git commit -am "Release %VERSION% preparation"
21+
22+
git tag -f Release-%version%
23+
git push --tags --force
24+
1625
cd ..
1726
mkdir dist
1827
set FOLDER=dist\kratos-%VERSION%

tools/prepare-release-files.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ def get_version_number(file_name):
1111
return version
1212

1313
if __name__ == "__main__":
14+
15+
# Open kratos.xml and set Production to 1
16+
file_name = "../kratos.gid/kratos.xml"
17+
tree = ET.parse(file_name)
18+
root = tree.getroot()
19+
production = root.find('Production')
20+
if production is not None:
21+
production.text = '1'
22+
else:
23+
production = ET.SubElement(root, 'Production')
24+
production.text = '1'
1425

1526
file_name = "../kratos.gid/kratos.spd"
1627
version = get_version_number(file_name)

0 commit comments

Comments
 (0)