Orchestrator can build end to end.
This reduces the scope of the demo to just building and installing a single .so, but it makes the demo actually build that single .so. Next up, writing some unit tests and fleshing out functionality. Test: see the README Change-Id: I560904b786fbf69d3a83dbb08d496dba5a3192ca
This commit is contained in:
@@ -44,93 +44,60 @@ class InnerBuildSoong(common.Commands):
|
||||
mkdirs(contributions_dir)
|
||||
|
||||
if "system" in args.api_domain:
|
||||
with open(os.path.join(contributions_dir, "public_api-1.json"), "w") as f:
|
||||
with open(os.path.join(contributions_dir, "api_a-1.json"), "w") as f:
|
||||
# 'name: android' is android.jar
|
||||
f.write(textwrap.dedent("""\
|
||||
{
|
||||
"name": "public_api",
|
||||
"name": "api_a",
|
||||
"version": 1,
|
||||
"api_domain": "system",
|
||||
"cc_libraries": [
|
||||
{
|
||||
"name": "libhwui",
|
||||
"name": "libhello1",
|
||||
"headers": [
|
||||
{
|
||||
"root": "frameworks/base/libs/hwui/apex/include",
|
||||
"root": "build/build/make/orchestrator/test_workspace/inner_tree_1",
|
||||
"files": [
|
||||
"android/graphics/jni_runtime.h",
|
||||
"android/graphics/paint.h",
|
||||
"android/graphics/matrix.h",
|
||||
"android/graphics/canvas.h",
|
||||
"android/graphics/renderthread.h",
|
||||
"android/graphics/bitmap.h",
|
||||
"android/graphics/region.h"
|
||||
"hello1.h"
|
||||
]
|
||||
}
|
||||
],
|
||||
"api": [
|
||||
"frameworks/base/libs/hwui/libhwui.map.txt"
|
||||
]
|
||||
}
|
||||
],
|
||||
"java_libraries": [
|
||||
{
|
||||
"name": "android",
|
||||
"api": [
|
||||
"frameworks/base/core/api/current.txt"
|
||||
]
|
||||
}
|
||||
],
|
||||
"resource_libraries": [
|
||||
{
|
||||
"name": "android",
|
||||
"api": "frameworks/base/core/res/res/values/public.xml"
|
||||
}
|
||||
],
|
||||
"host_executables": [
|
||||
{
|
||||
"name": "aapt2",
|
||||
"binary": "out/host/bin/aapt2",
|
||||
"runfiles": [
|
||||
"../lib/todo.so"
|
||||
]
|
||||
}
|
||||
]
|
||||
}"""))
|
||||
elif "com.android.bionic" in args.api_domain:
|
||||
with open(os.path.join(contributions_dir, "public_api-1.json"), "w") as f:
|
||||
# 'name: android' is android.jar
|
||||
f.write(textwrap.dedent("""\
|
||||
{
|
||||
"name": "public_api",
|
||||
"version": 1,
|
||||
"api_domain": "system",
|
||||
"cc_libraries": [
|
||||
{
|
||||
"name": "libc",
|
||||
"headers": [
|
||||
{
|
||||
"root": "bionic/libc/include",
|
||||
"files": [
|
||||
"stdio.h",
|
||||
"sys/klog.h"
|
||||
]
|
||||
}
|
||||
],
|
||||
"api": "bionic/libc/libc.map.txt"
|
||||
}
|
||||
],
|
||||
"java_libraries": [
|
||||
{
|
||||
"name": "android",
|
||||
"api": [
|
||||
"frameworks/base/libs/hwui/api/current.txt"
|
||||
"build/build/make/orchestrator/test_workspace/inner_tree_1/libhello1"
|
||||
]
|
||||
}
|
||||
]
|
||||
}"""))
|
||||
|
||||
|
||||
def analyze(self, args):
|
||||
if "system" in args.api_domain:
|
||||
# Nothing to export in this demo
|
||||
# Write a fake inner_tree.ninja; what the inner tree would have generated
|
||||
with open(os.path.join(args.out_dir, "inner_tree.ninja"), "w") as f:
|
||||
# TODO: Note that this uses paths relative to the workspace not the iner tree
|
||||
# for demo purposes until we get the ninja chdir change in.
|
||||
f.write(textwrap.dedent("""\
|
||||
rule compile_c
|
||||
command = mkdir -p ${out_dir} && g++ -c ${cflags} -o ${out} ${in}
|
||||
rule link_so
|
||||
command = mkdir -p ${out_dir} && gcc -shared -o ${out} ${in}
|
||||
build %(OUT_DIR)s/libhello1/hello1.o: compile_c build/build/make/orchestrator/test_workspace/inner_tree_1/libhello1/hello1.c
|
||||
out_dir = %(OUT_DIR)s/libhello1
|
||||
cflags = -Ibuild/build/make/orchestrator/test_workspace/inner_tree_1/libhello1/include
|
||||
build %(OUT_DIR)s/libhello1/libhello1.so: link_so %(OUT_DIR)s/libhello1/hello1.o
|
||||
out_dir = %(OUT_DIR)s/libhello1
|
||||
build system: phony %(OUT_DIR)s/libhello1/libhello1.so
|
||||
""" % { "OUT_DIR": args.out_dir }))
|
||||
with open(os.path.join(args.out_dir, "build_targets.json"), "w") as f:
|
||||
f.write(textwrap.dedent("""\
|
||||
{
|
||||
"staging": [
|
||||
{
|
||||
"dest": "staging/system/lib/libhello1.so",
|
||||
"obj": "libhello1/libhello1.so"
|
||||
}
|
||||
]
|
||||
}""" % { "OUT_DIR": args.out_dir }))
|
||||
|
||||
def main(argv):
|
||||
return InnerBuildSoong().Run(argv)
|
||||
|
Reference in New Issue
Block a user