Remove unused build scripts (flutter/engine#2883)

This commit is contained in:
Adam Barth
2016-08-07 13:48:27 -07:00
committed by GitHub
parent 08d05b7a34
commit e279bf0d33
4 changed files with 0 additions and 391 deletions

View File

@@ -1,39 +0,0 @@
#!/usr/bin/env python
# Copyright 2016 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 argparse
import subprocess
import shutil
import sys
import os
def MakeStamp(stamp_path):
dir_name = os.path.dirname(stamp_path)
if not os.path.isdir(dir_name):
os.makedirs()
with open(stamp_path, 'a'):
os.utime(stamp_path, None)
def main():
parser = argparse.ArgumentParser(description='Copy a directory')
parser.add_argument('--src', type=str)
parser.add_argument('--dst', type=str)
parser.add_argument('--stamp', type=str)
args = parser.parse_args()
shutil.rmtree(args.dst, True)
shutil.copytree(args.src, args.dst)
MakeStamp(args.stamp)
if __name__ == '__main__':
sys.exit(main())

View File

@@ -1,99 +0,0 @@
#!/usr/bin/env python
# Copyright 2016 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.
'''Creates the iOS native service SDK that developers can use the create
native services that can be dynamically loaded.'''
import errno
import os
import shutil
import sys
import argparse
import subprocess
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--simulator-out-dir',
dest='simulator_out_dir',
required=True,
help='The out directory for the simulator assets.')
parser.add_argument('--device-out-dir',
dest='device_out_dir',
required=True,
help='The out directory for the device assets.')
parser.add_argument('--dest',
dest='dest',
required=True,
help='The directory in which to create the SDK.')
parser.add_argument('--harness',
dest='harness',
required=True,
help='The SDK harness to use.')
parser.add_argument('headers',
metavar='H',
nargs='+',
help='A list of header directories to copy over to the SDK.')
args = parser.parse_args()
simulator_out_dir = os.path.abspath(args.simulator_out_dir)
device_out_dir = os.path.abspath(args.device_out_dir)
archive_path = 'obj/sky/services/dynamic/libFlutterService.a'
simulator_archive = os.path.join(simulator_out_dir, archive_path)
device_archive = os.path.join(device_out_dir, archive_path)
sdk_dir = os.path.join(os.path.abspath(args.dest), 'ServiceSDK')
if os.path.isdir(sdk_dir):
shutil.rmtree(sdk_dir)
shutil.copytree(os.path.abspath(args.harness), os.path.join(sdk_dir))
library_path = os.path.join(sdk_dir, 'Library')
header_path = os.path.join(sdk_dir, 'Headers')
mkdir_p(library_path)
mkdir_p(header_path)
subprocess.call([
'lipo',
simulator_archive,
device_archive,
'-create',
'-output',
os.path.join(library_path, 'libFlutterService.a'),
])
src_root = os.path.join(os.path.dirname(__file__), '../../')
for headers_dir in args.headers:
for root, _, files in os.walk(headers_dir):
for file in files:
if file.endswith(".h"):
source = os.path.abspath(os.path.join(root, file))
relative = os.path.relpath(source, src_root)
destination = os.path.abspath(os.path.join(header_path, relative))
destination_dir = os.path.dirname(destination)
mkdir_p(destination_dir)
shutil.copyfile(source, destination)
return 0
if __name__ == '__main__':
sys.exit(main())

View File

@@ -1,66 +0,0 @@
#!/usr/bin/env python
# Copyright 2016 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 argparse
import subprocess
import shutil
import sys
import os
def main():
parser = argparse.ArgumentParser(description='Creates the Flutter iOS SDK')
parser.add_argument('--dst', type=str, required=True)
parser.add_argument('--device-out-dir', type=str, required=True)
parser.add_argument('--simulator-out-dir', type=str, required=True)
args = parser.parse_args()
device_sdk = os.path.join(args.device_out_dir, 'Flutter')
simulator_sdk = os.path.join(args.simulator_out_dir, 'Flutter')
flutter_framework_binary = 'Flutter.framework/Flutter'
device_dylib = os.path.join(args.device_out_dir,
flutter_framework_binary)
simulator_dylib = os.path.join(args.simulator_out_dir,
flutter_framework_binary)
if not os.path.isdir(device_sdk):
print 'Cannot find iOS device SDK at', device_sdk
return 1
if not os.path.isdir(simulator_sdk):
print 'Cannot find iOS simulator SDK at', simulator_sdk
return 1
if not os.path.isfile(device_dylib):
print 'Cannot find iOS device dylib at', device_dylib
return 1
if not os.path.isfile(simulator_dylib):
print 'Cannot find iOS device dylib at', simulator_dylib
return 1
shutil.rmtree(args.dst, True)
shutil.copytree(device_sdk, args.dst)
sim_tools = 'Tools/iphonesimulator'
shutil.copytree(os.path.join(simulator_sdk, sim_tools),
os.path.join(args.dst, sim_tools))
subprocess.call([
'lipo',
device_dylib,
simulator_dylib,
'-create',
'-output',
os.path.join(args.dst, 'Tools/common/Flutter.framework/Flutter')
])
if __name__ == '__main__':
sys.exit(main())

View File

@@ -1,187 +0,0 @@
#!/usr/bin/env python
# Copyright 2015 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.
# See https://github.com/domokit/sky_engine/wiki/Release-process
import argparse
import os
import subprocess
import sys
import distutils.util
import tempfile
import zipfile
DRY_RUN = False
def run(cwd, args):
print 'RUNNING:', ' '.join(args), 'IN:', cwd
if DRY_RUN:
return
subprocess.check_call(args, cwd=cwd)
def confirm(prompt):
user_input = raw_input("%s (y/N) " % prompt)
try:
return distutils.util.strtobool(user_input) == 1
except ValueError:
return False
def git_revision(cwd):
return subprocess.check_output([
'git', 'rev-parse', 'HEAD',
], cwd=cwd).strip()
GS_URL = 'gs://mojo/flutter/%(commit_hash)s/%(config)s/%(name)s'
# Paths of the artifacts that will be packaged into a zip file.
ZIP_ARTIFACTS = {
'android-arm': [
'chromium-debug.keystore',
'icudtl.dat',
'dist/shell/SkyShell.apk',
'dist/shell/flutter.mojo',
'gen/sky/shell/shell/classes.dex.jar',
'gen/sky/shell/shell/shell/libs/armeabi-v7a/libsky_shell.so',
# TODO(mpcomplete): obsolete. Remove after updating the flutter tool.
'gen/sky/shell/shell/classes.dex',
],
'linux-x64': [
'dist/shell/icudtl.dat',
'dist/shell/sky_shell',
'dist/shell/sky_snapshot',
'dist/shell/flutter.mojo',
],
}
# Paths of the artifacts that will be uploaded to GCS as individual files.
FILE_ARTIFACTS = {
'android-arm': [
'dist/shell/flutter.mojo',
'dist/shell/libflutter_library.so',
],
'linux-x64': [
'dist/shell/flutter.mojo',
'dist/shell/libflutter_library.so',
],
}
def find_missing_artifacts(config, config_root):
result = []
for artifact_map in [ZIP_ARTIFACTS, FILE_ARTIFACTS]:
for artifact_path in artifact_map[config]:
full_path = os.path.join(config_root, artifact_path)
if not os.path.exists(full_path):
result.append(full_path)
return result
# Do not try to compress file types that are already compressed.
FILE_TYPE_COMPRESSION = {
'.apk': zipfile.ZIP_STORED,
}
def upload_artifacts(dist_root, config, commit_hash):
# Build and upload a zip file of artifacts
zip_fd, zip_filename = tempfile.mkstemp('.zip', 'artifacts_')
try:
os.close(zip_fd)
artifact_zip = zipfile.ZipFile(zip_filename, 'w')
for artifact_path in ZIP_ARTIFACTS[config]:
_, extension = os.path.splitext(artifact_path)
artifact_zip.write(os.path.join(dist_root, artifact_path),
os.path.basename(artifact_path),
FILE_TYPE_COMPRESSION.get(extension, zipfile.ZIP_DEFLATED))
artifact_zip.close()
dst = GS_URL % {
'config': config,
'commit_hash': commit_hash,
'name': 'artifacts.zip',
}
run(dist_root, ['gsutil', 'cp', zip_filename, dst])
finally:
os.remove(zip_filename)
# Upload individual file artifacts
for artifact_path in FILE_ARTIFACTS[config]:
dst = GS_URL % {
'config': config,
'commit_hash': commit_hash,
'name': os.path.basename(artifact_path),
}
z = ','.join([ 'mojo', 'so' ])
run(dist_root, ['gsutil', 'cp', '-z', z, artifact_path, dst])
def main():
parser = argparse.ArgumentParser(description='Deploy!')
parser.add_argument('--dry-run', action='store_true', default=False,
help='Just print commands w/o executing.')
parser.add_argument('--revision', help='The git revision to publish.')
args = parser.parse_args()
global DRY_RUN
DRY_RUN = args.dry_run
engine_root = os.path.abspath('.')
if not os.path.exists(os.path.join(engine_root, 'sky')):
print "Cannot find //sky. Is %s the Flutter engine repository?" % engine_root
return 1
commit_hash = git_revision(engine_root)
if commit_hash != args.revision:
print "Current revision %s does not match requested revision %s." % (commit_hash, args.revision)
print "Please update the current revision to %s." % args.revision
return 1
# Derived paths:
dart_sdk_root = os.path.join(engine_root, 'third_party/dart-sdk/dart-sdk')
pub_path = os.path.join(dart_sdk_root, 'bin/pub')
android_out_root = os.path.join(engine_root, 'out/android_Release')
linux_out_root = os.path.join(engine_root, 'out/Release')
sky_engine_package_root = os.path.join(android_out_root, 'dist/packages/sky_engine/sky_engine')
sky_services_package_root = os.path.join(android_out_root, 'dist/packages/sky_services/sky_services')
sky_engine_revision_file = os.path.join(sky_engine_package_root, 'lib', 'REVISION')
run(engine_root, ['sky/tools/gn', '--android', '--release'])
run(engine_root, ['ninja', '-C', 'out/android_Release', ':dist'])
run(engine_root, ['sky/tools/gn', '--release'])
run(engine_root, ['ninja', '-C', 'out/Release', ':dist'])
with open(sky_engine_revision_file, 'w') as stream:
stream.write(commit_hash)
configs = [('android-arm', android_out_root),
('linux-x64', linux_out_root)]
# Check for missing artifact files
missing_artifacts = []
for config, config_root in configs:
missing_artifacts.extend(find_missing_artifacts(config, config_root))
if missing_artifacts:
print ('Build is missing files:\n%s' %
'\n'.join('\t%s' % path for path in missing_artifacts))
return 1
# Upload artifacts
for config, config_root in configs:
upload_artifacts(config_root, config, commit_hash)
run(sky_engine_package_root, [pub_path, 'publish', '--force'])
run(sky_services_package_root, [pub_path, 'publish', '--force'])
if __name__ == '__main__':
sys.exit(main())