conditional includes in DEPS

325 views
Skip to first unread message

Johann Koenig

unread,
Oct 26, 2017, 3:40:18 PM10/26/17
to Chromium-dev
I would like to add an entry to DEPS which requires a .gclient entry to checkout.

I tried formatting it like so:
  'src/third_party/libaom/source/libaom': {
    'url': Var('aomedia_git') + '/aom.git' + '@' +  'd9f2286e4c0bbb0fee5719d151653247939c3847',
    'condition': 'enable_libaom == "yes"',
  },


but setting
  "enable_libaom": "yes",

in .gclient did not work. I see a bunch of other things depending on "checkout_<platform>" or "host_os == <os>"

How do these get set? Ideally I want to use the same condition statement in .gn files.

Dirk Pranke

unread,
Oct 27, 2017, 7:23:09 PM10/27/17
to Johann Koenig, Chromium-dev
I think you've worked this out, but in case you haven't, let me know off-list. I can/will reply back to this thread with the conclusion.

-- Dirk

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAE%3DFoMTojTXte18rorj9_zgbw%2BCMA342egxqq2n-J1v1Y3nMVw%40mail.gmail.com.

Johann Koenig

unread,
Nov 9, 2017, 4:56:28 PM11/9/17
to Dirk Pranke, Chromium-dev
On Fri, Oct 27, 2017 at 4:21 PM Dirk Pranke wrote: > I think you've worked this out, but in case you haven't, let me know off-list. I can/will reply back to this thread with the conclusion. checkout_libaom (it got renamed) needed to go in .gclient:custom_vars: solutions = [ { "url": "https://chromium.googlesource.com/chromium/src.git", "managed": False, "name": "src", "deps_file": ".DEPS.git", "custom_vars": { "checkout_libaom": True, }, }, ] Adding it to DEPS:gclient_gn_args puts it in src/build/config/gclient_args.gni: gclient_gn_args = [ 'checkout_libaom', 'checkout_nacl', ] gclient_args.gni: # Generated from '.DEPS.git' checkout_libaom = true checkout_nacl = true Which can then be imported into third_party/libaom/options.gni to automatically set a gn arg: import("//build/config/gclient_args.gni") declare_args() { enable_av1_decoder = checkout_libaom } And a flag is defined in third_party/libaom/BUILD.gn to create av1_features.h: buildflag_header("av1_features") { header = "av1_features.h" flags = [ "ENABLE_AV1_DECODER=$enable_av1_decoder", ] } Which can be depended on by a downstream consumer: deps += [ "//third_party/libaom", "//third_party/libaom:av1_features", ] and used to turn things on: #include "third_party/libaom/av1_features.h" #if BUILDFLAG(ENABLE_AV1_DECODER) #endif > On Thu, Oct 26, 2017 at 12:38 PM, 'Johann Koenig' via Chromium-dev wrote: >> I would like to add an entry to DEPS which requires a .gclient entry to checkout. >> >> I tried formatting it like so: >> 'src/third_party/libaom/source/libaom': { >> 'url': Var('aomedia_git') + '/aom.git' + '@' + 'd9f2286e4c0bbb0fee5719d151653247939c3847', >> 'condition': 'enable_libaom == "yes"', >> }, >> >> >> but setting >> "enable_libaom": "yes", >> >> in .gclient did not work. I see a bunch of other things depending on "checkout_" or "host_os == " >> >> How do these get set? Ideally I want to use the same condition statement in .gn files.

Johann Koenig

unread,
Nov 10, 2017, 12:54:33 PM11/10/17
to Dirk Pranke, Chromium-dev
Apologies for the formatting.

On Fri, Oct 27, 2017 at 4:21 PM Dirk Pranke <dpr...@chromium.org> wrote:
I think you've worked this out, but in case you haven't, let me know off-list. I can/will reply back to this thread with the conclusion.

checkout_libaom (it got renamed) needed to go in .gclient:custom_vars:
solutions = [
  {
    "managed": False,
    "name": "src",
    "deps_file": ".DEPS.git",
    "custom_vars": {
      "checkout_libaom": True,
    },
  },
]

Adding it to DEPS:gclient_gn_args puts it in src/build/config/gclient_args.gni:
gclient_gn_args = [
  'checkout_libaom',
  'checkout_nacl',
]

gclient_args.gni:
# Generated from '.DEPS.git'
checkout_libaom = true
checkout_nacl = true

Which can then be imported into third_party/libaom/options.gni to automatically set a gn arg:
import("//build/config/gclient_args.gni")
declare_args() {
  # Enable decoding AV1 video files.
  enable_av1_decoder = checkout_libaom
}
Reply all
Reply to author
Forward
0 new messages