Fix Rel() after ReplaceExtension or InSameDir
am: 2cdd5df7cc
Change-Id: I4b68b5c68ddcdcac80ff5d775296dd55f70349ba
This commit is contained in:
@@ -712,7 +712,7 @@ func (p OutputPath) ReplaceExtension(ctx PathContext, ext string) OutputPath {
|
|||||||
reportPathErrorf(ctx, "extension %q cannot contain /", ext)
|
reportPathErrorf(ctx, "extension %q cannot contain /", ext)
|
||||||
}
|
}
|
||||||
ret := PathForOutput(ctx, pathtools.ReplaceExtension(p.path, ext))
|
ret := PathForOutput(ctx, pathtools.ReplaceExtension(p.path, ext))
|
||||||
ret.rel = p.rel
|
ret.rel = pathtools.ReplaceExtension(p.rel, ext)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,7 +724,7 @@ func (p OutputPath) InSameDir(ctx PathContext, paths ...string) OutputPath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret := PathForOutput(ctx, filepath.Dir(p.path), path)
|
ret := PathForOutput(ctx, filepath.Dir(p.path), path)
|
||||||
ret.rel = p.rel
|
ret.rel = filepath.Join(filepath.Dir(p.rel), path)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -696,22 +696,26 @@ func ExampleOutputPath_ReplaceExtension() {
|
|||||||
ctx := &configErrorWrapper{
|
ctx := &configErrorWrapper{
|
||||||
config: TestConfig("out", nil),
|
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")
|
p2 := p.ReplaceExtension(ctx, "oat")
|
||||||
fmt.Println(p, p2)
|
fmt.Println(p, p2)
|
||||||
|
fmt.Println(p.Rel(), p2.Rel())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// out/system/framework/boot.art out/system/framework/boot.oat
|
// out/system/framework/boot.art out/system/framework/boot.oat
|
||||||
|
// boot.art boot.oat
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleOutputPath_FileInSameDir() {
|
func ExampleOutputPath_FileInSameDir() {
|
||||||
ctx := &configErrorWrapper{
|
ctx := &configErrorWrapper{
|
||||||
config: TestConfig("out", nil),
|
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")
|
p2 := p.InSameDir(ctx, "oat", "arm", "boot.vdex")
|
||||||
fmt.Println(p, p2)
|
fmt.Println(p, p2)
|
||||||
|
fmt.Println(p.Rel(), p2.Rel())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// out/system/framework/boot.art out/system/framework/oat/arm/boot.vdex
|
// 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"},
|
{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())
|
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"},
|
{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())
|
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"},
|
{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())
|
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] {
|
for _, target := range ctx.Config().Targets[android.Android] {
|
||||||
images[target.Arch.ArchType] = dir.Join(ctx,
|
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{
|
return bootImageConfig{
|
||||||
|
Reference in New Issue
Block a user