Skip to content

Commit dc17eba

Browse files
committed
Merge branch 'alloyDb' of https://github.com/tidev/alloy into alloyDb
2 parents 9065630 + 1cc54cf commit dc17eba

14 files changed

+21
-146
lines changed

Diff for: .github/workflows/build.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
Lint:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
with:
1616
fetch-depth: 0
17-
- uses: actions/setup-node@v1
17+
- uses: actions/setup-node@v4
1818
with:
19-
node-version: '16.x'
19+
node-version: '22.x'
2020
- name: Install dependencies
2121
run: npm ci
2222
- name: Lint
@@ -28,23 +28,22 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
nodeVersion: [ '16.x' ]
31+
nodeVersion: [ '22.x' ]
3232
os: [ macos-latest ]
33-
tiSDK: [ latest ]
33+
tiSDK: [ 'latest' ]
3434
steps:
35-
- uses: actions/checkout@v2
35+
- uses: actions/checkout@v4
3636
with:
3737
fetch-depth: 0
38-
- uses: actions/setup-node@v1
38+
- uses: actions/setup-node@v4
3939
with:
4040
node-version: ${{ matrix.nodeVersion }}
4141
- name: Install dependencies
4242
run: |
4343
npm ci
4444
npm i titanium -g
45-
ti sdk install ${{ matrix.tiSDK }} -d
45+
ti sdk install ${{ matrix.tiSDK }}
4646
env:
4747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4848
- name: Run tests
4949
run: npm test
50-

Diff for: .github/workflows/publish.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ jobs:
88

99
steps:
1010
- name: Checkout repository
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
1414

1515
- name: Setup node
16-
uses: actions/setup-node@v2
16+
uses: actions/setup-node@v4
1717
with:
18-
node-version: '16'
18+
node-version: '22'
1919
registry-url: 'https://registry.npmjs.org'
2020

2121
- name: Install dependencies

Diff for: Alloy/commands/compile/compilerUtils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ exports.generateCollectionBindingTemplate = function(args) {
10181018
code += ' if (e && e.fromAdapter) { return; }';
10191019
code += ' var opts = ' + handlerFunc + '.opts || {};';
10201020
code += ' var models = ' + whereCode + ';';
1021-
code += ' var len = models.length;';
1021+
code += ' var len = models ? models.length : 0;';
10221022
code += '<%= pre %>';
10231023
code += ' for (var i = 0; i < len; i++) {';
10241024
code += ' var <%= localModel %> = models[i];';
+2-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
var U = require('../../../utils'),
22
CU = require('../compilerUtils'),
3-
tiapp = require('../../../tiapp'),
4-
iOSProxy;
5-
6-
var MIN_VERSION = '5.4.0';
3+
tiapp = require('../../../tiapp');
74

85
exports.parse = function(node, state) {
96
return require('./base').parse(node, state, parse);
@@ -13,18 +10,12 @@ function parse(node, state, args) {
1310
// width is a valid property for a FIXED_SPACE button, add in if specified
1411
var width = (args.createArgs.width) ? ", width:'" + args.createArgs.width + "'" : '';
1512

16-
if (tiapp.version.gte(tiapp.getSdkVersion(), MIN_VERSION)) {
17-
iOSProxy = 'iOS';
18-
} else {
19-
iOSProxy = 'iPhone';
20-
}
21-
2213
return {
2314
parent: {
2415
node: node,
2516
symbol: args.symbol
2617
},
2718
styles: state.styles,
28-
code: args.symbol + ' = Ti.UI.createButton({systemButton: Ti.UI.' + iOSProxy + '.SystemButton.FIXED_SPACE' + width + '});'
19+
code: args.symbol + ' = Ti.UI.createButton({systemButton: Ti.UI.iOS.SystemButton.FIXED_SPACE' + width + '});'
2920
};
3021
}
+2-11
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
var U = require('../../../utils'),
22
CU = require('../compilerUtils'),
3-
tiapp = require('../../../tiapp'),
4-
iOSProxy;
5-
6-
var MIN_VERSION = '5.4.0';
3+
tiapp = require('../../../tiapp');
74

85
exports.parse = function(node, state) {
96
return require('./base').parse(node, state, parse);
107
};
118

129
function parse(node, state, args) {
1310

14-
if (tiapp.version.gte(tiapp.getSdkVersion(), MIN_VERSION)) {
15-
iOSProxy = 'iOS';
16-
} else {
17-
iOSProxy = 'iPhone';
18-
}
19-
2011
return {
2112
parent: {
2213
node: node,
2314
symbol: args.symbol
2415
},
2516
styles: state.styles,
26-
code: args.symbol + ' = Ti.UI.createButton({systemButton: Ti.UI.' + iOSProxy + '.SystemButton.FLEXIBLE_SPACE});'
17+
code: args.symbol + ' = Ti.UI.createButton({systemButton: Ti.UI.iOS.SystemButton.FLEXIBLE_SPACE});'
2718
};
2819
}

Diff for: Alloy/commands/compile/parsers/Ti.UI.AttributedString.js

-5
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@ var _ = require('lodash'),
44
CU = require('../compilerUtils'),
55
tiapp = require('../../../tiapp');
66

7-
var MIN_VERSION = '3.6.0';
8-
97
exports.parse = function(node, state) {
108
return require('./base').parse(node, state, parse);
119
};
1210

1311
function parse(node, state, args) {
14-
if (tiapp.version.lt(tiapp.getSdkVersion(), MIN_VERSION)) {
15-
U.die('Ti.UI.AttributedString (line ' + node.lineNumber + ') requires Titanium 3.6.0+');
16-
}
1712

1813
// Get label text from node text, if present
1914
var nodeText = U.XML.getNodeText(node);

Diff for: Alloy/commands/compile/parsers/Ti.UI.Button.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ var _ = require('lodash'),
22
styler = require('../styler'),
33
CU = require('../compilerUtils'),
44
U = require('../../../utils'),
5-
tiapp = require('../../../tiapp'),
6-
iOSProxy;
7-
8-
var MIN_VERSION = '5.4.0';
5+
tiapp = require('../../../tiapp');
96

107
var systemButtons = [
118
'ACTION', 'ACTIVITY', 'ADD', 'BOOKMARKS', 'CAMERA', 'CANCEL', 'COMPOSE', 'CONTACT_ADD',
@@ -25,15 +22,9 @@ function parse(node, state, args) {
2522
state.extraStyle = styler.createVariableStyle('title', U.possibleMultilineString(U.trim(nodeText.replace(/'/g, "\\'"))));
2623
}
2724

28-
if (tiapp.version.gte(tiapp.getSdkVersion(), MIN_VERSION)) {
29-
iOSProxy = 'iOS';
30-
} else {
31-
iOSProxy = 'iPhone';
32-
}
33-
3425
var systemButton = node.getAttribute('systemButton');
3526
if (_.includes(systemButtons, systemButton)) {
36-
node.setAttribute('systemButton', 'Ti.UI.' + iOSProxy + '.SystemButton.' + systemButton);
27+
node.setAttribute('systemButton', 'Ti.UI.iOS.SystemButton.' + systemButton);
3728
}
3829

3930
// Generate runtime code using default

Diff for: Alloy/commands/compile/parsers/Ti.UI.NavigationWindow.js

-15
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,13 @@ var _ = require('lodash'),
44
CU = require('../compilerUtils'),
55
tiapp = require('../../../tiapp');
66

7-
const MIN_VERSION_FOR_IOS = '3.1.3';
8-
const MIN_VERSION = '8.0.0';
9-
const MIN_ANDROID_TABGROUP_CHILD = '8.3.0';
10-
117
exports.parse = function(node, state) {
128
return require('./base').parse(node, state, parse);
139
};
1410

1511
function parse(node, state, args) {
16-
const tiappSdkVersion = tiapp.getSdkVersion();
1712
const platform = CU.getCompilerConfig().alloyConfig.platform;
18-
if (tiapp.version.lt(tiappSdkVersion, MIN_VERSION_FOR_IOS)) {
19-
U.die(`Ti.UI.iOS.NavigationWindow (line ${node.lineNumber}) requires Titanium ${MIN_VERSION_FOR_IOS}+`);
20-
}
2113

22-
if (tiapp.version.lt(tiappSdkVersion, MIN_VERSION)) {
23-
node.setAttribute('ns', 'Ti.UI.iOS');
24-
}
2514

2615
var children = U.XML.getElementsFromNodes(node.childNodes),
2716
err = ['NavigationWindow must have only one child element, which must be a Window or TabGroup'],
@@ -37,10 +26,6 @@ function parse(node, state, args) {
3726
theNode = CU.validateNodeName(child, [ 'Ti.UI.Window', 'Ti.UI.TabGroup' ]),
3827
windowSymbol;
3928

40-
if (platform === 'android' && theNode === 'Ti.UI.TabGroup' && tiapp.version.lt(tiappSdkVersion, MIN_ANDROID_TABGROUP_CHILD)) {
41-
U.die(`TabGroup can only be a child of a NavigationWindow on Android from SDK ${MIN_ANDROID_TABGROUP_CHILD} onwards. Current SDK is ${tiappSdkVersion}`);
42-
}
43-
4429
// generate the code for the child first
4530
if (theNode) {
4631
code += CU.generateNodeExtended(child, state, {

Diff for: Alloy/commands/compile/parsers/Ti.UI.OptionBar.js

-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
const _ = require('lodash');
22
const tiapp = require('../../../tiapp');
33
const U = require('../../../utils');
4-
const MIN_VERSION = '10.0.0';
54

65
exports.parse = function(node, state) {
7-
const tiappSdkVersion = tiapp.getSdkVersion();
8-
if (tiapp.version.lt(tiappSdkVersion, MIN_VERSION)) {
9-
U.die(`Ti.UI.OptionBar requires Titanium SDK ${MIN_VERSION}+`);
10-
}
116
return require('./Ti.UI.ButtonBar').parse(node, state);
127
};

Diff for: Alloy/commands/compile/parsers/Ti.UI.TabbedBar.js

-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
const tiapp = require('../../../tiapp');
22
const CU = require('../compilerUtils');
33
const U = require('../../../utils');
4-
const MIN_VERSION = '8.0.0';
54

65
exports.parse = function(node, state) {
7-
const tiappSdkVersion = tiapp.getSdkVersion();
8-
if (tiapp.version.lt(tiappSdkVersion, MIN_VERSION)) {
9-
const platform = CU.getCompilerConfig().alloyConfig.platform;
10-
if (platform !== 'ios') {
11-
U.die(`Ti.UI.TabbedBar for ${platform} requires Titanium ${MIN_VERSION}+`);
12-
}
13-
node.setAttribute('ns', 'Ti.UI.iOS');
14-
}
156
return require('./Ti.UI.ButtonBar').parse(node, state);
167
};

Diff for: Alloy/commands/compile/parsers/Ti.UI.Toolbar.js

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ var _ = require('lodash'),
66

77
exports.parse = function(node, state) {
88
var platform = CU.getCompilerConfig().alloyConfig.platform;
9-
if (tiapp.version.lt(tiapp.getSdkVersion(), '6.2.0')) {
10-
if (platform !== 'ios') {
11-
U.die('Ti.UI.Toolbar requires Titanium 6.2.0+');
12-
}
13-
node.setAttribute('ns', 'Ti.UI.iOS');
14-
}
159

1610
var eventObject = 'e',
1711
code = '',

Diff for: Alloy/commands/compile/parsers/Ti.UI.iPhone.NavigationGroup.js

-58
This file was deleted.

Diff for: Alloy/tiapp.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ tiapp.getSdkVersion = function() {
3535
} else {
3636
if (process.env.sdk) {
3737
return process.env.sdk;
38-
} else {
39-
return getSdkSelectVersion();
4038
}
4139
}
4240
};
41+
4342
tiapp.getBundleId = function() {
4443
var elems = doc.documentElement.getElementsByTagName('id');
4544
if (elems && elems.length > 0) {
@@ -58,6 +57,7 @@ tiapp.getBundleId = function() {
5857
return bundleId;
5958
}
6059
};
60+
6161
function getSdkSelectVersion() {
6262
var homeDir = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'],
6363
file = path.join(homeDir, '.titanium', 'config.json');

Diff for: test/projects/HarnessTemplate/tiapp.xml

+1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@
6969
<module platform="android">ti.map</module>
7070
<module platform="iphone">ti.map</module>
7171
</modules>
72+
<sdk-version>12.6.1.GA</sdk-version>
7273
</ti:app>

0 commit comments

Comments
 (0)