forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the build system to build artifacts for distribution
Instead of using a collection of Python scripts to generate the artifacts we want to distribute from this repository, we should just use the build system. This CL adds a top-level |dist| target that creates these artifacts in a "dist" directory of the build output.
- Loading branch information
Showing
4 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,11 @@ group("default") { | |
] | ||
} | ||
} | ||
|
||
group("dist") { | ||
testonly = true | ||
|
||
deps = [ | ||
"//sky/dist", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/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. | ||
|
||
import argparse | ||
import os | ||
import shutil | ||
|
||
def remove_empty_dirs(root_dir): | ||
for root, dirs, _ in os.walk(root_dir): | ||
for name in dirs: | ||
fname = os.path.join(root, name) | ||
if not os.listdir(fname): | ||
os.removedirs(fname) | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
description='Clean Sky package for distribution') | ||
parser.add_argument('package_dir', type=str) | ||
parser.add_argument('--touch', type=str) | ||
args = parser.parse_args() | ||
|
||
remove_empty_dirs(args.package_dir) | ||
|
||
material_design_icons = os.path.join(args.package_dir, 'lib/assets/material-design-icons') | ||
if os.path.exists(material_design_icons): | ||
shutil.rmtree(material_design_icons) | ||
|
||
with open(args.touch, 'w') as f: | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# 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. | ||
|
||
root_dist_dir = "$root_build_dir/dist" | ||
|
||
copy("sky_viewer") { | ||
sources = [ | ||
"$root_build_dir/sky_viewer.mojo", | ||
] | ||
outputs = [ "$root_dist_dir/viewer/{{source_file_part}}" ] | ||
|
||
deps = [ | ||
"//services/sky", | ||
] | ||
} | ||
|
||
copy("sky_shell") { | ||
if (is_android) { | ||
sources = [ | ||
"$root_build_dir/apks/SkyDemo.apk", | ||
] | ||
|
||
deps = [ | ||
"//sky/sdk/example/demo_launcher", | ||
] | ||
} else { | ||
sources = [ | ||
"$root_build_dir/sky_shell", | ||
"$root_build_dir/icudtl.dat", | ||
] | ||
|
||
deps = [ | ||
"//sky/shell", | ||
] | ||
} | ||
|
||
outputs = [ "$root_dist_dir/shell/{{source_file_part}}" ] | ||
} | ||
|
||
if (is_android) { | ||
import("//build/config/android/rules.gni") | ||
|
||
sky_sdk_dir = "$root_dist_dir/sdk/sky" | ||
|
||
copy_ex("create_sky_sdk") { | ||
clear_dir = true | ||
dest = "$root_dist_dir/sdk" | ||
sources = [ | ||
"$root_gen_dir/dart-pkg/sky", | ||
] | ||
deps = [ | ||
"//sky/sdk:sky", | ||
] | ||
} | ||
|
||
copy("copy_sky_sdk_license") { | ||
sources = [ | ||
"//AUTHORS", | ||
"//LICENSE", | ||
] | ||
outputs = [ "$sky_sdk_dir/{{source_file_part}}" ] | ||
deps = [ | ||
":create_sky_sdk" | ||
] | ||
} | ||
|
||
copy("copy_sky_sdk_apks") { | ||
sources = [ | ||
"$root_dist_dir/shell/SkyDemo.apk", | ||
] | ||
outputs = [ "$sky_sdk_dir/apks/{{source_file_part}}" ] | ||
deps = [ | ||
":create_sky_sdk", | ||
":sky_shell", | ||
] | ||
} | ||
|
||
action("sky_sdk") { | ||
stamp_file = "$target_gen_dir/sky_sdk_cleaned.stamp" | ||
|
||
script = "//sky/build/clean_sky_package.py" | ||
|
||
inputs = [ "$root_gen_dir/dart-pkg/sky.stamp" ] | ||
outputs = [ stamp_file ] | ||
|
||
args = [ | ||
rebase_path(sky_sdk_dir, root_build_dir), | ||
"--touch", | ||
rebase_path(stamp_file, root_build_dir), | ||
] | ||
|
||
deps = [ | ||
":copy_sky_sdk_apks", | ||
":copy_sky_sdk_license", | ||
":create_sky_sdk", | ||
"//sky/sdk:sky", | ||
] | ||
} | ||
} | ||
|
||
group("dist") { | ||
deps = [ | ||
":sky_shell", | ||
":sky_viewer", | ||
] | ||
|
||
if (is_android) { | ||
deps += [ ":sky_sdk" ] | ||
} | ||
} |