OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/android/internal_rules.gni") | 6 import("//build/config/android/internal_rules.gni") |
7 import("//tools/grit/grit_rule.gni") | 7 import("//tools/grit/grit_rule.gni") |
8 | 8 |
9 assert(is_android) | 9 assert(is_android) |
10 | 10 |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 # unittests_dep = ":foo_unittests" | 849 # unittests_dep = ":foo_unittests" |
850 # } | 850 # } |
851 template("unittest_apk") { | 851 template("unittest_apk") { |
852 assert(defined(invoker.unittests_dep), "Need unittests_dep for $target_name") | 852 assert(defined(invoker.unittests_dep), "Need unittests_dep for $target_name") |
853 | 853 |
854 test_suite_name = get_label_info(invoker.unittests_dep, "name") | 854 test_suite_name = get_label_info(invoker.unittests_dep, "name") |
855 | 855 |
856 if (defined(invoker.unittests_binary)) { | 856 if (defined(invoker.unittests_binary)) { |
857 unittests_binary = root_out_dir + "/" + invoker.unittests_binary | 857 unittests_binary = root_out_dir + "/" + invoker.unittests_binary |
858 } else { | 858 } else { |
859 unittests_binary = root_out_dir + "/" + test_suite_name | 859 unittests_binary = root_out_dir + "/lib.stripped/lib" + test_suite_name + ".
so" |
860 } | 860 } |
861 | 861 |
862 android_apk(target_name) { | 862 android_apk(target_name) { |
863 _apk_name = test_suite_name | 863 _apk_name = test_suite_name |
864 final_apk_path = "$root_build_dir/${_apk_name}_apk/${_apk_name}-debug.apk" | 864 final_apk_path = "$root_build_dir/${_apk_name}_apk/${_apk_name}-debug.apk" |
865 java_files = [ | 865 java_files = [ |
866 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv
ity.java" | 866 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv
ity.java" |
867 ] | 867 ] |
868 android_manifest = "//testing/android/java/AndroidManifest.xml" | 868 android_manifest = "//testing/android/java/AndroidManifest.xml" |
869 unittests_outputs = [ unittests_binary ] | 869 unittests_outputs = [ unittests_binary ] |
870 native_libs = [unittests_outputs[0]] | 870 native_libs = [unittests_outputs[0]] |
871 if (defined(invoker.deps)) { | 871 if (defined(invoker.deps)) { |
872 deps = invoker.deps | 872 deps = invoker.deps |
873 } | 873 } |
| 874 datadeps = [ |
| 875 "//tools/android/md5sum", |
| 876 ] |
874 testonly = true | 877 testonly = true |
875 } | 878 } |
876 } | 879 } |
877 | 880 |
878 # Generate .java files from .aidl files. | 881 # Generate .java files from .aidl files. |
879 # | 882 # |
880 # This target will store the .java files in a srcjar and should be included in | 883 # This target will store the .java files in a srcjar and should be included in |
881 # an android_library or android_apk's srcjar_deps. | 884 # an android_library or android_apk's srcjar_deps. |
882 # | 885 # |
883 # Variables | 886 # Variables |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 "//build/android/gyp/find.py", | 940 "//build/android/gyp/find.py", |
938 rebase_path([invoker.import_include], root_build_dir), | 941 rebase_path([invoker.import_include], root_build_dir), |
939 "list lines" | 942 "list lines" |
940 ) | 943 ) |
941 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) | 944 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) |
942 inputs += _java_files | 945 inputs += _java_files |
943 } | 946 } |
944 args += rebase_path(sources, root_build_dir) | 947 args += rebase_path(sources, root_build_dir) |
945 } | 948 } |
946 } | 949 } |
| 950 |
| 951 # Creates a dist directory for a native executable. |
| 952 # |
| 953 # Running a native executable on a device requires all the shared library |
| 954 # dependencies of that executable. To make it easier to install and run such an |
| 955 # executable, this will create a directory containing the native exe and all |
| 956 # it's library dependencies. |
| 957 # |
| 958 # Note: It's usually better to package things as an APK than as a native |
| 959 # executable. |
| 960 # |
| 961 # Variables |
| 962 # dist_dir: Directory for the exe and libraries. Everything in this directory |
| 963 # will be deleted before copying in the exe and libraries. |
| 964 # binary: Path to (stripped) executable. |
| 965 # |
| 966 # Example |
| 967 # create_native_executable_dist("foo_dist") { |
| 968 # dist_dir = "$root_build_dir/foo_dist" |
| 969 # binary = "$root_build_dir/exe.stripped/foo" |
| 970 # } |
| 971 template("create_native_executable_dist") { |
| 972 dist_dir = invoker.dist_dir |
| 973 binary = invoker.binary |
| 974 final_deps = [] |
| 975 template_name = target_name |
| 976 |
| 977 libraries_list = "${target_gen_dir}/${template_name}_library_dependencies.list
" |
| 978 |
| 979 # TODO(gyp) |
| 980 #'dependencies': [ |
| 981 #'<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
| 982 #], |
| 983 |
| 984 stripped_libraries_dir = "$root_build_dir/lib.stripped" |
| 985 final_deps += [ ":${template_name}__find_library_dependencies" ] |
| 986 action("${template_name}__find_library_dependencies") { |
| 987 script = "//build/android/gyp/write_ordered_libraries.py" |
| 988 depfile = "$target_gen_dir/$target_name.d" |
| 989 inputs = [ |
| 990 binary, |
| 991 android_readelf, |
| 992 ] |
| 993 outputs = [ |
| 994 depfile, |
| 995 libraries_list, |
| 996 ] |
| 997 rebased_binaries = rebase_path([ binary ], root_build_dir) |
| 998 args = [ |
| 999 "--depfile", rebase_path(depfile, root_build_dir), |
| 1000 "--input-libraries=$rebased_binaries", |
| 1001 "--libraries-dir", rebase_path(stripped_libraries_dir, root_build_dir), |
| 1002 "--output", rebase_path(libraries_list, root_build_dir), |
| 1003 "--readelf", rebase_path(android_readelf, root_build_dir), |
| 1004 ] |
| 1005 } |
| 1006 |
| 1007 final_deps += [ ":${template_name}__copy_libraries_and_exe" ] |
| 1008 copy_ex("${template_name}__copy_libraries_and_exe") { |
| 1009 clear_dir = true |
| 1010 inputs = [ |
| 1011 binary, |
| 1012 libraries_list |
| 1013 ] |
| 1014 dest = dist_dir |
| 1015 rebased_binaries_list = rebase_path([ binary ], root_build_dir) |
| 1016 rebased_libraries_list = rebase_path(libraries_list, root_build_dir) |
| 1017 args = [ |
| 1018 "--files=$rebased_binaries_list", |
| 1019 "--files=@FileArg($rebased_libraries_list:libraries)", |
| 1020 ] |
| 1021 } |
| 1022 |
| 1023 group(target_name) { |
| 1024 deps = final_deps |
| 1025 } |
| 1026 } |
OLD | NEW |