forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I2619784eca0f7a4dd66f2db0104cb746d9266b4e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244369 Commit-Queue: John Rosasco <[email protected]> Reviewed-by: Brian Salomon <[email protected]> Reviewed-by: Mike Klein <[email protected]>
- Loading branch information
1 parent
83f76ac
commit 24cbdab
Showing
28 changed files
with
1,186 additions
and
44 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
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,32 @@ | ||
# Copyright 2019 Google LLC. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
assert(is_fuchsia) | ||
|
||
import ("//build/fuchsia/sdk.gni") | ||
|
||
fuchsia_sdk_manifest_exists = false | ||
if (is_fuchsia && using_fuchsia_sdk) { | ||
manifest_exists = exec_script("//build/fuchsia/file_exists", | ||
[ "-file_name", | ||
rebase_path(fuchsia_sdk_manifest_path) ], | ||
"list lines", | ||
[ "//build/fuchsia/file_exists" ]) | ||
if (manifest_exists == [ "true" ]) { | ||
fuchsia_sdk_manifest_exists = true | ||
} | ||
} | ||
|
||
group("fuchsia") { | ||
if(fuchsia_sdk_manifest_exists == true) { | ||
deps = [ | ||
"fidl", | ||
"pkg", | ||
"sysroot", | ||
] | ||
} else { | ||
assert(false, "Fuchsia SDK not found. Set arg skia_update_fuchsia_sdk=True " + | ||
"to initialize.") | ||
} | ||
} |
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,14 @@ | ||
# Copyright 2019 Google LLC. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
assert(is_fuchsia) | ||
import("//build/fuchsia/sdk.gni") | ||
|
||
# | ||
# Generate gn targets for fidl libraries in the Fuchsia SDK. | ||
# | ||
fuchsia_sdk("fidl") { | ||
meta = fuchsia_sdk_manifest_path | ||
enabled_parts = [ "fidl_library" ] | ||
} |
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,92 @@ | ||
#!/usr/bin/env python | ||
|
||
# Copyright 2019 Google LLC. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
""" | ||
Generate C/C++ headers and source files from the set of FIDL files | ||
specified in the meta.json manifest. | ||
""" | ||
|
||
import argparse | ||
import collections | ||
import json | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
def GetFIDLFilesRecursive(libraries, sdk_base, path): | ||
with open(path) as json_file: | ||
parsed = json.load(json_file) | ||
result = [] | ||
deps = parsed['deps'] | ||
for dep in deps: | ||
dep_meta_json = os.path.abspath('%s/fidl/%s/meta.json' % (sdk_base, dep)) | ||
GetFIDLFilesRecursive(libraries, sdk_base, dep_meta_json) | ||
libraries[parsed['name']] = result + parsed['sources'] | ||
|
||
def GetFIDLFilesByLibraryName(sdk_base, root): | ||
libraries = collections.OrderedDict() | ||
GetFIDLFilesRecursive(libraries, sdk_base, root) | ||
return libraries | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('--fidlc-bin', dest='fidlc_bin', action='store', required=True) | ||
parser.add_argument('--fidlgen-bin', dest='fidlgen_bin', action='store', required=True) | ||
|
||
parser.add_argument('--sdk-base', dest='sdk_base', action='store', required=True) | ||
parser.add_argument('--root', dest='root', action='store', required=True) | ||
parser.add_argument('--json', dest='json', action='store', required=True) | ||
parser.add_argument('--include-base', dest='include_base', action='store', required=True) | ||
parser.add_argument('--output-base-cc', dest='output_base_cc', action='store', required=True) | ||
parser.add_argument('--output-c-header', dest='output_header_c', action='store', required=True) | ||
parser.add_argument('--output-c-tables', dest='output_c_tables', action='store', required=True) | ||
|
||
args = parser.parse_args() | ||
|
||
assert os.path.exists(args.fidlc_bin) | ||
assert os.path.exists(args.fidlgen_bin) | ||
|
||
fidl_files_by_name = GetFIDLFilesByLibraryName(args.sdk_base, args.root) | ||
|
||
fidlc_command = [ | ||
args.fidlc_bin, | ||
'--c-header', | ||
args.output_header_c, | ||
'--tables', | ||
args.output_c_tables, | ||
'--json', | ||
args.json | ||
] | ||
|
||
for _, fidl_files in fidl_files_by_name.iteritems(): | ||
fidlc_command.append('--files') | ||
for fidl_file in fidl_files: | ||
fidl_abspath = os.path.abspath('%s/%s' % (args.sdk_base, fidl_file)) | ||
fidlc_command.append(fidl_abspath) | ||
|
||
subprocess.check_call(fidlc_command) | ||
|
||
assert os.path.exists(args.json) | ||
|
||
fidlgen_command = [ | ||
args.fidlgen_bin, | ||
'-generators', | ||
'cpp', | ||
'-include-base', | ||
args.include_base, | ||
'-json', | ||
args.json, | ||
'-output-base', | ||
args.output_base_cc | ||
] | ||
|
||
subprocess.check_call(fidlgen_command) | ||
|
||
return 0 | ||
|
||
if __name__ == '__main__': | ||
sys.exit(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,19 @@ | ||
#!/usr/bin/env python | ||
|
||
# Copyright 2019 Google LLC. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
""" | ||
Prints "true" if the input |file_name| exists. | ||
""" | ||
|
||
import argparse | ||
import os | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-file_name", type=str, | ||
help="File name for which to check existence for.") | ||
args = parser.parse_args() | ||
if os.path.exists(args.file_name): | ||
print "true" |
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,18 @@ | ||
# Copyright 2019 Google LLC. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import ("../../gn/skia.gni") | ||
import ("//build/fuchsia/sdk.gni") | ||
|
||
if(is_fuchsia && skia_update_fuchsia_sdk && | ||
current_toolchain == default_toolchain) { | ||
cipd_dir = "${fuchsia_sdk_path}/../cipd" | ||
update_sdk_out = exec_script("//build/fuchsia/update_fuchsia_sdk", | ||
[ "-sdk_dir=" + rebase_path(fuchsia_sdk_path), | ||
"-clang_dir=" + rebase_path(fuchsia_toolchain_path), | ||
"-cipd_cache_dir=" + rebase_path(cipd_dir), | ||
"-cipd_clang_version=git_revision:a6e1de4afc51560df18c95cb616dec51248ed660" ], | ||
"list lines", | ||
[ "//build/fuchsia/update_fuchsia_sdk" ]) | ||
} |
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,58 @@ | ||
#!/usr/bin/env python | ||
|
||
# Copyright 2019 Google LLC. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
""" | ||
Builds a Fuchsia FAR archive. | ||
""" | ||
|
||
import argparse | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('--pm-bin', dest='pm_bin', action='store', required=True) | ||
parser.add_argument( | ||
'--pkg-dir', dest='pkg_dir', action='store', required=True) | ||
parser.add_argument( | ||
'--pkg-name', dest='pkg_name', action='store', required=True) | ||
parser.add_argument( | ||
'--pkg-version', dest='pkg_version', action='store', required=True) | ||
parser.add_argument( | ||
'--pkg-manifest', dest='pkg_manifest', action='store', required=True) | ||
|
||
args = parser.parse_args() | ||
|
||
assert os.path.exists(args.pm_bin) | ||
assert os.path.exists(args.pkg_dir) | ||
|
||
pkg_dir = args.pkg_dir | ||
pkg_name = args.pkg_name | ||
pkg_manifest = args.pkg_manifest | ||
pkg_version = args.pkg_version | ||
|
||
pm_command_base = [ | ||
args.pm_bin, | ||
'-o', | ||
pkg_dir, | ||
] | ||
|
||
# Create the package ID file. | ||
subprocess.check_call(pm_command_base + ['-n'] + [pkg_name] + ['init']) | ||
|
||
# Build the package. | ||
subprocess.check_call(pm_command_base + ['-m'] + [pkg_manifest] + ['build']) | ||
|
||
# Archive the package. | ||
subprocess.check_call(pm_command_base + ['-m'] + [pkg_manifest] + ['-version'] + [pkg_version] + ['archive']) | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
Oops, something went wrong.