mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #10929 from BrianMulhall/xmlbuilder2-update
Xmlbuilder2 update
This commit is contained in:
@@ -841,6 +841,13 @@ xmlbuilder: http://github.com/oozcitak/xmlbuilder-js
|
||||
Copyright (c) 2013 Ozgur Ozcitak
|
||||
|
||||
|
||||
----------
|
||||
xmlbuilder2: http://github.com/oozcitak/xmlbuilder2
|
||||
----------
|
||||
|
||||
Copyright (c) 2013 Ozgur Ozcitak
|
||||
|
||||
|
||||
----------
|
||||
xmldom: https://github.com/jindw/xmldom
|
||||
----------
|
||||
|
||||
2
meteor
2
meteor
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
BUNDLE_VERSION=12.16.1.3
|
||||
BUNDLE_VERSION=12.16.1.5
|
||||
|
||||
# OS Check. Put here because here is where we download the precompiled
|
||||
# bundles that are arch specific.
|
||||
|
||||
@@ -62,7 +62,8 @@ var packageJson = {
|
||||
optimism: "0.11.3",
|
||||
"@wry/context": "0.4.4",
|
||||
'lru-cache': '4.1.3',
|
||||
"anser": "1.4.8"
|
||||
"anser": "1.4.8",
|
||||
'xmlbuilder2': '1.3.0'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
47
tools/cordova/builder.js
vendored
47
tools/cordova/builder.js
vendored
@@ -10,6 +10,7 @@ import archinfo from '../utils/archinfo';
|
||||
import release from '../packaging/release.js';
|
||||
import { loadIsopackage } from '../tool-env/isopackets.js';
|
||||
import utils from '../utils/utils.js';
|
||||
import XmlBuilder from 'xmlbuilder2';
|
||||
|
||||
import { CORDOVA_ARCH } from './index.js';
|
||||
|
||||
@@ -123,8 +124,8 @@ export class CordovaBuilder {
|
||||
'DisallowOverscroll': true
|
||||
},
|
||||
platform: {
|
||||
ios: {},
|
||||
android: {}
|
||||
ios: {},
|
||||
android: {}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -246,9 +247,7 @@ export class CordovaBuilder {
|
||||
}
|
||||
|
||||
writeConfigXmlAndCopyResources(shouldCopyResources = true) {
|
||||
const { XmlBuilder } = loadIsopackage('xmlbuilder');
|
||||
|
||||
let config = XmlBuilder.create('widget');
|
||||
let config = XmlBuilder.create({ version: '1.0' }).ele('widget');
|
||||
|
||||
// Set the root attributes
|
||||
_.each({
|
||||
@@ -265,16 +264,16 @@ export class CordovaBuilder {
|
||||
});
|
||||
|
||||
// Set the metadata
|
||||
config.element('name').txt(this.metadata.name);
|
||||
config.element('description').txt(this.metadata.description);
|
||||
config.element('author', {
|
||||
config.ele('name').txt(this.metadata.name);
|
||||
config.ele('description').txt(this.metadata.description);
|
||||
config.ele('author', {
|
||||
href: this.metadata.website,
|
||||
email: this.metadata.email
|
||||
}).txt(this.metadata.author);
|
||||
|
||||
// Set the additional global configuration preferences
|
||||
_.each(this.additionalConfiguration.global, (value, key) => {
|
||||
config.element('preference', {
|
||||
config.ele('preference', {
|
||||
name: key,
|
||||
value: value.toString()
|
||||
});
|
||||
@@ -282,10 +281,10 @@ export class CordovaBuilder {
|
||||
|
||||
// Set custom tags into widget element
|
||||
_.each(this.custom, elementSet => {
|
||||
const tag = config.raw(elementSet);
|
||||
const tag = config.ele(elementSet);
|
||||
});
|
||||
|
||||
config.element('content', { src: this.metadata.contentUrl });
|
||||
config.ele('content', { src: this.metadata.contentUrl });
|
||||
|
||||
// Copy all the access rules
|
||||
_.each(this.accessRules, (options, pattern) => {
|
||||
@@ -293,23 +292,23 @@ export class CordovaBuilder {
|
||||
options = _.omit(options, 'type');
|
||||
|
||||
if (type === 'intent') {
|
||||
config.element('allow-intent', { href: pattern });
|
||||
config.ele('allow-intent', { href: pattern });
|
||||
} else if (type === 'navigation') {
|
||||
config.element('allow-navigation', _.extend({ href: pattern }, options));
|
||||
config.ele('allow-navigation', _.extend({ href: pattern }, options));
|
||||
} else {
|
||||
config.element('access', _.extend({ origin: pattern }, options));
|
||||
config.ele('access', _.extend({ origin: pattern }, options));
|
||||
}
|
||||
});
|
||||
|
||||
const platformElement = {
|
||||
ios: config.element('platform', {name: 'ios'}),
|
||||
android: config.element('platform', {name: 'android'})
|
||||
ios: config.ele('platform', { name: 'ios' }),
|
||||
android: config.ele('platform', { name: 'android' })
|
||||
}
|
||||
|
||||
// Set the additional platform-specific configuration preferences
|
||||
_.each(this.additionalConfiguration.platform, (prefs, platform) => {
|
||||
_.each(prefs, (value, key) => {
|
||||
platformElement[platform].element('preference', {
|
||||
platformElement[platform].ele('preference', {
|
||||
name: key,
|
||||
value: value.toString()
|
||||
});
|
||||
@@ -338,7 +337,7 @@ export class CordovaBuilder {
|
||||
Console.debug('Writing new config.xml');
|
||||
|
||||
const configXmlPath = files.pathJoin(this.projectRoot, 'config.xml');
|
||||
const formattedXmlConfig = config.end({ pretty: true });
|
||||
const formattedXmlConfig = config.end({ prettyPrint: true });
|
||||
files.writeFile(configXmlPath, formattedXmlConfig, 'utf8');
|
||||
}
|
||||
|
||||
@@ -386,7 +385,7 @@ export class CordovaBuilder {
|
||||
files.pathJoin(this.resourcesPath, filename));
|
||||
|
||||
// Set it to the xml tree
|
||||
xmlElement.element(tag, imageAttributes(name, width, height, src));
|
||||
xmlElement.ele(tag, imageAttributes(name, width, height, src));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -399,15 +398,15 @@ export class CordovaBuilder {
|
||||
files.pathJoin(this.projectRoot, filename));
|
||||
// And entry in config.xml
|
||||
if (!resourceFile.platform ||
|
||||
(resourceFile.platform && resourceFile.platform === "android")) {
|
||||
androidElement.element('resource-file', {
|
||||
(resourceFile.platform && resourceFile.platform === "android")) {
|
||||
androidElement.ele('resource-file', {
|
||||
src: resourceFile.src,
|
||||
target: resourceFile.target
|
||||
});
|
||||
}
|
||||
if (!resourceFile.platform ||
|
||||
(resourceFile.platform && resourceFile.platform === "ios")) {
|
||||
iosElement.element('resource-file', {
|
||||
(resourceFile.platform && resourceFile.platform === "ios")) {
|
||||
iosElement.ele('resource-file', {
|
||||
src: resourceFile.src,
|
||||
target: resourceFile.target
|
||||
});
|
||||
@@ -545,7 +544,7 @@ function createAppConfiguration(builder) {
|
||||
let settings = null;
|
||||
if (settingsFile) {
|
||||
settings = optimisticReadJsonOrNull(settingsFile);
|
||||
if (! settings) {
|
||||
if (!settings) {
|
||||
throw new Error("Unreadable --settings file: " + settingsFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ export const ISOPACKETS = {
|
||||
// cordova-support
|
||||
'boilerplate-generator',
|
||||
'webapp-hashing',
|
||||
'xmlbuilder',
|
||||
// cordova-support, logging
|
||||
'logging',
|
||||
// support for childProcess.sendMessage(topic, payload)
|
||||
@@ -116,13 +115,13 @@ export function loadIsopackage(packageName, isopacketName = "combined") {
|
||||
|
||||
if (_.has(ISOPACKETS, isopacketName)) {
|
||||
throw Error("Can't load isopacket before it has been verified: "
|
||||
+ isopacketName);
|
||||
+ isopacketName);
|
||||
}
|
||||
|
||||
throw Error("Unknown isopacket: " + isopacketName);
|
||||
}();
|
||||
|
||||
if (! _.has(isopacket, packageName)) {
|
||||
if (!_.has(isopacket, packageName)) {
|
||||
throw new Error("Unknown isopacket dependency: " + packageName);
|
||||
}
|
||||
|
||||
@@ -144,7 +143,7 @@ export function ensureIsopacketsLoadable() {
|
||||
|
||||
// If we're not running from checkout, then there's nothing to build and we
|
||||
// can declare that all isopackets are loadable.
|
||||
if (! files.inCheckout()) {
|
||||
if (!files.inCheckout()) {
|
||||
_.each(ISOPACKETS, function (packages, name) {
|
||||
loadedIsopackets[name] = null;
|
||||
});
|
||||
@@ -167,17 +166,17 @@ export function ensureIsopacketsLoadable() {
|
||||
var isopacketRoot = isopacketPath(isopacketName);
|
||||
var existingBuildinfo = files.readJSONOrNull(
|
||||
files.pathJoin(isopacketRoot, 'isopacket-buildinfo.json'));
|
||||
var needRebuild = ! existingBuildinfo;
|
||||
if (! needRebuild && existingBuildinfo.builtBy !== compiler.BUILT_BY) {
|
||||
var needRebuild = !existingBuildinfo;
|
||||
if (!needRebuild && existingBuildinfo.builtBy !== compiler.BUILT_BY) {
|
||||
needRebuild = true;
|
||||
}
|
||||
if (! needRebuild) {
|
||||
if (!needRebuild) {
|
||||
var watchSet = watch.WatchSet.fromJSON(existingBuildinfo.watchSet);
|
||||
if (! watch.isUpToDate(watchSet)) {
|
||||
if (!watch.isUpToDate(watchSet)) {
|
||||
needRebuild = true;
|
||||
}
|
||||
}
|
||||
if (! needRebuild) {
|
||||
if (!needRebuild) {
|
||||
// Great, it's loadable without a rebuild.
|
||||
loadedIsopackets[isopacketName] = null;
|
||||
return;
|
||||
@@ -185,7 +184,7 @@ export function ensureIsopacketsLoadable() {
|
||||
|
||||
// We're going to need to build! Make a catalog and loader if we haven't
|
||||
// yet.
|
||||
if (! isopacketBuildContext) {
|
||||
if (!isopacketBuildContext) {
|
||||
isopacketBuildContext = makeIsopacketBuildContext();
|
||||
}
|
||||
|
||||
@@ -209,7 +208,7 @@ export function ensureIsopacketsLoadable() {
|
||||
return;
|
||||
}
|
||||
|
||||
var builder = new Builder({outputPath: isopacketRoot});
|
||||
var builder = new Builder({ outputPath: isopacketRoot });
|
||||
builder.writeJson('isopacket-buildinfo.json', {
|
||||
builtBy: compiler.BUILT_BY,
|
||||
watchSet: built.watchSet.toJSON()
|
||||
@@ -234,7 +233,7 @@ export function ensureIsopacketsLoadable() {
|
||||
|
||||
// Returns a new all-local-packages catalog to be used for building isopackets.
|
||||
var newIsopacketBuildingCatalog = function () {
|
||||
if (! files.inCheckout()) {
|
||||
if (!files.inCheckout()) {
|
||||
throw Error("No need to build isopackets unless in checkout!");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user