Commit graph

5754 commits

Author SHA1 Message Date
Colin Cross
dfce764476 Fix finding next symbol when multiple symbols have the same address
Some exe files have a .data symbol at the same address as the
soong_build_number symbol.  If the .data symbol is after
soong_build_number in the symbol list, symbol_inject would think
the end address was the same as the start address, and use
uint32(-1) as the size.

Use sort.Search to find the first symbol whose section number is
the same as the target symbol, but whose address is higher than
the target symbol.

Test: manual
Change-Id: I51d6e53c6b906222ba68c5cf93be944843e23550
2018-02-28 15:04:59 -08:00
Jeff Gaston
f7542544d2 Remove unused property
Bug: 72552085
Test: androidmk prebuilts/sdk/current/support/Android.mk \
      | grep LOCAL_UNINSTALLABLE_MODULE && echo failed

Change-Id: Idcdd571812594599267985dfef2cc2fc6efbb5ba
2018-02-28 15:00:15 -05:00
Treehugger Robot
0c74ad9381 Merge changes I41d1c3c3,I9de0a0f5
* changes:
  Sort macho symbol table entries
  Fix symbol_inject on win32 exes
2018-02-27 22:55:21 +00:00
Colin Cross
15cd21a492 Report errors when opening config files
The error handling when opening config files was ignoring all errors
except ENOEXIST.  Report other errors, instead of passing nil to
json.NewDecoder and getting:
config file: out/soong/soong.config did not parse correctly: invalid argument

Bug: 73951413
Test: touch out/soong/soong.config && chmod a-r out/soong/soong.config && m
Test: rm out/soong/soong.config && m
Change-Id: I4a609b7f060b760b76ee829b83c0eb405340f58f
2018-02-27 19:30:40 +00:00
Colin Cross
c4a18e0291 Sort macho symbol table entries
macho symbol table entries are not always in order, which breaks
finding the next symbol to find the size of the target symbol.

Test: build_version_test
Change-Id: I41d1c3c3ff9929694e9ec2b034553d6b7ddef937
2018-02-23 22:45:55 -08:00
Colin Cross
64c6d4bf14 Fix symbol_inject on win32 exes
Win32 exes seem to prefix each symbol with an underscore like
macho.

Test: build_version_test
Change-Id: I9de0a0f5f25f93ad17d34b7c1b993511c77a57eb
2018-02-23 18:24:48 -08:00
Colin Cross
d2092dbc0d Merge changes I84868c92,If1690a70,Ia9aeb2ff
* changes:
  Use PathForSource instead of PathsForSource
  Move AllowMissingDependencies check from PathsForSource to PathForSource
  Pass nil instead of []string{} to ctx.Glob* functions
2018-02-24 00:39:56 +00:00
Dan Willemsen
7c695eb797 Merge "Add proto.canonical_path_from_root" 2018-02-23 20:38:10 +00:00
Colin Cross
480cd76672 Use PathForSource instead of PathsForSource
This reapplies If1690a708393964d3030cb908beaf7b6897c0084.

PathForSource does the AllowMissingDependencies check now, use it
instead of PathsForSource.

Test: m checkbuild
Change-Id: I84868c92ee43779f9b5c8b285dac92f5f87b018c
2018-02-23 11:31:45 -08:00
Colin Cross
192e97a95c Move AllowMissingDependencies check from PathsForSource to PathForSource
This reapplies Id7925999a27ea75a05e9301bbf1eb9f9a6bc4652 with
additional fixes to not use PathForSource in PathForModuleSrc.

PathsForSource was handling the AllowMissingDependencies case, but
PathForSource was not.  Refactor PathForSource and
ExistentPathForSource, and add logic to PathForSource to fall back
to behavior similar to ExistentPathForSource when
AllowMissingDependencies is set.

PathForModuleSrc uses PathForSource, which causes too many
globs (>50k).  The AllowMissingDependencies check doesn't make
much sense for PathForModuleSrc, since we already know the
project containing the definition of the module exists, we can
expect its local source files to exist.  Use pathForSource and
do an manual existence check instead.

Test: paths_test.go
Test: m ALLOW_MISSING_DEPENDENCIES=true
Change-Id: If1690a708393964d3030cb908beaf7b6897c0084
2018-02-23 11:31:45 -08:00
Colin Cross
461b445d62 Pass nil instead of []string{} to ctx.Glob* functions
[]string{} is unnecessary, just use nil.

Test: m ALLOW_MISSING_DEPENDENCIES=true
Change-Id: Ia9aeb2ffc483429787da0e473a7f1bc87eb4cad1
2018-02-23 11:31:45 -08:00
Colin Cross
0c18d451d2 Merge "Revert "Use PathForSource instead of PathsForSource"" 2018-02-23 07:32:19 +00:00
Colin Cross
c48c14369c Revert "Move AllowMissingDependencies check from PathsForSource to PathForSource"
This reverts commit 94a321045a.

Reason for revert: Broke builds with ALLOW_MISSING_DEPENDENCIES=true

Change-Id: I9604887f796a79809ef8d6c741597796219dcaf3
2018-02-23 07:09:15 +00:00
Colin Cross
5a49e1c65e Revert "Use PathForSource instead of PathsForSource"
This reverts commit 9d37831dd3.

Reason for revert: Broke builds with ALLOW_MISSING_DEPENDENCIES=true

Change-Id: Ibff79642f747b83364c83d6b298334121028e02d
2018-02-23 07:08:43 +00:00
Treehugger Robot
1b5599e462 Merge changes If1894fd9,Id7925999,I4fe11c3f,Iea2b0781,Id2c0a503
* changes:
  Use PathForSource instead of PathsForSource
  Move AllowMissingDependencies check from PathsForSource to PathForSource
  Propagate errors out of validatePath
  Add t.Run and t.Helper to paths_test.go
  Remove unused intermediates parameter from ExistentPathForSource
2018-02-23 02:28:35 +00:00
Dan Willemsen
ab9f4268c0 Add proto.canonical_path_from_root
Historically, we've always passed '-I .' as the first argument to
protoc, essentially treating all proto file package names as their full
path in the android source tree. This would make sense in a monorepo
world, but it makes less sense when we're pulling in external projects
with established package names.

So keep the same default (for now), but allow individual builds to opt
into using local paths as the default names with
'canonical_path_from_root: false'. A cleanup effort and/or large scale
change in the future could change the default to false.

As part of this, run protoc once per input proto file, since the flags
may need to change per-file. We'll also need this in order to specify
--dependency_out in the future.

Bug: 70704330
Test: aosp/master build-aosp_arm.ninja is identical
Test: aosp/master soong/build.ninja has expected changes
Test: m
Test: Build protobuf test
Change-Id: I9d6de9fd630326bbcced1c62a4a7e9546429b0ce
2018-02-22 16:48:35 -08:00
Colin Cross
336ad7a667 Fix java_import and android_library_import conversions
java_import and android_library_import modules can't be handled
directly in androidmk because the results may depend on properties
that haven't been parsed yet.  Add a bpfix pass (which is
automatically included at the end of androidmk) to select
android_library_import vs. java_import based on the extension
of the prebuilt file, and convert the srcs property to jars or aars
as appropriate.

Bug: 73724997
Test: androidmk_test.go
Change-Id: I1024742e9e96d5e1e88c3cc139eeb0d5a2f6849b
2018-02-22 14:54:47 -08:00
Colin Cross
3fad895e75 Don't pretend *parser.List is immutable
The functions in bpfix that take a *parser.List and return a
modified *parser.List are always returning the same pointer
and mutating the target of the pointer.  Remove the extra
unnecessary return value.

Also extract the getLiteralListProperty function.

Test: androidmk_test.go
Change-Id: I08d8aff955c72b7916741cda8083974a49af4d6f
2018-02-22 14:54:47 -08:00
Colin Cross
fabb608b27 Soong AAR prebuilt support
Add support for android_library_import modules that take an
aar file.

Bug: 73724997
Test: m checkbuild
Change-Id: I670b56f0a3b7501d9478a6064a04d0cb9c1bb611
2018-02-22 14:54:47 -08:00
Colin Cross
9d37831dd3 Use PathForSource instead of PathsForSource
PathForSource does the AllowMissingDependencies check now, use it
instead of PathsForSource.

Test: m checkbuild
Change-Id: If1894fd98d8d757ebc3c1635d5fcea86f81bfc4a
2018-02-22 14:43:36 -08:00
Colin Cross
94a321045a Move AllowMissingDependencies check from PathsForSource to PathForSource
PathsForSource was handling the AllowMissingDependencies case, but
PathForSource was not.  Refactor PathForSource and
ExistentPathForSource, and add logic to PathForSource to fall back
to behavior similar to ExistentPathForSource when
AllowMissingDependencies is set.

Test: paths_test.go
Change-Id: Id7925999a27ea75a05e9301bbf1eb9f9a6bc4652
2018-02-22 14:43:36 -08:00
Colin Cross
1ccfcc36bd Propagate errors out of validatePath
The next patch will need to more complicated custom error handling,
so make validatePath return an error and let the caller handle it.

Test: paths_test.go
Change-Id: I4fe11c3f319303d779596709f4819e828b5bdb9b
2018-02-22 14:43:36 -08:00
Colin Cross
dc75ae70f3 Add t.Run and t.Helper to paths_test.go
Test: paths_test.go
Change-Id: Iea2b07815fe82a346c5384571ebc2b57538722cc
2018-02-22 14:43:36 -08:00
Colin Cross
32f3898f0b Remove unused intermediates parameter from ExistentPathForSource
Test: m checkbuild
Change-Id: Id2c0a5039c2ec3b3795385c135ffec022ccd691e
2018-02-22 14:43:36 -08:00
Colin Cross
9ca6942956 Add aapt includes for prebuilt SDK jars
Add -I arguments to the aapt link command line if sdk_version is
set to a numbered SDK prebuilt jar.

Test: m checkbuild
Change-Id: Ieeadf84bc131ba94e0e4ee1b9eec7d1e80b31b19
2018-02-22 14:36:24 -08:00
Treehugger Robot
2f2f24f775 Merge "Only depend on a single file for generated headers" 2018-02-22 22:18:56 +00:00
Nan Zhang
581fd21e91 Droiddoc Support in Soong
Support Droiddoc to Soong based on core/droiddoc.mk. The non-std doclet
based droiddoc compilation output is a "real" stubs.jar instead of a
directory of java files and a timestamp file.

The std doclet based javadoc compilation output is a "empty" stubs.jar
instead of a timestamp file.

The stubs.jar will be exported to
out/target/common/obj/JAVA_LIBRARIES/$(LOCAL_MODULE)_intermediates/classes.jar
and out/target/common/docs/$(LOCAL_MODULE)-stubs.jar

A $(LOCAL_MODULE).zip file will be generated also, and is exported to
out/target/common/docs/$(LOCAL_MODULE)-docs.zip if property: installable is not set
to false.

Bug: b/70351683
Test: unittest + convert libcore docs Android.mk to Soong manually.

Change-Id: I1cffddd138a5d9d445f86a3d4a3fd4de88a2bc0f
(cherry picked from commit 78188ec622cb1ee24171455867fc58ffab91562e)
2018-02-22 11:14:13 -08:00
Treehugger Robot
50b8682dca Merge "Fix NDK gtest name." 2018-02-22 04:05:42 +00:00
Treehugger Robot
e35ad13004 Merge "Use android.InList for inList" 2018-02-22 03:22:43 +00:00
Dan Willemsen
9da9d49ede Only depend on a single file for generated headers
While the rule may really need all of the generated header files to
exist, only one of them (per genrule task) needs to be in the dependency
list, since the rest are essentially aliases.

This brings an AOSP aosp_arm-userdebug out/soong/build.ninja file from
372MB to 156MB, with equivalent functionality. The Android-aosp_arm.mk
file is reduced from 11MB to 6.5MB.

Bug: 73745773
Test: diff out/soong/build.ninja
Test: diff out/soong/Android-aosp_arm.mk
Test: rm -rf out; m
Change-Id: If17377666292cc20957417fc4c3cd52f98971d0c
2018-02-22 02:37:01 +00:00
Treehugger Robot
431e17af07 Merge "Use __SBOX_OUT_DIR__ in sbox output file list" 2018-02-22 01:59:09 +00:00
Colin Cross
baccf5b984 Use __SBOX_OUT_DIR__ in sbox output file list
The path to the output directory may be arbitrarily long, use
__SBOX_OUT_DIR__ in the list of output files passed to sbox
to avoid expanding it multiple times in the command line.

Fixes:
ninja: fatal: posix_spawn: Argument list too long
09:40:14 ninja failed with: exit status 1
when building libchrome with a long OUT or OUT_DIR_COMMON_BASE.

Bug: 73726635
Test: m checkbuild
Change-Id: I59024b2164287c8e531711afd9273b692ce9c28a
2018-02-21 14:55:34 -08:00
Dan Albert
7dd5899087 Fix NDK gtest name.
Test: make checkbuild
Bug: 73087488
Change-Id: I048da296d8000cd1c86a5174ff7864aed271f00c
2018-02-21 22:54:18 +00:00
Colin Cross
0d0ba59ec3 Use android.InList for inList
Remove duplicate implementations of inList.

Test: m checkbuild
Change-Id: I6943b95f6d47e6722b9ff1ab61ab14c429fe33a0
2018-02-21 11:02:16 -08:00
Jayant Chowdhary
b49ff309a1 Merge "Start using clang-tools prebuilts for abi diffing tools." 2018-02-21 18:16:02 +00:00
Treehugger Robot
d240e3d4e2 Merge "Only emit enabled VNDK libraries" 2018-02-21 02:35:31 +00:00
Jayant Chowdhary
a4c6df5d69 Start using clang-tools prebuilts for abi diffing tools.
Bug: 72504455

Test: make -j64

Change-Id: Idbe1142e11147163d0c032fb351e9f3d5614dfb1
2018-02-20 12:44:50 -08:00
Colin Cross
52226ad920 Fix injecting data into a .o file
Use section.Offset instead of Addr.

Test: symbol_inject -i test.o -o test2.o -s symbol -v value
Change-Id: I9c54a5a245e7674b8370fc27ba7d0b9995f2ed08
2018-02-20 17:54:20 +00:00
Colin Cross
f7eac7a2ac Fix comment on how java rules handle unknown output files
Test: none
Change-Id: I985e7961c87dd145d6eb2bd94cb8bdc43becc360
2018-02-20 17:54:00 +00:00
Elliott Hughes
5789ca9f28 Use the platform -std= for sdk_version.
Bug: http://b/72571399
Test: builds
Change-Id: I294cfadb7de54b1ae648e02ac9af34ed7a7405d8
2018-02-20 15:27:45 +00:00
Treehugger Robot
f28e32a2a5 Merge "Revert "Revert "Support filegroup in exclude_srcs""" 2018-02-19 18:14:37 +00:00
Jiyong Park
4b0322265f Only emit enabled VNDK libraries
Disabled VNDK libraries (due to arch mismatch) are no longer emitted to
make variables VNDK_CORE_LIBRARIES and LLNDK_LIBRARIES

Bug: 7456955
Test: choosecombo to aosp_walleye and m -j
Find libclang_rt.ubsan_standalone-<arch>-android in VNDK_CORE_LIBRARIES.
Only aarch64 and arm are found.

Change-Id: Iaa134d07513e39390fe34a31fdfe2e327b190996
2018-02-16 22:16:29 +09:00
Yi Kong
06d1060041 Merge "Disable inlining and loop unrolling in LTO without PGO profile" 2018-02-16 02:46:36 +00:00
Nan Zhang
27e284d2b0 Revert "Revert "Support filegroup in exclude_srcs""
This reverts commit 606e9de344.

Reason for revert: <try to fix the broken build yesterday>

Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5
Test: unittest
2018-02-15 14:38:40 -08:00
Nan Zhang
2e6a4ff3be Let Soong_UI to handle build_date.txt file
Soong_UI will update timestamp to build_date.txt, and export variables
to kati/ninja.

Test: m -j32
Bug: b/70351683
Change-Id: I153897afdf2d3f39a32d757d4c3ae7515caea52d
2018-02-15 11:45:53 -08:00
Przemyslaw Szczepaniak
4b5fe9d1b4 Add rsp and srcjar support to kotlinc build rule
Rsp files are supported through helper script (gen-kotlin-build-file.sh)
that generates the kotlinc module/build xml file.

Since rsp files are supported, I've added ExtractSrcJarsCmd step
to handle srcjars extraction.

Minor reorderings to make sure that TransformKotlinToClasses
recives only .java and .kt files when called from Module.compile.

Bug: 73281388
Test: make -j hidl-doc
Change-Id: I5a40b914569018dc529903a7f2864a5aeae838e5
2018-02-14 20:47:17 +00:00
Yi Kong
7e53c57ed6 Disable inlining and loop unrolling in LTO without PGO profile
Such optimisations may significantly increase the binary size when
compiler heuristics are off. Disabling these helps cut down the
binary sizes with negligible decrease in performance, but allows us to
be more comfortable enabling LTO across various projects.

Test: m
Test: dex2oat, hwui, skia benchmark
Bug: 62839002
Change-Id: Id63e8dd295df2972f76ae4e29ee367080fff8429
2018-02-14 21:21:23 +08:00
Zhizhou Yang
51be632b95 Fix llvm-ar error caused by using lto and sanitizer together
LLVM-AR does not allow passing --plugin options more than once. The
--plugin ARFLAGS that lto want to add, may already exist if sanitizer is
also turned on.

Fixed this by adding a new bool Flags.ArGoldPlugin. Set this variable to
true whenever LLVM gold plugin is needed for ArFlags. In function
TransformObjToStaticLib(), add this option to arFlags using global value
${config.LLVMGoldPlugin} if the bool value is true.

Bug: http://b/73160350
Test: build the image with make and succeeded.

Change-Id: I62785829b0a4b663225926e4aed98defc1b6da2c
(cherry picked from commit 4917049f6e)
2018-02-14 21:21:14 +08:00
Treehugger Robot
3bb5f2f2fa Merge "Add Respfile support for soong_zip." 2018-02-14 01:04:22 +00:00
Treehugger Robot
1fd468782a Merge "Use "jar" as default type, "compile" as default scope" 2018-02-13 23:17:02 +00:00