Skip to content
  • Dan Willemsen's avatar
    soong config: add value_variable substitution · ec8d490d
    Dan Willemsen authored
    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 b0935db8)
    ec8d490d
Loading