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

Unified Diff: build/java_binary.gypi

Issue 1057783002: Add new GN junit binary template and new GYP java binary template. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: build/java_binary.gypi
diff --git a/build/host_jar.gypi b/build/java_binary.gypi
similarity index 77%
copy from build/host_jar.gypi
copy to build/java_binary.gypi
index 6ccc1bdbad5a7635a6acb867aab474f8dae99966..e76168bc3772b35d341999333dfbded84af56862 100644
--- a/build/host_jar.gypi
+++ b/build/java_binary.gypi
@@ -1,13 +1,14 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2015 The Chromium Authors. All rights reserved.
jbudorick 2015/04/02 14:21:43 So this is in addition to build/host_jar.gypi? Do
mikecase (-- gone --) 2015/04/02 17:11:39 You're right. It looks like most of the things usi
# 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
-# a JAR file for use on a host in a consistent manner.
+# an executable from java code. The executable will be in the output folder's
+# /bin/ directory.
#
# To use this, create a gyp target with the following form:
# {
-# 'target_name': 'my_jar',
+# 'target_name': 'my_executable_jar',
# 'type': 'none',
# 'variables': {
# 'src_paths': [
@@ -16,6 +17,7 @@
# 'path/to/individual_file.java',
# ...
# ],
+# 'main_class': 'org.foo.FooMain',
# },
# 'includes': [ 'path/to/this/gypi/file' ],
# }
@@ -23,6 +25,8 @@
# Required variables:
# src_paths - A list of all paths containing java files that should be
# included in the jar. Paths can be either directories or files.
+# main_class - The class containing the main() function that should be called
+# when running the jar file.
# Optional/automatic variables:
# excluded_src_paths - A list of all paths that should be excluded from
# the jar.
@@ -30,8 +34,6 @@
# generated at build time.
# input_jars_paths - A list of paths to the jars that should be included
# in the classpath.
-# main_class - The class containing the main() function that should be called
-# when running the jar file.
# jar_excluded_classes - A list of .class files that should be excluded
# from the jar.
@@ -49,7 +51,6 @@
'jar_excluded_classes': [],
'jar_name': '<(_target_name).jar',
'jar_path': '<(jar_dir)/<(jar_name)',
- 'main_class%': '',
'stamp': '<(intermediate_dir)/jar.stamp',
},
'all_dependent_settings': {
@@ -71,9 +72,6 @@
['"<(jar_excluded_classes)" != ""', {
'extra_options': ['--excluded-classes=<(jar_excluded_classes)']
}],
- ['">(main_class)" != ""', {
- 'extra_options': ['--main-class=>(main_class)']
- }]
],
},
'inputs': [
@@ -97,6 +95,26 @@
'^@(java_sources)',
],
},
+ {
+ 'action_name': 'create_java_binary_script_<(_target_name)',
+ 'message': 'Creating java binary script <(_target_name)',
+ 'variables': {
+ 'output': '<(PRODUCT_DIR)/bin/<(_target_name)',
+ },
+ 'inputs': [
+ '<(DEPTH)/build/android/gyp/create_java_binary_script.py',
+ '<(jar_path)',
+ ],
+ 'outputs': [
+ '<(output)',
+ ],
+ 'action': [
+ 'python', '<(DEPTH)/build/android/gyp/create_java_binary_script.py',
+ '--classpath=>(input_jars_paths)',
+ '--jar-path=<(jar_path)',
+ '--output=<(output)',
+ '--main-class=>(main_class)',
+ ],
+ }
]
-}
-
+}

Powered by Google App Engine
This is Rietveld 408576698