Commit graph

8 commits

Author SHA1 Message Date
TreeHugger Robot
a59774eb49 Merge "soong config: add value_variable substitution" into rvc-dev 2020-04-11 17:24:57 +00:00
Sasha Smundak
227d5675c5 Make the names of 'soong_config_module_type_import' modules unique.
blueprint.writeAllModuleActions attemts to sort modules by name, and
sorting them assumes that each module's name is unique. Although
soong_config_module_type_import modules will not generate anything,
their names should be unique, too for that reason.

Fixes: 150421585
Test: m nothing
Change-Id: I6782e42c129dc3b0fc7649ce97d5f94effc63fa7
Merged-In: I6782e42c129dc3b0fc7649ce97d5f94effc63fa7
2020-04-10 13:54:07 -07:00
Dan Willemsen
ec8d490d58 soong config: add value_variable substitution
There are some cases that aren't handled with the existing variable
types for booleans or known lists of strings. Similarly to our
product_variables that uses %s / %d for things like
PLATFORM_SDK_VERSION, allow vendors to define their own config variables
to be substituted into properties.

For example, some of the makefiles that I've attempted to convert had
the option to pass in version numbers from the board, or the default
display size:

  -DDISPLAY_VERSION=550
  -DDISP_H=1080

These examples happen to be integers, but since our configuration
language (make) doesn't support numbers, %s works just as well.

This change will allow the above to be represented using:

  soong_config_module_type {
      name: "acme_cc_defaults",
      module_type: "cc_defaults",
      config_namespace: "acme",
      value_variables: [
          "DISPLAY_VERSION",
	  "DISP_H",
      ],
      properties: ["cflags"],
  }

  acme_cc_defaults {
      name: "my_defaults",
      soong_config_variables: {
          DISPLAY_VERSION: {
	      cflags: ["-DDISPLAY_VERSION=%s"],
	  },
	  DISP_H: {
	      cflags: ["-DDISP_H=%s"],
	  }
      },
  }

Bug: 153161144
Test: built-in tests
Change-Id: I18f35746b5cc39c304a136980249e886d38c6df6
Merged-In: I18f35746b5cc39c304a136980249e886d38c6df6
(cherry picked from commit b0935db8c3)
2020-04-09 13:30:38 -07:00
Dan Willemsen
1934adc077 soong_config: bool_variables shortcut
Using a lot of boolean variables can become very verbose without adding
really any new information:

      variables: ["a", "b", "c"],
  }

  soong_config_bool_variable {
      name: "a",
  }

  soong_config_bool_variable {
      name: "b",
  }

  soong_config_bool_variable {
      name: "c",
  }

Now turns into:

      bool_variables: ["a", "b", "c"],
  }

Bug: 153161144
Test: built-in tests
Change-Id: If5455a38433431c7ecbce1e5b32cfbb47f42602a
Merged-In: If5455a38433431c7ecbce1e5b32cfbb47f42602a
(cherry picked from commit 2b8b89cfa2)
2020-04-03 08:57:41 -07:00
Colin Cross
39e545cc06 Add dependency on Soong config module definition file
Add a dependency on the Soong config module definition file in case
it wasn't called Android.bp.

Fixes: 148866376
Test: m checkbuild
Change-Id: Ib441881bcee52fd1dc3a8d1c5ae4f5f0b7efe3ce
2020-02-06 19:35:49 +00:00
Bill Peckham
c93258bfec Minor cleanup in soong_config_modules documentation.
Test: build
Change-Id: Ia5a43a024203ca4b714926bcc89f7ec12523b8ad
2020-02-04 13:17:24 -08:00
Colin Cross
43e789d667 Follow input changes to proptools.CloneEmptyProperties
Test: m checkbuild
Change-Id: I1fd53d03722d134009f7ed663f05bd6dc5980dd1
2020-01-28 12:17:06 -08:00
Colin Cross
9d34f35815 Simplify vendor conditionals
Support vendor conditionals with no Go code.

Test: TestSoongConfigModule
Change-Id: I42546e7f17324921ada80f4d8e1cd399830f8dfc
2020-01-24 16:43:40 -08:00