Skip to content
Merged
Show file tree
Hide file tree
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
22 changes: 0 additions & 22 deletions .git-hooks/check-testing-disabled.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,3 @@ repos:
language: system
args:
- "fmt"

- id: check-testing-disabled
name: Check testing is disabled
description: "Ensure Package.swift has testing disabled and Package.resolved is not committed"
files: ^(Package\.swift|Package\.resolved)$
entry: .git-hooks/check-testing-disabled.sh
language: script
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
- Watch the regression fail before implementing the fix, then verify it passes. Cover relevant boundaries and unchanged behavior.
- For PDF rendering or pagination bugs, add generated-PDF integration coverage when practical, not just layout assertions.
- Use the Makefile. Run focused tests first, then `make test-macos`, `make lint`, and `git diff --check` before reporting completion.
- Test targets temporarily enable the flag in `Package.swift`. If initially disabled, restore it with `make test-disable` after testing.
- Test targets are always declared in `Package.swift`. Test commands must not modify the package manifest.
- Report which platforms were tested and any remaining failures or diagnostics. Do not imply all-platform verification from macOS alone.
30 changes: 6 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,30 +184,12 @@ build-xcframework:
.PHONY: test
test: test-ios test-macos test-maccatalyst test-tvos test-watchos test-visionos

## Enable test targets by setting testing flag to true
#
# Modifies the Package.swift to set the testing flag to true, enabling test targets.
.PHONY: test-enable
test-enable:
@echo "Setting testing flag to enable test targets..."
@sed -i.bak 's|/\*TESTING_FLAG\*/false/\*TESTING_FLAG\*/|/\*TESTING_FLAG\*/true/\*TESTING_FLAG\*/|g' Package.swift
@rm Package.swift.bak

## Disable test targets by setting testing flag to false
#
# Modifies the Package.swift to set the testing flag to false, disabling test targets.
.PHONY: test-disable
test-disable:
@echo "Setting testing flag to disable test targets..."
@sed -i.bak 's|/\*TESTING_FLAG\*/true/\*TESTING_FLAG\*/|/\*TESTING_FLAG\*/false/\*TESTING_FLAG\*/|g' Package.swift
@rm Package.swift.bak

## Run unit tests for TPPDF on latest iOS Simulator
#
# Runs unit tests for the TPPDF scheme on the latest iOS Simulator (iPhone 17 Pro).
# Writes logs to raw-test-ios.log and formats output with xcbeautify.
.PHONY: test-ios
test-ios: build-ios test-enable
test-ios: build-ios
set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild \
-scheme $(XCODE_SCHEME) \
-destination 'platform=iOS Simulator,OS=$(IOS_SIMULATOR_OS),name=$(IOS_DEVICE_NAME)' \
Expand All @@ -218,7 +200,7 @@ test-ios: build-ios test-enable
# Runs unit tests for the TPPDF scheme on macOS.
# Writes logs to raw-test-macos.log and formats output with xcbeautify.
.PHONY: test-macos
test-macos: build-macos test-enable
test-macos: build-macos
set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild \
-scheme $(XCODE_SCHEME) \
-destination 'platform=macOS' \
Expand All @@ -229,7 +211,7 @@ test-macos: build-macos test-enable
# Runs unit tests for the TPPDF scheme on Mac Catalyst.
# Writes logs to raw-test-maccatalyst.log and formats output with xcbeautify.
.PHONY: test-maccatalyst
test-maccatalyst: build-maccatalyst test-enable
test-maccatalyst: build-maccatalyst
set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild \
-scheme $(XCODE_SCHEME) \
-destination 'platform=macOS,variant=Mac Catalyst' \
Expand All @@ -240,7 +222,7 @@ test-maccatalyst: build-maccatalyst test-enable
# Runs unit tests for the TPPDF scheme on the latest tvOS Simulator (Apple TV 4K 3rd generation).
# Writes logs to raw-test-tvos.log and formats output with xcbeautify.
.PHONY: test-tvos
test-tvos: build-tvos test-enable
test-tvos: build-tvos
set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild \
-scheme $(XCODE_SCHEME) \
-destination 'platform=tvOS Simulator,OS=$(TVOS_SIMULATOR_OS),name=$(TVOS_DEVICE_NAME)' \
Expand All @@ -251,7 +233,7 @@ test-tvos: build-tvos test-enable
# Runs unit tests for the TPPDF scheme on the latest watchOS Simulator (Apple Watch Series 11).
# Writes logs to raw-test-watchos.log and formats output with xcbeautify.
.PHONY: test-watchos
test-watchos: build-watchos test-enable
test-watchos: build-watchos
set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild \
-scheme $(XCODE_SCHEME) \
-destination 'platform=watchOS Simulator,OS=$(WATCHOS_SIMULATOR_OS),name=$(WATCHOS_DEVICE_NAME)' \
Expand All @@ -262,7 +244,7 @@ test-watchos: build-watchos test-enable
# Runs unit tests for the TPPDF scheme on the latest visionOS Simulator (Apple Vision Pro).
# Writes logs to raw-test-visionos.log and formats output with xcbeautify.
.PHONY: test-visionos
test-visionos: build-visionos test-enable
test-visionos: build-visionos
set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild \
-scheme $(XCODE_SCHEME) \
-destination 'platform=visionOS Simulator,OS=$(VISION_OS_SIMULATOR_OS),name=$(VISION_OS_DEVICE_NAME)' \
Expand Down
28 changes: 10 additions & 18 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,6 @@

import PackageDescription

var testingTargets: [Target] = []

let isTestingEnabled = /*TESTING_FLAG*/false/*TESTING_FLAG*/
if isTestingEnabled {
testingTargets = [
.testTarget(name: "TPPDFTests", dependencies: ["TPPDF"], resources: [
.copy("resources/graphics-fixture.gif"),
.copy("resources/sample.pdf"),
.copy("resources/image-fixture.jpg"),
.copy("resources/table-content-fixture.png"),
]),
.testTarget(name: "TPPDFIntegrationTests", dependencies: ["TPPDF"], resources: [
.copy("resources/50-pages.pdf"),
]),
]
}

let package = Package(
name: "TPPDF",
platforms: [
Expand All @@ -34,5 +17,14 @@ let package = Package(
],
targets: [
.target(name: "TPPDF", path: "Source"),
] + testingTargets
.testTarget(name: "TPPDFTests", dependencies: ["TPPDF"], resources: [
.copy("resources/graphics-fixture.gif"),
.copy("resources/sample.pdf"),
.copy("resources/image-fixture.jpg"),
.copy("resources/table-content-fixture.png"),
]),
.testTarget(name: "TPPDFIntegrationTests", dependencies: ["TPPDF"], resources: [
.copy("resources/50-pages.pdf"),
]),
]
)
Loading