Skip to content

Commit

Permalink
Merge branch 'master' into module-unzip
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Sep 17, 2020
2 parents e86b11a + ac1c237 commit d98c849
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 87 deletions.
8 changes: 4 additions & 4 deletions build/lib/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,16 @@ class Packager {
const modulesDir = path.join(this.zipDir, 'modules');

// We have a race condition problem where where the top-level modules folder and the platform-specific
// sub-folders are trying to be created at the same time if we copy moduels in parallel
// sub-folders are trying to be created at the same time if we copy modules in parallel
// How can we avoid? Pre-create the common folder structure in advance!
await fs.ensureDir(modulesDir);
await fs.emptyDir(modulesDir);
const subDirs = this.platforms.concat([ 'commonjs' ]);
// Convert ios to iphone
const iosIndex = subDirs.indexOf('ios');
if (iosIndex !== -1) {
subDirs[iosIndex] = 'iphone';
}
await Promise.all(subDirs.map(d => fs.ensureDir(path.join(modulesDir, d))));
await Promise.all(subDirs.map(d => fs.emptyDir(path.join(modulesDir, d))));
// Now download/extract/copy the modules
await Promise.all(modules.map(m => this.handleModule(m)));

Expand Down Expand Up @@ -296,7 +296,7 @@ class Packager {
if (this.targetOS !== 'win32') {
ignoreDirs.push(path.join(SUPPORT_DIR, 'win32'));
}
// FIXME: Usee Array.prototype.some to filter more succinctly
// FIXME: Use Array.prototype.some to filter more succinctly
const filter = src => {
for (const ignore of ignoreDirs) {
if (src.includes(ignore)) {
Expand Down
1 change: 1 addition & 0 deletions build/lib/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ async function addTiAppProperties() {
content.push('\t<property name="presetDouble" type="double">1.23456</property>');
content.push('\t<property name="presetInt" type="int">1337</property>');
content.push('\t<property name="presetString" type="string">Hello!</property>');
content.push(`\t<property name="isCI" type="bool">${isCI}</property>`);
content.push('\t<transpile>true</transpile>');
} else if (line.indexOf('<android xmlns:android') >= 0) {
// Insert manifest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
24DE9E1011C5FE74003F90F6 /* <%- moduleIdAsIdentifier %>ModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "<%- moduleIdAsIdentifier %>ModuleAssets.m"; path = "Classes/<%- moduleIdAsIdentifier %>ModuleAssets.m"; sourceTree = "<group>"; };
AA747D9E0F9514B9006C5449 /* <%- moduleIdAsIdentifier %>_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "<%- moduleIdAsIdentifier %>_Prefix.pch"; sourceTree = SOURCE_ROOT; };
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
B11E042B241AC5C100EFA7DC /* TitaniumKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = TitaniumKit.xcframework; path = "<%- tisdkPath %>/iphone/Frameworks/TitaniumKit.xcframework"; sourceTree = "<group>"; };
B11E042B241AC5C100EFA7DC /* TitaniumKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = TitaniumKit.xcframework; path = "$(TITANIUM_SDK)/iphone/Frameworks/TitaniumKit.xcframework"; sourceTree = "<group>"; };
D2AAC07E0554694100DB518D /* lib<%- moduleId %>.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "lib<%- moduleId %>.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
B1E00E64241D179500C384C1 /* TitaniumKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = TitaniumKit.xcframework; path = "<%- tisdkPath %>/iphone/Frameworks/TitaniumKit.xcframework"; sourceTree = "<group>"; };
B1E00E64241D179500C384C1 /* TitaniumKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = TitaniumKit.xcframework; path = $(TITANIUM_SDK)/iphone/Frameworks/TitaniumKit.xcframework"; sourceTree = "<group>"; };
DB24E03B20766AC90033B2B1 /* <%- moduleIdAsIdentifier %>ExampleProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = <%- moduleIdAsIdentifier %>ExampleProxy.swift; path = Classes/<%- moduleIdAsIdentifier %>ExampleProxy.swift; sourceTree = "<group>"; };
DB34CDDE207B998A005F8E8C /* <%- moduleIdAsIdentifier %>ModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = <%- moduleIdAsIdentifier %>ModuleAssets.m; path = Classes/<%- moduleIdAsIdentifier %>ModuleAssets.m; sourceTree = SOURCE_ROOT; };
DB34CDDF207B998A005F8E8C /* <%- moduleIdAsIdentifier %>ModuleAssets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = <%- moduleIdAsIdentifier %>ModuleAssets.h; path = Classes/<%- moduleIdAsIdentifier %>ModuleAssets.h; sourceTree = SOURCE_ROOT; };
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"request-promise-native": "^1.0.9",
"rollup": "^2.27.0",
"rollup": "^2.27.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
Expand Down
44 changes: 22 additions & 22 deletions tests/Resources/ti.filesystem.file.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,15 @@ describe('Titanium.Filesystem.File', function () {
}

// write some initial contents
should(fileATxt.write('text initial ')).eql.true;
should(fileATxt.exists()).eql.true;
should(fileATxt.write('text initial ')).be.true();
should(fileATxt.exists()).be.true();

// Now move the file
should(fileATxt.move(destPath)).eql.true;
should(fileATxt.move(destPath)).be.true();

// Now verify that the original file doesn't exist and the new file does
should(fileATxt.exists()).eql.false;
should(dest.exists()).eql.true;
should(fileATxt.exists()).be.false();
should(dest.exists()).be.true();
});

it('moves file to another directory', function () {
Expand All @@ -594,19 +594,19 @@ describe('Titanium.Filesystem.File', function () {
}

if (!subdir.exists()) {
should(subdir.createDirectory()).eql.true;
should(subdir.createDirectory()).be.true();
}

// write some initial contents
should(fileATxt.write('text initial ')).eql.true;
should(fileATxt.exists()).eql.true;
should(fileATxt.write('text initial ')).be.true();
should(fileATxt.exists()).be.true();

// Now move the file
should(fileATxt.move(dest.nativePath)).eql.true;
should(fileATxt.move(dest.nativePath)).be.true();

// Now verify that the original file doesn't exist and the new file does
should(fileATxt.exists()).eql.false;
should(dest.exists()).eql.true;
should(fileATxt.exists()).be.false();
should(dest.exists()).be.true();
});
});

Expand All @@ -630,15 +630,15 @@ describe('Titanium.Filesystem.File', function () {
}

// write some initial contents
should(fileATxt.write('text initial ')).eql.true;
should(fileATxt.exists()).eql.true;
should(fileATxt.write('text initial ')).be.true();
should(fileATxt.exists()).be.true();

// Now rename the file
should(fileATxt.rename(destPath)).eql.true;
should(fileATxt.rename(destPath)).be.true();

// Now verify that the original file doesn't exist and the new file does
should(fileATxt.exists()).eql.false;
should(dest.exists()).eql.true;
should(fileATxt.exists()).be.false();
should(dest.exists()).be.true();
});

it('fails to rename file to another directory', function () {
Expand All @@ -655,19 +655,19 @@ describe('Titanium.Filesystem.File', function () {
}

if (!subdir.exists()) {
should(subdir.createDirectory()).eql.true;
should(subdir.createDirectory()).be.true();
}

// write some initial contents
should(fileATxt.write('text initial ')).eql.true;
should(fileATxt.exists()).eql.true;
should(fileATxt.write('text initial ')).be.true();
should(fileATxt.exists()).be.true();

// Now move the file
should(fileATxt.rename(dest.nativePath)).eql.false;
should(fileATxt.rename(dest.nativePath)).be.false();

// Now verify that the original file still exists and the new file doesn't
should(fileATxt.exists()).eql.true;
should(dest.exists()).eql.false;
should(fileATxt.exists()).be.true();
should(dest.exists()).be.false();
});
});

Expand Down
29 changes: 26 additions & 3 deletions tests/Resources/ti.network.httpclient.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@ describe('Titanium.Network.HTTPClient', function () {
}, 1);
};
xhr.onerror = function (e) {
should(e).should.be.type('undefined');
try {
should(e).should.be.type('undefined');
} catch (err) {
finish(err);
}
};
xhr.open('GET', 'https://www.google.com');
xhr.send();
Expand Down Expand Up @@ -642,7 +646,16 @@ describe('Titanium.Network.HTTPClient', function () {
finish(err);
}
};
xhr.onerror = e => finish(e);
let attempts = 3;
xhr.onerror = function (e) {
if (attempts-- > 0) {
Ti.API.warn('failed, attempting to retry request...');
xhr.send();
} else {
Ti.API.debug(JSON.stringify(e, null, 2));
finish(new Error(e.error || this.responseText));
}
};

xhr.open('POST', 'http://httpbin.org/post');
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf8');
Expand Down Expand Up @@ -671,7 +684,17 @@ describe('Titanium.Network.HTTPClient', function () {
}
finish();
};
xhr.onerror = e => finish(e);

let attempts = 3;
xhr.onerror = function (e) {
if (attempts-- > 0) {
Ti.API.warn('failed, attempting to retry request...');
xhr.send();
} else {
Ti.API.debug(JSON.stringify(e, null, 2));
finish(new Error(e.error || this.responseText));
}
};

xhr.open('GET', 'https://avatars1.githubusercontent.com/u/82188?s=200&v=4');
xhr.setRequestHeader('Accept-Encoding', 'identity');
Expand Down
7 changes: 7 additions & 0 deletions tests/Resources/ti.ui.tabgroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
/* eslint no-unused-expressions: "off" */
'use strict';
const should = require('./utilities/assertions'); // eslint-disable-line no-unused-vars
const utilities = require('./utilities/utilities');

const isCI = Ti.App.Properties.getBool('isCI', false);

describe('Titanium.UI.TabGroup', function () {
this.timeout(5000);
Expand Down Expand Up @@ -58,6 +61,10 @@ describe('Titanium.UI.TabGroup', function () {
});

it.windowsBroken('add Map.View to TabGroup', function (finish) {
if (isCI && utilities.isMacOS()) { // FIXME: On macOS CI (maybe < 10.15.6?), the mapView compelete event never fires! Does app need explicit focus added?
return finish(); // FIXME: skip when we move to official mocha package
}

this.slow(5000);
this.timeout(15000);

Expand Down
7 changes: 7 additions & 0 deletions tests/Resources/ti.ui.tableview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
/* eslint no-unused-expressions: "off" */
'use strict';
const should = require('./utilities/assertions');
const utilities = require('./utilities/utilities');

const isCI = Ti.App.Properties.getBool('isCI', false);

describe('Titanium.UI.TableView', function () {
this.timeout(5000);
Expand Down Expand Up @@ -1385,6 +1388,10 @@ describe('Titanium.UI.TableView', function () {
});

it.ios('row#rect', function (finish) {
if (isCI && utilities.isMacOS()) { // FIXME: On macOS CI (maybe < 10.15.6?), times out! Does app need explicit focus added?
return finish(); // FIXME: skip when we move to official mocha package
}

win = Ti.UI.createWindow();
const tableView = Ti.UI.createTableView();
const row = Ti.UI.createTableViewRow({
Expand Down

0 comments on commit d98c849

Please sign in to comment.