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

Unified Diff: build/android/gradle/generate_gradle.py

Issue 2621413002: Android: Split up build.gradle.jinja (Closed)
Patch Set: Rebase Created 3 years, 11 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
« no previous file with comments | « build/android/gradle/dependencies.jinja ('k') | build/android/gradle/java.jinja » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gradle/generate_gradle.py
diff --git a/build/android/gradle/generate_gradle.py b/build/android/gradle/generate_gradle.py
index d20ec41a380cd07161a8e9f657d29d6f0ac23d61..3c08114cfe43ddddd14f35c4908cab32690f1953 100755
--- a/build/android/gradle/generate_gradle.py
+++ b/build/android/gradle/generate_gradle.py
@@ -29,9 +29,7 @@ from util import build_utils
_DEFAULT_ANDROID_MANIFEST_PATH = os.path.join(
host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'AndroidManifest.xml')
-_JINJA_TEMPLATE_PATH = os.path.join(
- os.path.dirname(__file__), 'build.gradle.jinja')
-
+_FILE_DIR = os.path.dirname(__file__)
_JAVA_SUBDIR = 'symlinked-java'
_SRCJARS_SUBDIR = 'extracted-srcjars'
_JNI_LIBS_SUBDIR = 'symlinked-libs'
@@ -52,6 +50,11 @@ _DEFAULT_TARGETS = [
'//content/shell/android:content_shell_apk',
]
+
+def _TemplatePath(name):
+ return os.path.join(_FILE_DIR, '{}.jinja'.format(name))
+
+
def _RebasePath(path_or_list, new_cwd=None, old_cwd=None):
"""Makes the given path(s) relative to new_cwd, or absolute if not specified.
@@ -90,7 +93,7 @@ def _ReadBuildVars(output_dir):
def _RunNinja(output_dir, args):
- cmd = ['ninja', '-C', output_dir, '-j50']
+ cmd = ['ninja', '-C', output_dir, '-j1000']
cmd.extend(args)
logging.info('Running: %r', cmd)
subprocess.check_call(cmd)
@@ -329,13 +332,13 @@ def _GenerateGradleFile(build_config, build_vars, java_dirs, jni_libs,
for p in gradle['dependent_java_projects']]
variables['java_project_deps'] = [d.ProjectName() for d in deps]
- return jinja_processor.Render(_JINJA_TEMPLATE_PATH, variables)
+ return jinja_processor.Render(
+ _TemplatePath(target_type.split('_')[0]), variables)
def _GenerateRootGradle(jinja_processor):
"""Returns the data for the root project's build.gradle."""
- variables = {'template_type': 'root'}
- return jinja_processor.Render(_JINJA_TEMPLATE_PATH, variables)
+ return jinja_processor.Render(_TemplatePath('root'))
def _GenerateSettingsGradle(project_entries):
@@ -447,7 +450,7 @@ def main():
logging.info('Found %d dependent build_config targets.', len(all_entries))
logging.warning('Writing .gradle files...')
- jinja_processor = jinja_template.JinjaProcessor(host_paths.DIR_SOURCE_ROOT)
+ jinja_processor = jinja_template.JinjaProcessor(_FILE_DIR)
build_vars = _ReadBuildVars(output_dir)
project_entries = []
srcjar_tuples = []
« no previous file with comments | « build/android/gradle/dependencies.jinja ('k') | build/android/gradle/java.jinja » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698