Fix Rel() after ReplaceExtension or InSameDir am: 2cdd5df7cc
am: 54466adccc
am: ea72c068c3
Change-Id: I0292ca0c18a2f57619402bc648f4f8ec244eba7d
This commit is contained in:
commit
b66f1b0faf
4 changed files with 12 additions and 8 deletions
|
@ -712,7 +712,7 @@ func (p OutputPath) ReplaceExtension(ctx PathContext, ext string) OutputPath {
|
|||
reportPathErrorf(ctx, "extension %q cannot contain /", ext)
|
||||
}
|
||||
ret := PathForOutput(ctx, pathtools.ReplaceExtension(p.path, ext))
|
||||
ret.rel = p.rel
|
||||
ret.rel = pathtools.ReplaceExtension(p.rel, ext)
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ func (p OutputPath) InSameDir(ctx PathContext, paths ...string) OutputPath {
|
|||
}
|
||||
|
||||
ret := PathForOutput(ctx, filepath.Dir(p.path), path)
|
||||
ret.rel = p.rel
|
||||
ret.rel = filepath.Join(filepath.Dir(p.rel), path)
|
||||
return ret
|
||||
}
|
||||
|
||||
|
|
|
@ -696,22 +696,26 @@ func ExampleOutputPath_ReplaceExtension() {
|
|||
ctx := &configErrorWrapper{
|
||||
config: TestConfig("out", nil),
|
||||
}
|
||||
p := PathForOutput(ctx, "system/framework/boot.art")
|
||||
p := PathForOutput(ctx, "system/framework").Join(ctx, "boot.art")
|
||||
p2 := p.ReplaceExtension(ctx, "oat")
|
||||
fmt.Println(p, p2)
|
||||
fmt.Println(p.Rel(), p2.Rel())
|
||||
|
||||
// Output:
|
||||
// out/system/framework/boot.art out/system/framework/boot.oat
|
||||
// boot.art boot.oat
|
||||
}
|
||||
|
||||
func ExampleOutputPath_FileInSameDir() {
|
||||
ctx := &configErrorWrapper{
|
||||
config: TestConfig("out", nil),
|
||||
}
|
||||
p := PathForOutput(ctx, "system/framework/boot.art")
|
||||
p := PathForOutput(ctx, "system/framework").Join(ctx, "boot.art")
|
||||
p2 := p.InSameDir(ctx, "oat", "arm", "boot.vdex")
|
||||
fmt.Println(p, p2)
|
||||
fmt.Println(p.Rel(), p2.Rel())
|
||||
|
||||
// Output:
|
||||
// out/system/framework/boot.art out/system/framework/oat/arm/boot.vdex
|
||||
// boot.art oat/arm/boot.vdex
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ func TestDexPreopt(t *testing.T) {
|
|||
{android.PathForOutput(ctx, "test/oat/arm/package.vdex"), "/system/app/test/oat/arm/test.vdex"},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(rule.Installs(), wantInstalls) {
|
||||
if rule.Installs().String() != wantInstalls.String() {
|
||||
t.Errorf("\nwant installs:\n %v\ngot:\n %v", wantInstalls, rule.Installs())
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ func TestDexPreoptSystemOther(t *testing.T) {
|
|||
{android.PathForOutput(ctx, "test/oat/arm/package.vdex"), "/system_other/app/test/oat/arm/test.vdex"},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(rule.Installs(), wantInstalls) {
|
||||
if rule.Installs().String() != wantInstalls.String() {
|
||||
t.Errorf("\nwant installs:\n %v\ngot:\n %v", wantInstalls, rule.Installs())
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ func TestDexPreoptProfile(t *testing.T) {
|
|||
{android.PathForOutput(ctx, "test/oat/arm/package.vdex"), "/system/app/test/oat/arm/test.vdex"},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(rule.Installs(), wantInstalls) {
|
||||
if rule.Installs().String() != wantInstalls.String() {
|
||||
t.Errorf("\nwant installs:\n %v\ngot:\n %v", wantInstalls, rule.Installs())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
|
|||
|
||||
for _, target := range ctx.Config().Targets[android.Android] {
|
||||
images[target.Arch.ArchType] = dir.Join(ctx,
|
||||
"system/framework", target.Arch.ArchType.String(), "boot.art")
|
||||
"system/framework", target.Arch.ArchType.String()).Join(ctx, "boot.art")
|
||||
}
|
||||
|
||||
return bootImageConfig{
|
||||
|
|
Loading…
Reference in a new issue