Revert of Revert of Roll android_tools f6e2370:2a860d8 (patchset #1 id:1 of https...
[chromium-blink-merge.git] / remoting / app_remoting_webapp_build.gypi
blob9e739f74f8b20222cf7aa6760a65f79cc5c358cf
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
3 # found in the LICENSE file.
6   'includes': [
7     'remoting_version.gypi',
8     'remoting_locales.gypi',
9     'remoting_webapp_files.gypi',
10     'app_remoting_webapp_files.gypi',
11   ],
13   'variables': {
14     'chromium_code': 1,
16     'run_jscompile%': 0,
18     # The ar_service_environment variable is used to define the target
19     # environment for the app being built.
20     # The allowed values are dev, test, staging, and prod.
21     'conditions': [
22       ['buildtype == "Dev"', {
23         'ar_service_environment%': 'dev',
24       }, {  # buildtype != 'Dev'
25         # Non-dev build must have this set to 'prod'.
26         'ar_service_environment': 'prod',
27       }],
28     ],  # conditions
29   },  # end of variables
31   'target_defaults': {
32     'type': 'none',
34     'dependencies': [
35       # TODO(wez): Create proper resources for shared-stub and app-specific
36       # stubs.
37       '<(DEPTH)/remoting/remoting.gyp:remoting_resources',
38     ],
40     'locale_files': [
41       '<@(remoting_webapp_locale_files)',
42     ],
44     'includes': [
45       '../chrome/js_unittest_vars.gypi',
46     ],
48     'variables': {
49       'ar_app_manifest_app':
50         '>(ar_app_path)/manifest.json.jinja2',
51       'ar_app_manifest_common':
52         'webapp/app_remoting/manifest_common.json.jinja2',
53       'ar_app_specific_files': [
54         '>(ar_app_path)/icon16.png',
55         '>(ar_app_path)/icon48.png',
56         '>(ar_app_path)/icon128.png',
57       ],
58       'ar_generated_html_files': [
59         '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html',
60         '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html',
61       ],
62       'ar_webapp_files': [
63         '<@(ar_app_specific_files)',
64         '<@(ar_shared_resource_files)',
65         '<@(ar_all_js_files)',
66         '<@(ar_generated_html_files)',
67       ],
68       'output_dir': '<(PRODUCT_DIR)/app_streaming/<@(ar_service_environment)/>(_target_name)',
69       'zip_path': '<(PRODUCT_DIR)/app_streaming/<@(ar_service_environment)/>(_target_name).zip',
70       'remoting_app_id': [],
71       'remoting_app_name': '>(_app_name)',
72       'remoting_app_description': '>(_app_description)',
74       'ar_webapp_locales_listfile': '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)_locales.txt',
76       'conditions': [
77         ['ar_internal != 1', {
78           'ar_app_name': 'sample_app',
79           'ar_app_path': 'webapp/app_remoting/apps/>(ar_app_name)',
80         }, {
81           # This takes target names of the form 'ar_vvv_xxx_xxx' and extracts
82           # the vendor ('vvv') and the app name ('xxx_xxx').
83           'ar_app_vendor': '>!(python -c "import sys; print sys.argv[1].split(\'_\')[1]" >(_target_name))',
84           'ar_app_name': '>!(python -c "import sys; print \'_\'.join(sys.argv[1].split(\'_\')[2:])" >(_target_name))',
85           'ar_app_path': 'webapp/app_remoting/internal/apps/>(ar_app_vendor)/>(ar_app_name)',
86         }],
87       ],  # conditions
89     },  # variables
91     'actions': [
92       {
93         'action_name': 'Build ">(ar_app_name)" locales listfile',
94         'inputs': [
95           '<(remoting_localize_path)',
96         ],
97         'outputs': [
98           '<(ar_webapp_locales_listfile)',
99         ],
100         'action': [
101           'python', '<(remoting_localize_path)',
102           '--locale_output',
103           '"<(webapp_locale_dir)/@{json_suffix}/messages.json"',
104           '--locales_listfile',
105           '<(ar_webapp_locales_listfile)',
106           '<@(remoting_locales)',
107         ],
108       },
109       {
110         'action_name': 'Build ">(ar_app_name)" application stub',
111         'inputs': [
112           '<(DEPTH)/remoting/webapp/build-webapp.py',
113           '<(chrome_version_path)',
114           '<(remoting_version_path)',
115           '<@(ar_webapp_files)',
116           '<@(remoting_webapp_locale_files)',
117           '<@(ar_generated_html_files)',
118           '<(ar_app_manifest_app)',
119           '<(DEPTH)/remoting/<(ar_app_manifest_common)',
120           '<(ar_webapp_locales_listfile)',
121         ],
122         'outputs': [
123           '<(output_dir)',
124           '<(zip_path)',
125         ],
126         'action': [
127           'python', '<(DEPTH)/remoting/webapp/build-webapp.py',
128           '<(buildtype)',
129           '<(version_full)',
130           '<(output_dir)',
131           '<(zip_path)',
132           '<(ar_app_manifest_app)', # Manifest template
133           'app_remoting',  # Web app type
134           '<@(ar_webapp_files)',
135           '<@(ar_generated_html_files)',
136           '--locales_listfile',
137           '<(ar_webapp_locales_listfile)',
138           '--jinja_paths',
139           '<(DEPTH)/remoting/webapp/app_remoting',
140           '<@(remoting_app_id)',
141           '--app_name',
142           '<(remoting_app_name)',
143           '--app_description',
144           '<(remoting_app_description)',
145           '--app_capabilities',
146           '>@(_app_capabilities)',
147           '--service_environment',
148           '<@(ar_service_environment)',
149         ],
150       },
151       {
152         'action_name': 'Build ">(ar_app_name)" main.html',
153         'inputs': [
154           '<(DEPTH)/remoting/webapp/build-html.py',
155           '<(ar_main_template)',
156           '<@(ar_main_template_files)',
157         ],
158         'outputs': [
159           '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html',
160         ],
161         'action': [
162           'python', '<(DEPTH)/remoting/webapp/build-html.py',
163           '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html',
164           '<(ar_main_template)',
165           '--template-dir',
166           '<(DEPTH)/remoting',
167           '--templates',
168           '<@(ar_main_template_files)',
169           '--js',
170           '<@(ar_main_js_files)',
171         ],
172       },
173       {
174         'action_name': 'Build ">(ar_app_name)" wcs_sandbox.html',
175         'inputs': [
176           '<(DEPTH)/remoting/webapp/build-html.py',
177           '<(remoting_webapp_template_wcs_sandbox)',
178         ],
179         'outputs': [
180           '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html',
181         ],
182         'action': [
183           'python', '<(DEPTH)/remoting/webapp/build-html.py',
184           '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html',
185           '<(remoting_webapp_template_wcs_sandbox)',
186           '--template-dir',
187           '<(DEPTH)/remoting',
188           '--js',
189           '<@(remoting_webapp_wcs_sandbox_html_js_files)',
190         ],
191       },
192     ],  # actions
193     'conditions': [
194       ['buildtype == "Dev"', {
195         # Normally, the app-id for the orchestrator is automatically extracted
196         # from the webapp's extension id, but that approach doesn't work for
197         # dev webapp builds (since they all share the same dev extension id).
198         # The --appid arg will create a webapp that registers the given app-id
199         # rather than using the extension id.
200         # This is only done for Dev apps because the app-id for Release apps
201         # *must* match the extension id.
202         'variables': {
203           'remoting_app_id': ['--appid', '>(_app_id)'],
204         },
205       }],
206     ],  # conditions
207   },  # target_defaults