diff options
| author | 2019-12-23 13:32:08 +0000 | |
|---|---|---|
| committer | 2019-12-23 13:32:08 +0000 | |
| commit | e2bc36f12c6b4237ac1cc94f7ad7ba78737a5132 (patch) | |
| tree | 66771d84404c3c1b9b03d2605e597d6a5b240d68 /sdk/testing.go | |
| parent | 97e7279cc6ffaf707f03d0548392861e33034f98 (diff) | |
| parent | 9b478b083197297f7a08b795e1d392aa12d1c493 (diff) | |
Merge "Generate .srcjar for prebuilt_stubs_sources"
Diffstat (limited to 'sdk/testing.go')
| -rw-r--r-- | sdk/testing.go | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/sdk/testing.go b/sdk/testing.go index 950cf0a71..c0d6f51ab 100644 --- a/sdk/testing.go +++ b/sdk/testing.go @@ -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. |