summaryrefslogtreecommitdiff
path: root/android/defs.go
AgeCommit message (Collapse)Author
2025-02-03Move installation of dexpreopted system server classpath libraries into apex Colin Cross
System server jars in apexes currently use a heuristic to determine whether or not they are the "main" variant in order to create rules that copy their dexpreopt artifacts to the final installed location and their dex jars to a known location for other modules to reference. The heuristic depends on knowing all apexes that depend on the module, which will not be possible when the apex info mutator is rewritten to support future incremental analysis. Instead, export the dexpreopt artifacts and dex jars, and let the apex decide whether or not to install them. Bug: 372543712 Test: all soong tests pass Change-Id: I478bc2edceca4614e08e9a695b05d091e5437ba1
2025-01-22Wrap the soong installation rules with /bin/bash Spandan Das
Switching between `m` and `m --soong-only` is currently not a null build since the command line of the install actions changes. This CL wraps the install cmds with /bin/bash to match the command line of the install actions in regular `m` builds. Switching between `m` and `m --soong-only` is still not a null build (most likely due to `kernel_version_for_uffd_gc.txt), but with this CL only a subset of the actions (buildprop and rdeps) need to be rebuilt between the switch Bug: 390471378 Test: m out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_odm_image/android_common/odm.img Test: m out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_odm_image/android_common/odm.img --soong-only (only cmp of kernel_version_for_uffd_gc.txt) Test: m out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_odm_image/android_common/odm.img (copies kernel_version_for_uffd_gc.txt, runs gen_build_prop followed by build_img) Change-Id: If64af772fc6e3506310ffb9f7a0e9058befb9cfa
2024-12-20Revert "Define a tool and a static rule to calculate the hash of a directory" Jihoon Kang
This reverts commit bd7afdc2a15e776e9aff208577ab16fd693499f2. Reason for revert: No longer needed Change-Id: I71874f5426dcd20b3bacf04379fb3f897835a4d5
2024-12-20Define a tool and a static rule to calculate the hash of a directory Jihoon Kang
The rule will be used in a follow up change that adds a directory in a provider. Test: m nothing Bug: 381104942 Change-Id: I7147dcbc43e19840b2d73380785a01bda6643d85
2024-09-05Remove asset dir glob files Cole Faust
I'm rewriting how globs work in soong to make them compatible with hash-based ninja implementations. As part of this, I'm removing this unnecessary usage of globs to make them simpler. In this case, since we're already globbing the directory at analysis time and causing soong to rerun, we can ensure the aapt2 action also reruns by putting a hash of the glob results onto the command line. Bug: 364749114 Test: m framework-res, touch frameworks/base/core/res/assets/test1.txt, m framework-res rebuilt framework-res.apk, rm frameworks/base/core/res/assets/test1.txt, m framework-res rebuilt framework-res.apk again Change-Id: I4f666367a9a0fd0dfa42dc51ef3a788a02b41747
2024-04-10Remove unused writeFile var Paul Duffin
Test: TH Change-Id: I09922d8f837f41dad01bc64192fa174d988eb39a
2024-04-09Remove "exported" ninja variables Cole Faust
There was infrastructure to export ninja variables to bazel. Now that the bazel migration is cancelled, we don't need it anymore. Bug: 315353489 Test: m nothing Change-Id: I298cc2ac7ebd004557be3b30d75f7357cab0b7a0
2024-01-18Remove SymlinkOutputs Cole Faust
symlink_outputs was added so bazel could run ninja files, but we abanoned that approach in roboleaf, and then roboleaf was cancelled entirely. Remove this feature so we're more compatible with upstream ninja / n2. Bug: 160568334 Test: Presubmits Change-Id: Ic368c48dd01b68e51c471c3fe90d0c02c55956e9
2024-01-05Remove more bp2build Colin Cross
Bug: 315353489 Test: m blueprint_tests Change-Id: Ib854fe1a448c258fe086691a6e5ed2d98537f5e4
2023-12-19Write raw files to disk instead of the ninja file Colin Cross
Writing raw files as rules in the ninja file unnecessarily bloats the ninja file. Write files immediately to disk instead to files based on the hash of the contents, and then emit ninja rules to copy the files into place during the build. Delete obsolete files in a singleton at the end of analysis. Bug: 306029038 Test: Run: m libc_musl_version.h touch build/soong/Android.bp m libc_musl_version.h libc_musl_version.h/genrule.sbox.textproto is not recopied. Test: Run: lunch aosp_cf_x86_64_phone-userdebug m libc_musl_version.h lunch aosp_x86_64-userdebug m libc_musl_version.h lunch aosp_cf_x86_64_phone-userdebug m libc_musl_version.h libc_musl_version.h/genrule.sbox.textproto is recopied but restat prevents rerunning the genrule. Test: Run: touch out/soong/raw-aosp_cf_x86_64_phone/00/foo touch build/soong/Android.bp m nothing out/soong/raw-aosp_cf_x86_64_phone/00/foo is removed. Change-Id: I172869c4d49565504794c051e2e8c1f7cf46486e
2023-12-03Add TestContext parameter to ContentFromFileRuleForTests Colin Cross
The next CL will need a TestContext parameter in ContentFromFileRuleForTests in order to retrieve the file rule contents from the Config. Add it and update all the tests that use it in order to simply review of the next CL. Bug: 306029038 Test: go test ./... Change-Id: Ia4b4c9854017ea3472fa2f8ba42cf7f72720496e
2023-08-31Use aquery results to determine if a file should be executable Cole Faust
Now that aquery includes this information. Also added rm -f $out to some rules, because since they write files by shell redirection, if the file existed before and was executable, they wouldn't make the file non-executable and visa versa. Fixes: 297366783 Test: m bazel_sandwich Change-Id: Ie5b6c4275b162601f51deaec9912eea4be16988d
2023-08-24Add the system image test to the bazel sandwich Cole Faust
Also make -test.sh files executable, while we wait for a bazel update that will tell us which FileWrite actions should be executable. Bug: 297268692 Test: m bazel_sandwich Change-Id: I60498577ba12813bff8bbdbc1b997ea4addefd17
2023-02-07mixed build targets need transitive tidy files Sam Delmerico
Previously in mixed builds, only the tidy files for the boundary module were built, whereas all of its transitive dependencies' tidy files were not being built. Instead we should export the list of transitive tidy files for a module so that we can run clang-tidy for the boundary module as well as its dependencies. Bug: 195029134 Test: WITH_TIDY=1 DISABLE_ARTIFACT_PATH_REQUIREMENTS=true mss tidy-packages-modules-NeuralNetworks --bazel-mode-dev Change-Id: I463646d2ae1fc4aa075a54c264e1c34571c3fd5c
2023-01-03Use WriteFileRule instead of custom echo commands Cole Faust
These instances could use WriteFileRule instead of making their own shell code to write a file. Test: Presubmits Change-Id: I9c809b2164a68b4ce1c22fbbd0d7497240110b39
2022-11-15export neverallow include dir list to Bazel Sam Delmerico
Bazel needs to recreate the neverallow behavior for absolute includes, so export the list of include dirs to soong_injection. Bug: 250931909 Test: aosp/2302925 Change-Id: I3bd345ea4cfb3181f07e4570466f2fc8c5fe32da
2022-08-16CpExecutable should not preserve symlink Chih-Hung Hsieh
* When copy to an $out file, a symlink can become a dangling link. * The following chmod +x will fail with a dangling link. Bug: 241815504 Test: presubmit builds Change-Id: Ic3dd9d41376a94381981fb973b41a1650f5ac946
2021-11-17Install android_app_set modules in Soong Colin Cross
Add support for installing extra files from a zip file when installing a primary file, and use it to support installing android_app_set modules, which install a primary APK and then an unknown set of additional splits APKs. Test: app_set_test.go Test: install test android_app_set Bug: 204136549 Change-Id: Ia92f7e5c427adcef3bcf59c82a2f83450905c01d
2021-09-13Add module based host-tools snapshot Rob Seymour
Add new module: host_snapshot { name: "host-snapshot" deps: [ (list of host tools) ], ... } Package host tools using android.PackagingBase to capture host tools and transitive packaging data. Add JSON meta data to snapshot that allows snapshot to be installed via development/vendor_snapshot/update.py Add support to generate a fake host snapshot of all host modules that is used to detect required modules via development/vendor_snapshot/update.py. Bug: 192556798 Bug: 194799048 Bug: 192896149 Test: m HOST_FAKE_SNAPSHOT_ENABLE=true host-fake-snapshot dist -- check snapshot exists in dist Change-Id: I849c4db801cd858408f6fe6a3ce69262a23a5be9
2021-03-18Move android package on top of remotexec Colin Cross
Remove the references to the android package in remotexec so that the android package can reference the remoteexec package. This will allow RuleBuilder to integrate directly with remoteexec. Bug: 182612695 Test: m checkbuild Change-Id: I15be5ef126d8aacbd605518638f341daf6f31bb3
2021-03-16Fix WriteFileRule escaping Colin Cross
WriteFileRule shouldn't force the caller to ninja escape the input, and should shell escape spaces. Bug: 182612695 Test: manual Change-Id: Ide2f1ed92783eef7883279238de209d992d8f735
2021-03-04Make common dependencies of lint use restat Colin Cross
Use restat for the api_versions.xml and annotations.zip dependencies of lint so that frameworks/base changes don't always result in rerunning lint on every module. Bug: 181681346 Test: m lint-check Change-Id: Ic6a540b41cf79b21441311a8baefe528a3d90d8b
2020-12-11Add dependency to list of asset files Colin Cross
We had a dependency on each file in the asset directories, but that wouldn't cause aapt2 to run if a file was removed. Add a dependency on a file that contains the list of files in the asset directories. Fixes: 172867096 Test: m CarrierConfig && rm packages/apps/CarrierConfig/assets/carrier_config_no_sim.xml && m CarrierConfig Change-Id: I35f3b85355fa890a3e95eaa6458a21466b6930e4
2020-12-02WriteFileRule: Chunk long content and merge them to result Hans MÃ¥nsson
sbox.textproto files are created when handling genrule. The command for the genrule and output files are written to this file in the following format: commands < command: "...." copy_after: < from: "out/asm-generic/auxvec.h" to: "out/soong/.intermediates/kernel/msm-4.19/qti_generate_kernel_headers_arm/gen/asm-generic/auxvec.h" > copy_after: < from: "out/asm-generic/bitsperlong.h" to: "out/soong/.intermediates/kernel/msm-4.19/qti_generate_kernel_headers_arm/gen/asm-generic/bitsperlong.h" > .... > This file grow by one copy_after entry for each output file. When generating kenrnel headers where the number of output files are ~1000 we run into problems as the contents of sbox.textproto files are written to disk by generating a shell script using the following template: /bin/bash -c 'echo -e "$$0" > $out' $content If $content is very long as in the case of generating kernel headers we run into the issue where the command line is so long that the shell script return E2BIG. Fix this issue by chuking contents into smaller files and then merge them as a final step. Test: Build Issue: 174444967 Change-Id: I1a74023b4222d19672e4df7edb19810a9cf2136f
2020-11-14Replace android.WriteFile rule with android.WriteFileRule Colin Cross
The android.WriteFile rule takes careful escaping to produce the right contents. Wrap it in an android.WriteFileRule that handles the escaping. Test: compare all android.WriteFile outputs Change-Id: If71a5843af47a37ca61714e1a1ebb32d08536c31
2020-10-19Add symlink_outputs support to Soong. Jingwen Chen
This CL adds symlink_outputs to various locations in Soong that creates actions that creates symlink outputs, and explicitly mark them as such. Test: m Bug: 160568334 Change-Id: I322751bada52a9f49011c74731d84761586e03e7
2020-08-06Reland "Add prebuilt_build_tool to allow genrules to use prebuilt tools" Dan Willemsen
Includes fixes for out dirs at absolute paths, and symlinks to absolute paths. Also squashes support for exporting make vars, which previously happened in a later patch (which got moved first, since it's mostly infrastructure changes). Original message: cc_prebuilt_binary doesn't work well for host tools because they'll often be using their own versions of shared libraries that may not be compatible with what we build. So add a module type that allows genrules to use one of these prebuilts as a tool. Like other prebuilts, we'll use the source module if we have it, or the prebuilt otherwise. It supports adding extra dependencies for shared libraries or other data files that are necessary to run the tool. Any genrules using the tool will be rerun if any of the dependencies change. Bug: 128690776 Test: treehugger Test: build one-true-awk using genrule with bison Test: with OUT_DIR=$PWD/out Test: with OUT_DIR pointing to an absolute symlink Change-Id: I662296cb55503b6a10ec5e5465b138e9edeb71f3
2020-07-24Revert "Add prebuilt_build_tool to allow genrules to use prebuil..." David Su
Revert submission 1366377-prebuilt_build_tool_make Reason for revert: breaks build Reverted Changes: I20bf062bb:Export prebuilt tools to Make I4bb526492:Move some prebuilt build tool configs to Soong I195b68813:Support per-module MakeVars Ibcb257e7b:Fix dependency loop with flex I6150f0f39:Switch cc's use of bison and flex to prebuilt_buil... I6939451b8:Reland "Use genrules to build a consistent awk." Idee60640f:Add prebuilt_build_tool modules for genrule use I00893172b:Rename bison to bison_bin I82c26be1c:Add prebuilt_build_tool to allow genrules to use p... Change-Id: I6b3acf306d355f3e0463564c9ebe9482fa0f609e
2020-07-17Add prebuilt_build_tool to allow genrules to use prebuilt tools Dan Willemsen
cc_prebuilt_binary doesn't work well for host tools because they'll often be using their own versions of shared libraries that may not be compatible with what we build. So add a module type that allows genrules to use one of these prebuilts as a tool. Like other prebuilts, we'll use the source module if we have it, or the prebuilt otherwise. It supports adding extra dependencies for shared libraries or other data files that are necessary to run the tool. Any genrules using the tool will be rerun if any of the dependencies change. Bug: 128690776 Test: treehugger (builds one-true-awk with bison) Change-Id: I82c26be1c3c9fe6cab42892ddea339c301c0b316
2020-03-31Fix RuleBuilder remoteable actions running in the local pool. Ramy Medhat
This CL fixes a bug with RuleBuilder's handling of remoteable actions. It adds a new type of pool to identify remoteable rules by the android module context. The pool is then set to nil to actually run actions at NINJA_REMOTE_NUM_JOBS parallelism. Test: built aosp crosshatch userdebug Change-Id: I29452f6fc7a161b94189731e3e3cc1f34907b80c
2020-01-24Create a highmem pool and put metalava into it Colin Cross
Create a highmem pool based on the total RAM and the number of CPUs, with an override via the NINJA_HIGHMEM_NUM_JOBS variable. Put metalava into the highmem pool. Ninja does not support nested pools, and when goma or RBE is enabled the maximum ninja parallelism is set very high with local jobs in a local pool. When both the local pool and highmem pool are enabled, the total number of local jobs will be as high as the sum of the sizes of the two pools. Keep the highmem pool limited to 1/16th of the local pool when remote builds are enabled to try to minimize the effect while still limiting highmem jobs. Fixes: 142644983 Test: m nothing, examine pools Test: m USE_GOMA=true nothing, examine pools Change-Id: Id79f11f44948992960ac34ecf831dacbe21bd332
2019-04-04Fix package path of android/soong/android pctx Colin Cross
android/soong/common was renamed to android/soong/android long ago, but the pctx package path was still "android/soong/common". This required all users of rules defined in android/soong/android to import "android/soong/android" and then pctx.Import("android/soong/common"). Test: m checkbuild Change-Id: I20d096522760538f7cfc2bec3d4bfeba99b275d4
2017-08-31Make binaries executable Colin Cross
Split InstallFileName into InstallExecutable that does chmod +x after copying the file. Also remove InstallFile and rename InstallFileName to InstallFile. Test: m -j checkbuild Change-Id: Id41ad4eafe521f6cd5d8cc250b7747ecb3da8dfc
2017-07-26Delete output files before copying to them. Josh Gao
Avoid ETXTBSY when copying over a file that's being executed. Test: manual Test: m -j Change-Id: I0427b5018e67e12f685bce95028831b5661eee2c
2017-05-16Fix the issue "\n" didn't get interpreted properly. Nan Zhang
Added params to WriteFile rule that allow users to turn on the specific 'echo' options, such as "enable the interpretation of backslash escapes". Bug: b/38261000 Test: tested with real data files. Change-Id: I5145056b5c2522a3a72b9436055ec95d2fbd94c0
2017-03-31Generate file to map codenames to API levels. Dan Albert
The NDK stub library generator needs to know what unreleased API levels exist and what the ordering is between them. This singleton will later be expanded to generate api-level.h to cut down on duplication. Test: make out/soong/api_levels.json && cat out/soong/api_levels.json Bug: None Change-Id: I53126dd2cacb67c331c44f7d7c77c98b176b93cd
2016-10-20Add a "license" property to ndk_headers. Dan Albert
This field points to the license file for the headers being shipped. Test: make ndk && less $SOONG_OUT/ndk/NOTICE Bug: None Change-Id: I386f4e6f6d9776f422ffc09b8dab69e1911b08a4
2016-08-31Enable goma in soong Colin Cross
When the UseGoma flag is set, put all rules except the C compilation rule in an externally defined local_pool, which will have been created by kati. The gomacc wrapper will already be in the CC_WRAPPER environment variable. Bug: 31142427 Change-Id: I699d4edff2e302eee398dad8692ceb14721a628c
2016-07-18Add a timestamp touch rule. Dan Albert
Test: Works for the NDK changes I'm working on. Change-Id: I2731ef159122d6d44a6494a6c975a687bb49ff56
2016-05-18Rename common to android Colin Cross
Rename the "common" package to "android", because common is too generic. Also removes all android.Android naming stutter. Ran: gomvpkg -from 'android/soong/common' -to 'android/soong/android' gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext' gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext' gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase' gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext' gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext' gorename -from '"android/soong/android".AndroidModule' -to 'Module' Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7