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

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

Issue 1993893002: 👾 GN(android): Filter R.class files before obfuscating via proguard (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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 596
597 _proguard_preprocess = 597 _proguard_preprocess =
598 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess 598 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess
599 _input_jar_path = invoker.input_jar_path 599 _input_jar_path = invoker.input_jar_path
600 _output_jar_path = invoker.output_jar_path 600 _output_jar_path = invoker.output_jar_path
601 601
602 _jar_excluded_patterns = [] 602 _jar_excluded_patterns = []
603 if (defined(invoker.jar_excluded_patterns)) { 603 if (defined(invoker.jar_excluded_patterns)) {
604 _jar_excluded_patterns = invoker.jar_excluded_patterns 604 _jar_excluded_patterns = invoker.jar_excluded_patterns
605 } 605 }
606
607 _strip_resource_classes = 606 _strip_resource_classes =
608 defined(invoker.strip_resource_classes) && invoker.strip_resource_classes 607 defined(invoker.strip_resource_classes) && invoker.strip_resource_classes
608 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes
609 609
610 if (_jar_excluded_patterns != [] || _strip_resource_classes) { 610 if (_filter_jar) {
611 _filter_class_files_input_file = _input_jar_path 611 _filter_target = "${target_name}__filter"
612 if (_proguard_preprocess) { 612 _output_jar_target = _filter_target
613 _filter_class_files_input_file = 613 }
614 "$target_out_dir/$target_name-proguarded.jar" 614 if (_proguard_preprocess) {
615 } 615 _proguard_target = "${target_name}__proguard_process"
616 _output_jar_target = _proguard_target
617 }
618 if (!_filter_jar && !_proguard_preprocess) {
619 _copy_target = "${target_name}__copy"
620 _output_jar_target = _copy_target
616 } 621 }
617 622
618 if (_proguard_preprocess) { 623 if (_filter_jar) {
619 _proguard_config_path = invoker.proguard_config 624 _filtered_jar_path = _output_jar_path
620 _proguard_target = "${target_name}__proguard_process" 625 if (_proguard_preprocess) {
621 proguard(_proguard_target) { 626 _filtered_jar_path = "$target_out_dir/$target_name-filtered.jar"
627 }
628 action(_filter_target) {
629 script = "//build/android/gyp/jar.py"
622 forward_variables_from(invoker, 630 forward_variables_from(invoker,
623 [ 631 [
624 "deps", 632 "deps",
625 "public_deps", 633 "public_deps",
626 ]) 634 ])
627 inputs = [ 635 inputs = [
628 _build_config, 636 _build_config,
629 _input_jar_path, 637 _input_jar_path,
638 ]
639 outputs = [
640 _filtered_jar_path,
641 ]
642 args = [
643 "--input-jar",
644 rebase_path(_input_jar_path, root_build_dir),
645 "--jar-path",
646 rebase_path(_filtered_jar_path, root_build_dir),
647 "--excluded-classes=$_jar_excluded_patterns",
648 ]
649 if (_strip_resource_classes) {
650 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_config: javac:resource_packages)" ]
651 }
652 }
653 }
654
655 if (_proguard_preprocess) {
656 _proguard_config_path = invoker.proguard_config
657 proguard(_proguard_target) {
658 if (_filter_jar) {
659 _proguard_input_jar = _filtered_jar_path
660 public_deps = [
661 ":$_filter_target",
662 ]
663 } else {
664 _proguard_input_jar = _input_jar_path
665 public_deps = []
666 }
667 if (defined(invoker.deps)) {
668 deps = invoker.deps
669 }
670 if (defined(invoker.public_deps)) {
671 public_deps += invoker.public_deps
672 }
673 inputs = [
674 _build_config,
630 _proguard_config_path, 675 _proguard_config_path,
676 _proguard_input_jar,
631 ] 677 ]
632 output_jar_path = _output_jar_path 678 output_jar_path = _output_jar_path
633 if (defined(_filter_class_files_input_file)) {
634 output_jar_path = _filter_class_files_input_file
635 }
636 679
637 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] 680 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ]
638 _rebased_proguard_configs = 681 _rebased_proguard_configs =
639 [ rebase_path(_proguard_config_path, root_build_dir) ] 682 [ rebase_path(_proguard_config_path, root_build_dir) ]
640 args = [ 683 args = [
641 "--input-paths=$_rebased_input_paths", 684 "--input-paths=$_rebased_input_paths",
642 "--proguard-configs=$_rebased_proguard_configs", 685 "--proguard-configs=$_rebased_proguard_configs",
643 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", 686 "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
644 ] 687 ]
645 } 688 }
646 } else if (_jar_excluded_patterns == [] && !_strip_resource_classes) { 689 } else if (!_filter_jar) {
647 _output_jar_target = "${target_name}__copy_jar" 690 copy(_copy_target) {
648 copy(_output_jar_target) {
649 forward_variables_from(invoker, 691 forward_variables_from(invoker,
650 [ 692 [
651 "deps", 693 "deps",
652 "public_deps", 694 "public_deps",
653 ]) 695 ])
654 sources = [ 696 sources = [
655 _input_jar_path, 697 _input_jar_path,
656 ] 698 ]
657 outputs = [ 699 outputs = [
658 _output_jar_path, 700 _output_jar_path,
659 ] 701 ]
660 } 702 }
661 } 703 }
662 704
663 if (_jar_excluded_patterns != [] || _strip_resource_classes) {
664 _output_jar_target = "${target_name}__filter"
665 action(_output_jar_target) {
666 script = "//build/android/gyp/jar.py"
667 if (_proguard_preprocess) {
668 deps = [
669 ":$_proguard_target",
670 ]
671 } else {
672 forward_variables_from(invoker,
673 [
674 "deps",
675 "public_deps",
676 ])
677 }
678 inputs = [
679 _filter_class_files_input_file,
680 ]
681 outputs = [
682 _output_jar_path,
683 ]
684 args = [
685 "--input-jar",
686 rebase_path(_filter_class_files_input_file, root_build_dir),
687 "--jar-path",
688 rebase_path(_output_jar_path, root_build_dir),
689 "--excluded-classes=$_jar_excluded_patterns",
690 ]
691 if (_strip_resource_classes) {
692 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_config: javac:resource_packages)" ]
693 }
694 }
695 } else if (_proguard_preprocess) {
696 _output_jar_target = _proguard_target
697 }
698
699 group(target_name) { 705 group(target_name) {
700 forward_variables_from(invoker, 706 forward_variables_from(invoker,
701 [ 707 [
702 "data_deps", 708 "data_deps",
703 "visibility", 709 "visibility",
704 ]) 710 ])
705 public_deps = [ 711 public_deps = [
706 ":$_output_jar_target", 712 ":$_output_jar_target",
707 ] 713 ]
708 } 714 }
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 build_config = _build_config 1614 build_config = _build_config
1609 input_jar_path = _javac_jar_path 1615 input_jar_path = _javac_jar_path
1610 output_jar_path = _process_prebuilt_jar_path 1616 output_jar_path = _process_prebuilt_jar_path
1611 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { 1617 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
1612 proguard_preprocess = invoker.proguard_preprocess 1618 proguard_preprocess = invoker.proguard_preprocess
1613 proguard_config = invoker.proguard_config 1619 proguard_config = invoker.proguard_config
1614 } 1620 }
1615 deps = [ 1621 deps = [
1616 ":$_javac_target_name", 1622 ":$_javac_target_name",
1617 ] 1623 ]
1624 if (defined(invoker.deps)) {
1625 deps += invoker.deps
1626 }
1618 } 1627 }
1619 1628
1620 emma_instr(_emma_instr_target_name) { 1629 emma_instr(_emma_instr_target_name) {
1621 visibility = [ 1630 visibility = [
1622 ":$_ijar_target_name", 1631 ":$_ijar_target_name",
1623 ":$_final_target_name", 1632 ":$_final_target_name",
1624 ] 1633 ]
1625 1634
1626 forward_variables_from(invoker, [ "emma_instrument" ]) 1635 forward_variables_from(invoker, [ "emma_instrument" ])
1627 1636
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 2321
2313 args = [ 2322 args = [
2314 "--depfile", 2323 "--depfile",
2315 rebase_path(depfile, root_build_dir), 2324 rebase_path(depfile, root_build_dir),
2316 "--script-output-path", 2325 "--script-output-path",
2317 rebase_path(generated_script, root_build_dir), 2326 rebase_path(generated_script, root_build_dir),
2318 ] 2327 ]
2319 args += test_runner_args 2328 args += test_runner_args
2320 } 2329 }
2321 } 2330 }
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