This changes makes bpf module type uses OutputFilesProvider,
instead of current OutputFileProducer for inter-module-
communication.
Test: CI
Bug: 339477385
Bug: 342406930
Change-Id: I85d1141e9f6583cc5427756107da99f56b0c7ea1
This allows using select statements with it.
Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I6f3efaaa3d82505e38a91ee4ba0e18e404360191
Merged-In: If355d24506e3f117d27b21442a6c02bca3402dc7
In order to provide a more flexible ability for gensrcs's output, due to
current output_extension property will only allow to replace the string
after the last "." of input, in order to handle input with multiple dot
in file name, provide a way to trim the suffix of input string.
Bug: 335536003
Test: cd build/soong/genrule ; go test -run TestGenSrcs
Test: cd build/soong/genrule ; go test -run TestGenSrcsWithTrimExtAndOutpuExtension
Test: cd build/soong/genrule ; go test -run TestGenSrcsWithTrimExtButNoOutpuExtension
Test: cd build/soong/genrule ; go test -run TestGenSrcsWithOutpuExtension
Test: cd build/soong/android ; go test -run TestPathsForModuleSrc
Change-Id: I033bbe1d225f207f0f6bdc140df308884f214b51
This change prevents duplicate paths from being returned when resolving
filepath, glob and ":name{.tag}" syntax to android.Paths. Once all
existing modules are cleaned up to remove duplicates in the source
files, the duplicates removal can be converted into an error so that
passing duplicate source files in the module definition is restricted.
Test: patch to git_main, inspect ninja commands
Bug: 326674683
Change-Id: I38a4ce9238da25cd67968f6bc8058bc9facc4551
This relands aosp/3026027 with fixes for ndk_library. ndk_library
uses ctx.InstallFile to copy the stubs from an intermediate dir to
out/soong/ndk/sysroot/. The copy rule was created in
out/soong/installs-<product>.mk. This would cause issues when soong_ui
is run in `--soong-only` mode
To fix this, the cp rule is created entirely in soong. The stub library
is marked uninstallable to prevent creation of duplicate rules when
`--soong-only` mode is not used
Test: presubmits
Test: lunch ndk-trunk_staging-userdebug &&
ALLOW_MISSING_DEPENDENCIES=true build/soong/soong_ui.bash --soong-only
out/soong/ndk.timestamp
Change-Id: I6f8b87d88d8ca5ec9a3327e1f11e9aa654f8cdce
ndk_headers currently use ctx.Install to install headers in
out/soong/ndk/sysroot. The files are subsequently used to compile ndk
variants of cc libraries on host.
Since these headers are not actually installed on device, use android.Cp
to assemble the NDK sysroot. By itself, it should be a no-op, but
androd.Cp is more friendly with restricting the installation rules to
PRODUCT_PACKAGES.
To make it explicit that the sysroot is not a typical installation path,
this CL also modifies the type to OutputPath
Test: m
Bug: 332778109
Change-Id: I1131c3c764443cbaac525c6022cd09c47695d275
Every InstallPath will have String() called on it eventually, often
more than once if it is in a slice that is sorted. Precompute the
full path so it can be returned from InstallPath.String() without
recomputing every time.
Test: paths_test.go
Change-Id: I1ed0a3801806854356865c0a5fc35d5cf6d349fe
This is a followup cleanup for aosp/2876754 and replaces panic with
ctx.ModuleErrorf. The latter creates a more expressive build error.
Implementation details
- export moduleErrorf interface from build/soong/android. This minimal
interface will be used as a parameter for `DexJarBuildPath`
- Add ModuleErrorf to the function signature of DexJarBuildPath. This
parameter only gets used for Import and SdkLibraryImport structs.
These two can have duplicate deapexer definitions, and ModuleErrorf
will be used to report that error
- Create a minimal implementation of `ModuleErrorf` in tests of java and
apex
Test: m nothing --no-skip-soong-tests
Change-Id: I0febec651f40c3f04deb957e64133c94b80fbd78
Overriding android.ModuleContext's implementations of *Specific()
methods in cc.moduleContext and then passing that back to
android.PathForModuleInstall to affect the install path causes
problems if android.ModuleBase.GenerateBuildActions also tries
to call android.PathForModuleInstall directly with the
android.ModuleContext as it gets a different result.
Add InstallIn* methods to the android.Module interface, implement
default versions in android.ModuleBase, and override them in
cc.Module and rust.Module. Use them in android.PathsForModuleInstall
to allow the module to customize the behavior directly.
Test: TestInstallPartition
Change-Id: I7840e07eae34ac4f4d3490b021143d5f33a83626
To generate module-info.json in Soong for b/309006256 Soong needs to
know the test data paths. Moving test data installation into Soong will
also help later for test suite packaging.
Add ModuleContext.InstallTestData that installs the files listed in a
[]DataPath alongside the test. The files will also be passed to Make
to allow it to continue packaging them into the test suites for now.
Update the module types that are producing LOCAL_TEST_DATA entries
in their Android.mk files to go through InstallTestData instead.
Bug: 311428265
Test: atest --host toybox-gtests --test-timeout=120000
Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead
Add a method to DataPath that converts it to the relative install path
in preparation for adding additional complexity to DataPath.
Bug: 311428265
Test: builds
Change-Id: I65b06238aafda2db72c6a253744a3087976451cd
filepath.Join("foo", "") returns a newly allocated copy of "foo",
while filepath.Join("foo") does not. Strip out any empty path
components before calling filepath.Join.
Test: TestValidatePath
Change-Id: Ib47dbcd9d6463809acfe260dfd9af87ea280b4de
These bazel-built modules will be installed into the system image
as part of the bazel rule, rather than going through the make staging
directory.
Bug: 297269187
Test: m bazel_sandwich
Change-Id: I96c6e58f8e0898b2ad92cb7069745ca2059a39f8
This commit adds support for compiling rust rules inside the sbox
sandbox. To compile a rust module with sandboxing enabled, the entry
point to the crate must be specified via the `crate_root` property, and
all input sources and compile-time data must be specified via the `srcs`
and `compile_data` properties.
Bug: 286077158
Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
Revert submission 2651299-bazel_sandwich
Reason for revert: b/293883239, checking if this breaks the build.
Reverted changes: /q/submissionid:2651299-bazel_sandwich
Change-Id: I5f1d4bb13d21e6599f5c353dcaba2375f5ec234d
The "bazel sandwich" is a mechanism for bazel to depend on make/soong
outputs. The name comes from the fact that bazel is now at the top
and bottom of the build graph. This is intended to allow us to work
on converting the partition builds to bazel while not all of the
dependencies of the partition have been converted.
It works by adding the bazel_sandwich_import_file rule, which emits a
dangling symlink that starts with bazel_sandwich:, and includes
information that the aquery handler in soong reads. The aquery handler
rewrites the symlink so that it points to a file generated by
make/soong, and adds a ninja dependency from the symlink to the file
it's targeting.
This allows us to depend on make-built files from bazel, but notably
it doesn't allow us to depend on analysis-time information from make.
This shouldn't be a problem for the partitions, but limits the use of
the bazel sandwich to similar, less complicated types of builds.
go/roboleaf-bazel-sandwich
Bug: 265127181
Test: m bazel_sandwich
Change-Id: Ic41bae7be0b55f251d04a6a95f846c50ce897adc
Use Go's generics for DepSets so they don't require a type-specific
wrapper and reflection.
Test: depsets_test.go
Change-Id: I22ba0b7d680d37d2cd05230b0f560d166c4dd20b
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
This changes bp2build codegen, symlink forest generation, and
soong_build so that they do not rewrite output files if the contents are
unchanged.
Bug: 266983462
Test: m droid
Test: canonical_perf.sh benchmarking
Test: Manually verified that rerunning analysis did not regenerate
out/soong/workspace/prebuilts/sdk/BUILD.bazel unless contents changed
Change-Id: I5ec227df7a32b53c7fa0d741fb1403a51931024b
Perform a single pass over pathComponents in both validatePath and
validateSafePath instead.
Test: presubmits
Change-Id: I1499183e345ca180900c54a18f9dc8bd534f2588
This was always set to "." after aosp/1652613 and
aosp/1796650. While doing some rudimentary performance
profiling of soong, it turned out that SourcePath.String()
was taking 600+MB of memory joining the "." to the rest
of the path. Remove it for performance gains.
Bug: 262629589
Test: Verfied ninja files didn't change with this cl on aosp_arm64-userdebug
Change-Id: Id6b552ab8defe37e0c2b58e813fb1dbae427ae96
Make PackageVarContext implement PathGlobContext by implementing
GlobWithDeps. This will allow calls to ExistentPathForSource
inside a VariableFunc to use optimized glob dependencies instead of
falling back to AddNinjaFileDeps, which is resulting in extra
dependencies from soong_build on top level directories, triggering
extra Soong regenerations.
Remove the fallback path in ExistentPathForSource by making it take
a PathGlobContext, which is now a superset of PathContext.
Rewrite TestNinjaDeps to not rely on the unoptimized glob dependencies
in VariableFuncs and instead call ctx.Config().AddNinjaFileDeps
directly.
Bug: 257079828
Test: test_create_global_include_directory
Change-Id: I48cf189157d78b9252d339dbc9baeb27e4694807
This is a fix to aosp/2260763 and skips the existence check corectly.
Previously, it would not throw an exception during Soong analysis, but
would add the path to a `MissingDeps` object. The ninja graph generated
using this would throw an exception during ninja execution.
We should not do this check for `cc_api_library`. The prebuilt
library.so is missing in the build graph of the inner tree (expected),
but it will be present when the orchestrator creates the combined
multi-tree ninja graph.
Test: rm -rf out && multitree_build vendor/vendorimage
(I did not clean out/ in aosp/2260763, and therefore did not catch this
earlier)
Test: go test ./cc
Change-Id: I68d245acae3bfb777bfc8a72fb7cd4909cb0a289
Context
- Android-<target>.mk currently does not contain information about partition for its dependent unembedded jni libraries, but only lists the name of the unembedded jni libraries.
- If an android_app module depends on an unembedded jni library that is located in a different partition, make cannot find the library.
Implementation
- Create a string field partition in jniLib struct.
- Add variable "LOCAL_SOONG_JNI_LIBS_PARTITION_<target>", an array of mappings of the name of the jni library to its partition.
Bug: 154162945
Test: m
Change-Id: I6b8e1272ff59dc70e3dd6ce8c6c8e4686dad76df
* changes:
Move function PathForVndkRefAbiDump to Prevent unnecessary exports in paths.go
Change the type of parameter prevVersion to int in sourceAbiDump
This CL moves function PathForVndkRefAbiDump from android/paths.go to
cc/library.go to prevent unnecessary exports.
Test: make libz
Bug: 239915696
Change-Id: I1270e8d07edb09d93621c049acab9196757d356b
The AIDL source generation rule sets include flags based on the relative
path of .aidl sources. For .aidl sources provided by Bazel targets, e.g.
in a filegroup, the same directory could be added to the include path
twice. Instead we need to ensure that if a Bazel source provides the
include path, that we don't add it again from a Soong source.
Bug: 229251008
Test: USE_BAZEL_ANALYSIS=1 m api-stubs-docs-non-updatable
Change-Id: I4997039003242b43e0e52ccf41729acb4ad11324
Since vndk libraries don't need to maintain Cross-Version abi
compatibility. The newly proposed Cross-Version ABi checking mechanism
is applied to only ndk/ and platform/. The reference dumps of LLNDK
libraries should get from platform/ to be benefited from this checking
mechanism.
Test: mkdir -p prebuilts/abi-dumps/platform/UpsideDownCake/64/x86_64/source-based/ && cp prebuilts/abi-dumps/vndk/32/64/x86_64/source-based/libvndksupport.so.lsdump "$_"
make libvndksupport -j
Bug: 238383845
Change-Id: I663511d60623cd23619166d8d63fd26220a930e2
Add toolchains to support cross compiling to aarch64-linux-musl and
arm-linux-musleabihf.
Bug: 236052820
Test: build arm and arm64 musl sysroots
Change-Id: I47a9322929baff2492c6e8db989ece01fcbeb133
This change contains a prototype implementation for multitree. Several
interfaces and modules are added.
1. Imported/Exported
Modules implementing Exportable interface can export artifacts to other
components. "imported_filegroup" modules can import generated artifacts from other exported modules.
2. Multitree metadata
It contains information about imported/exported modules in each
component, and can be generated via "m update-meta".
3. cc library stub
It's based on prototype stub libraries. It uses imported/exported
mechanism to expose a C API, with a map.txt file and header files.
Bug: 230448564
Test: m
Change-Id: Id7ff7618e2c630c5617a564d8b23b60a1cc9c8e8
The ABI reference dump directory names contained TARGET_ARCH_VARIANT
or TARGET_2ND_ARCH_VARIANT. The builds with non-generic arch variant
could not find the reference dumps for their arches. This commit renames
the directories to <TARGET_ARCH> and <TARGET_2ND_ARCH>_<TARGET_ARCH> to
ensure that all arch variants are checked.
Bug: 213127415
Test: lunch aosp_cf_x86_64_phone-userdebug && make
Change-Id: I7617f3ffc0e1bc423eea8c39e0f2b745276b4244
While Bazel genrules will allow genrules to accept a directory as input,
the results can be unexpected to a user as changes to the contents of
the directory may not trigger a rebuild as expected. Restricting this
in Soong ensures that converted targets will behave as expected.
Test: CI
Change-Id: I8616f58d1df267005e6c0ca3f4730d06de52c0d9
Containers generally package the transitive installable
dependencies of their direct dependencies, track them as license
deps.
Bug: 207445310
Test: m checkbuild
Change-Id: Ic8640152cee0e0cfec5e85a1649a8adfd29d517a
* changes:
Fix InstallBypassMake symlink dependencies
Add tests for ctx.InstallFile
Fix OutDir vs SoongOutDir in tests
Fix go vet error
Add missing os.MkdirAll to WriteFileToOutputDir
Use pathtools.WriteFileIfChanged in translateAndroidMk
Call ctx.InstallFile on the primary install file last so that the
primary install file can depend on the extra install files, and so that
the primary install file can be inferred from the last installed file.
Add missing ctx.InstallFile calls for the dexpreopt and hostdex outputs.
Fix the install subdirectory for modules installing to the testcases
directory.
Bug: 204136549
Test: m checkbuild
Change-Id: I7edd7647be27439d3ca0ecc589ca5e89d4ba8474
Move cc module installation rules into Soong by overriding
InstallBypassMake. Update the locations that find host tools
to look in the Make installation directory instead of the Soong
installation directory, which will no longer be used.
The methods that find host tools are also used on go binaries,
so update the config methods that tell Blueprint where to install
go binaries to the Make installation directory too.
Bug: 204136549
Test: m checkbuild
Change-Id: Id172592c195e506102982a4af0084f6d9c68a896