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

Unified Diff: infra/bots/recipe_modules/skia/pdfium_flavor.py

Issue 2175373002: Move Skia recipes from build repo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address more comments Created 4 years, 5 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: infra/bots/recipe_modules/skia/pdfium_flavor.py
diff --git a/infra/bots/recipe_modules/skia/pdfium_flavor.py b/infra/bots/recipe_modules/skia/pdfium_flavor.py
new file mode 100644
index 0000000000000000000000000000000000000000..782daf0487a26d159b1f789331e8f4f486d83179
--- /dev/null
+++ b/infra/bots/recipe_modules/skia/pdfium_flavor.py
@@ -0,0 +1,64 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import re
+
+import default_flavor
+
+
+"""PDFium flavor utils, used for building PDFium with Skia."""
+
+
+class PDFiumFlavorUtils(default_flavor.DefaultFlavorUtils):
+
+ def compile(self, target):
+ """Build PDFium with Skia."""
+ pdfium_dir = self._skia_api.checkout_root.join('pdfium')
+
+ # Runhook to generate the gn binary in buildtools.
+ self._skia_api.run(
+ self._skia_api.m.step,
+ 'runhook',
+ cmd=['gclient', 'runhook', 'gn_linux64'],
+ cwd=pdfium_dir)
+
+ # Setup gn args.
+ gn_args = ['pdf_use_skia=true', 'pdf_is_standalone=true',
+ 'clang_use_chrome_plugins=false']
+ self._skia_api.run(
+ self._skia_api.m.step,
+ 'gn_gen',
+ cmd=['gn', 'gen', 'out/skia', '--args=%s' % ' '.join(gn_args)],
+ cwd=pdfium_dir,
+ env={'CHROMIUM_BUILDTOOLS_PATH': str(pdfium_dir.join('buildtools'))})
+
+ # Modify DEPS file to contain the current Skia revision.
+ skia_revision = self._skia_api.got_revision
+ deps_file = pdfium_dir.join('DEPS')
+ test_data = "'skia_revision': 'abc'"
+
+ original_contents = self._skia_api.m.file.read(
+ 'read PDFium DEPS', deps_file, test_data=test_data, infra_step=True)
+
+ deps_skia_regexp = re.compile(
+ r'(?<=["\']skia_revision["\']: ["\'])([a-fA-F0-9]+)(?=["\'])',
+ re.MULTILINE)
+ patched_contents = re.sub(deps_skia_regexp, str(skia_revision),
+ original_contents)
+ self._skia_api.m.file.write('write PDFium DEPs', deps_file,
+ patched_contents, infra_step=True)
+
+ # gclient sync after updating DEPS.
+ self._skia_api.run(
+ self._skia_api.m.step,
+ 'sync_pdfium',
+ cmd=['gclient', 'sync'],
+ cwd=pdfium_dir)
+
+ # Build PDFium.
+ self._skia_api.run(
+ self._skia_api.m.step,
+ 'build_pdfium',
+ cmd=['ninja', '-C', 'out/skia', '-j100'],
+ cwd=pdfium_dir)
« no previous file with comments | « infra/bots/recipe_modules/skia/ios_flavor.py ('k') | infra/bots/recipe_modules/skia/resources/binary_size_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698