Generate .srcjar for prebuilt_stubs_sources

Changes prebuilt_stubs_sources to generate a .srcjar from its input
instead of just exposing the srcs it is given. This ensures that it can
be used as a drop in replacement for a droidstubs module.

Updates the test for prebuilt_stubs_sources to be more representative
of the actual use made of it by sdk snapshot which outputs a directory
not a glob pattern. Added some documentation of the
prebuilts_stubs_sources srcs property to make it clear that it is
supposed to be a set of directories.

Extracts common code from sdk/testing.go for normalizing path/paths
for testing.

Bug: 143678475
Test: m conscrypt-module-sdk conscrypt-module-host-sdk conscrypt-module-test-sdk
      unzip those in place of external/conscrypt
	  build core-current-stubs-source which expects it to provide a .srcjar.
Change-Id: I8204a022557a9b0b45e19eac79ecba98ff95213d
This commit is contained in:
Paul Duffin
2019-12-10 13:41:51 +00:00
parent 120d73fe4f
commit 9b478b0831
5 changed files with 102 additions and 37 deletions

View File

@@ -118,6 +118,9 @@ type Path interface {
type WritablePath interface {
Path
// return the path to the build directory.
buildDir() string
// the writablePath method doesn't directly do anything,
// but it allows a struct to distinguish between whether or not it implements the WritablePath interface
writablePath()
@@ -848,7 +851,12 @@ func (p OutputPath) WithoutRel() OutputPath {
return p
}
func (p OutputPath) buildDir() string {
return p.config.buildDir
}
var _ Path = OutputPath{}
var _ WritablePath = OutputPath{}
// PathForOutput joins the provided paths and returns an OutputPath that is
// validated to not escape the build dir.
@@ -1151,6 +1159,13 @@ type InstallPath struct {
baseDir string // "../" for Make paths to convert "out/soong" to "out", "" for Soong paths
}
func (p InstallPath) buildDir() string {
return p.config.buildDir
}
var _ Path = InstallPath{}
var _ WritablePath = InstallPath{}
func (p InstallPath) writablePath() {}
func (p InstallPath) String() string {
@@ -1302,6 +1317,10 @@ type PhonyPath struct {
func (p PhonyPath) writablePath() {}
func (p PhonyPath) buildDir() string {
return p.config.buildDir
}
var _ Path = PhonyPath{}
var _ WritablePath = PhonyPath{}