Skip to content

Commit 8302c10

Browse files
committed
Support 20R10 version in feature flags github:11583
(copy code from runtime)
1 parent 58fd5da commit 8302c10

File tree

2 files changed

+37
-18
lines changed

2 files changed

+37
-18
lines changed

Project/Sources/Classes/_feature.4dm

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
2-
property ideVersion : Integer
3-
property ideBuild : Text
4-
property currentUser : Text
5-
property internalVersion : Integer
6-
property _features : Object
1+
property ideVersion; internalVersion : Text
2+
property ideBuild; currentUser : Text
73
property localFile : 4D:C1709.File
84
property isMain : Boolean
5+
property _features; local : Object
96

10-
property local : Collection
11-
12-
Class constructor($version : Integer; $file : 4D:C1709.File)
7+
Class constructor($version : Text; $file : 4D:C1709.File)
138

149
var $build : Integer
1510

1611
Super:C1705()
1712

18-
This:C1470.ideVersion:=Num:C11(Application version:C493($build))
13+
This:C1470.ideVersion:=String:C10(Application version:C493($build))
1914
This:C1470.ideBuild:=String:C10($build)
2015
This:C1470.currentUser:=Current system user:C484
2116

@@ -57,16 +52,28 @@ Function unstable($feature)
5752

5853
//====================================================================
5954
/// Storing a feature as delivered
60-
Function delivered($feature; $version : Integer)
55+
Function delivered($feature; $version : Text)
6156

6257
This:C1470._features[This:C1470._feature($feature)]:=(This:C1470.ideVersion>=$version)
6358

6459
//====================================================================
65-
/// Storing a feature as debug (only available in dev mode)
66-
Function debug($feature)
60+
/// Storing a feature as debug (only available in matrix database)
61+
Function matrix($feature)
6762

6863
This:C1470._features[This:C1470._feature($feature)]:=(Structure file:C489=Structure file:C489(*))
6964

65+
//====================================================================
66+
/// .matrix() alias
67+
Function debug($feature)
68+
69+
This:C1470.matrix($feature)
70+
71+
//====================================================================
72+
/// Storing a feature as debug (only available in dev mode)
73+
Function interpeted($feature)
74+
75+
This:C1470._features[This:C1470._feature($feature)]:=(Not:C34(Is compiled mode:C492))
76+
7077
//====================================================================
7178
/// Storing a feature as only available in main branch
7279
Function main($feature)
@@ -79,6 +86,18 @@ Function wip($feature)
7986

8087
This:C1470._features[This:C1470._feature($feature)]:=(Structure file:C489=Structure file:C489(*))
8188

89+
//====================================================================
90+
// Activate a feature for project mode only
91+
Function project($feature)
92+
93+
This:C1470._features[This:C1470._feature($feature)]:=Bool:C1537(Get database parameter:C643(Is host database a project:K37:99))
94+
95+
//====================================================================
96+
// Activate a feature for binary database only
97+
Function binary($feature)
98+
99+
This:C1470._features[This:C1470._feature($feature)]:=Not:C34(Bool:C1537(Get database parameter:C643(Is host database a project:K37:99)))
100+
82101
//====================================================================
83102
/// Storing an alias name for a feature
84103
Function alias($alias; $original)
@@ -99,7 +118,7 @@ Function dev($feature; $user)
99118
//______________________________________________________
100119
: (Value type:C1509($user)=Is collection:K8:32)
101120

102-
This:C1470._features[This:C1470._feature($feature)]:=($user.indexOf(This:C1470.currentUser)#-1)
121+
This:C1470._features[This:C1470._feature($feature)]:=($user.includes(This:C1470.currentUser))
103122

104123
//______________________________________________________
105124
: (Value type:C1509($user)=Is text:K8:3)
@@ -193,7 +212,7 @@ Function loadLocal()
193212
//______________________________________________________
194213
: ($key="version")
195214

196-
$enabled:=(This:C1470.ideVersion>=Num:C11($o.enabled[$key]))
215+
$enabled:=(This:C1470.ideVersion>=String:C10($o.enabled[$key]))
197216

198217
//______________________________________________________
199218
: ($key="type")

Project/Sources/Methods/FEATURES.4dm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ var Feature : cs:C1710._feature
1010

1111
If (Feature=Null:C1517)
1212

13-
var $version : Integer
14-
$version:=2080 // 20R8
13+
var $version : Text
14+
$version:="2080" // 20R8
1515

16-
If ($version>Num:C11(Application version:C493()))
16+
If ($version>Application version:C493())
1717

1818
ALERT:C41("The current 4D version ("+Application version:C493+") is lower than the internal version ("+String:C10($version)+").\r\rYou need to fix this!")
1919
METHOD OPEN PATH:C1213(Current method name:C684; 13; *)

0 commit comments

Comments
 (0)