summaryrefslogtreecommitdiff
path: root/golang
AgeCommit message (Collapse)Author
2025-02-12Don't panic in ModuleForTests and friends Colin Cross
Panicking in ModuleForTests and similar test helper functions was a mistake. Go's test runner stops running tests as soon as any test panics, which means debugging multiple tests panicking requires rerunning all the tests after fixing each panic to find the next one. Pass the *testing.T into ModuleForTests and friends so that it can call t.Fatalf instead. Test: all soong tests pass Change-Id: I5d0f2424eaf04fb795079e6d1e4b9469d8c7033c
2025-02-04Fixes for missing rules in m --soong-only Spandan Das
This CL 1. Disables filesystem diff test if there is no kati invocation, since there will not be a file_list.txt to do the comparison 2. Disables installation for goBinary if it is in an unexported namespace. Test: m checkbuild --soong-build (top of stack) Bug: 394096939 Change-Id: I5057c2cc431f5e8db12816c3dacf69b3159e18d5
2025-02-04Create install rule for loadplugins without adding to blueprint_tools Spandan Das
m checkbuild --soong-only currently runs into errors for "Test for dangling rules" since the install rule for loadplugins is not created in `m --soong-only`. In regular `m` builds kati generates the installation rule since `LOCAL_SOONG_INSTALLED_MODULE` for `loadplugins` is empty in the generated Android.mk file. To solve the missing rule in soong-only mode, always generate the installation rule. To prevent repeated reanalysis in `m`, do not add the installed file to `blueprint_tools`, which is a transitive dep of droid via droid_targets. Bug: 394096939 Test: m blueprint_tools && m blueprint_tools (second one is noop) Test: m checkbuild --soong-only (passes at top of stack) Change-Id: I202bb2fa31543f8e3acbe11a4732f6236cd3b71f
2025-01-06Always use out/host for host tools Cole Faust
Previously, files were installed to out/host or out/soong/host based on if kati was used or not. That was changed in aosp/3418304, but this HostToolDir() that's used by blueprint was not updated to match that change, so soong-only builds were failing with missing host tools. Bug: 388038396 Test: m --soong-only dist, ./prebuilts/build-tools/build-prebuilts.sh Change-Id: Ib104a6399ce2308d81651ec620323caaf9c76151
2024-10-28Support host-cross variant on golang modules Cole Faust
This doesn't actually add support for cross-compiling go modules, even when built on the cross-compile variant, the results will still just be built for the current host. However, it does make the variants of golang modules match up better with other host tools that are being built for a cross-compile variant. Bug: 369916167 Test: m nothing on aosp_cf_arm64_only_phone with aosp/3318965 Change-Id: I2245d09d2cfc9bcfb819d678cdae541dd87a441d
2024-10-09Merge "Update test for go modules with mutliple variants" into main Cole Faust
2024-10-07Annotate mutators that use methods that prevent mutator coalescing Colin Cross
Mutator coalescing reduces the overhead of visiting every module for every mutator by calling a series of mutator methods on a a single module in a row. This is only valid for well-behaved mutators. Add methods on MutatorHandle that allow annotating mutators that are not well behaved, and use that to prevent coalescing mutators. Bug: 372076859 Test: all soong tests pass with race detector on Flag: EXEMPT refactor Change-Id: Id9b005f05227e5558cac6d488030a7398af13fb8
2024-10-04Remove cross compilation support from go packages Cole Faust
Go packages supported cross-compilation (to linux_musl at least), but go binaries did not. Go packages also add a reverse dependency onto the binary packages, which would cause a missing dependency error, except that all non-primary variants of go modules essentially disable themselves and reuse outputs from the primary variants. However, in mac builds, for some reason the primary variant is arm64 but the binary is only created for x86_64. This causes the missing dependency, but mac sets AllowMissingDependencies, but the missing dependencies still cause problems when generating soong documentation. After we submit this cl, we can potentially make the go modules not copy outputs from the primary variation, and instead have all variations work independently. Bug: 369916167 Test: m soong_docs on mac Change-Id: I967e63fc16f3b2a5cc1fa00ab62f5626b268c087
2024-10-04Update test for go modules with mutliple variants Cole Faust
Go modules now generate files into a variant-specific subfolder. Since that subfolder depends on the host os/arch, don't explicitly check its value, but instead allow anything there. Bug: 369916167 Test: m --no-skip-soong-tests Change-Id: I37e395c866d34f596f0936b720b89c8f9615dcf8
2024-09-12Fix reanalysis after full build Colin Cross
Blueprint bootstrap and Soong each create rules to install blueprint_go_binary modules to the same location, but with different command lines. Binaries used during bootstrap are installed using the bootstrap rule, but then get reinstalled during a full build via the blueprint_tools phony that is a dependency of droid. This changes the command line used for the rule stored in .ninja_log, and then on the next bootstrap ninja will rerun the binaries, triggering reanalysis. As a quick fix, don't create install rules for loadplugins and soong_build. A more permanent fix may be to move the bootstrap installation to a different location, but that will require more testing. Bug: 366291149 Test: m blueprint_tools && m blueprint_tools Flag; EXEMPT bugfix Change-Id: Ib7f2910976f4b5e6add2128ce0b2a5d10445a53c
2024-09-11Wrap blueprint_go_binary and bootstrap_go_package into android.Modules Colin Cross
Depending on a blueprint_go_binary from a Soong module requires hacks that allow Soong to support both blueprint.Module and android.Module. Wrap the blueprint Go module types with ones that implement android.Module, and delete all the related hacks. Bug: 319288033 Test: m checkbuild Flag: EXEMPT refactor Change-Id: I9b62b450de09bd10288333fbc66aa71c867ae0b3