OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Generates an Android Studio project from a GN target.""" | 6 """Generates an Android Studio project from a GN target.""" |
7 | 7 |
8 import argparse | 8 import argparse |
9 import codecs | 9 import codecs |
10 import glob | 10 import glob |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 jinja_processor, split_projects): | 242 jinja_processor, split_projects): |
243 self.project_dir = project_dir | 243 self.project_dir = project_dir |
244 self.build_vars = build_vars | 244 self.build_vars = build_vars |
245 self.use_gradle_process_resources = use_gradle_process_resources | 245 self.use_gradle_process_resources = use_gradle_process_resources |
246 self.jinja_processor = jinja_processor | 246 self.jinja_processor = jinja_processor |
247 self.split_projects = split_projects | 247 self.split_projects = split_projects |
248 | 248 |
249 def _GenJniLibs(self, root_entry): | 249 def _GenJniLibs(self, root_entry): |
250 libraries = [] | 250 libraries = [] |
251 for entry in self._GetEntries(root_entry): | 251 for entry in self._GetEntries(root_entry): |
252 libraries += entry.BuildConfig().get('native', []) | 252 libraries += entry.BuildConfig().get('native', {}).get('libraries', []) |
253 if libraries: | 253 if libraries: |
254 return _CreateJniLibsDir(constants.GetOutDirectory(), | 254 return _CreateJniLibsDir(constants.GetOutDirectory(), |
255 self.EntryOutputDir(root_entry), libraries) | 255 self.EntryOutputDir(root_entry), libraries) |
256 return [] | 256 return [] |
257 | 257 |
258 def _GenJavaDirs(self, root_entry): | 258 def _GenJavaDirs(self, root_entry): |
259 java_files = [] | 259 java_files = [] |
260 for entry in self._GetEntries(root_entry): | 260 for entry in self._GetEntries(root_entry): |
261 java_files += entry.JavaFiles() | 261 java_files += entry.JavaFiles() |
262 java_dirs, excludes = _ComputeJavaSourceDirsAndExcludes( | 262 java_dirs, excludes = _ComputeJavaSourceDirsAndExcludes( |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 _ExtractZips(generator.project_dir, zip_tuples) | 737 _ExtractZips(generator.project_dir, zip_tuples) |
738 | 738 |
739 logging.warning('Project created! (%d subprojects)', len(project_entries)) | 739 logging.warning('Project created! (%d subprojects)', len(project_entries)) |
740 logging.warning('Generated projects work best with Android Studio 2.2') | 740 logging.warning('Generated projects work best with Android Studio 2.2') |
741 logging.warning('For more tips: https://chromium.googlesource.com/chromium' | 741 logging.warning('For more tips: https://chromium.googlesource.com/chromium' |
742 '/src.git/+/master/docs/android_studio.md') | 742 '/src.git/+/master/docs/android_studio.md') |
743 | 743 |
744 | 744 |
745 if __name__ == '__main__': | 745 if __name__ == '__main__': |
746 main() | 746 main() |
OLD | NEW |