Commit graph

320 commits

Author SHA1 Message Date
Colin Cross
fff8ad2f35 Merge changes I5059a1e3,I5a06a893
* changes:
  Add --write_if_changed argument to soong_zip
  Add searchable android.DirectorySortedPaths
2017-11-14 23:44:25 +00:00
Colin Cross
5e6cfbead9 Add searchable android.DirectorySortedPaths
Add an android.DirectorySortedPaths that stores paths sorted such
that all paths in a directory including subdirectories are in a
contiguous subslice.  This will allow efficient O(log(N)) finding
of all paths in a directory using a binary search on the directory
prefix.

Test: TestDirectorySortedPaths in paths_test.go
Change-Id: I5a06a89351ae06e88c06526be54a6b79075361b7
2017-11-13 15:11:08 -08:00
Dan Willemsen
cbf9e827a7 Update default configuration
This isn't often used, but the values were quite old. So update them to
something closer to aosp_arm64 from today.

Bug: 68803744
Test: m clean; m --skip-make libc
Change-Id: Id5c60b62e7c7a91635dea9669fc604d63d299778
2017-11-13 14:46:44 -08:00
Colin Cross
62255a7687 Merge "Add presingletons" 2017-11-11 00:53:53 +00:00
Colin Cross
a0059915d1 Merge "Add OncePer.Get()" 2017-11-10 22:48:38 +00:00
Vishwath Mohan
1fa3ac552d CFI include/exclude path support (Soong)
This CL adds the ability to centrally enable or disable CFI for
components using either an environment or product config
variable. This is a better, nore manageable option that enabling CFI
across each component individually.

Bug: 67507323
Test: CFI_INCLUDE_PATHS= system/nfc m -j40
Test: CFI_EXCLUDE_PATHS = frameworks/av m -j40

Change-Id: I38b77946759121aec99ab25f31aaee2e5d993f73
2017-11-08 18:56:10 -08:00
Treehugger Robot
c7b8e72c91 Merge "Change bool, and string properties to *bool, and *string for cc" 2017-11-08 18:41:33 +00:00
Nan Zhang
0007d810e2 Change bool, and string properties to *bool, and *string for cc
there's no use case for prepending/appending to bool, and string
properties within module struct. Declearing "*bool" and "*string" almost
cover everything user need.

I did see one case that user specify relative_install_path as
path prefix in cc_defaults, and concatenate with the one in real module
to get the final relative install path in Android.bp <bionic/tests/libs>.

Test: m -j checkbuild
Bug: b/68853585
Change-Id: If3a7a2689c3fc307aae136af6bc9c57f27a1e1a0
2017-11-07 15:57:16 -08:00
Colin Cross
5a79c83893 Add presingletons
Plumb blueprint's presingletons through register.go.

Test: m checkbuild
Change-Id: I5bc0f311740c9220f7afdf2999e6f080f5b0c5ab
2017-11-07 13:36:44 -08:00
Colin Cross
99c6dfaecc Add OncePer.Get()
Allow functions to get the result associated with a OncePer key without
also specifiying a function.  Panics if the key has not already been
set.  Also replace the open-coded concurrent map implementation with
the new sync.Map.

Test: m checkbuild
Change-Id: I814fdb1ffffaee8398dc877af146e29638c8a6a8
2017-11-07 13:36:44 -08:00
Colin Cross
519917db89 Let LoadHooks call CreateModule
Move AppendProperties and PrependProperties into TopDownMutatorContext
so that LoadHooks can be a subset of TopDownMutatorContext that also
includes CreateModule.

Test: m checkbuild
Bug: 35570956
Change-Id: Iffa6a6aec96f08821c2446e0e0f4622ab772b54c
2017-11-07 13:08:36 -08:00
Dan Albert
f45c6934c8 Stop building MIPS ABIs for the NDK.
Test: build/soong/scripts/build-ndk-prebuilts.sh
Bug: https://github.com/android-ndk/ndk/issues/272
Change-Id: Ia8d48b1ecef5e1a3b239e2817eeed5dbe43e52ef
2017-11-03 19:38:03 +00:00
Treehugger Robot
d1dec3bd72 Merge "Revert "Revert "Make some common properties overridden when used in defaults modules""" 2017-11-02 00:10:39 +00:00
Colin Cross
7d716baedf Revert "Revert "Make some common properties overridden when used in defaults modules""
This reverts commit 5c3c768187.

This reapplies I70e45caa92f65dc6a3bc81ae33a5a8f34ad11890 along with
additional changes in other projects to match the new types.

Bug: 68337468
Test: m checkbuild
Change-Id: I2d2d876b291869f834a6468d3e2ad99148f94a15
2017-11-01 14:24:48 -07:00
Colin Cross
126a25cb3d Propagate PRODUCT_MINIMIZE_JAVA_DEBUG_INFO to soong and use it
Strip debug info in javac when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO
is set.

Test: m with PRODUCT_MINIMIZE_JAVA_DEBUG_INFO=true
Change-Id: I167e742662801291c516bf1ff826486560d22147
2017-11-01 12:51:16 -07:00
Nicolas Geoffray
5c3c768187 Revert "Make some common properties overridden when used in defaults modules"
Bug: 68337468

Breaks HOST_PREFER_32BIT=true

This reverts commit 617016a6f2.

Change-Id: Ifb20f41cdf93dbfd73a3aac5b055e595e334350b
2017-11-01 09:32:53 +00:00
Colin Cross
617016a6f2 Make some common properties overridden when used in defaults modules
Switch commonProperties to *string and *bool so that defining them
in a module correctly overrides instead of appends to values set
in defaults modules.

Bug: 68337468
Test: m checkbuild
Change-Id: I70e45caa92f65dc6a3bc81ae33a5a8f34ad11890
2017-11-01 05:28:36 +00:00
Treehugger Robot
76530ec6f7 Merge "Import AAPT-related product variables from make" 2017-10-31 23:39:24 +00:00
Colin Cross
face4e4563 Import AAPT-related product variables from make
Test: m checkbuild
Change-Id: I22113c17d240ff26652cea7df801a183343faebd
2017-10-30 17:36:41 -07:00
Treehugger Robot
7e768301b9 Merge "ModuleFactoryAdapter -> ModuleFactoryAdaptor" 2017-10-27 23:20:31 +00:00
Steven Moreland
b1448e4e0b ModuleFactoryAdapter -> ModuleFactoryAdaptor
Fixes type

Test: none
Change-Id: If1a85537243390a0e0d65b8911767288e00538c2
2017-10-27 14:46:47 -07:00
Nan Zhang
9a36418089 Use prebuilt turbine jar for unbundled javac builds.
Test: m -j
Change-Id: If2ab85f8591fe7ab275a1d4fefdd80d871f2c36d
2017-10-25 11:11:37 -07:00
Colin Cross
0617bb85c6 Fix missing source module with ALLOW_MISSING_DEPENDENCIES=true
A module referenced with srcs: ":module" was not honoring
ALLOW_MISSING_DEPENDENCIES=true.  Don't fail if the module
doesn't exist, an error will already have been produced by
ExtractSourcesDeps.

Bug: 68183622
Test: m ALLOW_MISSING_DEPENDENCIES=true
Change-Id: Id806633d12ab2ecd78b532e1922e59824e5c20a8
2017-10-24 13:05:06 -07:00
Colin Cross
d11fcda940 Convert Visit*Deps from blueprint.Module to android.Module
Also adds checks that the dependencies are android.Modules and
are not disabled.

Test: m checkbuild
Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2
2017-10-24 13:01:03 -07:00
Colin Cross
b671544973 Move first/last unique elements utility functions to android package
Move firstUniqueElements to android.FirstUniqueStrings,
lastUniqueElements to android.LastUniqueStrings, and lastUniquePaths
to android.LastUniquePaths.

Test: m checkbuild
Change-Id: Ieac840405126c7f8f98afb4a4ef35c01a18fe7fb
2017-10-24 12:12:32 -07:00
Colin Cross
ae88703df5 Move ModuleContext.ModuleBuild to ModuleContext.Build
Now that android.ModuleContext does not include blueprint.ModuleContext
we can rename android.ModuleContext.ModuleBuild to
android.ModuleContext.Build without colliding with
blueprint.ModuleContext.Build.  Leave ModuleBuild as a wrapper around
Build for now to avoid having to update all the users outside
build/soong simultaneously.

Test: m checkbuild
Change-Id: I18eb8cc04faf002049a11d9aac97e9732ff5d638
2017-10-24 10:59:00 -07:00
Colin Cross
3f68a1362b Make android.ModuleContext not include blueprint.ModuleContext
android.ModuleContext should replace the blueprint.ModuleContext
methods with ones that take android.Module parameters instead of
blueprint.Module parameters.  As a first step, don't include
blueprint.ModuleContext in android.ModuleContext and manually
specify the methods from blueprint.ModuleContext that we need.
Future patches will replace these methods with ones that take
android.* types.  Also do the same for TopDownMutatorContext.

Test: m checkbuild
Change-Id: If11c298eed98bc65712b4942d0283cafa058726c
2017-10-24 10:58:59 -07:00
Colin Cross
0d3f8c0db6 Use prebuilt dx for PDK builds
The source for dx may not be available in PDK builds, use the
prebuilt one from prebuilts/build-tools instead.

Bug: 67663308
Test: m TARGET_BUILD_PDK=true
Change-Id: I9090b5190539f901fc05264a472133c12d4ea2a1
2017-10-24 10:52:26 -07:00
Nan Zhang
ed19fc3e2c Support Turbine in Soong.
If sdk jars(android_stubs_current, etc) are compiled using soong java
modules, we have to filter them when running Java build with Turbine.

TODO: provide more unit-tests.

Test: m clean && m -j32; go test java_test

Change-Id: Iad7c241b0e8b0ca760950733f513124b56c84564
2017-10-20 16:26:18 -07:00
Alan Leung
9e07394fd0 Merge "Add D8 support" 2017-10-20 18:59:22 +00:00
Alan Leung
1d476fcbeb Add D8 support
Bug: 67754178
Test: m -j32 checkbuild && USE_D8=true m -j32 checkbuild

Change-Id: If63afc10ceb5e753bbb7f195bb8a895eaef10775
2017-10-19 16:27:42 -07:00
Colin Cross
702e0f8ab0 Use full relative paths to get module outputs in tests
Make Rel() on ModuleOutPath and ModuleGenPath return the path
relative to the module out and module gen directories respectively,
and make TestingModule.Output() match against the full relative
path to the module.

Test: java_test.go still passes
Change-Id: Id5b2ec3fdef41d4169b943e68d032fc64a2b6f92
2017-10-19 20:44:11 +00:00
Jeff Gaston
294356f045 Automatically reorder C/C++ link dependencies in Soong
This uses knowledge of transitive dependencies to reorder
linker command line arguments such that if module A depends
on module B, then module A is automatically listed before
module B in the linker command line.

This should mostly remove the need for Android.bp files to
list all of their static dependencies in link order

Bug: 66260943
Test: reorder the entries of static_libs in an Android.bp and see that linking still succeeds

Change-Id: I20f851ab9f2f30031254e4f30023b6140d15d6c3
2017-10-18 14:30:05 -07:00
Jeff Gaston
af3cc2d23c Some clarifications in preparation to automatically order linker dependencies
Test: Browse the code and determine whether it's easier to understand
Bug: 66260943
Change-Id: I88c24a8a31ef68f428919087d206433659265684
2017-10-18 18:06:02 +00:00
Colin Cross
99967a7b34 Allow arch-specific modules to be disabled in the PDK
Modules may need to be disabled in the PDK for the device but not
the host.

Test: m checkbuild
Change-Id: Ie40555d1437d9f36ceec753884dc4045132998eb
2017-10-17 16:25:26 -07:00
Colin Cross
93e8595044 Initial kotlin support
Allow java libraries to specify .kt sources, precompile them with
kotlin, and then pass them in the classpath to javac.

Bug: 65219535
Test: java_test.go
Change-Id: Ife22b6ef82ced9ec26a9e5392b2dadacbb16546f
2017-10-17 16:25:22 -07:00
Colin Cross
1369cdb280 Initial support for converting jars to java9 system modules
Adds a java_system_modules module type that (when
EXPERIMENTAL_USE_OPENJDK9 is set to true) converts a list of
java library modules and prebuilt jars into system modules,
and plumbs the system modules through to the javac command
line.

Also exports the location of the system modules to make
variables, as well as the name of the default system module.

Test: TestClasspath in java_test.go, runs automatically as part of the build
Bug: 63986449
Change-Id: I27bd5d2010092422a27b69c91568e49010e02f40
2017-10-16 15:00:02 -07:00
Jiyong Park
6a43f04777 Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.

However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume

cc_library {
    name: "libfoo",
    srcs: ["foo.c"],
    target: {
        vendor: {
            srcs: ["bar.c"],
        },
    },
}

Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o

So, bar.o is included twice and this causes multiple symbol definition
error.

In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.

Bug: 67731122
Test: build
Test: cc_test.go

Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-13 14:36:12 +09:00
Colin Cross
6ccbc913e4 Let tests override environment
Pass an environment to TestConfig that will be used for
all Config.Getenv calls.

Test: none
Change-Id: I683cd9c9e0db61c9bfd2adb27fca78f558f225c4
2017-10-10 23:28:43 -07:00
Colin Cross
92430106c3 Add hostdex support
If hostdex: true is specified for a java library, create an extra
Make module that copies the dex jar to a module with a -hostdex
suffix in the host output directory.

Bug: 67600882
Test: m -j checkbuild
Change-Id: I859dfaabeefdca714b566de94e00f74e03c85939
2017-10-10 08:02:20 -07:00
Colin Cross
05a39cbacc Fix mixing genrule dependencies with globs
Putting a genrule dependency after a glob in a srcs property
was causing the generated files to be treated as globbed files
and hitting an interface conversion panic.

Bug: 67364649
Test: TestGeneratedSources in later patch
Change-Id: I8a076c9998fdd07e53769922be433a793ca575a9
2017-10-09 15:35:47 -07:00
Dan Willemsen
9d93e33b1e Merge "Add target.linux for linux kernel based targets" 2017-10-06 19:43:34 +00:00
Jeff Gaston
60e38b613f Merge "Revert "Some clarifications in preparation to automatically order linker dependencies"" 2017-10-04 21:09:29 +00:00
Jeff Gaston
7b6118be6b Revert "Some clarifications in preparation to automatically order linker dependencies"
This reverts commit 2370af0e23.

Reason for revert: New Build Breakage: aosp-master/aosp_arm64_ab-userdebug @ 4376965

Change-Id: Ibe4b819c4292457c454bf42e6d94fba3071ec04b
2017-10-04 21:07:42 +00:00
Jeff Gaston
2ade0243ae Merge "Some clarifications in preparation to automatically order linker dependencies" 2017-10-04 17:45:40 +00:00
Jeff Gaston
2370af0e23 Some clarifications in preparation to automatically order linker dependencies
Test: Browse the code and determine whether it's easier to understand
Bug: 66260943
Change-Id: Ia3fdb8f38e83ad8225a72c8de2804db23a90ef9b
2017-10-03 17:18:01 -07:00
Colin Cross
19ab372dd8 Merge "Add support for .proto files in java modules" 2017-10-03 23:02:51 +00:00
Dan Willemsen
86fc1ebac3 Add target.linux for linux kernel based targets
This includes android, linux_bionic, and linux_glibc currently.

Test: m nothing
Change-Id: I088eab583eee695c1f61a65a79a302837e5f4577
2017-10-03 14:44:06 -07:00
Dan Willemsen
5746bd481e Remove target.linux
Once this is submitted and we don't have any more references to
target.linux, it can be added back as a common target for all
linux-kernel based targets.

Test: m nothing
Change-Id: Iae5e82eaed65f58950115f21530ae04afd0602b9
2017-10-03 19:44:54 +00:00
Colin Cross
6af17aa022 Add support for .proto files in java modules
Test: m -j checkbuild
Change-Id: Ia03429948baebff85164a91a34507866c97a08ef
2017-10-03 10:25:15 -07:00