Merge "Generate .srcjar for prebuilt_stubs_sources"

This commit is contained in:
Paul Duffin
2019-12-23 13:32:08 +00:00
committed by Gerrit Code Review
5 changed files with 102 additions and 37 deletions

View File

@@ -183,7 +183,7 @@ func (r *testSdkResult) getSdkSnapshotBuildInfo(sdk *sdk) *snapshotBuildInfo {
switch bp.Rule.String() {
case android.Cp.String():
// Get source relative to build directory.
src := r.pathRelativeToBuildDir(bp.Input)
src := android.NormalizePathForTesting(bp.Input)
// Get destination relative to the snapshot root
dest := bp.Output.Rel()
_, _ = fmt.Fprintf(copyRules, "%s -> %s\n", src, dest)
@@ -199,12 +199,12 @@ func (r *testSdkResult) getSdkSnapshotBuildInfo(sdk *sdk) *snapshotBuildInfo {
// This could be an intermediate zip file and not the actual output zip.
// In that case this will be overridden when the rule to merge the zips
// is processed.
info.outputZip = r.pathRelativeToBuildDir(bp.Output)
info.outputZip = android.NormalizePathForTesting(bp.Output)
case mergeZips.String():
// Copy the current outputZip to the intermediateZip.
info.intermediateZip = info.outputZip
mergeInput := r.pathRelativeToBuildDir(bp.Input)
mergeInput := android.NormalizePathForTesting(bp.Input)
if info.intermediateZip != mergeInput {
r.t.Errorf("Expected intermediate zip %s to be an input to merge zips but found %s instead",
info.intermediateZip, mergeInput)
@@ -212,10 +212,10 @@ func (r *testSdkResult) getSdkSnapshotBuildInfo(sdk *sdk) *snapshotBuildInfo {
// Override output zip (which was actually the intermediate zip file) with the actual
// output zip.
info.outputZip = r.pathRelativeToBuildDir(bp.Output)
info.outputZip = android.NormalizePathForTesting(bp.Output)
// Save the zips to be merged into the intermediate zip.
info.mergeZips = r.pathsRelativeToBuildDir(bp.Inputs)
info.mergeZips = android.NormalizePathsForTesting(bp.Inputs)
}
}
@@ -232,19 +232,6 @@ func (r *testSdkResult) ModuleForTests(name string, variant string) android.Test
return r.ctx.ModuleForTests(name, variant)
}
func (r *testSdkResult) pathRelativeToBuildDir(path android.Path) string {
buildDir := filepath.Clean(r.config.BuildDir()) + "/"
return strings.TrimPrefix(filepath.Clean(path.String()), buildDir)
}
func (r *testSdkResult) pathsRelativeToBuildDir(paths android.Paths) []string {
var result []string
for _, path := range paths {
result = append(result, r.pathRelativeToBuildDir(path))
}
return result
}
// Check the snapshot build rules.
//
// Takes a list of functions which check different facets of the snapshot build rules.