Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

periphery 2.21.2 (new formula) #202049

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Formula/p/periphery.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
class Periphery < Formula
desc "Identify unused code in Swift projects"
homepage "https://github.com/peripheryapp/periphery"
url "https://github.com/peripheryapp/periphery/archive/refs/tags/2.21.2.tar.gz"
sha256 "97e399df17d1e681703c5c8852e50b40c056a98b41dc4c615011c048b8348dbb"
license "MIT"
head "https://github.com/peripheryapp/periphery.git", branch: "master"

depends_on xcode: ["15.4", :build]
depends_on macos: :sonoma

uses_from_macos "swift" => [:build, :test]
uses_from_macos "curl"
uses_from_macos "libxml2"

def install
args = if OS.mac?
["--disable-sandbox"]
else
["--static-swift-stdlib"]
end
system "swift", "build", *args, "--configuration", "release", "--product", "periphery"
bin.install ".build/release/periphery"
end

test do
# Periphery dynamically loads 'libIndexStore' at runtime and must find its location depending on the host OS.
# On macOS, the library is bundled within Xcode at a consistent location. On Linux, the library path is assumed
# to be at 'lib/libIndexStore.so' relative to the path of the 'swift' binary, which is a reasonable assumption for
# most installations. However, this is not the case on the Homebrew Linux test container, and the shared libraries
# do not appear to be present.
return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]

system "swift", "package", "init", "--name", "test", "--disable-xctest", "--disable-swift-testing"
system "swift", "build", "--disable-sandbox"
manifest = shell_output "swift package --disable-sandbox describe --type json"
File.write "manifest.json", manifest
system bin/"periphery", "scan", "--strict", "--skip-build", "--json-package-manifest-path", "manifest.json"
end
end
Loading