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

オープン 初心者向け
#763 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
android, swift
領域
build-system

調査の方向性

skipstone/Sources/SkipBuild/Commands/AndroidCommand.swiftでbinPathCmdの検索箇所と、AndroidTestCommand.swiftのcaptureLineヘルパーの周辺を読みます。--show-bin-pathの呼び出しでlaunchToolがstderrをどう扱うかを追い、SwiftPMの非推奨警告が出ている状態で、該当するAndroidのビルドまたはテストのフローを実行します。binパスがstdoutから取得され、警告によってビルドが無効な出力ディレクトリを使うことがなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Swift
スター
3.3k
フォーク
115
平均マージ
1日 15時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

skiptools/skip のほかの issue

skiptools/skip の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。