New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

crosswalk-app-tools

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crosswalk-app-tools - npm Package Compare versions

Comparing version 0.9.1 to 0.10.0

src/util/Keys.js

36

android/lib/AndroidPlatform.js

@@ -320,3 +320,6 @@ // Copyright © 2014 Intel Corporation. All rights reserved.

return null;
} else if (xwalk.version.major > 16) {
} else if (xwalk.version.major < 18) {
output.error("This version can't support Crosswalk " + xwalk.version.major + ". Please use previous version of this tool.");
return null;
} else if (xwalk.version.major > 18) {
output.warning("This tool has not been tested with Crosswalk " + xwalk.version.major + ".");

@@ -425,3 +428,3 @@ }

return undefined;
return targetsSpec;
};

@@ -1252,5 +1255,3 @@

* built into classes.dex in the APK.
* For .js files, they'll be copied into assets/xwalk-extensions/.
* For .json files, the'll be merged into one file called
* extensions-config.json and copied into assets/.
* For .json/.js files, they'll be copied into assets/xwalk-extensions/myextension.
*/

@@ -1262,3 +1263,2 @@ AndroidPlatform.prototype.importExtensions =

var extensionsConfig = [];
var extensionsPerms = [];

@@ -1286,2 +1286,4 @@ this.application.manifest.extensions.forEach(function (extPath) {

var extRootPath = Path.join(this.platformPath, "assets", "xwalk-extensions");
var jsonDstPath = Path.join(extRootPath, extName);
var jsonBuf = FS.readFileSync(jsonPath, {"encoding": "utf8"});

@@ -1292,3 +1294,3 @@ var configJson = JSON.parse(jsonBuf);

// Copy js
var jsPath = Path.join(extPath, extName + ".js");
var jsPath = Path.join(extPath, configJson.jsapi);
if (!ShellJS.test("-f", jsPath)) {

@@ -1298,14 +1300,14 @@ output.warning("Skipping extension, file not found " + jsPath);

}
var jsDstPath = Path.join(this.platformPath, "assets", "xwalk-extensions");
ShellJS.mkdir(jsDstPath);
ShellJS.cp("-f", jsPath, jsDstPath);
configJson.jsapi = [ "xwalk-extensions", configJson.jsapi ].join("/");
ShellJS.mkdir(extRootPath);
ShellJS.mkdir(jsonDstPath);
ShellJS.cp("-f", jsPath, jsonDstPath);
}
// Copy json
ShellJS.mkdir(extRootPath);
ShellJS.mkdir(jsonDstPath);
ShellJS.cp("-f", jsonPath, jsonDstPath);
// Copy jar
ShellJS.cp("-f", jarPath, Path.join(this.platformPath, "libs"));
// Accumulate config
extensionsConfig.push(configJson);
// Accumulate permissions

@@ -1322,8 +1324,2 @@ for (var i = 0; configJson.permissions && i < configJson.permissions.length; i++) {

// Write config
if (extensionsConfig.length > 0) {
var configJsonPath = Path.join(this.platformPath, "assets", "extensions-config.json");
FS.writeFileSync(configJsonPath, FormatJson.plain(extensionsConfig));
}
// Add permissions to manifest, so they end up in AndroidManifest.xml later

@@ -1330,0 +1326,0 @@ extensionsPerms.forEach(function (perm) {

@@ -25,3 +25,3 @@ // Copyright © 2014 Intel Corporation. All rights reserved.

Application.call(app, tmpdir, _packageId);
app.create(_packageId, {}, function(errno) {
app.create(_packageId, { 'android-crosswalk': 'canary' }, function(errno) {

@@ -47,3 +47,3 @@ test.equal(errno, 0);

Application.call(app, tmpdir, _packageId);
app.create(_packageId, {}, function(errno) {
app.create(_packageId, { 'android-crosswalk': 'canary' }, function(errno) {

@@ -50,0 +50,0 @@ if (!errno) {

{
"name": "crosswalk-app-tools",
"version": "0.9.1",
"version": "0.10.0",
"description": "An APK packager for the Crosswalk Project -- http://crosswalk-project.org",

@@ -5,0 +5,0 @@ "author": "Robert Staudinger <robert.staudinger@intel.com>",

@@ -48,3 +48,3 @@ Crosswalk-app-tools

-m --manifest=<package-id> Fill manifest.json with default values
-p --platforms=<target-systems> Specify target platform
-p --platforms=<android|windows> Specify target platform
-r --release Build release packages

@@ -76,8 +76,2 @@ -t --targets=<target-archs> Target CPU architectures

<target-systems>
List of operating systems for which to create packages.
Default is android-only, which is supported on Apple OSX, Linux and Windows
Creating Windows MSIs is supported on Microsoft Windows only.
Example: --platforms="android windows"
<version-spec>

@@ -84,0 +78,0 @@ * Channel name, i.e. stable/beta/canary

@@ -105,2 +105,3 @@ // Copyright © 2014 Intel Corporation. All rights reserved.

this.loadManifest(Path.join(this._appPath, "manifest.json"));
this._generatedPackage = null;
}

@@ -217,2 +218,18 @@

/**
* Absolute path to the generated package.
* Ruturn null without successfully build.
* @member {String} generatedPackage
* @instance
* @memberOf Application
*/
Object.defineProperty(Application.prototype, "generatedPackage", {
get: function() {
return this._generatedPackage;
},
set: function(packagePath) {
this._generatedPackage = packagePath;
}
});
/**
* Read-only {@link Manifest} object.

@@ -219,0 +236,0 @@ * @member {Manifest} manifest

@@ -175,2 +175,11 @@ // Copyright © 2014 Intel Corporation. All rights reserved.

}
// Absolute path of Extension Hooks.
// This info is needed to skip them when generating MSI.
this._extensionHooks = [];
this._extensions.forEach(function(extension, i){
var path = Path.join(extension, "XWalkExtensionHooks.js");
if (ShellJS.test("-f", path)) {
this._extensionHooks.push(path);
}
}.bind(this));

@@ -629,2 +638,13 @@ // Target platforms

/**
* Extension hooks.
* @member {String} extensionHooks
* @instance
* @memberOf Manifest
*/
Object.defineProperty(Manifest.prototype, "extensionHooks", {
get: function() {
return this._extensionHooks;
}
});
/**
* Build target platforms for the apps

@@ -631,0 +651,0 @@ * @member {String[]} targetPlatforms

@@ -200,2 +200,3 @@ // Copyright © 2014 Intel Corporation. All rights reserved.

}
this._application.generatedPackage = packagePath;
};

@@ -202,0 +203,0 @@

@@ -21,2 +21,4 @@ // Copyright © 2014 Intel Corporation. All rights reserved.

IndexParser: require("./IndexParser"),
/** {@link Keys} */
Keys: require("./Keys"),
/** {@link Targets} */

@@ -29,2 +31,11 @@ Targets: require("./Targets"),

/** expose some dependencies for hooks */
AdmZip: require("adm-zip"),
FormatJson: require("format-json"),
NodeUuid: require("node-uuid"),
ParseColor: require("parse-color"),
XmlBuilder: require("xmlbuilder"),
XmlDom: require("xmldom"),
ShellJS: require("shelljs"),
/**

@@ -31,0 +42,0 @@ * Iterate an array with provisions for asynchronous processing of each item.

@@ -44,2 +44,5 @@ // Copyright © 2014 Intel Corporation. All rights reserved.

crosswalk: "\t\t\tPath to crosswalk zip"
},
build: { // Extra options for command "build"
googleApiKeyName: "\t\ŧGoogle API key name in ~/.crosswalk-app-tools-keys.json"
}

@@ -213,2 +216,5 @@ };

// Namespace util
var util = this.application.util;
var output = this.output;

@@ -221,2 +227,14 @@ var manifest = this.application.manifest;

var googleKeys = null;
if (args.googleApiKeyName) {
try {
googleKeys = util.Keys.getGoogleApiKeys(args.googleApiKeyName);
output.info("Using Google API Key '" + args.googleApiKeyName + "'");
} catch (e) {
output.error("Failed loading Google API Key '" + args.googleApiKeyName + "'");
output.error(e.message);
output.error("Google APIs will not be functional");
}
}
// WiX wants 4 component version numbers, so append as many ".0" as needed.

@@ -260,4 +278,4 @@ // Manifest versions are restricted to 4 parts max.

icon: this.selectIcon(),
product: manifest.packageId
//extensions: 'tests/extension/echo_extension'
product: manifest.packageId,
googleApiKeys: googleKeys
};

@@ -264,0 +282,0 @@ sdk.generateMSI(this.appPath, this.platformPath, metaData,

@@ -51,3 +51,2 @@

* 'is_64_bit' {Bool} - 64 bit arch. flag, 'false' by default
* 'extensions' - path to the Crosswalk C++ extensions to be used by the app
*/

@@ -112,3 +111,2 @@ WixSDK.prototype.generateMSI =

function Is64Bit() { return ('is_64_bit' in meta_data) ? meta_data.is_64_bit : false; }
function HasExtensions() { return meta_data.hasOwnProperty('extensions'); }

@@ -149,4 +147,6 @@ var root = builder.create('Wix').att('xmlns', 'http://schemas.microsoft.com/wix/2006/wi');

{ Id: 'ApplicationFilesFolder', 'Name': meta_data.app_name });
// Try to align with the in-folder extensions' directory name of Android.
var app_relative_extensions_dir = 'xwalk-extensions';
var app_extensions_folder = app_root_folder.ele('Directory',
{ Id: 'ApplicationExtensionsFolder', 'Name': 'extensions' });
{ Id: 'ApplicationExtensionsFolder', 'Name': app_relative_extensions_dir });
var program_menu_folder = target_dir.ele('Directory', { Id: 'ProgramMenuFolder' });

@@ -230,6 +230,13 @@ var app_menu_folder = program_menu_folder.ele('Directory',

function installFiles(source_dir_path, dest_folder_object) {
// @skip_array contains absolute path of those need to be skipped, items can be
// directory or files.
function installFiles(source_dir_path, dest_folder_object, skip_array) {
var app_files = readDir.readSync(source_dir_path);
app_files.forEach(function (name) {
var directory = path.dirname(name);
var absPath = path.join(source_dir_path, name);
if (skip_array.indexOf(absPath) >= 0 ||
skip_array.indexOf(path.dirname(absPath)) >= 0)
return;
var node = (directory == '.') ? dest_folder_object : GetFolderNode(directory, dest_folder_object);

@@ -240,8 +247,25 @@ AddFileComponent(node, source_dir_path, name);

installFiles(app_path, app_files_folder);
if (HasExtensions())
installFiles(meta_data.extensions, app_extensions_folder);
// Extensions are supposed to be in the source application root dir: app_path.
// Then we copy them to the sub-directory of the installer folder:
// app_files_folder/xwalk-extensions
// So, if we still fully copy the source application root directory, all the
// extensions will be duplicated.
// Extensions can be divided by categories in seperate directories.
this._manifest.extensions.forEach(function(extDir) {
installFiles(extDir, app_extensions_folder, this._manifest.extensionHooks);
if (path.normalize(path.dirname(extDir)) == path.normalize(app_path)) {
extensions_relative_dir.push(path.relative(app_path, extDir));
}
}.bind(this));
// Skip in-folder extensions copying to avoid duplication.
installFiles(app_path, app_files_folder, this._manifest.extensions);
var program_menu_folder_ref = product.ele('DirectoryRef', { Id: 'ApplicationProgramsFolder' });
var component = program_menu_folder_ref.ele('Component', { Id: 'ApplicationShortcut', Guid: uuid.v1() });
var registry_entries_component;
if (meta_data.googleApiKeys) {
var registry_entries_ref = product.ele('DirectoryRef', { Id: 'TARGETDIR' });
registry_entries_component = registry_entries_ref.ele('Component', { Id: 'RegistryEntries', Guid: uuid.v1() });
}

@@ -259,4 +283,5 @@ var cmd_line_args = InQuotes(path.join(meta_data.app_name, 'manifest.json'));

}
if (HasExtensions())
cmd_line_args += ' --external-extensions-path=extensions';
if (this._manifest.extensions.length > 0) {
cmd_line_args += ' --external-extensions-path=' + app_relative_extensions_dir;
}
if (meta_data.configId === "debug") {

@@ -290,5 +315,33 @@ cmd_line_args += " --enable-inspector";

if (meta_data.googleApiKeys) {
var registry_entries = registry_entries_component.ele('RegistryKey', {
Root: 'HKCU',
Key: 'Software\\' + meta_data.manufacturer + '\\' + meta_data.product,
Action: 'createAndRemoveOnUninstall'
});
registry_entries.ele('RegistryValue', {
Type: 'string',
Name: 'GOOGLE_API_KEY',
Value: meta_data.googleApiKeys.GOOGLE_API_KEY,
KeyPath: 'yes'
});
registry_entries.ele('RegistryValue', {
Type: 'string',
Name: 'GOOGLE_DEFAULT_CLIENT_ID',
Value: meta_data.googleApiKeys.GOOGLE_DEFAULT_CLIENT_ID
});
registry_entries.ele('RegistryValue', {
Type: 'string',
Name: 'GOOGLE_DEFAULT_CLIENT_SECRET',
Value: meta_data.googleApiKeys.GOOGLE_DEFAULT_CLIENT_SECRET
});
}
var feature = product.ele('Feature', { Id: 'MainApplication', Level: '1' });
file_ids.forEach(function (file_id) { feature.ele('ComponentRef', { Id: file_id }); });
feature.ele('ComponentRef', { Id: "ApplicationShortcut" });
if (meta_data.googleApiKeys) {
feature.ele('ComponentRef', { Id: "RegistryEntries" });
}

@@ -295,0 +348,0 @@ var xml_str = root.end({ pretty: true });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc