Chromium Code Reviews| Index: build/host_executable_jar.gypi |
| diff --git a/build/host_executable_jar.gypi b/build/host_executable_jar.gypi |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d1c8e4eba50cda26ce16d75f5f43ddc00de6db46 |
| --- /dev/null |
| +++ b/build/host_executable_jar.gypi |
| @@ -0,0 +1,155 @@ |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +# This file is meant to be included into a target to provide a rule to build |
| +# an executable .jar for use on a host in a consistent manner. |
| +# |
| +# To use this, create a gyp target with the following form: |
| +# { |
| +# 'target_name': 'my_jar', |
| +# 'type': 'none', |
| +# 'variables': { |
| +# 'main_class': 'my.package.MyMainClass', |
| +# 'src_paths': [ |
| +# 'path/to/directory', |
| +# 'path/to/other/directory', |
| +# 'path/to/individual_file.java', |
| +# ... |
| +# ], |
| +# }, |
| +# 'includes': [ 'path/to/this/gypi/file' ], |
| +# } |
| +# |
| +# Required variables: |
| +# main_class - The class containing the main() function that should be |
| +# called when running the .jar file. |
| +# src_paths - A list of all paths containing java files that should be |
| +# included in the jar. Paths can be either directories or files. |
| +# Optional/automatic variables: |
| +# excluded_src_paths - A list of all paths that should be excluded from |
| +# the jar. |
| +# generated_src_dirs - Directories containing additional .java files |
| +# generated at build time. |
| +# input_jars_paths - A list of paths to the jars that should be included |
| +# in the classpath. |
| +# jar_excluded_classes - A list of .class files that should be excluded |
| +# from the jar. |
| + |
| +{ |
| + 'dependencies': [ |
| + '<(DEPTH)/build/android/setup.gyp:build_output_dirs', |
| + ], |
| + 'variables': { |
| + 'classes_dir': '<(intermediate_dir)/classes', |
| + 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| + 'excluded_src_paths%': [], |
| + 'generated_src_dirs%': [], |
| + 'input_jars_paths%': [], |
| + 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', |
| + 'jar_dir': '<(PRODUCT_DIR)/lib.java', |
| + 'jar_excluded_classes%': [], |
| + 'jar_name': '<(_target_name).jar', |
| + 'jar_path': '<(jar_dir)/<(jar_name)', |
| + 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
| + 'manifest_path': '<(intermediate_dir)/<(_target_name).manifest', |
| + }, |
| + 'all_dependent_settings': { |
| + 'variables': { |
| + 'input_jars_paths': ['<(jar_path)'] |
| + }, |
| + }, |
| + 'actions': [ |
| + { |
| + 'action_name': 'javac_<(_target_name)', |
| + 'message': 'Compiling <(_target_name) java sources', |
| + 'variables': { |
| + 'java_sources': ['<!@(find <@(src_paths) -name "*.java")'], |
| + 'conditions': [ |
| + ['"<(excluded_src_paths)" != ""', { |
| + 'java_sources!': ['<!@(find <@(excluded_src_paths) -name "*.java")'] |
|
cjhopman
2014/09/15 22:27:36
This won't allow you to exclude sources in generat
jbudorick
2014/09/16 02:50:41
Hm, I hadn't thought of people trying to exclude t
|
| + }], |
| + ], |
| + }, |
| + 'inputs': [ |
| + '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| + '<(DEPTH)/build/android/gyp/javac.py', |
| + '^@(java_sources)', |
|
cjhopman
2014/09/15 22:27:37
Does this have to be '^' because of the 'java_sour
jbudorick
2014/09/16 02:50:41
Yep. Exclusion happens between PHASE_LATE (>) and
|
| + '>@(input_jars_paths)', |
| + ], |
| + 'outputs': [ |
| + '<(classes_dir)', |
| + '<(compile_stamp)', |
| + ], |
| + 'action': [ |
| + 'python', '<(DEPTH)/build/android/gyp/javac.py', |
| + '--classes-dir=<(classes_dir)', |
| + '--classpath=>(input_jars_paths)', |
| + '--src-gendirs=>(generated_src_dirs)', |
| + '--chromium-code=<(chromium_code)', |
| + '--stamp=<(compile_stamp)', |
| + '^@(java_sources)', |
| + ] |
| + }, |
| + { |
| + 'action_name': 'manifest_for_<(_target_name)', |
| + 'message': 'Creating manifest for <(_target_name) jar', |
| + 'variables': { |
| + 'extra_options': [ |
| + '--classpath=>@(input_jars_paths)', |
| + ], |
| + 'conditions': [ |
| + ['">(main_class)" != ""', { |
| + 'extra_options': ['--main-class=>(main_class)'] |
| + }], |
| + ], |
| + }, |
| + 'inputs':[ |
| + '<(compile_stamp)', |
| + '>@(input_jars_paths)', |
| + '<(DEPTH)/build/android/gyp/manifest.py', |
| + ], |
| + 'outputs': [ |
| + '<(manifest_path)', |
| + ], |
| + 'action': [ |
| + 'python', '<(DEPTH)/build/android/gyp/manifest.py', |
| + '<@(extra_options)', |
| + '--output-file=<(manifest_path)', |
| + ], |
| + }, |
| + { |
| + 'action_name': 'jar_<(_target_name)', |
| + 'message': 'Creating <(_target_name) jar', |
| + 'variables': { |
| + 'extra_options': [], |
| + 'conditions': [ |
| + ['"<(jar_excluded_classes)" != ""', { |
| + 'extra_options': ['--excluded-classes=<(jar_excluded_classes)'] |
| + }], |
| + ], |
| + }, |
| + 'inputs': [ |
| + '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| + '<(DEPTH)/build/android/gyp/util/md5_check.py', |
| + '<(DEPTH)/build/android/gyp/jar.py', |
| + '<(compile_stamp)', |
| + '<(manifest_path)', |
| + '<(classes_dir)', |
| + ], |
| + 'outputs': [ |
| + '<(jar_path)', |
| + '<(jar_stamp)' |
| + ], |
| + 'action': [ |
| + 'python', '<(DEPTH)/build/android/gyp/jar.py', |
| + '--classes-dir=<(classes_dir)', |
| + '--jar-path=<(jar_path)', |
| + '--manifest-file=<(manifest_path)', |
| + '--stamp=<(jar_stamp)', |
| + '<@(extra_options)' |
| + ], |
| + }, |
| + ] |
| +} |
| + |