diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c8fa986b..2585eda65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,12 +11,12 @@ jobs: Lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: - node-version: '16.x' + node-version: '18.x' - name: Install dependencies run: npm ci - name: Lint @@ -28,23 +28,22 @@ jobs: strategy: fail-fast: false matrix: - nodeVersion: [ '16.x' ] + nodeVersion: [ '18.x' ] os: [ macos-latest ] - tiSDK: [ latest ] + tiSDK: [ '12.5.0.GA' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.nodeVersion }} - name: Install dependencies run: | npm ci npm i titanium -g - ti sdk install ${{ matrix.tiSDK }} -d + ti sdk install ${{ matrix.tiSDK }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run tests run: npm test - diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1ed15caa2..300428964 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,14 +8,14 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '18' registry-url: 'https://registry.npmjs.org' - name: Install dependencies diff --git a/Alloy/commands/compile/parsers/Alloy.Abstract.FixedSpace.js b/Alloy/commands/compile/parsers/Alloy.Abstract.FixedSpace.js index 64e612373..ee283d4fe 100644 --- a/Alloy/commands/compile/parsers/Alloy.Abstract.FixedSpace.js +++ b/Alloy/commands/compile/parsers/Alloy.Abstract.FixedSpace.js @@ -1,9 +1,6 @@ var U = require('../../../utils'), CU = require('../compilerUtils'), - tiapp = require('../../../tiapp'), - iOSProxy; - -var MIN_VERSION = '5.4.0'; + tiapp = require('../../../tiapp'); exports.parse = function(node, state) { return require('./base').parse(node, state, parse); @@ -13,18 +10,12 @@ function parse(node, state, args) { // width is a valid property for a FIXED_SPACE button, add in if specified var width = (args.createArgs.width) ? ", width:'" + args.createArgs.width + "'" : ''; - if (tiapp.version.gte(tiapp.getSdkVersion(), MIN_VERSION)) { - iOSProxy = 'iOS'; - } else { - iOSProxy = 'iPhone'; - } - return { parent: { node: node, symbol: args.symbol }, styles: state.styles, - code: args.symbol + ' = Ti.UI.createButton({systemButton: Ti.UI.' + iOSProxy + '.SystemButton.FIXED_SPACE' + width + '});' + code: args.symbol + ' = Ti.UI.createButton({systemButton: Ti.UI.iOS.SystemButton.FIXED_SPACE' + width + '});' }; } diff --git a/Alloy/commands/compile/parsers/Alloy.Abstract.FlexSpace.js b/Alloy/commands/compile/parsers/Alloy.Abstract.FlexSpace.js index 123449c39..a541e0d2a 100644 --- a/Alloy/commands/compile/parsers/Alloy.Abstract.FlexSpace.js +++ b/Alloy/commands/compile/parsers/Alloy.Abstract.FlexSpace.js @@ -1,9 +1,6 @@ var U = require('../../../utils'), CU = require('../compilerUtils'), - tiapp = require('../../../tiapp'), - iOSProxy; - -var MIN_VERSION = '5.4.0'; + tiapp = require('../../../tiapp'); exports.parse = function(node, state) { return require('./base').parse(node, state, parse); @@ -11,18 +8,12 @@ exports.parse = function(node, state) { function parse(node, state, args) { - if (tiapp.version.gte(tiapp.getSdkVersion(), MIN_VERSION)) { - iOSProxy = 'iOS'; - } else { - iOSProxy = 'iPhone'; - } - return { parent: { node: node, symbol: args.symbol }, styles: state.styles, - code: args.symbol + ' = Ti.UI.createButton({systemButton: Ti.UI.' + iOSProxy + '.SystemButton.FLEXIBLE_SPACE});' + code: args.symbol + ' = Ti.UI.createButton({systemButton: Ti.UI.iOS.SystemButton.FLEXIBLE_SPACE});' }; } diff --git a/Alloy/commands/compile/parsers/Ti.UI.AttributedString.js b/Alloy/commands/compile/parsers/Ti.UI.AttributedString.js index 63674756c..3b6451670 100644 --- a/Alloy/commands/compile/parsers/Ti.UI.AttributedString.js +++ b/Alloy/commands/compile/parsers/Ti.UI.AttributedString.js @@ -4,16 +4,11 @@ var _ = require('lodash'), CU = require('../compilerUtils'), tiapp = require('../../../tiapp'); -var MIN_VERSION = '3.6.0'; - exports.parse = function(node, state) { return require('./base').parse(node, state, parse); }; function parse(node, state, args) { - if (tiapp.version.lt(tiapp.getSdkVersion(), MIN_VERSION)) { - U.die('Ti.UI.AttributedString (line ' + node.lineNumber + ') requires Titanium 3.6.0+'); - } // Get label text from node text, if present var nodeText = U.XML.getNodeText(node); diff --git a/Alloy/commands/compile/parsers/Ti.UI.Button.js b/Alloy/commands/compile/parsers/Ti.UI.Button.js index 5c1c4c76c..035400a6f 100755 --- a/Alloy/commands/compile/parsers/Ti.UI.Button.js +++ b/Alloy/commands/compile/parsers/Ti.UI.Button.js @@ -2,10 +2,7 @@ var _ = require('lodash'), styler = require('../styler'), CU = require('../compilerUtils'), U = require('../../../utils'), - tiapp = require('../../../tiapp'), - iOSProxy; - -var MIN_VERSION = '5.4.0'; + tiapp = require('../../../tiapp'); var systemButtons = [ 'ACTION', 'ACTIVITY', 'ADD', 'BOOKMARKS', 'CAMERA', 'CANCEL', 'COMPOSE', 'CONTACT_ADD', @@ -25,15 +22,9 @@ function parse(node, state, args) { state.extraStyle = styler.createVariableStyle('title', U.possibleMultilineString(U.trim(nodeText.replace(/'/g, "\\'")))); } - if (tiapp.version.gte(tiapp.getSdkVersion(), MIN_VERSION)) { - iOSProxy = 'iOS'; - } else { - iOSProxy = 'iPhone'; - } - var systemButton = node.getAttribute('systemButton'); if (_.includes(systemButtons, systemButton)) { - node.setAttribute('systemButton', 'Ti.UI.' + iOSProxy + '.SystemButton.' + systemButton); + node.setAttribute('systemButton', 'Ti.UI.iOS.SystemButton.' + systemButton); } // Generate runtime code using default diff --git a/Alloy/commands/compile/parsers/Ti.UI.NavigationWindow.js b/Alloy/commands/compile/parsers/Ti.UI.NavigationWindow.js index a7a6b9830..e4363af8b 100644 --- a/Alloy/commands/compile/parsers/Ti.UI.NavigationWindow.js +++ b/Alloy/commands/compile/parsers/Ti.UI.NavigationWindow.js @@ -4,24 +4,13 @@ var _ = require('lodash'), CU = require('../compilerUtils'), tiapp = require('../../../tiapp'); -const MIN_VERSION_FOR_IOS = '3.1.3'; -const MIN_VERSION = '8.0.0'; -const MIN_ANDROID_TABGROUP_CHILD = '8.3.0'; - exports.parse = function(node, state) { return require('./base').parse(node, state, parse); }; function parse(node, state, args) { - const tiappSdkVersion = tiapp.getSdkVersion(); const platform = CU.getCompilerConfig().alloyConfig.platform; - if (tiapp.version.lt(tiappSdkVersion, MIN_VERSION_FOR_IOS)) { - U.die(`Ti.UI.iOS.NavigationWindow (line ${node.lineNumber}) requires Titanium ${MIN_VERSION_FOR_IOS}+`); - } - if (tiapp.version.lt(tiappSdkVersion, MIN_VERSION)) { - node.setAttribute('ns', 'Ti.UI.iOS'); - } var children = U.XML.getElementsFromNodes(node.childNodes), err = ['NavigationWindow must have only one child element, which must be a Window or TabGroup'], @@ -37,10 +26,6 @@ function parse(node, state, args) { theNode = CU.validateNodeName(child, [ 'Ti.UI.Window', 'Ti.UI.TabGroup' ]), windowSymbol; - if (platform === 'android' && theNode === 'Ti.UI.TabGroup' && tiapp.version.lt(tiappSdkVersion, MIN_ANDROID_TABGROUP_CHILD)) { - U.die(`TabGroup can only be a child of a NavigationWindow on Android from SDK ${MIN_ANDROID_TABGROUP_CHILD} onwards. Current SDK is ${tiappSdkVersion}`); - } - // generate the code for the child first if (theNode) { code += CU.generateNodeExtended(child, state, { diff --git a/Alloy/commands/compile/parsers/Ti.UI.OptionBar.js b/Alloy/commands/compile/parsers/Ti.UI.OptionBar.js index b75b77602..da6f61bef 100644 --- a/Alloy/commands/compile/parsers/Ti.UI.OptionBar.js +++ b/Alloy/commands/compile/parsers/Ti.UI.OptionBar.js @@ -1,12 +1,7 @@ const _ = require('lodash'); const tiapp = require('../../../tiapp'); const U = require('../../../utils'); -const MIN_VERSION = '10.0.0'; exports.parse = function(node, state) { - const tiappSdkVersion = tiapp.getSdkVersion(); - if (tiapp.version.lt(tiappSdkVersion, MIN_VERSION)) { - U.die(`Ti.UI.OptionBar requires Titanium SDK ${MIN_VERSION}+`); - } return require('./Ti.UI.ButtonBar').parse(node, state); }; diff --git a/Alloy/commands/compile/parsers/Ti.UI.TabbedBar.js b/Alloy/commands/compile/parsers/Ti.UI.TabbedBar.js index e7527ff1e..82f591140 100644 --- a/Alloy/commands/compile/parsers/Ti.UI.TabbedBar.js +++ b/Alloy/commands/compile/parsers/Ti.UI.TabbedBar.js @@ -1,16 +1,7 @@ const tiapp = require('../../../tiapp'); const CU = require('../compilerUtils'); const U = require('../../../utils'); -const MIN_VERSION = '8.0.0'; exports.parse = function(node, state) { - const tiappSdkVersion = tiapp.getSdkVersion(); - if (tiapp.version.lt(tiappSdkVersion, MIN_VERSION)) { - const platform = CU.getCompilerConfig().alloyConfig.platform; - if (platform !== 'ios') { - U.die(`Ti.UI.TabbedBar for ${platform} requires Titanium ${MIN_VERSION}+`); - } - node.setAttribute('ns', 'Ti.UI.iOS'); - } return require('./Ti.UI.ButtonBar').parse(node, state); }; diff --git a/Alloy/commands/compile/parsers/Ti.UI.Toolbar.js b/Alloy/commands/compile/parsers/Ti.UI.Toolbar.js index 3295bd3f2..a2d1aa46c 100644 --- a/Alloy/commands/compile/parsers/Ti.UI.Toolbar.js +++ b/Alloy/commands/compile/parsers/Ti.UI.Toolbar.js @@ -6,12 +6,6 @@ var _ = require('lodash'), exports.parse = function(node, state) { var platform = CU.getCompilerConfig().alloyConfig.platform; - if (tiapp.version.lt(tiapp.getSdkVersion(), '6.2.0')) { - if (platform !== 'ios') { - U.die('Ti.UI.Toolbar requires Titanium 6.2.0+'); - } - node.setAttribute('ns', 'Ti.UI.iOS'); - } var eventObject = 'e', code = '', diff --git a/Alloy/commands/compile/parsers/Ti.UI.iPhone.NavigationGroup.js b/Alloy/commands/compile/parsers/Ti.UI.iPhone.NavigationGroup.js deleted file mode 100755 index e63c3de07..000000000 --- a/Alloy/commands/compile/parsers/Ti.UI.iPhone.NavigationGroup.js +++ /dev/null @@ -1,58 +0,0 @@ -var styler = require('../styler'), - U = require('../../../utils'), - CU = require('../compilerUtils'), - tiapp = require('../../../tiapp'), - logger = require('../../../logger'); - -var DEPRECATED_VERSION = '3.1.3'; - -exports.parse = function(node, state) { - return require('./base').parse(node, state, parse); -}; - -function parse(node, state, args) { - if (tiapp.version.gte(tiapp.getSdkVersion(), DEPRECATED_VERSION)) { - logger.warn([ - 'Ti.UI.iPhone.NavigationGroup (line ' + node.lineNumber + ') is deprecated as of Titanium ' + DEPRECATED_VERSION, - 'Use Ti.UI.NavigationWindow instead' - ]); - } - - var children = U.XML.getElementsFromNodes(node.childNodes), - err = ['NavigationGroup must have only one child element, which must be a Window'], - code = ''; - - // NavigationGroup must have 1 window as a child - if (children.length !== 1) { - U.die(err); - } - - var child = children[0], - childArgs = CU.getParserArgs(child), - theNode = CU.validateNodeName(child, 'Ti.UI.Window'), - windowSymbol; - - // generate the code for the Window first - if (theNode) { - code += CU.generateNodeExtended(child, state, { - parent: {}, - post: function(node, state, args) { - windowSymbol = state.parent.symbol; - } - }); - } else { - err.unshift('Invalid NavigationGroup child "' + childArgs.fullname + '"'); - U.die(err); - } - - // create navgroup with window - state.extraStyle = styler.createVariableStyle('window', windowSymbol); - code += require('./default').parse(node, state).code; - - // Update the parsing state - return { - parent: {}, - styles: state.styles, - code: code - }; -} diff --git a/Alloy/tiapp.js b/Alloy/tiapp.js index 0f15181e6..67ef97e39 100644 --- a/Alloy/tiapp.js +++ b/Alloy/tiapp.js @@ -35,20 +35,10 @@ tiapp.getSdkVersion = function() { } else { if (process.env.sdk) { return process.env.sdk; - } else { - return getSdkSelectVersion(); } } }; -function getSdkSelectVersion() { - var homeDir = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], - file = path.join(homeDir, '.titanium', 'config.json'); - if (!fs.existsSync(file)) { - U.die('Titanium configuration file does not exist at "' + file + '"'); - } - var ticonfig = JSON.parse(fs.readFileSync(file, {encoding: 'utf8'})); - return ticonfig.sdk.selected; -} + // Get the value of a property from the tiapp.xml tiapp.getProperty = function(name) { diff --git a/test/projects/HarnessTemplate/tiapp.xml b/test/projects/HarnessTemplate/tiapp.xml index b593ed82c..14160cdd9 100644 --- a/test/projects/HarnessTemplate/tiapp.xml +++ b/test/projects/HarnessTemplate/tiapp.xml @@ -69,4 +69,5 @@ ti.map ti.map + 12.5.0.GA