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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 _WriteFile(output_file, data) | 290 _WriteFile(output_file, data) |
291 | 291 |
292 return output_file | 292 return output_file |
293 | 293 |
294 def _Relativize(self, entry, paths): | 294 def _Relativize(self, entry, paths): |
295 return _RebasePath(paths, self.EntryOutputDir(entry)) | 295 return _RebasePath(paths, self.EntryOutputDir(entry)) |
296 | 296 |
297 def _Srcjars(self, entry): | 297 def _Srcjars(self, entry): |
298 srcjars = _RebasePath(entry.Gradle().get('bundled_srcjars', [])) | 298 srcjars = _RebasePath(entry.Gradle().get('bundled_srcjars', [])) |
299 if not self.use_gradle_process_resources: | 299 if not self.use_gradle_process_resources: |
300 srcjars += _RebasePath(entry.BuildConfig()['javac']['srcjars']) | 300 srcjars += _RebasePath(entry.Javac()['srcjars']) |
| 301 srcjars += _RebasePath(entry.Gradle().get('srcjars')) |
301 return srcjars | 302 return srcjars |
302 | 303 |
303 def _GetEntries(self, entry): | 304 def _GetEntries(self, entry): |
304 if self.split_projects: | 305 if self.split_projects: |
305 return [entry] | 306 return [entry] |
306 return entry.AllEntries() | 307 return entry.AllEntries() |
307 | 308 |
308 def EntryOutputDir(self, entry): | 309 def EntryOutputDir(self, entry): |
309 return os.path.join(self.project_dir, entry.GradleSubdir()) | 310 return os.path.join(self.project_dir, entry.GradleSubdir()) |
310 | 311 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 _ExtractZips(generator.project_dir, zip_tuples) | 738 _ExtractZips(generator.project_dir, zip_tuples) |
738 | 739 |
739 logging.warning('Project created! (%d subprojects)', len(project_entries)) | 740 logging.warning('Project created! (%d subprojects)', len(project_entries)) |
740 logging.warning('Generated projects work best with Android Studio 2.2') | 741 logging.warning('Generated projects work best with Android Studio 2.2') |
741 logging.warning('For more tips: https://chromium.googlesource.com/chromium' | 742 logging.warning('For more tips: https://chromium.googlesource.com/chromium' |
742 '/src.git/+/master/docs/android_studio.md') | 743 '/src.git/+/master/docs/android_studio.md') |
743 | 744 |
744 | 745 |
745 if __name__ == '__main__': | 746 if __name__ == '__main__': |
746 main() | 747 main() |
OLD | NEW |