Commit graph

21 commits

Author SHA1 Message Date
Zi Wang
fe152e302a Update TestNonExistentPropertyInSoongConfigModule
with new expected error message that reflects the real unrecognized
property

Test: TestNonExistentPropertyInSoongConfigModule and CI

Bug: 171232169
Change-Id: I5af8e62b12a80c4891d7f3b57bbf4be456b2a798
2023-10-30 14:42:44 -07:00
Inseob Kim
81b00a8db7 Use hashed subdir for soong_config modules
This is to differentiate soong intermediate directories for soong config
modules. This will help incremental build across different
devices.

Test result of building panther, building cheetah, and building panther
again:

Before this change
- build time: 02:57
- # of tasks: 31044

After this change
- build time: 01:48
- # of tasks: 1694

Build time includes build.ninja generating time (which is more than 1
minute), so the overriden artifacts become far fewer.

And "NINJA_ARGS='-n -d explain' m" only gave 4 "command line changed"
nodes.

Bug: 279362051
Test: see above
Change-Id: I4891cbe823ae21628465e5c6eb26a4837ccdd202
2023-05-26 18:07:05 +09:00
Paul Duffin
e8b4768134 Avoid separate call to module factory to create conditional properties
Previously, the soong_config_module_type (and related module types)
would make a special call to the module factory of the module type
being customized to get the properties from which it created the
conditional properties. That caused problems when trying to customize
a singleton module. See the bug for more details.

This change avoids that special call by deferring the creation of the
conditional properties struct until just after the
soong_config_module_type's factory function calls the customized module
factory to create the module and properties. The properties are then
used to create the conditional properties struct avoiding the extra
factory call.

The conditional properties struct is only created once per module type
that soong_config_module_type (and related module types) creates.

Bug: 264876909
Test: m nothing
Change-Id: I55dc71d2553cb59d921a96c6458d0bc877512bbb
2023-01-09 16:49:00 +00:00
Paul Duffin
f1e6a048d0 Test using soong_config_module_type with singleton module type
Singleton module types have some special behavior that can cause
problems when trying to extend them with soong_config_module_type so
this adds some tests of how they work together.

Currently, the tests show that they do not work together, a follow up
change will correct that.

Bug: 264876909
Test: m nothing
Change-Id: I250ee4e18b3c04d1c91808f55722da74b813a570
2023-01-09 16:48:56 +00:00
Paul Duffin
3229998d37 Dedup registration of Soong config module types
Bug: 264876909
Test: m nothing
Change-Id: I467a2090b32438cbbf88bbb453bb4960757ec37a
2023-01-09 16:48:46 +00:00
Liz Kammer
72beb34609 Add package for printing starlark formatted data
Bug: 216168792
Test: build/bazel/ci/bp2build.sh
Change-Id: I3a06b19396f7ffe1c638042cda7e731dd840f1d6
2022-02-08 17:32:28 -05:00
Jingwen Chen
a47f28d28e bp2build: add support for soong_config_module_type.
Test: CI, go unit test
Bug: 198556411
Change-Id: Idf862904d51d822f92af0c072341c31b7a02fc64
2021-11-08 13:38:28 +00:00
Liz Kammer
bdce0dfbdf Add tests for defaults used in conditions_default
Bug: 203123704
Test: go test soong tests
Change-Id: Ia12c51d01108ad1f311d738b182d4bb94c500810
2021-10-18 12:49:41 +00:00
Liz Kammer
0fc1e134b9 Add test to reproduce bug in error message.
soong config variable modules allow specifying a non-existent property,
which results in an unhelpful error message when the module type is then
used.

Bug: 171232169
Test: go test soong tests
Change-Id: I6174c0d35a28952157ee925f51d615e2ee735f8a
2021-07-15 12:38:35 -04:00
Paul Duffin
30ac3e7ca7 Remove uses of FixtureFactory from android package
Bug: 183235980
Test: m nothing
Change-Id: I72898ada020ee1a73fd534c61afb5c22fa00c1e5
2021-03-22 18:31:53 +00:00
Paul Duffin
791302b412 Convert android/soong_config_modules_test.go to test fixtures
Bug: 182885307
Test: m nothing
Change-Id: I53231b820154447e359e48afa47cdf76f0ec6c47
2021-03-18 12:17:05 +00:00
Liz Kammer
432bd598ae Add conditions_default for soong config variables.
Each variable can specify a conditions_default for properties to be used
when the variable is not set, not set to a true value (for bools), or is
set to a value that is not present in the module (for strings).

Test: m nothing
Test: go test soong tests
Change-Id: I76ec026da2369b407f0f530f77760f530e7958fc
2021-01-21 14:25:20 -05:00
Colin Cross
ae8600b507 Pass Config to NewTestContext instead of ctx.Register
Prepare for using Config when adding singletons by passing
Config to NewTestContext and NewContext instead of to ctx.Register.
This will enable a followup change to store SingletonMakeVarsProviders
registered on the Context in the Config, which is necessary to run
multiple tests in parallel without data races.

Test: all soong tests
Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-11-12 10:07:49 -08:00
Liz Kammer
9244491f17 Merge "Enable defaults in soong_config_module_type props" 2020-10-12 23:18:28 +00:00
Colin Cross
405af07859 Revert "Make lots of tests run in parallel"
This reverts commit 323dc60712.

Reason for revert: Possible cause of test instability
Bug: 170513220
Test: soong tests

Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-09 18:34:24 -07:00
Liz Kammer
dbd4809b06 Enable defaults in soong_config_module_type props
Test: go tests
Test: m
Change-Id: I8fe8c17320086034f4745b2da974a2c73c949eaf
2020-10-09 14:28:34 -07:00
Colin Cross
323dc60712 Make lots of tests run in parallel
Putting t.Parallel() in each test makes them run in parallel.
Additional t.Parallel() could be added to each subtest, although
that requires making a local copy of the loop variable for
table driven tests.

Test: m checkbuild
Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-10-06 15:12:22 -07:00
Dan Willemsen
b0935db8c3 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"],
	  }
      },
  }

Test: built-in tests
Change-Id: I18f35746b5cc39c304a136980249e886d38c6df6
2020-03-24 07:15:16 -07:00
Dan Willemsen
2b8b89cfa2 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"],
  }

Test: built-in tests
Change-Id: If5455a38433431c7ecbce1e5b32cfbb47f42602a
2020-03-23 22:42:32 -07:00
Colin Cross
3beeb1ebb4 Add test for capitalized Soong config variable
Soong config variables come from Make where they might be capitalized,
but Blueprint didn't handle capitalized variables well.  Add test
coverage for capitalized Soong config variables.

Bug: 148865218
Test: soong_config_module_test.go
Change-Id: I1e434e392d5ee660a221a0d3f959811c35e65865
2020-02-06 19:36:05 +00: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