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

Side by Side Diff: build/java_apk.gypi

Issue 20210002: [Android] Sets up a coverage system for java using EMMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Gets code coverage for non-apk java working Created 7 years, 4 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
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 # This file is meant to be included into a target to provide a rule 5 # This file is meant to be included into a target to provide a rule
6 # to build Android APKs in a consistent manner. 6 # to build Android APKs in a consistent manner.
7 # 7 #
8 # To use this, create a gyp target with the following form: 8 # To use this, create a gyp target with the following form:
9 # { 9 # {
10 # 'target_name': 'my_package_apk', 10 # 'target_name': 'my_package_apk',
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 'compile_stamp': '<(intermediate_dir)/compile.stamp', 89 'compile_stamp': '<(intermediate_dir)/compile.stamp',
90 'jar_stamp': '<(intermediate_dir)/jar.stamp', 90 'jar_stamp': '<(intermediate_dir)/jar.stamp',
91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', 91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
92 'strip_stamp': '<(intermediate_dir)/strip.stamp', 92 'strip_stamp': '<(intermediate_dir)/strip.stamp',
93 'classes_dir': '<(intermediate_dir)/classes', 93 'classes_dir': '<(intermediate_dir)/classes',
94 'javac_includes': [], 94 'javac_includes': [],
95 'jar_excluded_classes': [], 95 'jar_excluded_classes': [],
96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', 96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', 97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
98 'dex_path': '<(intermediate_dir)/classes.dex', 98 'dex_path': '<(intermediate_dir)/classes.dex',
99 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
frankf 2013/08/01 19:57:41 This is defined in bunch of places. Is there a way
gkanwar1 2013/08/07 19:24:56 Unfortunately I don't think there's a simple way t
99 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', 100 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
100 'push_stamp': '<(intermediate_dir)/push.stamp', 101 'push_stamp': '<(intermediate_dir)/push.stamp',
101 'link_stamp': '<(intermediate_dir)/link.stamp', 102 'link_stamp': '<(intermediate_dir)/link.stamp',
102 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', 103 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp',
103 'codegen_input_paths': [], 104 'codegen_input_paths': [],
104 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', 105 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
105 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', 106 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
106 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', 107 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
107 'source_dir': '<(java_in_dir)/src', 108 'source_dir': '<(java_in_dir)/src',
108 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', 109 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
(...skipping 14 matching lines...) Expand all
123 ['gyp_managed_install == 1', { 124 ['gyp_managed_install == 1', {
124 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', 125 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
125 }, { 126 }, {
126 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', 127 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
127 }], 128 }],
128 ], 129 ],
129 }, 130 },
130 'native_lib_target%': '', 131 'native_lib_target%': '',
131 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', 132 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
132 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', 133 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
134 'conditions': [
135 ['emma_instrument != 0', {
136 'classes_final_dir': '<(intermediate_dir)/classes_instr',
137 }, {
138 'classes_final_dir': '<(intermediate_dir)/classes',
139 }]
140 ]
133 }, 141 },
134 # Pass the jar path to the apk's "fake" jar target. This would be better as 142 # Pass the jar path to the apk's "fake" jar target. This would be better as
135 # direct_dependent_settings, but a variable set by a direct_dependent_settings 143 # direct_dependent_settings, but a variable set by a direct_dependent_settings
136 # cannot be lifted in a dependent to all_dependent_settings. 144 # cannot be lifted in a dependent to all_dependent_settings.
137 'all_dependent_settings': { 145 'all_dependent_settings': {
138 'variables': { 146 'variables': {
139 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', 147 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
140 }, 148 },
141 }, 149 },
142 'conditions': [ 150 'conditions': [
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 'action': [ 373 'action': [
366 'python', '<(DEPTH)/build/android/gyp/apk_install.py', 374 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
367 '--android-sdk-tools=<(android_sdk_tools)', 375 '--android-sdk-tools=<(android_sdk_tools)',
368 '--apk-path=<(incomplete_apk_path)', 376 '--apk-path=<(incomplete_apk_path)',
369 '--build-device-configuration=<(build_device_config_path)', 377 '--build-device-configuration=<(build_device_config_path)',
370 '--install-record=<(apk_install_record)', 378 '--install-record=<(apk_install_record)',
371 ], 379 ],
372 }, 380 },
373 ], 381 ],
374 }], 382 }],
383 ['emma_instrument != 0', {
384 'actions': [
385 {
386 'action_name': 'emma_instr_<(_target_name)',
387 'message': 'Instrumenting <(_target_name) classes',
388 'inputs': [
389 '<(compile_stamp)',
390 '<(DEPTH)/build/android/ant/apk-instr.xml',
391 '<(DEPTH)/build/android/gyp/ant.py',
392 '<(DEPTH)/build/android/gyp/util/build_utils.py',
393 ],
394 'outputs': [
395 '<(intermediate_dir)/coverage.em',
396 '<(classes_final_dir)',
397 ],
398 'action': [
399 'python', '<(DEPTH)/build/android/gyp/ant.py',
400 '-DCLASSES_DIR=<(classes_dir)',
401 '-DCLASSES_FINAL_DIR=<(classes_final_dir)',
402 '-DEMMA_COVERAGE_FILE=<(intermediate_dir)/coverage.em',
403 '-DEMMA_SOURCES_FILE=<(intermediate_dir)/emma_sources.txt',
404 '-DJAVA_SRC=<(java_in_dir)/src',
405 '-DADDITIONAL_SRC=>(additional_src_dirs)',
406 '-DGENERATED_SRC=>(generated_src_dirs)',
407 '-DANDROID_SDK_ROOT=<(android_sdk_root)',
408 '-Dbasedir=.',
409 '-buildfile',
410 '<(DEPTH)/build/android/ant/apk-instr.xml',
411 'instr-classes',
412 ]
413 },
414 ],
415 }],
375 ], 416 ],
376 'actions': [ 417 'actions': [
377 { 418 {
378 'action_name': 'ant_codegen_<(_target_name)', 419 'action_name': 'ant_codegen_<(_target_name)',
379 'message': 'Generating R.java for <(_target_name)', 420 'message': 'Generating R.java for <(_target_name)',
380 'conditions': [ 421 'conditions': [
381 ['is_test_apk == 1', { 422 ['is_test_apk == 1', {
382 'variables': { 423 'variables': {
383 'additional_res_dirs=': [], 424 'additional_res_dirs=': [],
384 'additional_res_packages=': [], 425 'additional_res_packages=': [],
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 '--chromium-code=<(chromium_code)', 497 '--chromium-code=<(chromium_code)',
457 '--stamp=<(compile_stamp)', 498 '--stamp=<(compile_stamp)',
458 499
459 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . 500 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja .
460 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', 501 '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
461 ], 502 ],
462 }, 503 },
463 { 504 {
464 'action_name': 'jar_<(_target_name)', 505 'action_name': 'jar_<(_target_name)',
465 'message': 'Creating <(_target_name) jar', 506 'message': 'Creating <(_target_name) jar',
507 'conditions': [
508 ['emma_instrument != 0', {
509 'inputs': [ '<(intermediate_dir)/coverage.em', ]
510 }, {
511 'inputs': [ '<(compile_stamp)' ]
512 }]
513 ],
466 'inputs': [ 514 'inputs': [
467 '<(DEPTH)/build/android/gyp/util/build_utils.py', 515 '<(DEPTH)/build/android/gyp/util/build_utils.py',
468 '<(DEPTH)/build/android/gyp/util/md5_check.py', 516 '<(DEPTH)/build/android/gyp/util/md5_check.py',
469 '<(DEPTH)/build/android/gyp/jar.py', 517 '<(DEPTH)/build/android/gyp/jar.py',
470 '<(compile_stamp)',
471 ], 518 ],
472 'outputs': [ 519 'outputs': [
473 '<(jar_stamp)', 520 '<(jar_stamp)',
474 ], 521 ],
475 'action': [ 522 'action': [
476 'python', '<(DEPTH)/build/android/gyp/jar.py', 523 'python', '<(DEPTH)/build/android/gyp/jar.py',
477 '--classes-dir=<(classes_dir)', 524 '--classes-dir=<(classes_final_dir)',
478 '--jar-path=<(jar_path)', 525 '--jar-path=<(jar_path)',
479 '--excluded-classes=<(jar_excluded_classes)', 526 '--excluded-classes=<(jar_excluded_classes)',
480 '--stamp=<(jar_stamp)', 527 '--stamp=<(jar_stamp)',
481 528
482 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . 529 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja .
483 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', 530 '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
484 ] 531 ]
485 }, 532 },
486 { 533 {
487 'action_name': 'ant_obfuscate_<(_target_name)', 534 'action_name': 'ant_obfuscate_<(_target_name)',
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 ], 576 ],
530 }, 577 },
531 { 578 {
532 'action_name': 'dex_<(_target_name)', 579 'action_name': 'dex_<(_target_name)',
533 'variables': { 580 'variables': {
534 'conditions': [ 581 'conditions': [
535 ['proguard_enabled == "true"', { 582 ['proguard_enabled == "true"', {
536 'input_paths': [ '<(obfuscate_stamp)' ], 583 'input_paths': [ '<(obfuscate_stamp)' ],
537 'proguard_enabled_input_path': '<(obfuscated_jar_path)', 584 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
538 }], 585 }],
586 ['emma_instrument != 0', {
587 'dex_input_paths': [ '<(emma_device_jar)' ],
588 'input_paths': [ '<(intermediate_dir)/coverage.em' ],
589 }, {
590 'input_paths': [ '<(compile_stamp)' ]
591 }],
539 ], 592 ],
540 'input_paths': [ '<(compile_stamp)' ],
541 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], 593 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ],
542 'dex_generated_input_dirs': [ '<(classes_dir)' ], 594 'dex_generated_input_dirs': [ '<(classes_final_dir)' ],
543 'output_path': '<(dex_path)', 595 'output_path': '<(dex_path)',
544 }, 596 },
545 'includes': [ 'android/dex_action.gypi' ], 597 'includes': [ 'android/dex_action.gypi' ],
546 }, 598 },
547 { 599 {
548 'action_name': 'ant package resources', 600 'action_name': 'ant package resources',
549 'message': 'Packaging resources for <(_target_name) APK.', 601 'message': 'Packaging resources for <(_target_name) APK.',
550 'inputs': [ 602 'inputs': [
551 '<(DEPTH)/build/android/ant/apk-package-resources.xml', 603 '<(DEPTH)/build/android/ant/apk-package-resources.xml',
552 '<(DEPTH)/build/android/gyp/util/build_utils.py', 604 '<(DEPTH)/build/android/gyp/util/build_utils.py',
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 'action': [ 667 'action': [
616 'python', '<(DEPTH)/build/android/gyp/ant.py', 668 'python', '<(DEPTH)/build/android/gyp/ant.py',
617 '-quiet', 669 '-quiet',
618 '-DANDROID_SDK_ROOT=<(android_sdk_root)', 670 '-DANDROID_SDK_ROOT=<(android_sdk_root)',
619 '-DAPK_NAME=<(apk_name)', 671 '-DAPK_NAME=<(apk_name)',
620 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', 672 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
621 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', 673 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)',
622 '-DOUT_DIR=<(intermediate_dir)', 674 '-DOUT_DIR=<(intermediate_dir)',
623 '-DSOURCE_DIR=<(source_dir)', 675 '-DSOURCE_DIR=<(source_dir)',
624 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', 676 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)',
677 '-DEMMA_INSTRUMENT=<(emma_instrument)',
625 678
626 '-Dbasedir=.', 679 '-Dbasedir=.',
627 '-buildfile', 680 '-buildfile',
628 '<(DEPTH)/build/android/ant/apk-package.xml', 681 '<(DEPTH)/build/android/ant/apk-package.xml',
629 682
630 # Add list of inputs to the command line, so if inputs change 683 # Add list of inputs to the command line, so if inputs change
631 # (e.g. if a Java file is removed), the command will be re-run. 684 # (e.g. if a Java file is removed), the command will be re-run.
632 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. 685 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
633 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', 686 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
634 ] 687 ]
635 }, 688 },
636 ], 689 ],
637 } 690 }
OLDNEW
« build/android/test_runner.py ('K') | « build/java.gypi ('k') | content/content.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698