%endif
Name: crosswalk
-Version: 8.37.187.0
+Version: 9.37.190.0
Release: 0
Summary: Crosswalk is an app runtime based on Chromium
License: (BSD-3-Clause and LGPL-2.1+)
-MAJOR=8
+MAJOR=9
MINOR=37
-BUILD=187
+BUILD=190
PATCH=0
# yuicompressor-*.jar was gotten from http://yui.github.io/yuicompressor/.
file_name = "yuicompressor-%s.jar" % version
cur_dir = os.path.realpath(os.path.dirname(__file__))
- return os.path.join(cur_dir, "libs", file_name)
+ return os.path.join(cur_dir, file_name)
def ExecuteCmd(file_list, ext):
app_root = app_info.app_root
if os.path.exists(name):
shutil.rmtree(name)
- shutil.copytree('app_src', name)
+ shutil.copytree('template', name)
shutil.rmtree(os.path.join(name, 'src'))
- src_root = os.path.join('app_src', 'src', 'org', 'xwalk', 'app', 'template')
+ src_root = os.path.join('template', 'src', 'org', 'xwalk', 'app', 'template')
src_activity = os.path.join(src_root, 'AppTemplateActivity.java')
if not os.path.isfile(src_activity):
print ('Please make sure that the java file'
dest_activity = name + 'Activity.java'
shutil.copyfile(src_activity, os.path.join(root_path, dest_activity))
if app_root:
- assets_path = os.path.join(name, 'assets')
- shutil.rmtree(assets_path)
- os.makedirs(assets_path)
- app_src_path = os.path.join(assets_path, 'www')
- shutil.copytree(app_root, app_src_path)
+ assets_path = os.path.join(name, 'assets', 'www')
+ if os.path.isdir(assets_path):
+ shutil.rmtree(assets_path)
+ shutil.copytree(app_root, assets_path)
if compressor:
- CompressSourceFiles(app_src_path, compressor)
+ CompressSourceFiles(assets_path, compressor)
def CustomizeStringXML(name, description):
strings_path = os.path.join(name, 'res', 'values', 'strings.xml')
if not os.path.isfile(strings_path):
print ('Please make sure strings_xml'
- ' exists under app_src folder.')
+ ' exists under template folder.')
sys.exit(6)
if description:
manifest_path = os.path.join(name, 'AndroidManifest.xml')
if not os.path.isfile(manifest_path):
print ('Please make sure AndroidManifest.xml'
- ' exists under app_src folder.')
+ ' exists under template folder.')
sys.exit(6)
CustomizeStringXML(name, description)
+++ /dev/null
-#!/usr/bin/env python
-#
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-# pylint: disable=F0401
-
-"""An Ant wrapper that suppresses useless Ant output.
-
-Ant build scripts output "BUILD SUCCESSFUL" and build timing at the end of
-every build. In the Android build, this just adds a lot of useless noise to the
-build output. This script forwards its arguments to ant, and prints Ant's
-output up until the BUILD SUCCESSFUL line.
-"""
-
-import sys
-
-from util import build_utils
-
-
-def main(argv):
- stdout = build_utils.CheckCallDie(['ant'] + argv[1:], suppress_output=True)
- stdout = stdout.decode("utf-8").strip().split('\n')
- for line in stdout:
- if line.strip() == 'BUILD SUCCESSFUL':
- break
- print(line)
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv))
+++ /dev/null
-#!/usr/bin/env python
-#
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-# pylint: disable=F0401
-
-import optparse
-import os
-import sys
-
-from util import build_utils
-from util import md5_check
-
-def Find(name, path):
- for root, _, files in os.walk(path):
- if name in files:
- return os.path.join(root, name)
-
-
-def AddExeExtensions(name):
- exts_str = os.environ.get('PATHEXT', '').lower()
- exts = [_f for _f in exts_str.split(os.pathsep) if _f]
- result = []
- result.append(name)
- for e in exts:
- result.append(name + e)
- return result
-
-
-def DoDex(options, paths):
- dx_binary = ''
- for dx_str in AddExeExtensions('dx'):
- dx_binary = Find(dx_str, options.android_sdk_root)
- if dx_binary:
- break
- dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths
-
- record_path = '%s.md5.stamp' % options.dex_path
- md5_check.CallAndRecordIfStale(
- lambda: build_utils.CheckCallDie(dex_cmd, suppress_output=True),
- record_path=record_path,
- input_paths=paths,
- input_strings=dex_cmd)
-
- build_utils.Touch(options.dex_path)
-
-
-def main():
- parser = optparse.OptionParser()
- parser.add_option('--android-sdk-root', help='Android sdk root directory.')
- parser.add_option('--dex-path', help='Dex output path.')
- parser.add_option('--stamp', help='Path to touch on success.')
-
- # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
- parser.add_option('--ignore', help='Ignored.')
-
- options, paths = parser.parse_args()
-
- DoDex(options, paths)
-
- if options.stamp:
- build_utils.Touch(options.stamp)
-
-
-if __name__ == '__main__':
- sys.exit(main())
+++ /dev/null
-#!/usr/bin/env python
-#
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-# pylint: disable=F0401
-"""Signs and zipaligns APK.
-"""
-
-import optparse
-import shutil
-import sys
-
-from util import build_utils
-
-def SignApk(keystore_path, unsigned_path, signed_path, alias, code, alias_code):
- intermediate_path = unsigned_path + '.copy'
- shutil.copy(unsigned_path, intermediate_path)
- sign_cmd = [
- 'jarsigner',
- '-sigalg', 'MD5withRSA',
- '-digestalg', 'SHA1',
- '-keystore', keystore_path,
- '-storepass', code,
- '-keypass', alias_code,
- intermediate_path, alias
- ]
- build_utils.CheckCallDie(sign_cmd)
- shutil.move(intermediate_path, signed_path)
-
-
-def AlignApk(zipalign_path, unaligned_path, final_path):
- align_cmd = [
- zipalign_path,
- '-f', '4', # 4 bytes
- unaligned_path,
- final_path
- ]
- build_utils.CheckCallDie(align_cmd)
-
-
-def main():
- parser = optparse.OptionParser()
-
- parser.add_option('--zipalign-path', help='Path to the zipalign tool.')
- parser.add_option('--unsigned-apk-path', help='Path to input unsigned APK.')
- parser.add_option('--final-apk-path',
- help='Path to output signed and aligned APK.')
- parser.add_option('--keystore-path', help='Path to keystore for signing.')
- parser.add_option('--keystore-alias', help='Alias name of keystore.')
- parser.add_option('--keystore-passcode', help='Passcode of keystore.')
- parser.add_option('--keystore-alias-passcode',
- help='Passcode for alias\'s private key in the keystore.')
- parser.add_option('--stamp', help='Path to touch on success.')
- options, _ = parser.parse_args()
-
- signed_apk_path = options.unsigned_apk_path + '.signed.apk'
- SignApk(options.keystore_path, options.unsigned_apk_path,
- signed_apk_path, options.keystore_alias, options.keystore_passcode,
- options.keystore_alias_passcode)
- AlignApk(options.zipalign_path, signed_apk_path, options.final_apk_path)
-
- if options.stamp:
- build_utils.Touch(options.stamp)
-
-
-if __name__ == '__main__':
- sys.exit(main())
+++ /dev/null
-#!/usr/bin/env python
-#
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-# pylint: disable=F0401
-
-import fnmatch
-import optparse
-import os
-import sys
-
-from util import build_utils
-from util import md5_check
-
-
-def DoJar(options):
- class_files = build_utils.FindInDirectory(options.classes_dir, '*.class')
- for exclude in options.excluded_classes.split():
- class_files = [f for f in class_files if not fnmatch.fnmatch(f, exclude)]
-
- jar_path = os.path.abspath(options.jar_path)
-
- # The paths of the files in the jar will be the same as they are passed in to
- # the command. Because of this, the command should be run in
- # options.classes_dir so the .class file paths in the jar are correct.
- jar_cwd = options.classes_dir
- class_files_rel = [os.path.relpath(f, jar_cwd) for f in class_files]
- jar_cmd = ['jar', 'cf0', jar_path] + class_files_rel
-
- record_path = '%s.md5.stamp' % options.jar_path
- md5_check.CallAndRecordIfStale(
- lambda: build_utils.CheckCallDie(jar_cmd, cwd=jar_cwd),
- record_path=record_path,
- input_paths=class_files,
- input_strings=jar_cmd)
-
- build_utils.Touch(options.jar_path)
-
-
-def main():
- parser = optparse.OptionParser()
- parser.add_option('--classes-dir', help='Directory containing .class files.')
- parser.add_option('--jar-path', help='Jar output path.')
- parser.add_option('--excluded-classes',
- help='List of .class file patterns to exclude from the jar.')
- parser.add_option('--stamp', help='Path to touch on success.')
-
- options, _ = parser.parse_args()
-
- DoJar(options)
-
- if options.stamp:
- build_utils.Touch(options.stamp)
-
-
-if __name__ == '__main__':
- sys.exit(main())
-
+++ /dev/null
-#!/usr/bin/env python
-#
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-# pylint: disable=F0401
-
-import fnmatch
-import optparse
-import os
-import sys
-
-from util import build_utils
-from util import md5_check
-
-
-def DoJavac(options):
- output_dir = options.output_dir
-
- java_files = build_utils.FindInDirectories(options.src_dirs, '*.java')
- if options.javac_includes:
- filtered_java_files = []
- for f in java_files:
- for include in options.javac_includes:
- if fnmatch.fnmatch(f, include):
- filtered_java_files.append(f)
- break
- java_files = filtered_java_files
-
- # Compiling guava with certain orderings of input files causes a compiler
- # crash... Sorted order works, so use that.
- # See https://code.google.com/p/guava-libraries/issues/detail?id=950
- java_files.sort()
-
- jar_inputs = []
- for path in options.classpath:
- if os.path.exists(path + '.TOC'):
- jar_inputs.append(path + '.TOC')
- else:
- jar_inputs.append(path)
-
- javac_cmd = [
- 'javac',
- '-g',
- '-source', '1.5',
- '-target', '1.5',
- '-classpath', os.pathsep.join(options.classpath),
- '-d', output_dir,
- '-Xlint:unchecked',
- '-Xlint:deprecation',
- ] + java_files
-
- def Compile():
- # Delete the classes directory. This ensures that all .class files in the
- # output are actually from the input .java files. For example, if a .java
- # file is deleted or an inner class is removed, the classes directory should
- # not contain the corresponding old .class file after running this action.
- build_utils.DeleteDirectory(output_dir)
- build_utils.MakeDirectory(output_dir)
- suppress_output = not options.chromium_code
- build_utils.CheckCallDie(javac_cmd, suppress_output=suppress_output)
-
- record_path = '%s/javac.md5.stamp' % options.output_dir
- md5_check.CallAndRecordIfStale(
- Compile,
- record_path=record_path,
- input_paths=java_files + jar_inputs,
- input_strings=javac_cmd)
-
-
-def main():
- parser = optparse.OptionParser()
- parser.add_option('--src-dirs', action='append',
- help='Directories containing java files.')
- parser.add_option('--javac-includes', action='append',
- help='A list of file patterns. If provided, only java files that match' +
- 'one of the patterns will be compiled.')
- parser.add_option('--classpath', action='append',
- help='Classpaths for javac.')
- parser.add_option('--output-dir', help='Directory for javac output.')
- parser.add_option('--stamp', help='Path to touch on success.')
- parser.add_option('--chromium-code', type='int', help='Whether code being '
- 'compiled should be built with stricter warnings for '
- 'chromium code.')
-
- options, _ = parser.parse_args()
-
- DoJavac(options)
-
- if options.stamp:
- build_utils.Touch(options.stamp)
-
-
-if __name__ == '__main__':
- sys.exit(main())
-
-
+++ /dev/null
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-from __future__ import print_function
-import fnmatch
-import os
-import pipes
-import shutil
-import subprocess
-import sys
-import traceback
-
-
-def MakeDirectory(dir_path):
- try:
- os.makedirs(dir_path)
- except OSError:
- pass
-
-
-def DeleteDirectory(dir_path):
- if os.path.exists(dir_path):
- shutil.rmtree(dir_path)
-
-
-def Touch(path):
- MakeDirectory(os.path.dirname(path))
- with open(path, 'a'):
- os.utime(path, None)
-
-
-def FindInDirectory(directory, filter_string):
- files = []
- for root, _, filenames in os.walk(directory):
- matched_files = fnmatch.filter(filenames, filter_string)
- files.extend((os.path.join(root, f) for f in matched_files))
- return files
-
-
-def FindInDirectories(directories, filter_string):
- all_files = []
- for directory in directories:
- all_files.extend(FindInDirectory(directory, filter_string))
- return all_files
-
-
-# This can be used in most cases like subprocess.check_call. The output,
-# particularly when the command fails, better highlights the command's failure.
-# This call will directly exit on a failure in the subprocess so that no python
-# stacktrace is printed after the output of the failed command (and will
-# instead print a python stack trace before the output of the failed command)
-def CheckCallDie(args, suppress_output=False, cwd=None):
- if not cwd:
- cwd = os.getcwd()
-
- if os.name == 'posix':
- child = subprocess.Popen(args,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd)
- else:
- child = subprocess.Popen(args,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd, shell=True)
-
- stdout, _ = child.communicate()
-
- if child.returncode:
- stacktrace = traceback.extract_stack()
- print(''.join(traceback.format_list(stacktrace)), file=sys.stderr)
- # A user should be able to simply copy and paste the command that failed
- # into their shell.
- copyable_command = ' '.join(map(pipes.quote, args))
- copyable_command = ('( cd ' + os.path.abspath(cwd) + '; '
- + copyable_command + ' )')
- print('Command failed:', copyable_command, '\n', file=sys.stderr)
-
- if stdout:
- print(stdout)
-
- # Directly exit to avoid printing stacktrace.
- sys.exit(child.returncode)
-
- else:
- if stdout and not suppress_output:
- print(stdout)
- return stdout
-
-
-def GetModifiedTime(path):
- # For a symlink, the modified time should be the greater of the link's
- # modified time and the modified time of the target.
- return max(os.lstat(path).st_mtime, os.stat(path).st_mtime)
+++ /dev/null
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import hashlib
-import os
-
-
-def CallAndRecordIfStale(
- function, record_path=None, input_paths=None,
- input_strings=None, force=False):
- """Calls function if the md5sum of the input paths/strings has changed.
-
- The md5sum of the inputs is compared with the one stored in record_path. If
- this has changed (or the record doesn't exist), function will be called and
- the new md5sum will be recorded.
-
- If force is True, the function will be called regardless of whether the
- md5sum is out of date.
- """
- input_paths = input_paths or []
- input_strings = input_strings or []
- md5_checker = _Md5Checker(
- record_path=record_path,
- input_paths=input_paths,
- input_strings=input_strings)
- if force or md5_checker.IsStale():
- function()
- md5_checker.Write()
-
-
-def _UpdateMd5ForFile(md5, path, block_size=2**16):
- with open(path, 'rb') as infile:
- while True:
- data = infile.read(block_size)
- if not data:
- break
- md5.update(data)
-
-
-def _UpdateMd5ForDirectory(md5, dir_path):
- for root, _, files in os.walk(dir_path):
- for f in files:
- _UpdateMd5ForFile(md5, os.path.join(root, f))
-
-
-def _UpdateMd5ForPath(md5, path):
- if os.path.isdir(path):
- _UpdateMd5ForDirectory(md5, path)
- else:
- _UpdateMd5ForFile(md5, path)
-
-
-class _Md5Checker(object):
- def __init__(self, record_path=None, input_paths=None, input_strings=None):
- assert record_path.endswith('.stamp'), (
- 'record paths must end in \'.stamp\' so that they are easy to find '
- 'and delete')
-
- input_paths = input_paths or []
- input_strings = input_strings or []
- self.record_path = record_path
-
- md5 = hashlib.md5()
- for i in sorted(input_paths):
- _UpdateMd5ForPath(md5, i)
- for s in input_strings:
- md5.update(s.encode('utf-8'))
- self.new_digest = md5.hexdigest()
-
- self.old_digest = ''
- if os.path.exists(self.record_path):
- with open(self.record_path, 'r') as old_record:
- self.old_digest = old_record.read()
-
- def IsStale(self):
- return self.old_digest != self.new_digest
-
- def Write(self):
- with open(self.record_path, 'w') as new_record:
- new_record.write(self.new_digest)
# found in the LICENSE file.
# pylint: disable=F0401
-import operator
import optparse
import os
import re
import subprocess
import sys
-sys.path.append('scripts/gyp')
-
from app_info import AppInfo
from customize import VerifyAppName, CustomizeAll, \
ParseParameterForCompressor, ReplaceSpaceWithUnderscore
-from dex import AddExeExtensions
from handle_permissions import permission_mapping_table
from manifest_json_parser import HandlePermissionList
from manifest_json_parser import ManifestJsonParser
+NATIVE_LIBRARY = 'libxwalkcore.so'
+
+
def CleanDir(path):
if os.path.exists(path):
shutil.rmtree(path)
return ("x86", "arm")
+def ConvertArchNameToArchFolder(arch):
+ arch_dict = {
+ 'x86': 'x86',
+ 'arm': 'armeabi-v7a'
+ }
+ return arch_dict.get(arch, None)
+
+
+def AddExeExtensions(name):
+ exts_str = os.environ.get('PATHEXT', '').lower()
+ exts = [_f for _f in exts_str.split(os.pathsep) if _f]
+ result = []
+ result.append(name)
+ for e in exts:
+ result.append(name + e)
+ return result
+
+
def RunCommand(command, verbose=False, shell=False):
"""Runs the command list, print the output, and propagate its result."""
proc = subprocess.Popen(command, stdout=subprocess.PIPE,
print ('Command "%s" exited with non-zero exit code %d'
% (' '.join(command), result))
sys.exit(result)
+ return output
def Which(name):
return None
-def Find(name, path):
- """Find executable file with the given name
- and maximum API level under specific path."""
- result = {}
- for root, _, files in os.walk(path):
- if name in files:
- key = os.path.join(root, name)
- sdk_version = os.path.basename(os.path.dirname(key))
- str_num = re.search(r'\d+', sdk_version)
- if str_num:
- result[key] = int(str_num.group())
- else:
- result[key] = 0
- if not result:
- raise Exception()
- return max(iter(result.items()), key=operator.itemgetter(1))[0]
+def GetAndroidApiLevel():
+ """Get Highest Android target level installed.
+ return -1 if no targets have been found.
+ """
+ target_output = RunCommand(['android', 'list', 'target', '-c'])
+ target_regex = re.compile(r'android-(\d+)')
+ targets = map(int, target_regex.findall(target_output))
+ targets.extend([-1])
+ return max(targets)
def GetVersion(path):
return version_str
+def ContainsNativeLibrary(path):
+ return os.path.isfile(os.path.join(path, NATIVE_LIBRARY))
+
+
def ParseManifest(options):
parser = ManifestJsonParser(os.path.expanduser(options.manifest))
if not options.name:
'installation and your PATH environment variable.')
sys.exit(1)
- sdk_root_path = os.path.dirname(os.path.dirname(android_path))
-
- try:
- sdk_jar_path = Find('android.jar',
- os.path.join(sdk_root_path, 'platforms'))
- except Exception:
- print('Your Android SDK may be ruined, please reinstall it.')
- sys.exit(2)
-
- level_string = os.path.basename(os.path.dirname(sdk_jar_path))
- api_level = int(re.search(r'\d+', level_string).group())
+ api_level = GetAndroidApiLevel()
if api_level < 14:
print('Please install Android API level (>=14) first.')
sys.exit(3)
+ target_string = 'android-%d' % api_level
if options.keystore_path:
key_store = os.path.expanduser(options.keystore_path)
if options.keystore_passcode:
key_code = options.keystore_passcode
else:
- print('Please provide the passcode of the developer key.')
- sys.exit(6)
+ key_code = None
if options.keystore_alias_passcode:
key_alias_code = options.keystore_alias_passcode
else:
- print('--keystore-alias-passcode was not specified, '
- 'using the keystore\'s passcode as the alias keystore passcode.')
- key_alias_code = key_code
+ key_alias_code = None
else:
print ('Use xwalk\'s keystore by default for debugging. '
'Please switch to your keystore when distributing it to app market.')
- key_store = 'scripts/ant/xwalk-debug.keystore'
+ key_store = 'xwalk-debug.keystore'
key_alias = 'xwalkdebugkey'
key_code = 'xwalkdebug'
key_alias_code = 'xwalkdebug'
- if not os.path.exists('out'):
- os.mkdir('out')
-
- # Make sure to use ant-tasks.jar correctly.
- # Default Android SDK names it as ant-tasks.jar
- # Chrome third party Android SDk names it as anttasks.jar
- ant_tasks_jar_path = os.path.join(sdk_root_path,
- 'tools', 'lib', 'ant-tasks.jar')
- if not os.path.exists(ant_tasks_jar_path):
- ant_tasks_jar_path = os.path.join(sdk_root_path,
- 'tools', 'lib', 'anttasks.jar')
-
- aapt_path = ''
- for aapt_str in AddExeExtensions('aapt'):
- try:
- aapt_path = Find(aapt_str, sdk_root_path)
- print('Use %s in %s.' % (aapt_str, sdk_root_path))
- break
- except Exception:
- pass
- if not aapt_path:
- print('Your Android SDK may be ruined, please reinstall it.')
- sys.exit(2)
-
# Check whether ant is installed.
try:
cmd = ['ant', '-version']
print('Please install ant first.')
sys.exit(4)
- res_dirs = '-DADDITIONAL_RES_DIRS=\'\''
- res_packages = '-DADDITIONAL_RES_PACKAGES=\'\''
- res_r_text_files = '-DADDITIONAL_R_TEXT_FILES=\'\''
+ # Update android project for app and xwalk_core_library.
+ update_project_cmd = ['android', 'update', 'project',
+ '--path', name, '--target', target_string,
+ '--name', name]
if options.mode == 'embedded':
- # Prepare the .pak file for embedded mode.
- pak_src_path = os.path.join('native_libs_res', 'xwalk.pak')
- pak_des_path = os.path.join(name, 'assets', 'xwalk.pak')
- shutil.copy(pak_src_path, pak_des_path)
-
- # Prepare the icudtl.dat for embedded mode.
- icudtl_src_path = os.path.join('native_libs_res', 'icudtl.dat')
- icudtl_des_path = os.path.join(name, 'assets', 'icudtl.dat')
- shutil.copy(icudtl_src_path, icudtl_des_path)
-
- js_src_dir = os.path.join('native_libs_res', 'jsapi')
- js_des_dir = os.path.join(name, 'assets', 'jsapi')
- if os.path.exists(js_des_dir):
- shutil.rmtree(js_des_dir)
- shutil.copytree(js_src_dir, js_des_dir)
-
- res_ui_java = os.path.join('gen', 'ui_java')
- res_content_java = os.path.join('gen', 'content_java')
- res_xwalk_java = os.path.join('gen', 'xwalk_core_internal_java')
- res_dir = os.path.join('libs_res', 'xwalk_core_library')
- res_dirs = ('-DADDITIONAL_RES_DIRS=' + res_dir)
- res_packages = ('-DADDITIONAL_RES_PACKAGES=org.chromium.ui '
- 'org.xwalk.core.internal org.chromium.content')
- res_r_text_files = ('-DADDITIONAL_R_TEXT_FILES='
- + os.path.join(res_ui_java, 'java_R', 'R.txt') + ' '
- + os.path.join(res_xwalk_java, 'java_R', 'R.txt') + ' '
- + os.path.join(res_content_java, 'java_R', 'R.txt'))
-
- resource_dir = '-DRESOURCE_DIR=' + os.path.join(name, 'res')
- manifest_path = os.path.join(name, 'AndroidManifest.xml')
- cmd = ['python', os.path.join('scripts', 'gyp', 'ant.py'),
- '-DAAPT_PATH=%s' % aapt_path,
- res_dirs,
- res_packages,
- res_r_text_files,
- '-DANDROID_MANIFEST=%s' % manifest_path,
- '-DANDROID_SDK_JAR=%s' % sdk_jar_path,
- '-DANDROID_SDK_ROOT=%s' % sdk_root_path,
- '-DANDROID_SDK_VERSION=%d' % api_level,
- '-DANT_TASKS_JAR=%s' % ant_tasks_jar_path,
- '-DLIBRARY_MANIFEST_PATHS= ',
- '-DOUT_DIR=out',
- resource_dir,
- '-DSTAMP=codegen.stamp',
- '-Dbasedir=.',
- '-buildfile',
- os.path.join('scripts', 'ant', 'apk-codegen.xml')]
- RunCommand(cmd, options.verbose)
-
- # Check whether java is installed.
- try:
- cmd = ['java', '-version']
- RunCommand(cmd, shell=True)
- except EnvironmentError:
- print('Please install Oracle JDK first.')
- sys.exit(5)
-
- # Compile App source code with app runtime code.
- cmd = ['python', os.path.join('scripts', 'gyp', 'javac.py'),
- '--output-dir=%s' % os.path.join('out', 'classes'),
- '--classpath',
- os.path.join(os.getcwd(), 'libs', 'xwalk_app_runtime_java.jar'),
- '--classpath',
- sdk_jar_path,
- '--src-dirs',
- os.path.join(os.getcwd(), name, 'src'),
- '--src-dirs',
- os.path.join(os.getcwd(), 'out', 'gen'),
- '--chromium-code=0',
- '--stamp=compile.stam']
- RunCommand(cmd, options.verbose)
-
- # Package resources.
- asset_dir = '-DASSET_DIR=%s' % os.path.join(name, 'assets')
- xml_path = os.path.join('scripts', 'ant', 'apk-package-resources.xml')
- cmd = ['python', os.path.join('scripts', 'gyp', 'ant.py'),
- '-DAAPT_PATH=%s' % aapt_path,
- res_dirs,
- res_packages,
- res_r_text_files,
- '-DANDROID_SDK_JAR=%s' % sdk_jar_path,
- '-DANDROID_SDK_ROOT=%s' % sdk_root_path,
- '-DANT_TASKS_JAR=%s' % ant_tasks_jar_path,
- '-DAPK_NAME=%s' % name,
- '-DAPP_MANIFEST_VERSION_CODE=0',
- '-DAPP_MANIFEST_VERSION_NAME=Developer Build',
- asset_dir,
- '-DCONFIGURATION_NAME=Release',
- '-DOUT_DIR=out',
- resource_dir,
- '-DSTAMP=package_resources.stamp',
- '-Dbasedir=.',
- '-buildfile',
- xml_path]
- RunCommand(cmd, options.verbose)
-
- dex_path = '--dex-path=' + os.path.join(os.getcwd(), 'out', 'classes.dex')
- app_runtime_jar = os.path.join(os.getcwd(),
- 'libs', 'xwalk_app_runtime_java.jar')
+ RunCommand(['android', 'update', 'lib-project',
+ '--path', os.path.join(name, 'xwalk_core_library'),
+ '--target', target_string])
+ update_project_cmd.extend(['-l', 'xwalk_core_library'])
+ else:
+ # Shared mode doesn't need xwalk_runtime_java.jar.
+ os.remove(os.path.join(name, 'libs', 'xwalk_runtime_java.jar'))
+
+ RunCommand(update_project_cmd)
# Check whether external extensions are included.
extensions_string = 'xwalk-extensions'
extensions_dir = os.path.join(os.getcwd(), name, extensions_string)
external_extension_jars = FindExtensionJars(extensions_dir)
- input_jars = []
- if options.mode == 'embedded':
- input_jars.append(os.path.join(os.getcwd(), 'libs',
- 'xwalk_runtime_embedded.dex.jar'))
- dex_command_list = ['python', os.path.join('scripts', 'gyp', 'dex.py'),
- dex_path,
- '--android-sdk-root=%s' % sdk_root_path,
- app_runtime_jar,
- os.path.join(os.getcwd(), 'out', 'classes')]
- dex_command_list.extend(external_extension_jars)
- dex_command_list.extend(input_jars)
- RunCommand(dex_command_list)
-
- src_dir = '-DSOURCE_DIR=' + os.path.join(name, 'src')
- apk_path = '-DUNSIGNED_APK_PATH=' + os.path.join('out', 'app-unsigned.apk')
- native_lib_path = '-DNATIVE_LIBS_DIR='
- if options.mode == 'embedded':
- if options.arch == 'x86':
- x86_native_lib_path = os.path.join('native_libs', 'x86', 'libs',
- 'x86', 'libxwalkcore.so')
- if os.path.isfile(x86_native_lib_path):
- native_lib_path += os.path.join('native_libs', 'x86', 'libs')
- else:
- print('No x86 native library has been found for creating a Crosswalk '
- 'embedded APK.')
- sys.exit(10)
- elif options.arch == 'arm':
- arm_native_lib_path = os.path.join('native_libs', 'armeabi-v7a', 'libs',
- 'armeabi-v7a', 'libxwalkcore.so')
- if os.path.isfile(arm_native_lib_path):
- native_lib_path += os.path.join('native_libs', 'armeabi-v7a', 'libs')
- else:
- print('No ARM native library has been found for creating a Crosswalk '
- 'embedded APK.')
- sys.exit(10)
- # A space is needed for Windows.
- native_lib_path += ' '
- cmd = ['python', 'scripts/gyp/ant.py',
- '-DANDROID_SDK_ROOT=%s' % sdk_root_path,
- '-DANT_TASKS_JAR=%s' % ant_tasks_jar_path,
- '-DAPK_NAME=%s' % name,
- '-DCONFIGURATION_NAME=Release',
- native_lib_path,
- '-DOUT_DIR=out',
- src_dir,
- apk_path,
- '-Dbasedir=.',
- '-buildfile',
- 'scripts/ant/apk-package.xml']
- RunCommand(cmd, options.verbose)
-
- # Find the path of zipalign.
- # XWALK-2033: zipalign can be in different locations depending on Android
- # SDK version that used ((eg. /tools, /build-tools/android-4.4W etc),).
- # So looking up the location of zipalign here instead of hard coding.
- # Refer to: https://codereview.chromium.org/238253015
- zipalign_path = ''
- for zipalign_str in AddExeExtensions('zipalign'):
- try:
- zipalign_path = Find(zipalign_str, sdk_root_path)
- if options.verbose:
- print('Use %s in %s.' % (zipalign_str, sdk_root_path))
- break
- except Exception:
- pass
- if not zipalign_path:
- print('zipalign could not be found in your Android SDK.'
- ' Make sure it is installed.')
- sys.exit(10)
- apk_path = '--unsigned-apk-path=' + os.path.join('out', 'app-unsigned.apk')
- final_apk_path = '--final-apk-path=' + \
- os.path.join('out', name + '.apk')
- cmd = ['python', 'scripts/gyp/finalize_apk.py',
- '--zipalign-path=%s' % zipalign_path,
- apk_path,
- final_apk_path,
- '--keystore-path=%s' % key_store,
- '--keystore-alias=%s' % key_alias,
- '--keystore-passcode=%s' % key_code,
- '--keystore-alias-passcode=%s' % key_alias_code]
- RunCommand(cmd)
+ for external_extension_jar in external_extension_jars:
+ shutil.copyfile(external_extension_jar,
+ os.path.join(name, 'libs',
+ os.path.basename(external_extension_jar)))
- src_file = os.path.join('out', name + '.apk')
+ if options.mode == 'embedded':
+ # Remove existing native libraries in xwalk_core_library, they are probably
+ # for the last execution to make apk for another CPU arch.
+ # And then copy the native libraries for the specified arch into
+ # xwalk_core_library.
+ arch = ConvertArchNameToArchFolder(options.arch)
+ if not arch:
+ print ('Invalid CPU arch: %s.' % arch)
+ sys.exit(10)
+ library_lib_path = os.path.join(name, 'xwalk_core_library', 'libs')
+ for dir_name in os.listdir(library_lib_path):
+ lib_dir = os.path.join(library_lib_path, dir_name)
+ if ContainsNativeLibrary(lib_dir):
+ shutil.rmtree(lib_dir)
+ native_lib_path = os.path.join(name, 'native_libs', arch)
+ if ContainsNativeLibrary(native_lib_path):
+ shutil.copytree(native_lib_path, os.path.join(library_lib_path, arch))
+ else:
+ print('No %s native library has been found for creating a Crosswalk '
+ 'embedded APK.' % arch)
+ sys.exit(10)
+
+ ant_cmd = ['ant', 'release', '-f', os.path.join(name, 'build.xml')]
+ if not options.verbose:
+ ant_cmd.extend(['-quiet'])
+ ant_cmd.extend(['-Dkey.store="%s"' % os.path.abspath(key_store)])
+ ant_cmd.extend(['-Dkey.alias="%s"' % key_alias])
+ if key_code:
+ ant_cmd.extend(['-Dkey.store.password="%s"' % key_code])
+ if key_alias_code:
+ ant_cmd.extend(['-Dkey.alias.password="%s"' % key_alias_code])
+ ant_result = subprocess.call(ant_cmd)
+ if ant_result != 0:
+ print('Command "%s" exited with non-zero exit code %d'
+ % (' '.join(ant_cmd), ant_result))
+ sys.exit(ant_result)
+
+ src_file = os.path.join(name, 'bin', '%s-release.apk' % name)
package_name = name
if options.app_version:
package_name += ('_' + options.app_version)
dst_file = os.path.join(options.target_dir,
'%s_%s.apk' % (package_name, options.arch))
shutil.copyfile(src_file, dst_file)
- CleanDir('out')
- if options.mode == 'embedded':
- os.remove(pak_des_path)
def PrintPackageInfo(options, name, packaged_archs):
if options.mode == 'shared':
Execution(options, name)
elif options.mode == 'embedded':
+ # Copy xwalk_core_library into app folder and move the native libraries
+ # out.
+ # When making apk for specified CPU arch, will only include the
+ # corresponding native library by copying it back into xwalk_core_library.
+ target_library_path = os.path.join(name, 'xwalk_core_library')
+ shutil.copytree('xwalk_core_library', target_library_path)
+ library_lib_path = os.path.join(target_library_path, 'libs')
+ native_lib_path = os.path.join(name, 'native_libs')
+ os.makedirs(native_lib_path)
+ available_archs = []
+ for dir_name in os.listdir(library_lib_path):
+ lib_dir = os.path.join(library_lib_path, dir_name)
+ if ContainsNativeLibrary(lib_dir):
+ shutil.move(lib_dir, os.path.join(native_lib_path, dir_name))
+ available_archs.append(dir_name)
if options.arch:
Execution(options, name)
packaged_archs.append(options.arch)
# will be generated.
valid_archs = ['x86', 'armeabi-v7a']
for arch in valid_archs:
- lib_path = os.path.join('native_libs', arch, 'libs',
- arch, 'libxwalkcore.so')
- if os.path.isfile(lib_path):
+ if arch in available_archs:
if arch.find('x86') != -1:
options.arch = 'x86'
elif arch.find('arm') != -1:
packaged_archs.append(options.arch)
else:
print('Warning: failed to create package for arch "%s" '
- 'due to missing library %s' %
- (arch, lib_path))
+ 'due to missing native library' % arch)
if len(packaged_archs) == 0:
print('No packages created, aborting')
# replace the original native library with an empty library.
# Because it doesn't affect the result of test.
if options.mode == 'embedded':
- native_library_dir = 'native_libs'
+ native_library_dir = os.path.join('xwalk_core_library', 'libs')
native_library_temp_dir = 'temp'
shutil.copytree(native_library_dir, native_library_temp_dir)
for root, _, files in os.walk(native_library_dir):
def restoreNativeLibrary():
# Restore the original native library for embedded mode.
if options.mode == 'embedded':
- native_library_dir = 'native_libs'
+ native_library_dir = os.path.join('xwalk_core_library', 'libs')
native_library_temp_dir = 'temp'
- if os.path.exists(native_library_dir):
+ if os.path.isdir(native_library_dir):
shutil.rmtree(native_library_dir)
shutil.move(native_library_temp_dir, native_library_dir)
@staticmethod
def archs():
- x86_native_lib_path = os.path.join('native_libs', 'x86', 'libs',
+ x86_native_lib_path = os.path.join('xwalk_core_library', 'libs',
'x86', 'libxwalkcore.so')
- arm_native_lib_path = os.path.join('native_libs', 'armeabi-v7a', 'libs',
+ arm_native_lib_path = os.path.join('xwalk_core_library', 'libs',
'armeabi-v7a', 'libxwalkcore.so')
arch_list = []
if os.path.isfile(x86_native_lib_path):
cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
'--package=org.xwalk.example', '--app-url=http://www.intel.com',
'--keystore-path=%s' % keystore_path, '--keystore-alias=xwalk-test',
- '--keystore-passcode=xwalk-test', self._mode]
+ '--keystore-passcode=xwalk-test',
+ '--keystore-alias-passcode=xwalk-test', self._mode]
RunCommand(cmd)
self.addCleanup(Clean, 'Example', '1.0.0')
self.assertTrue(os.path.exists('Example'))
def executeCommandAndVerifyResult(self, exec_file):
# Test all of supported options with empty 'mode' option.
- icon_path = './app_src/res/drawable-xhdpi/crosswalk.png'
+ icon_path = './template/res/drawable-xhdpi/crosswalk.png'
extension_path = 'test_data/extensions/myextension'
arch = ''
icon = ''
if (GURL(app_id_or_url).spec().empty()) {
application = application_service_->Launch(app_id_or_url, params);
} else {
- params.entry_points = Application::URLKey;
+ params.entry_points = Application::StartURLKey;
std::string error;
scoped_refptr<ApplicationData> application_data =
ApplicationData::Create(GURL(app_id_or_url), &error);
#include "xwalk/application/common/manifest.h"
#include "xwalk/application/common/manifest_handler.h"
+#if defined(OS_TIZEN)
+#include "xwalk/application/common/id_util.h"
+#endif
+
namespace errors = xwalk::application_manifest_errors;
namespace keys = xwalk::application_manifest_keys;
namespace widget_keys = xwalk::application_widget_keys;
return false;
}
+// FIXME: This function is wrong and has to be re-implemented
+// further (see XWALK-2230)
bool GetPackageType(const base::FilePath& path,
xwalk::application::Package::Type* package_type,
std::string* error) {
return false;
}
+#if defined(OS_TIZEN)
+bool GetPackageType(const std::string& application_id,
+ xwalk::application::Package::Type* package_type,
+ std::string* error) {
+ if (xwalk::application::IsValidWGTID(application_id)) {
+ *package_type = xwalk::application::Package::WGT;
+ return true;
+ } else if (xwalk::application::IsValidXPKID(application_id)) {
+ *package_type = xwalk::application::Package::XPK;
+ return true;
+ }
+
+ *error = base::StringPrintf("Invalid application id: %s",
+ application_id.c_str());
+ return false;
+}
+#endif
+
bool IsSingletonElement(const std::string& name) {
for (int i = 0; i < arraysize(kSingletonElements); ++i)
if (kSingletonElements[i] == name)
Manifest::SourceType source_type,
std::string* error) {
Package::Type package_type;
+#if defined(OS_TIZEN)
+ if (!GetPackageType(application_id, &package_type, error))
+#else
if (!GetPackageType(application_path, &package_type, error))
+#endif
return NULL;
return LoadApplication(application_path, application_id,
return GenerateId(path_bytes);
}
+#if defined(OS_TIZEN)
+bool IsValidWGTID(const std::string& id) {
+ return RE2::FullMatch(id, kWGTAppIdPattern);
+}
+
+bool IsValidXPKID(const std::string& id) {
+ return RE2::FullMatch(id, kXPKAppIdPattern);
+}
+#endif
+
bool IsValidApplicationID(const std::string& id) {
#if defined(OS_TIZEN)
- if (RE2::FullMatch(id, kWGTAppIdPattern) ||
- RE2::FullMatch(id, kXPKAppIdPattern))
+ if (IsValidWGTID(id) ||
+ IsValidXPKID(id))
return true;
return false;
#endif
#if defined(OS_TIZEN)
std::string GetPackageIdFromAppId(const std::string& app_id);
+bool IsValidWGTID(const std::string& id);
+bool IsValidXPKID(const std::string& id);
#endif
} // namespace application
shutil.rmtree(dir_to_clean)
-def PrepareFromChromium(target_dir):
- gyp_dir = os.path.join(target_dir, 'scripts', 'gyp')
- if not os.path.exists(gyp_dir):
- os.makedirs(gyp_dir)
- shutil.copytree('../build/android/gyp/util', os.path.join(gyp_dir, 'util'))
-
-
def PrepareFromXwalk(src_dir, target_dir):
'''Prepare different files for app packaging tools. All resources are used by
make_apk.py.
# Get the dir of source code from src_dir: ../../.
source_code_dir = os.path.dirname(os.path.dirname(src_dir))
- # The directories for source and target .jar files.
+ # The directory to copy libraries and code from.
jar_src_dir = os.path.join(src_dir, 'lib.java')
- jar_target_dir = os.path.join(target_dir, 'libs')
+ xwalk_core_library_dir = os.path.join(src_dir, 'xwalk_core_library')
- # The directories for generated resources.
- gen_res_src_dir = os.path.join(src_dir, 'gen')
- gen_res_target_dir = os.path.join(target_dir, 'gen')
- xwalk_core_library_res_dir = os.path.join(
- src_dir, 'xwalk_core_library', 'res')
+ # The directory to copy libraries, code and resources to.
+ app_target_dir = os.path.join(target_dir, 'template')
+ jar_target_dir = os.path.join(app_target_dir, 'libs')
# The directory for source packaging tools.
tools_src_dir = os.path.join(source_code_dir, 'xwalk/app/tools/android')
- # The directories for source and target gyp.
- gyp_src_dir = os.path.join(tools_src_dir, 'gyp')
- gyp_target_dir = os.path.join(target_dir, 'scripts/gyp')
-
# The source file/directory list to be copied and the target directory list.
source_target_list = [
(os.path.join(source_code_dir, 'xwalk/VERSION'), target_dir),
# This jar is needed for minifying and obfuscating the javascript and css.
(os.path.join(tools_src_dir,
- 'libs/yuicompressor-' + yui_compressor_version + '.jar'),
- jar_target_dir),
-
- # This jar is needed for 'javac' compile.
- (os.path.join(jar_src_dir, 'xwalk_app_runtime_java.jar'), jar_target_dir),
- (os.path.join(jar_src_dir, 'xwalk_runtime_embedded.dex.jar'),
- jar_target_dir),
-
- # Native library, like libxwalkcore.so.
- (os.path.join(src_dir, 'xwalk_runtime_lib_apk/libs/x86'),
- os.path.join(target_dir, 'native_libs/x86/libs/x86')),
- (os.path.join(src_dir, 'xwalk_runtime_lib_apk/libs/armeabi-v7a'),
- os.path.join(target_dir, 'native_libs/armeabi-v7a/libs/armeabi-v7a')),
-
- # Native source package(xwalk.pak) and related js files for extension.
- (os.path.join(src_dir, 'xwalk_runtime_lib/assets'),
- os.path.join(target_dir, 'native_libs_res')),
-
- # Various Java resources.
- # FIXME(wang16): Copy from the xwalk_core_library first. We need to
- # consider refine the whole process of make_apk.
- (os.path.join(gen_res_src_dir, 'ui_java/java_R'),
- os.path.join(gen_res_target_dir, 'ui_java/java_R')),
- (os.path.join(gen_res_src_dir, 'content_java/java_R'),
- os.path.join(gen_res_target_dir, 'content_java/java_R')),
- (os.path.join(gen_res_src_dir, 'xwalk_core_internal_java/java_R'),
- os.path.join(gen_res_target_dir, 'xwalk_core_internal_java/java_R')),
- (xwalk_core_library_res_dir,
- os.path.join(target_dir, 'libs_res/xwalk_core_library')),
+ 'libs/yuicompressor-%s.jar' % yui_compressor_version),
+ target_dir),
# The app wrapper code. It's the template Java code.
(os.path.join(source_code_dir, 'xwalk/app/android/app_template'),
- os.path.join(target_dir, 'app_src')),
-
- # Copy below 7 files to overwrite the existing ones from Chromium.
- (os.path.join(gyp_src_dir, 'util/build_utils.py'),
- os.path.join(gyp_target_dir, 'util')),
- (os.path.join(gyp_src_dir, 'util/md5_check.py'),
- os.path.join(gyp_target_dir, 'util')),
- (os.path.join(gyp_src_dir, 'ant.py'), gyp_target_dir),
- (os.path.join(gyp_src_dir, 'dex.py'), gyp_target_dir),
- (os.path.join(gyp_src_dir, 'finalize_apk.py'), gyp_target_dir),
- (os.path.join(gyp_src_dir, 'jar.py'), gyp_target_dir),
- (os.path.join(gyp_src_dir, 'javac.py'), gyp_target_dir),
+ app_target_dir),
+
+ # Shared mode uses xwalk_app_runtime_java.jar only.
+ # Embedded mode needs both.
+ (os.path.join(jar_src_dir, 'xwalk_app_runtime_java.jar'), jar_target_dir),
+ (os.path.join(jar_src_dir, 'xwalk_runtime_java.jar'), jar_target_dir),
+
+ # XWalk Core Library
+ (xwalk_core_library_dir, os.path.join(target_dir, 'xwalk_core_library')),
# Build and python tools.
- (os.path.join(tools_src_dir, 'ant'),
- os.path.join(target_dir, 'scripts/ant')),
+ (os.path.join(tools_src_dir, 'ant', 'xwalk-debug.keystore'), target_dir),
(os.path.join(tools_src_dir, 'app_info.py'), target_dir),
(os.path.join(tools_src_dir, 'compress_js_and_css.py'), target_dir),
(os.path.join(tools_src_dir, 'customize.py'), target_dir),
# Process target.
if source_is_file and not os.path.exists(target_path):
os.makedirs(target_path)
+ if not source_is_file and os.path.isdir(target_path):
+ shutil.rmtree(target_path)
# Do copy.
if source_is_file:
target_dir = args[0]
src_dir = os.path.dirname(target_dir)
Clean(target_dir)
- PrepareFromChromium(target_dir)
PrepareFromXwalk(src_dir, target_dir)
'xwalk/experimental/launch_screen/launch_screen_api.js',
'xwalk/experimental/presentation/presentation_api.js',
'xwalk/runtime/android/core_internal/src/org/xwalk/core/'
- + 'internal/extension/api/device_capabilities/device_capabilities_api.js'
+ + 'internal/extension/api/contacts/contacts_api.js',
+ 'xwalk/runtime/android/core_internal/src/org/xwalk/core/'
+ + 'internal/extension/api/device_capabilities/device_capabilities_api.js',
+ 'xwalk/runtime/android/core_internal/src/org/xwalk/core/'
+ + 'internal/extension/api/messaging/messaging_api.js'
]
# Copy JS binding file to assets/jsapi folder.
shutil.move(src_file, dst_file)
-def CopyResources(out_dir):
+def ReplaceCrunchedImage(project_source, filename, filepath):
+ """Replace crunched images with source images.
+ """
+ search_dir = [
+ 'content/public/android/java/res',
+ 'ui/android/java/res'
+ ]
+
+ pathname = os.path.basename(filepath)
+ #replace crunched 9-patch image resources.
+ for search in search_dir:
+ absdir = os.path.join(project_source, search)
+ for dirname, _, files in os.walk(absdir):
+ if filename in files:
+ relativedir = os.path.basename(dirname)
+ if (pathname == 'drawable' and relativedir == 'drawable-mdpi') or \
+ relativedir == pathname:
+ source_file = os.path.abspath(os.path.join(dirname, filename))
+ target_file = os.path.join(filepath, filename)
+ shutil.copyfile(source_file, target_file)
+ return
+
+
+def CopyResources(project_source, out_dir):
print 'Copying resources...'
res_dir = os.path.join(out_dir, LIBRARY_PROJECT_NAME, 'res')
temp_dir = os.path.join(out_dir, LIBRARY_PROJECT_NAME, 'temp')
if os.path.isdir(temp_dir):
shutil.rmtree(temp_dir)
+ #search 9-patch, then replace it with uncrunch image.
+ for dirname, _, files in os.walk(res_dir):
+ for filename in files:
+ if filename.endswith('.9.png'):
+ ReplaceCrunchedImage(project_source, filename, dirname)
+
def PostCopyLibraryProject(out_dir):
print 'Post Copy Library Project...'
# Copy Eclipse project files of library project.
CopyProjectFiles(options.source, out_dir)
# Copy binaries and resuorces.
- CopyResources(out_dir)
+ CopyResources(options.source, out_dir)
CopyBinaries(out_dir)
# Copy JS API binding files.
CopyJSBindingFiles(options.source, out_dir)
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Intel Corporation. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+# pylint: disable=F0401
+
+import optparse
+import os
+import shutil
+import sys
+import zipfile
+
+LIBRARY_PROJECT_NAME = 'xwalk_core_library'
+AAR_LIBRARY_NAME = 'xwalk_core_library_aar'
+
+def AddGeneratorOptions(option_parser):
+ option_parser.add_option('-s', dest='source',
+ help='Source directory of project root.',
+ type='string')
+ option_parser.add_option('-t', dest='target',
+ help='Product out target directory.',
+ type='string')
+
+
+def CopyProjectFiles(out_dir):
+ """cp out/Release/xwalk_core_library/AndroidManifest<file>
+ out/Release/xwalk_core_library_aar/<file>
+ """
+
+ print 'Copying library project files...'
+ files_to_copy = [
+ # AndroidManifest.xml from template.
+ 'AndroidManifest.xml',
+ ]
+ for f in files_to_copy:
+ source_file = os.path.join(out_dir, LIBRARY_PROJECT_NAME, f)
+ target_file = os.path.join(out_dir, AAR_LIBRARY_NAME, f)
+ shutil.copy2(source_file, target_file)
+
+
+def CopyBinaries(out_dir):
+ """cp out/Release/xwalk_core_library/libs/*
+ out/Release/xwalk_core_library_aar/jni/
+ """
+
+ print 'Copying binaries...'
+ # Copy jar files to classes.jar.
+ libs_dir = os.path.join(out_dir, LIBRARY_PROJECT_NAME, 'libs')
+
+ source_file = os.path.join(libs_dir, 'xwalk_core_library_java.jar')
+ target_file = os.path.join(out_dir, AAR_LIBRARY_NAME, 'classes.jar')
+ shutil.copyfile(source_file, target_file)
+
+ # Copy native libraries.
+ source_dir = os.path.join(out_dir, LIBRARY_PROJECT_NAME, 'libs')
+ target_dir = os.path.join(out_dir, AAR_LIBRARY_NAME, 'jni')
+ if not os.path.exists(target_dir):
+ os.makedirs(target_dir)
+
+ if os.path.exists(source_dir):
+ for item in os.listdir(source_dir):
+ sub_path = os.path.join(source_dir, item)
+ target_dir = os.path.join(target_dir, item)
+ if os.path.isdir(sub_path):
+ shutil.copytree(sub_path, target_dir)
+
+ # Copy R.txt.
+ r_source_dir = os.path.join(out_dir, 'gen', 'xwalk_core_internal_java')
+ r_source_file = os.path.join(r_source_dir, 'java_R', 'R.txt')
+ r_target_file = os.path.join(out_dir, AAR_LIBRARY_NAME, 'R.txt')
+ shutil.copyfile(r_source_file, r_target_file)
+
+
+def CopyResources(out_dir):
+ print 'Copying resources...'
+ source_dir = os.path.join(out_dir, LIBRARY_PROJECT_NAME, 'res')
+ target_dir = os.path.join(out_dir, AAR_LIBRARY_NAME, 'res')
+ shutil.copytree(source_dir, target_dir)
+
+
+def GenerateAAR(aar_path, aar_dir):
+ zfile = zipfile.ZipFile(aar_path, 'w')
+ abs_src = os.path.abspath(aar_dir)
+ for dirname, _, files in os.walk(aar_dir):
+ for filename in files:
+ absname = os.path.abspath(os.path.join(dirname, filename))
+ relativename = absname[len(abs_src) + 1:]
+ zfile.write(absname, relativename)
+ zfile.close()
+ #delete the AAR dir.
+ shutil.rmtree(aar_dir)
+
+
+def main(argv):
+ print 'Generating XWalkCore AAR Library...'
+ option_parser = optparse.OptionParser()
+ AddGeneratorOptions(option_parser)
+ options, _ = option_parser.parse_args(argv)
+
+ if not os.path.exists(options.source):
+ print 'Source project does not exist, please provide correct directory.'
+ sys.exit(1)
+ out_dir = options.target
+
+ # Clean the aar library.
+ aar_path = os.path.join(out_dir, 'xwalk_core_library.aar')
+ if os.path.exists(aar_path):
+ os.remove(aar_path)
+
+ aar_dir = os.path.join(out_dir, AAR_LIBRARY_NAME)
+ if os.path.exists(aar_dir):
+ shutil.rmtree(aar_dir)
+ os.mkdir(aar_dir)
+
+ # Copy Eclipse project files of library project.
+ CopyProjectFiles(out_dir)
+ # Copy binaries and resuorces.
+ CopyResources(out_dir)
+ CopyBinaries(out_dir)
+ GenerateAAR(aar_path, aar_dir)
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
}],
],
},
+ {
+ 'target_name': 'bulk_data_transmission',
+ 'type': 'loadable_module',
+ 'variables': {
+ 'mac_strip': 0,
+ },
+ 'sources': [
+ 'test/bulk_data_transmission.c',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'product_dir': '<(PRODUCT_DIR)\\tests\\extension\\bulk_data_transmission\\'
+ }, {
+ 'product_dir': '<(PRODUCT_DIR)/tests/extension/bulk_data_transmission/'
+ }],
+ ],
+ },
],
}
--- /dev/null
+// Bulk data transmission example for Crosswalk
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "xwalk/extensions/public/XW_Extension.h"
+
+static const char* kSource_bulk_data_api = "var bulkDataListener = null;"
+""
+"extension.setMessageListener(function(msg) {"
+" if (bulkDataListener instanceof Function) {"
+" bulkDataListener(msg);"
+" };"
+"});"
+""
+"exports.requestBulkDataAsync = function(power, callback) {"
+" bulkDataListener = callback;"
+" extension.postMessage(power.toString());"
+"};"
+;
+
+static XW_Extension g_extension = 0;
+static const XW_CoreInterface* g_core = NULL;
+static const XW_MessagingInterface* g_messaging = NULL;
+
+static void instance_created(XW_Instance instance) {
+ printf("Instance %d created!\n", instance);
+}
+
+static void instance_destroyed(XW_Instance instance) {
+ printf("Instance %d destroyed!\n", instance);
+}
+
+static void handle_message(XW_Instance instance, const char* message) {
+ int size = atoi(message);
+ char* data = malloc(size + 1);
+ memset(data, 'p', size);
+ data[size] = '\0';
+ printf("Instance %d created %d bytes of data chunk from native.\n", instance, size);
+ g_messaging->PostMessage(instance, data);
+ free(data);
+}
+
+static void shutdown(XW_Extension extension) {
+ printf("Shutdown\n");
+}
+
+// this is the only function which needs to be public
+int32_t XW_Initialize(XW_Extension extension, XW_GetInterface get_interface) {
+ // set up the extension
+ g_extension = extension;
+ g_core = get_interface(XW_CORE_INTERFACE);
+ g_core->SetExtensionName(extension, "bulkData");
+
+ g_core->SetJavaScriptAPI(extension, kSource_bulk_data_api);
+
+ g_core->RegisterInstanceCallbacks(
+ extension, instance_created, instance_destroyed);
+ g_core->RegisterShutdownCallback(extension, shutdown);
+
+ g_messaging = get_interface(XW_MESSAGING_INTERFACE);
+ g_messaging->Register(extension, handle_message);
+
+ return XW_OK;
+}
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bulk Data Transmission demo</title>
+</head>
+<body>
+
+<p>This uses the bulk data transmission extension defined in
+bulk_data_transmission.c (compiled to libbulk_data_transmission.so) to
+extend Crosswalk.</p>
+
+<div id="out">
+ <div id='async' />
+</div>
+
+<script>
+var div = document.getElementById('out');
+var divAsync = document.getElementById('async');
+
+var readableSize = function(size) {
+ var suffixCount = 0;
+ while (size >= 1024) {
+ size = size / 1024;
+ ++suffixCount;
+ }
+
+ var suffix;
+ switch(suffixCount) {
+ case 0:
+ suffix = 'B';
+ break;
+ case 1:
+ suffix = 'KB';
+ break;
+ case 2:
+ suffix = 'MB';
+ break;
+ case 3:
+ suffix = 'GB';
+ break;
+ case 4:
+ suffix = 'TB';
+ break;
+ default:
+ return nil;
+ }
+ return size + suffix;
+}
+
+var requestDataAsync = function(size) {
+ bulkData.requestBulkDataAsync(size, function(msg) {
+ var message = document.createElement('p');
+ message.innerText = 'Requested '
+ + readableSize(msg.length) + ' data chunk asynchronously';
+ divAsync.appendChild(message);
+ });
+}
+
+var startPow = 1;
+var maxPow = 26; // 26 is 64MB, which is the limit of IPC post message
+var repeatTimes = 1;
+
+var index = startPow * repeatTimes;
+
+function runTestCase() {
+ return new Promise(function(resolve) {
+ var size = Math.pow(2, Math.floor(index / repeatTimes));
+ requestDataAsync(size);
+ resolve();
+ }).then(function() {
+ ++index;
+ if (index == (maxPow + 1) * repeatTimes) {
+ document.title = "Pass";
+ return;
+ }
+ runTestCase();
+ }, function(e) {
+ console.error(e);
+ document.title = "Fail";
+ });
+};
+runTestCase();
+
+</script>
+</body>
+</html>
bool ExtensionWithInvalidName::s_instance_was_created = false;
+static const char* kBulkDataAPI = "var bulkDataListener = null;"
+""
+"extension.setMessageListener(function(msg) {"
+" if (bulkDataListener instanceof Function) {"
+" bulkDataListener(msg);"
+" };"
+"});"
+""
+"exports.requestBulkDataAsync = function(power, callback) {"
+" bulkDataListener = callback;"
+" extension.postMessage(power.toString());"
+"};";
+
+class BulkDataContext : public XWalkExtensionInstance {
+ public:
+ BulkDataContext() {
+ }
+ virtual void HandleMessage(scoped_ptr<base::Value> msg) OVERRIDE {
+ std::string message;
+ msg->GetAsString(&message);
+ int size = atoi(message.c_str());
+ std::string data_chunk(size, 'p');
+ scoped_ptr<base::Value> data(new base::StringValue(data_chunk));
+ PostMessageToJS(data.Pass());
+ }
+};
+
+class BulkDataExtension : public XWalkExtension {
+ public:
+ BulkDataExtension() : XWalkExtension() {
+ set_name("bulkData");
+ set_javascript_api(kBulkDataAPI);
+ }
+
+ virtual XWalkExtensionInstance* CreateInstance() OVERRIDE {
+ return new BulkDataContext();
+ }
+};
+
} // namespace
class XWalkExtensionsTest : public XWalkExtensionsTestBase {
XWalkExtensionVector* extensions) OVERRIDE {
extensions->push_back(new EchoExtension);
extensions->push_back(new ExtensionWithInvalidName);
+ extensions->push_back(new BulkDataExtension);
}
};
xwalk_test_utils::NavigateToURL(runtime(), url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
+
+IN_PROC_BROWSER_TEST_F(XWalkExtensionsTest, BulkDataExtension) {
+ content::RunAllPendingInMessageLoop();
+ GURL url = GetExtensionsTestURL(base::FilePath(),
+ base::FilePath().AppendASCII("bulk_data_transmission.html"));
+ content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ title_watcher.AlsoWaitForTitle(kFailString);
+ xwalk_test_utils::NavigateToURL(runtime(), url);
+ EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
+}
%endif
Name: crosswalk
-Version: 8.37.187.0
+Version: 9.37.190.0
Release: 0
Summary: Crosswalk is an app runtime based on Chromium
License: (BSD-3-Clause and LGPL-2.1+)
'filename': 'libffmpegsumo.so',
'buildtype': ['dev'],
},
-# installer creation scripts
- {
- 'filename': 'create_linux_installer.sh',
- 'buildtype': ['dev', 'official'],
- },
- {
- 'filename': 'app.desktop.templ',
- 'buildtype': ['dev', 'official'],
- },
- {
- 'filename': 'Makefile.templ',
- 'buildtype': ['dev', 'official'],
- },
]
'filename': 'libGLESv2.dll',
'buildtype': ['dev', 'official'],
},
-# installer creation scripts
- {
- 'filename': 'create_windows_installer.bat',
- 'buildtype': ['dev', 'official'],
- },
- {
- 'filename': 'app.wxs.templ',
- 'buildtype': ['dev', 'official'],
- },
- {
- 'filename': 'guid.vbs',
- 'buildtype': ['dev', 'official'],
- },
# syms files
{
'filename': 'xwalk.exe.pdb',
+++ /dev/null
-install:
- mkdir ${INSTALL_DIR} -p && rm Makefile && cp -r * ${INSTALL_DIR}
- cp *.desktop /usr/share/applications
+++ /dev/null
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Comment=$COMMENT
-Name=$APP_NAME
-StartupNotify=true
-NoDisplay=false
-Icon=
-Exec=$INSTALL_DIR/xwalk $APP_ARGUMENTS file://$INSTALL_DIR/$APP_INDEX
+++ /dev/null
-#!/bin/sh
-absolute_path () {
- echo `cd $1 && pwd`
-}
-THIS_SCRIPT=$0
-SCRIPT_DIR=`dirname $THIS_SCRIPT`
-SCRIPT_DIR=`absolute_path $SCRIPT_DIR`
-TEMP_DIR=/tmp/xwalk_build
-while [ "$1" != "" ]; do
- DASHED_PARAM=$1
- PARAM=`echo ${DASHED_PARAM}|sed 's/--//'`
- if [ "$PARAM" = "$DASHED_PARAM" ]; then
- APP_PATH=$PARAM
- else
- if ! echo $PARAM |grep = ; then
- PARAM=`echo $PARAM |sed 's/^\(.*\)/\U\1/'`
- eval $PARAM=true
- else
- PARAM=`echo $PARAM |sed 's/^\(.*=\)/\U\1/'`
- eval $PARAM
- fi
- fi
- shift
-done
-
-if [ "x$HELP" != "x" ]; then
- echo
- echo usage: $THIS_SCRIPT [options] [app_path]
- echo
- echo This script is used to create a standalone installer for Crosswalk applications. It
- echo depends on checkinstall and Crosswalk to function properly.
- echo The following options are supported:
- echo "
- app_path Path to the Crosswalk application. If not specified, the
- current directory is used.
- --xwalk_path=<path> Path to Crosswalk binaries. If not specified, the script
- will try to find them through PATH, the app path, or
- the current directory.
- --app_name=<name> Name of the application. If not specified, the name
- of the application directory is used.
- --version=<version> The version of the application, defaults to 1.0.0
- --app_index=<path> Path of app index file, relative to app_path. If not
- specified, index.html is used.
- --app_arguments=<path> Arugments to be passed into Crosswalk executable
- Example: --app_arguments=--allow-file-access-from-files
- --out=<path> Path of the output package file, defaults to
- $TEMP_DIR/<app_name>
- --publisher=<name> The manufacturer of this application, defaults to "Me"
- --shadow_install=<yes|no> Enable/disable installing app to a temporary directory
- for testing purposed. Defaults to yes
- --help Print this message "
- exit 1
-fi
-
-if [ "x`which checkinstall`" = "x" ]; then
- echo
- echo "checkinstall is required to create an application package. You can install it by:
- sudo apt-get install checkinstall"
- exit 1
-fi
-if [ "x$APP_PATH" = "x" ]; then
- APP_PATH=`pwd`
-fi
-if [ "x$APP_INDEX" = "x" ]; then
- APP_INDEX=index.html
-fi
-if [ "x$VERSION" = "x" ]; then
- VERSION=1.0.0
-fi
-if [ "x$XWALK_PATH" = "x" ]; then
- XWALK_PATH=`which xwalk`
- if [ "x$XWALK_PATH" != "x" ]; then
- XWALK_PATH=`dirname $XWALK_PATH`
- fi
- if [ "x$XWALK_PATH" = "x" ]; then
- XWALK_PATH=$APP_PATH
- if ! test -f "$XWALK_PATH/xwalk"; then
- XWALK_PATH=`pwd`
- if ! test -f "$XWALK_PATH/xwalk"; then
- echo Please make sure you have installed xwalk and setup the PATH enviroment variable
- echo on your system properly. Or you can specify the Crosswalk path through --xwalk_path
- echo command line parameter.
- exit 1
- fi
- fi
- fi
-fi
-if [ "x$APP_NAME" = "x" ]; then
- APP_NAME=`basename $APP_PATH`
-fi
-if [ "x$PUBLISHER" = "x" ]; then
- PUBLISHER=Me
-fi
-
-if [ "x$OUT" != "x" ]; then
- OUT_OPT="--pakdir=$OUT"
-fi
-
-if [ "x$SHADOW_INSTALL" = "x" ]; then
- SHADOW_INSTALL=yes
-fi
-
-XWALK_PATH=`absolute_path $XWALK_PATH`
-APP_PATH=`absolute_path $APP_PATH`
-BUILD_DIR=$TEMP_DIR/`basename $APP_PATH`
-#export some variables so that Makefile can use them
-export INSTALL_DIR=/opt/${PUBLISHER}/${APP_NAME}
-
-#Prepare for the build dir
-mkdir -p $TEMP_DIR
-cp -r $APP_PATH $TEMP_DIR
-if ! test -f $APP_PATH/Makefile; then
- cp $SCRIPT_DIR/Makefile.templ $BUILD_DIR/Makefile
-fi
-if ! ls *.desktop > /dev/null 2>&1; then
- while read line; do eval echo $line; done < $SCRIPT_DIR/app.desktop.templ > $BUILD_DIR/$APP_NAME.desktop
-fi
-cd $XWALK_PATH && cp xwalk xwalk.pak libffmpegsumo.so $BUILD_DIR
-
-#build the package
-cd $BUILD_DIR && checkinstall --pkgname=$APP_NAME --pkgversion=$VERSION \
- --backup=no --install=no --exclude=Makefile --fstrans=$SHADOW_INSTALL $OUT_OPT
-if [ $? != 0 -a -f $APP_PATH/Makefile ]; then
- echo "Warning: Packaging failed. Maybe there are some unsupported operations in your app's Makefile? Please try re-run the script with --shadow_install=no using sudo"
- echo
-fi
+++ /dev/null
-#!/bin/sh
-init_env() {
- APP_NAME=$1
- VERSION=$2
- if [ "x$VERSION" = "x" ]; then
- VERSION=1.0.0
- fi
- DEB_FILE=${APP_NAME}_$VERSION-*.deb
- DEB_PATH=$BUILD_DIR/$DEB_FILE
- DESKTOP_FILE=$APP_NAME.desktop
- DESKTOP_PATH=$BUILD_DIR/$DESKTOP_FILE
- DESKTOP_PATH_IN_DEB=/usr/share/applications/$DESKTOP_FILE
- if test -f $DEB_PATH; then
- rm $DEB_PATH
- fi
-}
-
-file_exist_in_deb() {
- run_test "Check file $1 existence in deb" "dpkg --contents $DEB_PATH |grep $1"
-}
-
-run_test () {
- if ! eval $2; then
- echo $1 failed!
- exit 1
- fi
-}
-
-APP_NAME=test-app
-TMP_DIR=/tmp
-XWALK_PATH=--xwalk_path=../../../../../../out/Release
-BUILD_DIR=$TMP_DIR/xwalk_build/$APP_NAME
-if test -e $BUILD_DIR; then
- rm -r $BUILD_DIR
-fi
-
-mkdir -p $APP_NAME
-cd $APP_NAME
-echo hello > index.html
-
-init_env $APP_NAME
-
-run_test "Check app_arguments help message" "../create_linux_installer.sh --help |grep app_arguments"
-
-case $1 in
- 1)
- init_env test-app 1.0.1
- DEB_PATH=$TMP_DIR/$DEB_FILE
- run_test "Create package" "../create_linux_installer.sh $XWALK_PATH --version=$VERSION --out=$TMP_DIR"
-
- #test if the version argument works
- run_test "Check DEB existence" "test -e $DEB_PATH"
- #test if files installed successfully
- file_exist_in_deb index.html
- file_exist_in_deb xwalk
- file_exist_in_deb xwalk.pak
- file_exist_in_deb libffmpegsumo.so
- file_exist_in_deb $DESKTOP_PATH_IN_DEB
- ;;
-
- 2)
- init_env custom-app-name
- run_test "Create package with customized app name" "../create_linux_installer.sh $XWALK_PATH --app_name=$APP_NAME && test -e $DEB_PATH"
- file_exist_in_deb $DESKTOP_PATH_IN_DEB
- run_test "Check desktop file" "grep $APP_NAME $DESKTOP_PATH"
-;;
- 3)
- CUSTOM_INDEX=src/custom_index.html
- APP_ARGUMENTS=--allow-file-access-from-files
- run_test "Test app_index" "../create_linux_installer.sh $XWALK_PATH --app_arguments=$APP_ARGUMENTS --app_index=$CUSTOM_INDEX && grep $CUSTOM_INDEX $DESKTOP_PATH && grep -- $APP_ARGUMENTS $DESKTOP_PATH"
-;;
-esac
+++ /dev/null
-<?xml version='1.0' encoding='windows-1252'?>\r
-<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r
-\r
- <Product Name='$(env.APP_NAME)' Id='*' UpgradeCode='$(env.UPGRADE_CODE)'\r
- Language='1033' Version="$(env.VERSION)" Manufacturer="$(env.PUBLISHER)">\r
-\r
-\r
- <Package Id='*' Keywords='Installer' Description="$(env.APP_NAME) $(env.VERSION) Installer"\r
- Comments='This is a Web-based application backed by Crosswalk.' Manufacturer="$(env.PUBLISHER)"\r
- InstallerVersion='100' Languages='1033' Compressed='yes'>\r
- </Package>\r
- <Media Id="1" Cabinet="installer.cab" EmbedCab="yes"/>\r
- <Property Id="MSIFASTINSTALL" Value="1"/>\r
- <Directory Id="TARGETDIR" Name="SourceDir">\r
- <Directory Id="ProgramFilesFolder">\r
- <Directory Id="INSTALLDIR" Name="$(env.APP_NAME)">\r
- </Directory>\r
- </Directory>\r
-\r
- <Directory Id="ProgramMenuFolder">\r
- <Directory Id="ProgramMenuSubfolder" Name="$(env.APP_NAME)">\r
- <Component Id="app_shortcuts" Guid="7C342EE9-85DD-4F1E-8F09-4AABB6DAB47D">\r
- <Shortcut Id="AppShortcut" Name="$(env.APP_NAME)" Description="This is a Web-based application backed by Crosswalk"\r
- Target="[INSTALLDIR]xwalk.exe" WorkingDirectory="INSTALLDIR"\r
- Arguments='$(env.APP_ARGUMENTS) "[INSTALLDIR]$(env.APP_INDEX)"'/>\r
- <RegistryValue Root="HKCU" Key="Software\$(env.PUBLISHER)\$(env.APP_NAME)"\r
- Name="installed" Type="integer" Value="1" KeyPath="yes"/>\r
- <RemoveFolder Id="ProgramMenuSubfolder" On="uninstall"/>\r
- </Component>\r
- </Directory>\r
- </Directory>\r
- </Directory>\r
- <Feature Id="launch_app" Level="1">\r
- <?if not $(env.WXS_FILES) = xwalkFiles ?>\r
- <ComponentGroupRef Id="appFilesGroup" />\r
- <?endif ?>\r
- <?if not $(env.WXS_FILES) = " appFiles.wxs" ?>\r
- <ComponentGroupRef Id="xwalkFilesGroup" />\r
- <?endif ?>\r
- <ComponentRef Id="app_shortcuts" />\r
- </Feature>\r
- <MajorUpgrade AllowSameVersionUpgrades="yes" \r
- DowngradeErrorMessage="A later version of this product is already installed. Setup will now exit."/> \r
- </Product>\r
-</Wix>\r
+++ /dev/null
-@echo off\r
-setlocal enabledelayedexpansion\r
-set THIS_SCRIPT=%0\r
-set WXS_TEMPL_FILE="%~dp0\app.wxs.templ"\r
-set GUID_GEN="%~dp0\guid.vbs"\r
-:loop\r
-set DASHED_PARAM=%1\r
-set PARAM=!DASHED_PARAM:--=!\r
-if "!PARAM!" == "!DASHED_PARAM!" (\r
- set APP_PATH=!PARAM!\r
-) else (\r
- if x%2==x (set !PARAM!=true) else (set !PARAM!=%2)\r
- shift\r
-)\r
-@shift\r
- \r
-@if not "%~1"=="" goto loop\r
-\r
-if not x%HELP%==x (\r
- echo.\r
- echo usage: %THIS_SCRIPT% [options] [app_path]\r
- echo.\r
- echo This script is used to create a standalone installer for Crosswalk applications. It \r
- echo depends on Wix toolset and Crosswalk to function properly.\r
- echo The following options are supported:\r
- echo.\r
- echo app_path Path to the Crosswalk application. If not specified, the\r
- echo current directory is used.\r
- echo --wix_bin_path=^<path^> Path to Wix toolset binaries. If not specified, the\r
- echo script will try to find them through PATH\r
- echo --xwalk_path=^<path^> Path to Crosswalk binaries. If not specified, the script\r
- echo will try to find them through PATH, the app path, or\r
- echo the current directory.\r
- echo --app_name=^<name^> Name of the application. If not specified, the name\r
- echo of the application directory is used.\r
- echo --version=^<version^> The version of the application, defaults to 1.0.0\r
- echo --app_index=^<args^> Path of app index file, relative to app_path. If not\r
- echo specified, "index.html" is used.\r
- echo --app_arguments=^<args^> Arguments to be passed into Crosswalk executable.\r
- echo Example: --app_arguments=--allow-file-access-from-files\r
- echo --out=^<pathname^> File Path of the output installer file, defaults to the\r
- echo current directory with %%app_name%%.msi as its name.\r
- echo --publisher=^<name^> The manufacturer of this application, defaults to "Me"\r
- echo --help Print this message \r
- exit /b\r
-\r
-)\r
-if x%WIX_BIN_PATH%==x (\r
- FOR /F "tokens=*" %%A IN ('where candle') DO SET WIX_BIN_PATH="%%A"\r
-)\r
-if not x%WIX_BIN_PATH%==x set WIX_BIN_PATH=!WIX_BIN_PATH:\candle.exe=!\r
-if x%WIX_BIN_PATH%==x (\r
- set WIX_BIN_PATH="C:\Program Files (x86)\WiX Toolset v3.7\bin"\r
- if not exist "!WIX_BIN_PATH!\candle.exe" (\r
- echo Please make sure you have installed Wix and setup the PATH enviroment variable on\r
- echo your system properly. Or you can specify the wix path through --wix_bin_path\r
- echo command line parameter. You can download Wix from http://wixtoolset.org\r
- exit /b\r
- )\r
-)\r
-if x%APP_PATH%==x set APP_PATH=%CD%\r
-if x%APP_INDEX%==x set APP_INDEX=index.html\r
-if x%VERSION%==x set VERSION=1.0.0\r
-if x%XWALK_PATH%==x (\r
- FOR /F "tokens=*" %%A IN ('where xwalk') DO SET XWALK_PATH="%%A"\r
- if x%XWALK_PATH%==x (\r
- set XWALK_PATH=%APP_PATH%\r
- if not exist "!XWALK_PATH!\xwalk.exe" (\r
- set XWALK_PATH=%CD%\r
- if not exist "!XWALK_PATH!\xwalk.exe" (\r
- echo Please make sure you have installed Crosswalk and setup the PATH enviroment variable\r
- echo on your system properly. Or you can specify the Crosswalk path through --xwalk_path \r
- echo command line parameter.\r
- \r
- exit /b\r
- )\r
- )\r
- )\r
-)\r
-if x%APP_NAME%==x (\r
- for %%F in (%APP_PATH%) do set APP_NAME=%%~nF\r
-)\r
-if x%PUBLISHER%==x set PUBLISHER=Me\r
-\r
-set MAIN_OBJ_FILE=%TEMP%\%APP_NAME%.wixobj\r
-\r
-pushd %XWALK_PATH%\r
-set XWALK_PATH=%CD%\r
-popd\r
-pushd %APP_PATH%\r
-set APP_PATH=%CD%\r
-popd\r
-set PACKAGING_INI="%APP_PATH%\_packaging.ini"\r
-\r
-if not "x!APP_PATH:%XWALK_PATH%=!"=="x%APP_PATH%" (\r
- set __DIRS.1="%APP_PATH%"\r
- set __HARV_FILES.1=appFiles\r
-) else (\r
- if not "x!XWALK_PATH:%APP_PATH%=!"=="x%XWALK_PATH%" (\r
- set __DIRS.1="%XWALK_PATH%"\r
- set __HARV_FILES.1=xwalkFiles\r
- ) else (\r
- set __DIRS.1="%APP_PATH%"\r
- set __HARV_FILES.1=appFiles\r
- set __DIRS.2="%XWALK_PATH%"\r
- set __HARV_FILES.2=xwalkFiles\r
- )\r
-)\r
-set WXS_FILES=\r
-set OBJ_FILES=\r
-if not exist %GUID_GEN% (\r
- echo.\r
- echo File not found: %GUID_GEN%\r
- echo Please make sure all the supporting files are in the script folder!\r
- exit /b\r
-)\r
-if x%OUT%==x (\r
- set OUT=%APP_NAME%.msi\r
- if exist !OUT! (\r
- set /p CONFIRM_DEL="The output file !OUT! already exists, replace it(Y/N)?" %=%\r
- if /I Y==!CONFIRM_DEL! goto :yes\r
- if /I YES==!CONFIRM_DEL! goto :yes\r
- echo.\r
- echo Installer not created!\r
- exit /b\r
- :yes\r
- del !OUT!\r
- )\r
-)\r
-for /f "tokens=2* delims=.=" %%A IN ('"SET __HARV_FILES."') do (\r
- set WXS_FILE=%TEMP%\%%B.wxs\r
- set OBJ_FILE=%TEMP%\%%B.wixobj\r
- %WIX_BIN_PATH%\heat dir !__DIRS.%%A! -gg -cg %%BGroup -srd -dr INSTALLDIR -var var.%%BDir -o !WXS_FILE!\r
- %WIX_BIN_PATH%\candle -dappFilesDir="%APP_PATH%" -dxwalkFilesDir="%XWALK_PATH%" !WXS_FILE! -o !OBJ_FILE!\r
- set "WXS_FILES=!WXS_FILES! !WXS_FILE!"\r
- set "OBJ_FILES=!OBJ_FILES! !OBJ_FILE!"\r
-)\r
-\r
-if exist %PACKAGING_INI% (\r
- for /f "delims=" %%x in ( 'type %PACKAGING_INI%') do (set "%%x")\r
-)\r
-FOR /F "tokens=*" %%A IN ('cscript //nologo %GUID_GEN% %UPGRADE_CODE%') DO (\r
- SET UPGRADE_CODE=%%A\r
- echo UPGRADE_CODE=!UPGRADE_CODE!>%PACKAGING_INI%\r
-)\r
-%WIX_BIN_PATH%\candle -dappFilesDir="%APP_PATH%" -dxwalkFilesDir="%XWALK_PATH%" %WXS_TEMPL_FILE% -o %MAIN_OBJ_FILE%\r
-%WIX_BIN_PATH%\light -spdb %MAIN_OBJ_FILE% %OBJ_FILES% -o %OUT%\r
+++ /dev/null
-if WScript.Arguments.length <> 1 then\r
- set obj = CreateObject("Scriptlet.TypeLib") \r
- WScript.StdOut.WriteLine MID(obj.GUID, 2, len(obj.GUID) - 4)\r
-else\r
- WScript.StdOut.WriteLine WScript.Arguments(0)\r
-end if\r
'../content/app/startup_helper_win.cc', # Needed by InitializedSandbox
'runtime/resources/xwalk.rc',
],
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)',
- 'files': [
- 'tools/packaging/bootstrapped/win/app.wxs.templ',
- 'tools/packaging/bootstrapped/win/create_windows_installer.bat',
- 'tools/packaging/bootstrapped/win/guid.vbs',
- ],
- },
- ],
'configurations': {
'Debug_Base': {
'msvs_settings': {
'../sandbox/sandbox.gyp:sandbox',
],
}], # OS=="win"
- ['OS == "linux"', {
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)',
- 'files': [
- 'tools/packaging/bootstrapped/linux/app.desktop.templ',
- 'tools/packaging/bootstrapped/linux/create_linux_installer.sh',
- 'tools/packaging/bootstrapped/linux/Makefile.templ',
- ],
- }
- ],
- }],
['OS=="mac"', {
'product_name': '<(xwalk_product_name)',
'dependencies!': [
'xwalk_runtime_lib_apk',
'xwalk_app_hello_world_apk',
'xwalk_app_template',
- 'xwalk_core_sample_apk'
+ 'xwalk_core_sample_apk',
+ 'xwalk_core_library_aar'
],
}],
],
},
],
},
+ {
+ 'target_name': 'xwalk_core_library_aar',
+ 'type': 'none',
+ 'dependencies': [
+ 'xwalk_core_library',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'generate_xwalk_core_library_aar',
+ 'message': 'Generating XwalkCore AAR Library.',
+ 'inputs': [
+ '<(DEPTH)/xwalk/build/android/common_function.py',
+ '<(DEPTH)/xwalk/build/android/generate_xwalk_core_library_aar.py',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/xwalk_core_library_aar_intermediate/always_run',
+ ],
+ 'action': [
+ 'python', '<(DEPTH)/xwalk/build/android/generate_xwalk_core_library_aar.py',
+ '-s', '<(DEPTH)',
+ '-t', '<(PRODUCT_DIR)',
+ ],
+ },
+ ],
+ },
],
}