Commit graph

18 commits

Author SHA1 Message Date
Paul Duffin
3f7bf9fa0d Allow namespace config to be tested properly
Previously, the NewTextContext created a context that always called
NewNameResolver with a export filter that always returned true.

This change fixes that by:
1. Changing NewNameResolver to take a Config parameter instead of a
   filter parameter and pushing the code to create the filter from the
   Config from newNameResolver() in cmd/soong_build/main.go into the
   NewNameResolver function.

2. Extracting a newTestContextForFixture that does not create a
   NameResolver or set it on the context. That avoids creating a
   NameResolver before the test has prepared the config.

3. Modify the fixture to create and set the NameResolver in the Context
   after the config has been prepared by the test.

4. Added test to verify that it all works.

Bug: 234825639
Test: m nothing
Change-Id: Ie4b13f18093dc01a0ab65a9ecfd143585d843b55
2022-11-08 17:38:56 +00:00
Colin Cross
a6389e975e Make all Nameless modules have unique names
Nameless modules still have to have unique names to avoid collisions
when sorting by name.  Give them all pointer suffixes, and rename
NamelessModule to NamespacelessModule

Fixes: 235475711
Test: soong_config_modules_test.go
Change-Id: Ib2d34e8bcbb4f988bf00c1012511494f54d9a53e
2022-06-22 17:19:03 -07:00
Usta Shrestha
c725f47f5d cosmetic: 1)typos 2)parameters named for clarity
Test: n/a
Bug: n/a
Change-Id: I49faa1d8dec4b729409a45e87212b271ecf9e9d1
2022-01-29 06:34:53 +00:00
Paul Duffin
4fbfb59d3e Extract preparer for namespace
Bug: 193228441
Test: m nothing
Change-Id: If00b0595edd48be8c8d3308b87fb920dfb0340ee
2021-07-09 23:54:01 +01:00
Bob Badour
38620edca1 getNamespacesToSearchForModule to use blueprint.Namespace
Allow for nil argument.

Test: m all

Change-Id: I03e3afe00d72905f259ce1af5085387b796ebc3d
2020-12-21 18:40:53 +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
Colin Cross
31a738bda0 Use blueprint's load hooks
Make android.AddLoadHook wrap blueprint.AddLoadHook.  Also pass
the config object to ParseBlueprintsFiles.

Test: all soong tests
Change-Id: I60c988b717d395f52498ec23ef7c9046d9861a6e
2020-01-06 10:57:26 -08:00
Colin Cross
cd84b4e36b Give Blueprint modules access to all namespaces
Don't enforce namespaces on Blueprint modules like
bootstrap_go_package, their dependencies are handled before
namespaces are initialized in namespaceMutator.

Fixes: 135246048
Test: TestDependingOnBlueprintModuleInRootNamespace
Change-Id: I7cf1c26bb8512eed59d6b4eb42a49f7080ffa281
2019-06-14 11:26:09 -07:00
Paul Duffin
2e61fa6e14 Add visibility support
Implementation uploaded for review. Includes unit tests but does not
yet handle prebuilts, that will come in a future change once some
more general issues with prebuilts and namespaces is resolved.

See README.md#Visibility for details of what this does and how to use
it.

Bug: 112158820
Test: add visibility rules for core library modules, make core-tests
Change-Id: I8ec980554398ad6f2d42043ce518f811a35da679
2019-04-26 12:37:37 +01:00
Patrice Arruda
64765aaef9 Soong: Add synopsis to soong_namespace module.
Synopsis was missing to soong_namespace module. Also added documentation
to imports properties. This required the namespaceProperties struct to be
pulled out of the NamespaceModule struct in order for the documentation
tool to extract the property documentation.

Bug: b/128337482
Test: Ran the doc generation command and verified that the synopsis was
added to soong_namespace and imports properties is listed too.

Change-Id: I519b14629bdbc85f35fbc8fa03e78dc2ad3f655e
2019-03-26 09:09:41 -07:00
Colin Cross
5f692ec219 Remove empty DepsMutator methods
Add an empty DepsMutator to ModuleBase so it doesn't have to be
implemented on every module that doesn't need it.

Test: all soong tests
Change-Id: I545a832a0dbf27386d3080377a75ea482cd9ce59
2019-02-01 17:17:58 -08:00
Dan Willemsen
59339a29e1 Fix go vet issues
Test: go vet ./...
Change-Id: Ifb936ccc5e2b5a2c3fcbbbcb54f680e2973ea1b3
2018-07-22 21:18:45 -07:00
Colin Cross
eafb10c23a Fix module rename inside namespace
Rename was expecting fully qualified names, but context.go always
passes it short names.

Bug: 77922456
Test: TestRename in namespace_test.go
Change-Id: I552ff39fd8ed6ba6da4262925060b45104840ff7
2018-04-16 21:38:15 +00:00
Jeff Gaston
b274ed3252 Make ninja file deterministic even with dup module names
Bug: 65683273
Test: ./build/soong/scripts/diff_build_graphs.sh \
      --products=aosp_arm '' ''

Change-Id: Ie01ff579d69e94b12363f53aec5d25810211c451
2017-12-04 17:44:32 -08:00
Jeff Gaston
5c3886de5a require namespaces to be declared only in files named Android.bp
Bug: 65683273
Test: m -j nothing # which runs unit tests

Change-Id: I5edf0e0482809f5ac9fb9dfff342fb404e1c52da
2017-12-04 17:44:32 -08:00
Jeff Gaston
088e29ed38 Revert "Revert "Soong support for namespaces""
This mostly reverts commit 178d5fefc0
and mostly reapplies change I6d3e52ef62c4cabe85b9a135a54de0e1a6aab29c .

Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
      --products=aosp_arm \
      'build/blueprint:work^ build/soong:work^' \
      'build/blueprint:work build/soong:work'
      # and see that the only changes were:
      # 1. adding some new files
      # 2. changing some line numbers
Test: m -j nothing # which runs unit tests

Change-Id: I32baae00277a547fdcdd1c2219fe6625ee0e45d7
2017-12-04 17:44:29 -08:00
Jeff Gaston
178d5fefc0 Revert "Soong support for namespaces"
This reverts commit 63a250a336.

Reason for revert: Some failures:
  namespace_test.go:648: dir1/Blueprints:2:4: a namespace must be the first module in the file 
  such as New Build Breakage: aosp-master/build_test @ 4475274

Change-Id: I1b5db8eb934e51ff22241bfca44199d886b1393b
2017-11-30 00:43:43 +00:00
Jeff Gaston
63a250a336 Soong support for namespaces
Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
      --products=aosp_arm \
      'build/blueprint:work^ build/soong:work^' \
      'build/blueprint:work build/soong:work'
      # and see that the only changes were:
      # 1. adding some new files
      # 2. changing some line numbers
Test: m -j nothing # which runs unit tests

Change-Id: I6d3e52ef62c4cabe85b9a135a54de0e1a6aab29c
2017-11-29 13:03:40 -08:00