Integrate the Android SDK, android-library

Review Request #2528 - Created July 24, 2015 and submitted

Information
Mateo Rodriguez
pants
split2
1866
bc5661e...
Reviewers
pants-reviews
jsirois, patricklaw, zundel

This is the 2nd part of splitting up #2040. This follows up
on #2467 (adding unpack_libraries task and android_library).
This adds the google and android m2 repos from the SDK into
ivysettings.xml.

AndroidLibraries are unpacked once per artifact in UnpackLibraries.
The unpack .class files are packed into the android_binary's
classes.dex file. The android_library BUILD files allow for
include/exclude patterns, those patterns are filtered against
during the repack in DxCompile. This allows us several advantages:

  • each artifact is unpacked only once, no matter how many
    dependees or include patterns
  • therefore each class file has a static path, so duplicate
    class files (allowed in the build but illegal to pass to
    dx tool) are easily detected
  • Version conflicts are detected by class name(which is how it
    is done within the dx tool) and can raise a useful exception.

Processing the resources in AaptGen is moved off of the
codegen backend. The gentarget for AaptGen is the
AndroidBinary. Each android_library in the transitive
closure needs to be compiled against the binary's target_sdk.
Libraries are passed to the aapt tool once for every SDK
version they support.

This also adds lots of testing for big parts of the android
pipeline and a couple of new example projects to show the
new functionality.

Problems/Followups

  • Duplicated code in UnpackJars and UnpackLibraries, including
    fingerprint handling. Pulling up an Unpack base class or refactor
    to FileUtil or something (this includes Fingerprint strategy)
  • No invalidation framework for aapt_gen yet. It doesn't currently
    distinguish between libraries that need to be processed by
    multiple SDKs.

References #1390
References #10

Travis passed

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
John Sirois
John Sirois
John Sirois
Mateo Rodriguez
John Sirois
Mateo Rodriguez
John Sirois
Mateo Rodriguez
John Sirois
John Sirois
Mateo Rodriguez
Mateo Rodriguez
Review request changed

Status: Closed (submitted)

Loading...