Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: components/cronet/android/BUILD.gn

Issue 2347233002: Add src_files to src_jar GN template (Closed)
Patch Set: Added source_deps that packages sources from the deps .sources files. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/cronet/tools/jar_src.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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/buildflag_header.gni") 5 import("//build/buildflag_header.gni")
6 import("//build/config/android/config.gni") 6 import("//build/config/android/config.gni")
7 import("//build/config/android/rules.gni") 7 import("//build/config/android/rules.gni")
8 import("//build/util/version.gni") 8 import("//build/util/version.gni")
9 import("//chrome/version.gni") 9 import("//chrome/version.gni")
10 import("//testing/test.gni") 10 import("//testing/test.gni")
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 rebase_path(_output_jar, root_build_dir), 804 rebase_path(_output_jar, root_build_dir),
805 ] 805 ]
806 806
807 deps = [ 807 deps = [
808 ":extract_cronet_jars", 808 ":extract_cronet_jars",
809 ] 809 ]
810 } 810 }
811 811
812 template("jar_src") { 812 template("jar_src") {
813 action(target_name) { 813 action(target_name) {
814 _rebased_src_dirs = rebase_path(invoker.src_dirs, root_build_dir) 814 _rebased_src_search_dirs =
815 rebase_path(invoker.src_search_dirs, root_build_dir)
815 816
816 script = "//components/cronet/tools/jar_src.py" 817 script = "//components/cronet/tools/jar_src.py"
817 depfile = "$target_gen_dir/$target_name.d" 818 depfile = "$target_gen_dir/$target_name.d"
818 outputs = [ 819 outputs = [
819 invoker.jar_path, 820 invoker.jar_path,
820 ] 821 ]
821 args = [ 822 args = [
822 "--src-dir=${_rebased_src_dirs}", 823 "--src-search-dirs=${_rebased_src_search_dirs}",
823 "--jar-path", 824 "--jar-path",
824 rebase_path(invoker.jar_path, root_build_dir), 825 rebase_path(invoker.jar_path, root_build_dir),
825 "--depfile", 826 "--depfile",
826 rebase_path(depfile, root_build_dir), 827 rebase_path(depfile, root_build_dir),
827 ] 828 ]
828 829
830 deps = []
831 if (defined(invoker.deps)) {
832 deps += invoker.deps
833 }
834
835 _src_jars = []
836
837 # Add src jar files that explicitly listed in "src_jars".
829 if (defined(invoker.src_jars)) { 838 if (defined(invoker.src_jars)) {
830 inputs = invoker.src_jars 839 inputs = invoker.src_jars
831 _rebased_src_jars = rebase_path(invoker.src_jars, root_build_dir) 840 _rebased_src_jars = rebase_path(invoker.src_jars, root_build_dir)
832 args += [ "--src-jar=${_rebased_src_jars}" ] 841 _src_jars += _rebased_src_jars
833 } 842 }
834 deps = [ 843
835 ":effective_connection_type_java", 844 # Add src jars that are implicitly listed through "srcjar_deps".
836 ] 845 if (defined(invoker.srcjar_deps)) {
846 foreach(_srcjar_dep, invoker.srcjar_deps) {
847 _dep_gen_dir = get_label_info(_srcjar_dep, "target_gen_dir")
848 _dep_name = get_label_info(_srcjar_dep, "name")
849 _src_jars += rebase_path([ "$_dep_gen_dir/$_dep_name.srcjar" ])
850 deps += [ _srcjar_dep ]
851 }
852 }
853
854 # Create the list of all source files. These are files that are explicitly g iven in
855 # "src_files" and files that are implicitly found through "source_deps".
856 _src_files = []
857 if (defined(invoker.src_files)) {
858 _src_files += invoker.src_files
859 }
860
861 # Add source files referenced by "source_deps".
862 if (defined(invoker.source_deps)) {
863 foreach(_source_dep, invoker.source_deps) {
864 _sources = []
865 _dep_dir = get_label_info(_source_dep, "dir")
866 _dep_gen_dir = get_label_info(_source_dep, "target_gen_dir")
867 _dep_name = get_label_info(_source_dep, "name")
868 _source_file = "$_dep_gen_dir/$_dep_name.sources"
agrieve 2016/09/21 00:33:45 You should also add these files to the action's in
kapishnikov 2016/09/21 17:45:56 Done.
869 _sources = rebase_path(read_file(_source_file, "list lines"),
agrieve 2016/09/21 00:33:45 The bot is failing because GN makes no ordering gu
kapishnikov 2016/09/21 17:45:56 Done. Moved the ".sources" parsing to the python s
870 _dep_dir,
871 root_build_dir)
872 _src_files += _sources
873 }
874 }
875 args += [ "--src-jar=${_src_jars}" ]
876 args += [ "--src-files=${_src_files}" ]
837 } 877 }
838 } 878 }
839 879
840 jar_src("jar_cronet_api_source") { 880 jar_src("jar_cronet_api_source") {
841 src_dirs = [ "api/src" ] 881 src_search_dirs = [ "api/src" ]
842 882
843 # Include generated Java files which should be a part of the API. 883 # Include generated Java files which should be a part of the API.
844 src_jars = [ "$root_gen_dir/components/cronet/android/effective_connection_typ e_java.srcjar" ] 884 srcjar_deps = [ ":effective_connection_type_java" ]
885 source_deps = [ ":cronet_api" ]
845 jar_path = "$_package_dir/cronet_api-src.jar" 886 jar_path = "$_package_dir/cronet_api-src.jar"
846 } 887 }
847 888
848 jar_src("jar_cronet_sample_source") { 889 zip("jar_cronet_sample_source") {
849 src_dirs = [ "sample" ] 890 inputs = [
850 jar_path = "$_package_dir/cronet-sample-src.jar" 891 "sample/AndroidManifest.xml",
892 "sample/javatests/AndroidManifest.xml",
893 "sample/javatests/proguard.cfg",
894 "sample/javatests/src/org/chromium/cronet_sample_apk/Criteria.java",
895 "sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTest.java",
896 "sample/README",
897 "sample/res/layout/activity_main.xml",
898 "sample/res/layout/dialog_url.xml",
899 "sample/res/values/dimens.xml",
900 "sample/res/values/strings.xml",
901 "sample/src/org/chromium/cronet_sample_apk/CronetSampleActivity.java",
902 "sample/src/org/chromium/cronet_sample_apk/CronetSampleApplication.java",
903 ]
904 output = "$_package_dir/cronet-sample-src.jar"
905 base_dir = "sample"
851 } 906 }
852 907
853 jar_src("jar_cronet_other_source") { 908 jar_src("jar_cronet_other_source") {
854 src_dirs = [ 909 src_search_dirs = [
855 "//base/android/java/src", 910 "//base/android/java/src",
856 "//components/cronet/android/java/src", 911 "//components/cronet/android/java/src",
857 "//net/android/java/src", 912 "//net/android/java/src",
858 "//url/android/java/src", 913 "//url/android/java/src",
859 ] 914 ]
915 source_deps = [
916 ":cronet_java",
917 "//base:base_java",
918 "//net/android:net_java",
919 "//url:url_java",
920 ]
860 jar_path = "$_package_dir/cronet-src.jar" 921 jar_path = "$_package_dir/cronet-src.jar"
861 } 922 }
862 923
863 action("generate_licenses") { 924 action("generate_licenses") {
864 _license_path = "$_package_dir/LICENSE" 925 _license_path = "$_package_dir/LICENSE"
865 926
866 script = "//components/cronet/tools/cronet_licenses.py" 927 script = "//components/cronet/tools/cronet_licenses.py"
867 outputs = [ 928 outputs = [
868 _license_path, 929 _license_path,
869 ] 930 ]
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 ":jar_cronet_api_source", 1059 ":jar_cronet_api_source",
999 ":jar_cronet_other_source", 1060 ":jar_cronet_other_source",
1000 ":jar_cronet_sample_source", 1061 ":jar_cronet_sample_source",
1001 ":repackage_extracted_jars", 1062 ":repackage_extracted_jars",
1002 ] 1063 ]
1003 if (current_cpu == "arm" && arm_version == 7) { 1064 if (current_cpu == "arm" && arm_version == 7) {
1004 deps += [ ":enforce_no_neon" ] 1065 deps += [ ":enforce_no_neon" ]
1005 } 1066 }
1006 } 1067 }
1007 } 1068 }
OLDNEW
« no previous file with comments | « no previous file | components/cronet/tools/jar_src.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698