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

Side by Side Diff: build/config/android/internal_rules.gni

Issue 2001573003: 💂 GN: Fix java_library() when supplied with a generated .java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/sanitizers/sanitizers.gni") 6 import("//build/config/sanitizers/sanitizers.gni")
7 import("//build/config/zip.gni") 7 import("//build/config/zip.gni")
8 import("//third_party/ijar/ijar.gni") 8 import("//third_party/ijar/ijar.gni")
9 9
10 assert(is_android) 10 assert(is_android)
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 } 1459 }
1460 1460
1461 # Compiles and jars a set of java files. 1461 # Compiles and jars a set of java files.
1462 # 1462 #
1463 # Outputs: 1463 # Outputs:
1464 # $jar_path.jar 1464 # $jar_path.jar
1465 # $jar_path.interface.jar 1465 # $jar_path.interface.jar
1466 # 1466 #
1467 # Variables 1467 # Variables
1468 # java_files: List of .java files to compile. 1468 # java_files: List of .java files to compile.
1469 # java_deps: List of java dependencies. These should all have a .jar output
1470 # at "${target_gen_dir}/${target_name}.jar.
1471 # chromium_code: If true, enable extra warnings. 1469 # chromium_code: If true, enable extra warnings.
1472 # srcjar_deps: List of srcjar dependencies. The .java files contained in the 1470 # srcjar_deps: List of srcjar dependencies. The .java files contained in the
1473 # dependencies srcjar outputs will be compiled and added to the output jar. 1471 # dependencies srcjar outputs will be compiled and added to the output jar.
1474 # jar_path: Use this to explicitly set the output jar path. Defaults to 1472 # jar_path: Use this to explicitly set the output jar path. Defaults to
1475 # "${target_gen_dir}/${target_name}.jar. 1473 # "${target_gen_dir}/${target_name}.jar.
1476 template("compile_java") { 1474 template("compile_java") {
1477 set_sources_assignment_filter([]) 1475 set_sources_assignment_filter([])
1478 forward_variables_from(invoker, [ "testonly" ]) 1476 forward_variables_from(invoker, [ "testonly" ])
1479 1477
1480 assert(defined(invoker.java_files)) 1478 assert(defined(invoker.java_files))
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 public_deps = [ 1654 public_deps = [
1657 ":$_emma_instr_target_name", 1655 ":$_emma_instr_target_name",
1658 ":$_ijar_target_name", 1656 ":$_ijar_target_name",
1659 ] 1657 ]
1660 } 1658 }
1661 } 1659 }
1662 1660
1663 template("java_library_impl") { 1661 template("java_library_impl") {
1664 set_sources_assignment_filter([]) 1662 set_sources_assignment_filter([])
1665 forward_variables_from(invoker, [ "testonly" ]) 1663 forward_variables_from(invoker, [ "testonly" ])
1664 _accumulated_deps = []
1665 if (defined(invoker.deps)) {
1666 _accumulated_deps = invoker.deps
1667 }
1666 1668
1667 assert(defined(invoker.java_files) || defined(invoker.srcjars) || 1669 assert(defined(invoker.java_files) || defined(invoker.srcjars) ||
1668 defined(invoker.srcjar_deps)) 1670 defined(invoker.srcjar_deps))
1669 _base_path = "$target_gen_dir/$target_name" 1671 _base_path = "$target_gen_dir/$target_name"
1670 1672
1671 # Jar files can be needed at runtime (by Robolectric tests or java binaries), 1673 # Jar files can be needed at runtime (by Robolectric tests or java binaries),
1672 # so do not put them under gen/. 1674 # so do not put them under gen/.
1673 _jar_name = target_name 1675 _jar_name = target_name
1674 if (defined(invoker.jar_name)) { 1676 if (defined(invoker.jar_name)) {
1675 _jar_name = invoker.jar_name 1677 _jar_name = invoker.jar_name
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 _dex_path = _base_path + ".dex.jar" 1721 _dex_path = _base_path + ".dex.jar"
1720 if (defined(invoker.dex_path)) { 1722 if (defined(invoker.dex_path)) {
1721 _dex_path = invoker.dex_path 1723 _dex_path = invoker.dex_path
1722 } 1724 }
1723 } 1725 }
1724 1726
1725 # Define build_config_deps which will be a list of targets required to 1727 # Define build_config_deps which will be a list of targets required to
1726 # build the _build_config. 1728 # build the _build_config.
1727 if (defined(invoker.override_build_config)) { 1729 if (defined(invoker.override_build_config)) {
1728 _build_config = invoker.override_build_config 1730 _build_config = invoker.override_build_config
1729
1730 # When a custom build config file is specified, we need to use the deps
1731 # supplied by the invoker any time we reference the build config file.
1732 assert(defined(invoker.deps),
1733 "If you specify a build config file for " +
1734 "java_library_impl($target_name), you should " +
1735 "also specify the target that made it in the deps")
1736 build_config_deps = invoker.deps
1737 } else { 1731 } else {
1738 _build_config = _base_path + ".build_config" 1732 _build_config = _base_path + ".build_config"
1739 build_config_target_name = "${_template_name}__build_config" 1733 build_config_target_name = "${_template_name}__build_config"
1740 build_config_deps = [ ":$build_config_target_name" ]
1741 1734
1742 write_build_config(build_config_target_name) { 1735 write_build_config(build_config_target_name) {
1743 forward_variables_from(invoker, [ "deps" ]) 1736 deps = _accumulated_deps
1744 if (defined(invoker.is_java_binary) && invoker.is_java_binary) { 1737 if (defined(invoker.is_java_binary) && invoker.is_java_binary) {
1745 type = "java_binary" 1738 type = "java_binary"
1746 } else { 1739 } else {
1747 type = "java_library" 1740 type = "java_library"
1748 } 1741 }
1749 supports_android = _supports_android 1742 supports_android = _supports_android
1750 requires_android = _requires_android 1743 requires_android = _requires_android
1751 bypass_platform_checks = defined(invoker.bypass_platform_checks) && 1744 bypass_platform_checks = defined(invoker.bypass_platform_checks) &&
1752 invoker.bypass_platform_checks 1745 invoker.bypass_platform_checks
1753 1746
1754 build_config = _build_config 1747 build_config = _build_config
1755 jar_path = _jar_path 1748 jar_path = _jar_path
1756 if (_supports_android) { 1749 if (_supports_android) {
1757 dex_path = _dex_path 1750 dex_path = _dex_path
1758 } 1751 }
1759 } 1752 }
1753 _accumulated_deps += [ ":$build_config_target_name" ]
1760 } 1754 }
1761 1755
1762 _srcjar_deps = [] 1756 _srcjar_deps = []
1763 if (defined(invoker.srcjar_deps)) { 1757 if (defined(invoker.srcjar_deps)) {
1764 _srcjar_deps = invoker.srcjar_deps 1758 _srcjar_deps = invoker.srcjar_deps
1765 } 1759 }
1766 1760
1767 _srcjars = [] 1761 _srcjars = []
1768 if (defined(invoker.srcjars)) { 1762 if (defined(invoker.srcjars)) {
1769 _srcjars = invoker.srcjars 1763 _srcjars = invoker.srcjars
(...skipping 21 matching lines...) Expand all
1791 "proguard_preprocess", 1785 "proguard_preprocess",
1792 ]) 1786 ])
1793 jar_path = _jar_path 1787 jar_path = _jar_path
1794 build_config = _build_config 1788 build_config = _build_config
1795 java_files = _java_files 1789 java_files = _java_files
1796 srcjar_deps = _srcjar_deps 1790 srcjar_deps = _srcjar_deps
1797 srcjars = _srcjars 1791 srcjars = _srcjars
1798 chromium_code = _chromium_code 1792 chromium_code = _chromium_code
1799 supports_android = _supports_android 1793 supports_android = _supports_android
1800 emma_instrument = _emma_instrument 1794 emma_instrument = _emma_instrument
1801 deps = build_config_deps 1795 deps = _accumulated_deps
1802 } 1796 }
1797 _accumulated_deps += [ ":$_compile_java_target" ]
1798 assert(_accumulated_deps != []) # Mark used.
1803 1799
1804 if (defined(invoker.main_class)) { 1800 if (defined(invoker.main_class)) {
1805 # Targets might use the generated script while building, so make it a dep 1801 # Targets might use the generated script while building, so make it a dep
1806 # rather than a data_dep. 1802 # rather than a data_dep.
1807 _final_deps += [ ":${_template_name}__java_binary_script" ] 1803 _final_deps += [ ":${_template_name}__java_binary_script" ]
1808 java_binary_script("${_template_name}__java_binary_script") { 1804 java_binary_script("${_template_name}__java_binary_script") {
1809 forward_variables_from(invoker, 1805 forward_variables_from(invoker,
1810 [ 1806 [
1811 "bootclasspath", 1807 "bootclasspath",
1812 "main_class", 1808 "main_class",
1813 "wrapper_script_args", 1809 "wrapper_script_args",
1814 ]) 1810 ])
1815 build_config = _build_config 1811 build_config = _build_config
1816 jar_path = _jar_path 1812 jar_path = _jar_path
1817 script_name = _template_name 1813 script_name = _template_name
1818 if (defined(invoker.wrapper_script_name)) { 1814 if (defined(invoker.wrapper_script_name)) {
1819 script_name = invoker.wrapper_script_name 1815 script_name = invoker.wrapper_script_name
1820 } 1816 }
1821 deps = build_config_deps 1817 deps = _accumulated_deps
1822 } 1818 }
1823 } 1819 }
1824 1820
1825 _has_lint_target = false 1821 _has_lint_target = false
1826 if (_supports_android) { 1822 if (_supports_android) {
1827 if (_chromium_code) { 1823 if (_chromium_code) {
1828 _has_lint_target = true 1824 _has_lint_target = true
1829 android_lint("${_template_name}__lint") { 1825 android_lint("${_template_name}__lint") {
1830 android_manifest = _android_manifest 1826 android_manifest = _android_manifest
1831 build_config = _build_config 1827 build_config = _build_config
1832 jar_path = _jar_path 1828 jar_path = _jar_path
1833 java_files = _java_files 1829 java_files = _java_files
1834 deps = build_config_deps + [ ":$_compile_java_target" ] 1830 deps = _accumulated_deps
1835 if (defined(invoker.deps)) {
1836 deps += invoker.deps
1837 }
1838 } 1831 }
1839 1832
1840 if (_run_findbugs) { 1833 if (_run_findbugs) {
1841 findbugs("${_template_name}__findbugs") { 1834 findbugs("${_template_name}__findbugs") {
1842 build_config = _build_config 1835 build_config = _build_config
1843 jar_path = _jar_path 1836 jar_path = _jar_path
1844 deps = build_config_deps + [ ":$_compile_java_target" ] 1837 deps = _accumulated_deps
1845 } 1838 }
1846 } 1839 }
1847 1840
1848 # Use an intermediate group() rather as the data_deps target in order to 1841 # Use an intermediate group() rather as the data_deps target in order to
1849 # avoid lint artifacts showing up as runtime_deps (while still having lint 1842 # avoid lint artifacts showing up as runtime_deps (while still having lint
1850 # run in parallel to other targets). 1843 # run in parallel to other targets).
1851 group("${_template_name}__analysis") { 1844 group("${_template_name}__analysis") {
1852 public_deps = [ 1845 public_deps = [
1853 ":${_template_name}__lint", 1846 ":${_template_name}__lint",
1854 ] 1847 ]
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 2314
2322 args = [ 2315 args = [
2323 "--depfile", 2316 "--depfile",
2324 rebase_path(depfile, root_build_dir), 2317 rebase_path(depfile, root_build_dir),
2325 "--script-output-path", 2318 "--script-output-path",
2326 rebase_path(generated_script, root_build_dir), 2319 rebase_path(generated_script, root_build_dir),
2327 ] 2320 ]
2328 args += test_runner_args 2321 args += test_runner_args
2329 } 2322 }
2330 } 2323 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698