summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommaso Negri <me@tommasongr.com>2026-08-11 12:10:48 +0200
committerTommaso Negri <me@tommasongr.com>2026-08-11 12:10:48 +0200
commitc3f13e775e8814986974d646d6e4ba21b5cbf228 (patch)
tree6d776beb3008b2a446426be03345508fb80bffb2
parent149f4cb0e22f6b08e1eb26e765b80892ce295ff2 (diff)
downloadbar-c3f13e775e8814986974d646d6e4ba21b5cbf228.tar.gz
bar-c3f13e775e8814986974d646d6e4ba21b5cbf228.zip
remove docc dependency in favor of the bundled binary
-rw-r--r--.gitignore2
-rw-r--r--Makefile52
-rw-r--r--Package.resolved24
-rw-r--r--Package.swift3
4 files changed, 47 insertions, 34 deletions
diff --git a/.gitignore b/.gitignore
index 0023a53..3f976de 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
.DS_Store
/.build
+/.docc-build
+/docs
/Packages
xcuserdata/
DerivedData/
diff --git a/Makefile b/Makefile
index e84a5b3..57bbcb7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,28 @@
PREFIX ?= $(HOME)/.local/bin
+# Auto-detect docc binary: prefer standalone, fall back to xcrun
+DOCC := $(shell which docc 2>/dev/null || echo "xcrun docc")
+
+# Derive the build triple from the bin path (e.g., arm64-apple-macosx)
+BUILD_DIR := $(shell swift build -c debug --show-bin-path 2>/dev/null)
+TRIPLE := $(notdir $(patsubst %/,%,$(dir $(BUILD_DIR))))
+MODULE_DIR := .build/$(TRIPLE)/debug/Modules
+SYMBOL_GRAPH_DIR := .build/$(TRIPLE)/symbolgraph
+
+.DEFAULT_GOAL := all
+
all: run
run:
swift run -c debug
build:
+ swift build -c debug
+
+release:
swift build -c release
-install: build
+install: release
install -d $(PREFIX)
install ".build/release/bar" "$(PREFIX)/bar"
@@ -16,9 +30,33 @@ uninstall:
rm -f "$(PREFIX)/bar"
clean:
- rm -rf .build
-
-docs:
- swift package --disable-sandbox preview-documentation --target bar
-
-.PHONY: all run build install uninstall clean docs
+ rm -rf .build .docc-build docs
+
+# Build the project and generate symbol graphs (prerequisite for docc targets)
+# Uses -minimum-access-level internal to capture doc-commented types even when they aren't public
+symbol-graphs: build
+ mkdir -p $(SYMBOL_GRAPH_DIR)
+ xcrun swift-symbolgraph-extract \
+ -module-name bar \
+ -target $(TRIPLE)26.0 \
+ -sdk $(shell xcrun --show-sdk-path 2>/dev/null) \
+ -minimum-access-level internal \
+ -I $(MODULE_DIR) \
+ -output-dir $(SYMBOL_GRAPH_DIR)
+
+preview-docs: symbol-graphs
+ $(DOCC) preview Sources/bar/bar.docc \
+ --additional-symbol-graph-dir $(SYMBOL_GRAPH_DIR) \
+ --output-dir .docc-build
+
+generate-docs: symbol-graphs
+ $(DOCC) convert Sources/bar/bar.docc \
+ --additional-symbol-graph-dir $(SYMBOL_GRAPH_DIR) \
+ --transform-for-static-hosting \
+ --hosting-base-path bar \
+ --output-path ./docs \
+ --source-service github \
+ --source-service-base-url https://github.com/paninihouse/bar/blob/master \
+ --checkout-path ~/Developer/paninihouse/tools/bar/
+
+.PHONY: all run build release install uninstall clean symbol-graphs preview-docs generate-docs
diff --git a/Package.resolved b/Package.resolved
deleted file mode 100644
index 96dc26d..0000000
--- a/Package.resolved
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "originHash" : "8466be431e8d0f0e999032674c527fee8cc36501529de24f3005631ecc4727db",
- "pins" : [
- {
- "identity" : "swift-docc-plugin",
- "kind" : "remoteSourceControl",
- "location" : "https://github.com/apple/swift-docc-plugin",
- "state" : {
- "revision" : "647c708be89f834fa6a6d4945442793a77ddf5b6",
- "version" : "1.5.0"
- }
- },
- {
- "identity" : "swift-docc-symbolkit",
- "kind" : "remoteSourceControl",
- "location" : "https://github.com/swiftlang/swift-docc-symbolkit",
- "state" : {
- "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
- "version" : "1.0.0"
- }
- }
- ],
- "version" : 3
-}
diff --git a/Package.swift b/Package.swift
index cc8578a..6f73ea2 100644
--- a/Package.swift
+++ b/Package.swift
@@ -5,9 +5,6 @@ import PackageDescription
let package = Package(
name: "bar",
platforms: [.macOS(.v26)],
- dependencies: [
- .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
- ],
targets: [
.executableTarget(name: "bar"),
.testTarget(name: "barTests", dependencies: ["bar"]),