Loading android/package_ctx.go +1 −1 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ func (p PackageContext) PrefixedExistentPathsForSourcesVariable( return p.VariableFunc(name, func(config Config) (string, error) { ctx := &configErrorWrapper{p, config, []error{}} paths := ExistentPathsForSources(ctx, "", paths) paths := ExistentPathsForSources(ctx, paths) if len(ctx.errors) > 0 { return "", ctx.errors[0] } Loading android/paths.go +5 −11 Original line number Diff line number Diff line Loading @@ -191,9 +191,8 @@ func PathsForSource(ctx PathContext, paths []string) Paths { if ctx.Config().AllowMissingDependencies() { if modCtx, ok := ctx.(ModuleContext); ok { ret := make(Paths, 0, len(paths)) intermediates := pathForModule(modCtx).withRel("missing") for _, path := range paths { p := ExistentPathForSource(ctx, intermediates.String(), path) p := ExistentPathForSource(ctx, path) if p.Valid() { ret = append(ret, p.Path()) } else { Loading @@ -213,10 +212,10 @@ func PathsForSource(ctx PathContext, paths []string) Paths { // ExistentPathsForSources returns a list of Paths rooted from SrcDir that are // found in the tree. If any are not found, they are omitted from the list, // and dependencies are added so that we're re-run when they are added. func ExistentPathsForSources(ctx PathContext, intermediates string, paths []string) Paths { func ExistentPathsForSources(ctx PathContext, paths []string) Paths { ret := make(Paths, 0, len(paths)) for _, path := range paths { p := ExistentPathForSource(ctx, intermediates, path) p := ExistentPathForSource(ctx, path) if p.Valid() { ret = append(ret, p.Path()) } Loading Loading @@ -531,12 +530,7 @@ func PathForSource(ctx PathContext, pathComponents ...string) SourcePath { // ExistentPathForSource returns an OptionalPath with the SourcePath if the // path exists, or an empty OptionalPath if it doesn't exist. Dependencies are added // so that the ninja file will be regenerated if the state of the path changes. func ExistentPathForSource(ctx PathContext, intermediates string, pathComponents ...string) OptionalPath { if len(pathComponents) == 0 { // For when someone forgets the 'intermediates' argument panic("Missing path(s)") } func ExistentPathForSource(ctx PathContext, pathComponents ...string) OptionalPath { p := validatePath(ctx, pathComponents...) path := SourcePath{basePath{p, ctx.Config(), ""}} Loading Loading @@ -765,7 +759,7 @@ func PathForVndkRefAbiDump(ctx ModuleContext, version, fileName string, vndkOrNd } refDumpFileStr := "prebuilts/abi-dumps/" + vndkOrNdkDir + "/" + version + "/" + archName + "/" + sourceOrBinaryDir + "/" + fileName + ext return ExistentPathForSource(ctx, "", refDumpFileStr) return ExistentPathForSource(ctx, refDumpFileStr) } // PathForModuleOut returns a Path representing the paths... under the module's Loading cc/pgo.go +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ func (props *PgoProperties) addProfileGatherFlags(ctx ModuleContext, flags Flags func (props *PgoProperties) getPgoProfileFile(ctx BaseModuleContext) android.OptionalPath { // Test if the profile_file is present in any of the PGO profile projects for _, profileProject := range getPgoProfileProjects(ctx.DeviceConfig()) { path := android.ExistentPathForSource(ctx, "", profileProject, *props.Pgo.Profile_file) path := android.ExistentPathForSource(ctx, profileProject, *props.Pgo.Profile_file) if path.Valid() { return path } Loading java/java.go +3 −3 Original line number Diff line number Diff line Loading @@ -371,8 +371,8 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep { jar = filepath.Join(dir, "core.jar") } aidl := filepath.Join(dir, "framework.aidl") jarPath := android.ExistentPathForSource(ctx, "sdkdir", jar) aidlPath := android.ExistentPathForSource(ctx, "sdkdir", aidl) jarPath := android.ExistentPathForSource(ctx, jar) aidlPath := android.ExistentPathForSource(ctx, aidl) if (!jarPath.Valid() || !aidlPath.Valid()) && ctx.Config().AllowMissingDependencies() { return sdkDep{ Loading Loading @@ -530,7 +530,7 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt flags = append(flags, android.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I")) flags = append(flags, android.JoinWithPrefix(aidlIncludes.Strings(), "-I")) flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String()) if src := android.ExistentPathForSource(ctx, "", ctx.ModuleDir(), "src"); src.Valid() { if src := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "src"); src.Valid() { flags = append(flags, "-I"+src.String()) } Loading Loading
android/package_ctx.go +1 −1 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ func (p PackageContext) PrefixedExistentPathsForSourcesVariable( return p.VariableFunc(name, func(config Config) (string, error) { ctx := &configErrorWrapper{p, config, []error{}} paths := ExistentPathsForSources(ctx, "", paths) paths := ExistentPathsForSources(ctx, paths) if len(ctx.errors) > 0 { return "", ctx.errors[0] } Loading
android/paths.go +5 −11 Original line number Diff line number Diff line Loading @@ -191,9 +191,8 @@ func PathsForSource(ctx PathContext, paths []string) Paths { if ctx.Config().AllowMissingDependencies() { if modCtx, ok := ctx.(ModuleContext); ok { ret := make(Paths, 0, len(paths)) intermediates := pathForModule(modCtx).withRel("missing") for _, path := range paths { p := ExistentPathForSource(ctx, intermediates.String(), path) p := ExistentPathForSource(ctx, path) if p.Valid() { ret = append(ret, p.Path()) } else { Loading @@ -213,10 +212,10 @@ func PathsForSource(ctx PathContext, paths []string) Paths { // ExistentPathsForSources returns a list of Paths rooted from SrcDir that are // found in the tree. If any are not found, they are omitted from the list, // and dependencies are added so that we're re-run when they are added. func ExistentPathsForSources(ctx PathContext, intermediates string, paths []string) Paths { func ExistentPathsForSources(ctx PathContext, paths []string) Paths { ret := make(Paths, 0, len(paths)) for _, path := range paths { p := ExistentPathForSource(ctx, intermediates, path) p := ExistentPathForSource(ctx, path) if p.Valid() { ret = append(ret, p.Path()) } Loading Loading @@ -531,12 +530,7 @@ func PathForSource(ctx PathContext, pathComponents ...string) SourcePath { // ExistentPathForSource returns an OptionalPath with the SourcePath if the // path exists, or an empty OptionalPath if it doesn't exist. Dependencies are added // so that the ninja file will be regenerated if the state of the path changes. func ExistentPathForSource(ctx PathContext, intermediates string, pathComponents ...string) OptionalPath { if len(pathComponents) == 0 { // For when someone forgets the 'intermediates' argument panic("Missing path(s)") } func ExistentPathForSource(ctx PathContext, pathComponents ...string) OptionalPath { p := validatePath(ctx, pathComponents...) path := SourcePath{basePath{p, ctx.Config(), ""}} Loading Loading @@ -765,7 +759,7 @@ func PathForVndkRefAbiDump(ctx ModuleContext, version, fileName string, vndkOrNd } refDumpFileStr := "prebuilts/abi-dumps/" + vndkOrNdkDir + "/" + version + "/" + archName + "/" + sourceOrBinaryDir + "/" + fileName + ext return ExistentPathForSource(ctx, "", refDumpFileStr) return ExistentPathForSource(ctx, refDumpFileStr) } // PathForModuleOut returns a Path representing the paths... under the module's Loading
cc/pgo.go +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ func (props *PgoProperties) addProfileGatherFlags(ctx ModuleContext, flags Flags func (props *PgoProperties) getPgoProfileFile(ctx BaseModuleContext) android.OptionalPath { // Test if the profile_file is present in any of the PGO profile projects for _, profileProject := range getPgoProfileProjects(ctx.DeviceConfig()) { path := android.ExistentPathForSource(ctx, "", profileProject, *props.Pgo.Profile_file) path := android.ExistentPathForSource(ctx, profileProject, *props.Pgo.Profile_file) if path.Valid() { return path } Loading
java/java.go +3 −3 Original line number Diff line number Diff line Loading @@ -371,8 +371,8 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep { jar = filepath.Join(dir, "core.jar") } aidl := filepath.Join(dir, "framework.aidl") jarPath := android.ExistentPathForSource(ctx, "sdkdir", jar) aidlPath := android.ExistentPathForSource(ctx, "sdkdir", aidl) jarPath := android.ExistentPathForSource(ctx, jar) aidlPath := android.ExistentPathForSource(ctx, aidl) if (!jarPath.Valid() || !aidlPath.Valid()) && ctx.Config().AllowMissingDependencies() { return sdkDep{ Loading Loading @@ -530,7 +530,7 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt flags = append(flags, android.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I")) flags = append(flags, android.JoinWithPrefix(aidlIncludes.Strings(), "-I")) flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String()) if src := android.ExistentPathForSource(ctx, "", ctx.ModuleDir(), "src"); src.Valid() { if src := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "src"); src.Valid() { flags = append(flags, "-I"+src.String()) } Loading