diff --git a/android/paths.go b/android/paths.go index c5e4806cf..99d5ba7bc 100644 --- a/android/paths.go +++ b/android/paths.go @@ -1268,10 +1268,11 @@ var _ resPathProvider = SourcePath{} // PathForModuleSrc returns a Path representing the paths... under the // module's local source directory. func PathForModuleSrc(ctx ModuleMissingDepsPathContext, pathComponents ...string) Path { - p, err := validatePath(pathComponents...) - if err != nil { - reportPathError(ctx, err) - } + // Just join the components textually just to make sure that it does not corrupt a fully qualified + // module reference, e.g. if the pathComponents is "://other:foo" then using filepath.Join() or + // validatePath() will corrupt it, e.g. replace "//" with "/". If the path is not a module + // reference then it will be validated by expandOneSrcPath anyway when it calls expandOneSrcPath. + p := strings.Join(pathComponents, string(filepath.Separator)) paths, err := expandOneSrcPath(ctx, p, nil) if err != nil { if depErr, ok := err.(missingDependencyError); ok { diff --git a/android/paths_test.go b/android/paths_test.go index c0667dce2..4c18cfda0 100644 --- a/android/paths_test.go +++ b/android/paths_test.go @@ -1373,8 +1373,7 @@ func TestPathForModuleSrc(t *testing.T) { } `), errorHandler: FixtureExpectsAllErrorsToMatchAPattern([]string{ - // The message is broken because PathForModuleSrc corrupts the name during validation. - `"foo": missing dependencies: /other:b, is the property annotated with android:"path"`, + `"foo": missing dependencies: //other:b, is the property annotated with android:"path"`, `"foo": missing dependency on "//other:c", is the property annotated with android:"path"`, }), },