Skip to content

Commit c40beca

Browse files
committed
Sligthly improved WarnAboutArchIncompatibleLibraries
1 parent f06377e commit c40beca

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

warn_about_arch_incompatible_libraries.go

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,19 @@ func (s *WarnAboutArchIncompatibleLibraries) Run(ctx *types.Context) error {
4848
buildProperties := ctx.BuildProperties
4949
logger := ctx.GetLogger()
5050

51-
archs := []string{}
52-
archs = append(archs, targetPlatform.Platform.Architecture)
53-
54-
if buildProperties[constants.BUILD_PROPERTIES_ARCH_OVERRIDE_CHECK] != constants.EMPTY_STRING {
55-
overrides := strings.Split(buildProperties[constants.BUILD_PROPERTIES_ARCH_OVERRIDE_CHECK], ",")
56-
for _, override := range overrides {
57-
archs = append(archs, override)
58-
}
51+
archs := []string{targetPlatform.Platform.Architecture}
52+
if overrides, ok := buildProperties[constants.BUILD_PROPERTIES_ARCH_OVERRIDE_CHECK]; ok {
53+
archs = append(archs, strings.Split(overrides, ",")...)
5954
}
6055

6156
for _, importedLibrary := range ctx.ImportedLibraries {
62-
if !importedLibrary.SupportsArchitectures(archs) {
63-
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_LIBRARY_INCOMPATIBLE_ARCH, importedLibrary.Name, sliceToCommaSeparatedString(importedLibrary.Architectures), sliceToCommaSeparatedString(archs))
57+
if !importedLibrary.SupportsAnyArchitectureIn(archs) {
58+
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_LIBRARY_INCOMPATIBLE_ARCH,
59+
importedLibrary.Name,
60+
strings.Join(importedLibrary.Architectures, ", "),
61+
strings.Join(archs, ", "))
6462
}
6563
}
6664

6765
return nil
6866
}
69-
70-
func sliceToCommaSeparatedString(slice []string) string {
71-
str := "("
72-
str = str + slice[0]
73-
for i := 1; i < len(slice); i++ {
74-
str = str + ", " + slice[i]
75-
}
76-
return str + ")"
77-
}

0 commit comments

Comments
 (0)