`skip android build`: `--show-bin-path` result read from merged stdout+stderr, so a SwiftPM deprecation warning can be used as the bin path

Abierto Apto para principiantes
#763 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
android, swift
Área
build-system

Línea de trabajo

Lee skipstone/Sources/SkipBuild/Commands/AndroidCommand.swift alrededor de la consulta de binPathCmd y el helper captureLine de AndroidTestCommand.swift. Sigue cómo launchTool maneja stderr en las llamadas con --show-bin-path y luego ejecuta el flujo de compilación o pruebas de Android pertinente con presente el aviso de obsolescencia de SwiftPM. Se considera terminado cuando la ruta bin se obtiene de stdout y el aviso no puede hacer que la compilación use un directorio de salida no válido.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

skip android build (via the Gradle buildAndroidSwiftPackage… step) determines the .so output directory by running swift build --show-bin-path … --build-system native and taking the last non-empty line of the output. That output is read through launchTool(...), which defaults to includeStdErr: true, so stdout and stderr are merged.

SwiftPM prints a deprecation warning on stderr for --build-system native:

warning: '--build-system native' has been deprecated and will be removed in a future release; please report an issue at https://github.com/swiftlang/swift-package-manager/issues if you are unable to adopt the default build system.

When that stderr line happens to arrive after the stdout path line, lines.last is the warning sentence, Skip uses it as buildOutputFolder, and the build then fails trying to open it (NSCocoaErrorDomain Code=260, file not found). It is an ordering race: the same commit passes and fails on consecutive runs with the same warning present.

Where

  • skipstone/Sources/SkipBuild/Commands/AndroidCommand.swift (~L986–1016 on main @ 1.9.21): binPathCmd → launchTool(swiftCmd, arguments:…, env:) → binPath = lines.last.
  • skipstone/Sources/SkipBuild/Commands/AndroidTestCommand.swift: captureLine(...) is documented as "the last non-empty stdout line" but also calls launchTool with the default includeStdErr: true; it is used for --show-bin-path (harness and --build-tests).

The --show-bin-path lookup was introduced in skiptools/skipstone#245 (swiftbuild support). The stdout/stderr output shape of --show-bin-path with --build-system native is visible in swiftlang/swift-build#1363.

Versions

  • Skip 1.9.8 (Homebrew, invoked by Gradle) and 1.9.12 (Package.resolved), macOS, Skip Fuse app.
  • The code is unchanged on main at 1.9.21 (3dfa66f).

Suggested fix

  • Pass includeStdErr: false for the --show-bin-path invocations (and in captureLine), and/or
  • pick the last line that is an absolute path to an existing directory instead of lines.last.

Workaround we use

Retry the Gradle assemble once when the log contains both Code=260 and adopt the default build system.

Lenguaje dominante
Swift
Estrellas
3.3k
Forks
115
Merge medio
1 d 15 h
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de skiptools/skip

Todos los issues de skiptools/skip

Issues similares

Más issues de Swift

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.