From 1ddc055b74338646447ac7f6262b15e04e0895e2 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sun, 16 Aug 2026 11:11:38 +0200 Subject: [PATCH] Let the test folder add its own files The app folders have been synchronized groups for a while, so adding a source file to the app takes no project edit. The test folder was still a hand written list, and every test or sample document we added cost four lines of made up object ids in project.pbxproj. Making it a synchronized group too ends that. Two things had to move out of the folder first, because a synchronized group copies everything left in it into the bundle: the fixture generator, now in scripts/, and Info.plist, which held nothing but build setting placeholders and is better generated. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Xryx81PvamT674wzzQujjg --- OpenDocumentReader.xcodeproj/project.pbxproj | 63 ++++--------------- OpenDocumentReaderTests/Info.plist | 22 ------- README.md | 8 ++- .../make-test-fixtures.py | 12 ++-- 4 files changed, 23 insertions(+), 82 deletions(-) delete mode 100644 OpenDocumentReaderTests/Info.plist rename OpenDocumentReaderTests/fixtures/make-fixtures.py => scripts/make-test-fixtures.py (96%) diff --git a/OpenDocumentReader.xcodeproj/project.pbxproj b/OpenDocumentReader.xcodeproj/project.pbxproj index 9a3c92e..650610e 100644 --- a/OpenDocumentReader.xcodeproj/project.pbxproj +++ b/OpenDocumentReader.xcodeproj/project.pbxproj @@ -22,17 +22,7 @@ A11E00000000000000000016 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = A11E00000000000000000013 /* PrivacyInfo.xcprivacy */; }; A11E00000000000000000017 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = A11E00000000000000000015 /* PrivacyInfo.xcprivacy */; }; E1A78CF72C1A53DB00CD43E4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1EB6C492C1A510D003EC5A0 /* Foundation.framework */; }; - E22B252F2557F0E2001D0C52 /* OpenDocumentReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E22B252E2557F0E2001D0C52 /* OpenDocumentReaderTests.swift */; }; - E24110312586349500800247 /* test.odt in Resources */ = {isa = PBXBuildFile; fileRef = E24110232586349500800247 /* test.odt */; }; E26C39392250DC6E009C484A /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E26C39382250DC6E009C484A /* WebKit.framework */; }; - E2A17B0400000000000000A4 /* PageTabBarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A17B0300000000000000A3 /* PageTabBarTests.swift */; }; - E2A17B0500000000000000A5 /* DeclaredDocumentTypesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A17B0600000000000000A6 /* DeclaredDocumentTypesTests.swift */; }; - E2A17B0700000000000000A7 /* EditWorkflowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A17B0800000000000000A8 /* EditWorkflowTests.swift */; }; - E2A17B1000000000000000B0 /* test.ods in Resources */ = {isa = PBXBuildFile; fileRef = E2A17B1200000000000000B2 /* test.ods */; }; - E2A17B1100000000000000B1 /* test.odp in Resources */ = {isa = PBXBuildFile; fileRef = E2A17B1300000000000000B3 /* test.odp */; }; - E2A17B1400000000000000B4 /* test.csv in Resources */ = {isa = PBXBuildFile; fileRef = E2A17B1500000000000000B5 /* test.csv */; }; - E2A17B1600000000000000B6 /* test.pdf in Resources */ = {isa = PBXBuildFile; fileRef = E2A17B1700000000000000B7 /* test.pdf */; }; - E2A17B1800000000000000B8 /* test-encrypted.pdf in Resources */ = {isa = PBXBuildFile; fileRef = E2A17B1900000000000000B9 /* test-encrypted.pdf */; }; E2A17B2000000000000000C0 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2A17B2200000000000000C2 /* CoreFoundation.framework */; }; E2A17B2100000000000000C1 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2A17B2300000000000000C3 /* CFNetwork.framework */; }; FB494C85E264BD924C1EA54E /* OdrCore in Frameworks */ = {isa = PBXBuildFile; productRef = E381918B979121CD165C966A /* OdrCore */; }; @@ -60,19 +50,8 @@ A11E00000000000000000014 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A11E00000000000000000015 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; E1EB6C492C1A510D003EC5A0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - E22B252E2557F0E2001D0C52 /* OpenDocumentReaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenDocumentReaderTests.swift; sourceTree = ""; }; - E22B25302557F0E2001D0C52 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E237952F2274844400BA7238 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; - E24110232586349500800247 /* test.odt */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.odt; sourceTree = ""; }; E26C39382250DC6E009C484A /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; - E2A17B0300000000000000A3 /* PageTabBarTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageTabBarTests.swift; sourceTree = ""; }; - E2A17B0600000000000000A6 /* DeclaredDocumentTypesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeclaredDocumentTypesTests.swift; sourceTree = ""; }; - E2A17B0800000000000000A8 /* EditWorkflowTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditWorkflowTests.swift; sourceTree = ""; }; - E2A17B1200000000000000B2 /* test.ods */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.ods; sourceTree = ""; }; - E2A17B1300000000000000B3 /* test.odp */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.odp; sourceTree = ""; }; - E2A17B1500000000000000B5 /* test.csv */ = {isa = PBXFileReference; lastKnownFileType = text; path = test.csv; sourceTree = ""; }; - E2A17B1700000000000000B7 /* test.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = test.pdf; sourceTree = ""; }; - E2A17B1900000000000000B9 /* test-encrypted.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "test-encrypted.pdf"; sourceTree = ""; }; E2A17B2200000000000000C2 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; E2A17B2300000000000000C3 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -93,6 +72,11 @@ path = OpenDocumentReader; sourceTree = ""; }; + A11E00000000000000000022 /* OpenDocumentReaderTests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = OpenDocumentReaderTests; + sourceTree = ""; + }; /* End PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFrameworksBuildPhase section */ @@ -164,24 +148,6 @@ path = configs; sourceTree = ""; }; - E22B252D2557F0E2001D0C52 /* OpenDocumentReaderTests */ = { - isa = PBXGroup; - children = ( - E24110232586349500800247 /* test.odt */, - E2A17B1200000000000000B2 /* test.ods */, - E2A17B1300000000000000B3 /* test.odp */, - E2A17B1500000000000000B5 /* test.csv */, - E2A17B1700000000000000B7 /* test.pdf */, - E2A17B1900000000000000B9 /* test-encrypted.pdf */, - E22B252E2557F0E2001D0C52 /* OpenDocumentReaderTests.swift */, - E2A17B0300000000000000A3 /* PageTabBarTests.swift */, - E2A17B0600000000000000A6 /* DeclaredDocumentTypesTests.swift */, - E2A17B0800000000000000A8 /* EditWorkflowTests.swift */, - E22B25302557F0E2001D0C52 /* Info.plist */, - ); - path = OpenDocumentReaderTests; - sourceTree = ""; - }; E2BB4B64220EF4F20056176B /* Frameworks */ = { isa = PBXGroup; children = ( @@ -204,7 +170,7 @@ A11E0000000000000000000B /* OpenDocumentReader */, A11E00000000000000000009 /* Ads */, A11E0000000000000000000A /* NoAds */, - E22B252D2557F0E2001D0C52 /* OpenDocumentReaderTests */, + A11E00000000000000000022 /* OpenDocumentReaderTests */, E2BB4B64220EF4F20056176B /* Frameworks */, 52A348B12A9262D100DACAB9 /* OpenDocumentReader.app */, A11E00000000000000000008 /* OpenDocumentReader Lite.app */, @@ -254,6 +220,9 @@ dependencies = ( E22B25322557F0E2001D0C52 /* PBXTargetDependency */, ); + fileSystemSynchronizedGroups = ( + A11E00000000000000000022 /* OpenDocumentReaderTests */, + ); name = OpenDocumentReaderTests; productName = OpenDocumentReaderTests; productReference = 52A348B22A9262D100DACAB9 /* OpenDocumentReaderTests.xctest */; @@ -361,12 +330,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - E24110312586349500800247 /* test.odt in Resources */, - E2A17B1000000000000000B0 /* test.ods in Resources */, - E2A17B1100000000000000B1 /* test.odp in Resources */, - E2A17B1400000000000000B4 /* test.csv in Resources */, - E2A17B1600000000000000B6 /* test.pdf in Resources */, - E2A17B1800000000000000B8 /* test-encrypted.pdf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -392,10 +355,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - E22B252F2557F0E2001D0C52 /* OpenDocumentReaderTests.swift in Sources */, - E2A17B0400000000000000A4 /* PageTabBarTests.swift in Sources */, - E2A17B0500000000000000A5 /* DeclaredDocumentTypesTests.swift in Sources */, - E2A17B0700000000000000A7 /* EditWorkflowTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -489,7 +448,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; CODE_SIGN_STYLE = Automatic; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - INFOPLIST_FILE = OpenDocumentReaderTests/Info.plist; + GENERATE_INFOPLIST_FILE = YES; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -508,7 +467,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = OpenDocumentReaderTests/Info.plist; + GENERATE_INFOPLIST_FILE = YES; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/OpenDocumentReaderTests/Info.plist b/OpenDocumentReaderTests/Info.plist deleted file mode 100644 index 64d65ca..0000000 --- a/OpenDocumentReaderTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/README.md b/README.md index 4fd7121..4afa177 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Two targets rather than two configurations of one, because a Swift package product is linked by a target and no build setting takes it back out. Pro's release executable is 0.5 MB against Lite's 4.4 MB. -Three folders, each a synchronized group, so adding a file is all it takes to +Four folders, each a synchronized group, so adding a file is all it takes to add it to the build: | folder | in | @@ -44,6 +44,7 @@ add it to the build: | `OpenDocumentReader/` | both | | `Ads/` | Lite | | `NoAds/` | Full | +| `OpenDocumentReaderTests/` | the test bundle | `Ads/` is the only place that names a type from an ad sdk. `AdSlot` (the banner and the consent form) and `AdPrivacy` (the way back to that choice) have a no-op @@ -58,7 +59,10 @@ else, so there is nothing to withhold. `configs/full` and `configs/lite` hold each bundle's `Info.plist` and privacy manifest, out of the synchronized folder, since anything left in there would be -copied into both apps. +copied into both apps. For the same reason `scripts/make-test-fixtures.py`, which +writes the small sample documents, sits outside the test folder: everything in +there is copied into the test bundle, and the tests want the documents, not the +script that made them. ## How a document reaches the screen diff --git a/OpenDocumentReaderTests/fixtures/make-fixtures.py b/scripts/make-test-fixtures.py similarity index 96% rename from OpenDocumentReaderTests/fixtures/make-fixtures.py rename to scripts/make-test-fixtures.py index 99e46dd..a2c062a 100644 --- a/OpenDocumentReaderTests/fixtures/make-fixtures.py +++ b/scripts/make-test-fixtures.py @@ -5,7 +5,7 @@ sample documents are, because all a test asks of them is how many pages a two sheet spreadsheet turns into. Rerun when a fixture needs another sheet or slide: - python3 OpenDocumentReaderTests/fixtures/make-fixtures.py + python3 scripts/make-test-fixtures.py """ import shutil @@ -169,24 +169,24 @@ def write(path: Path, mimetype: str, content_xml: str) -> None: def main() -> None: - here = Path(__file__).resolve().parent + tests = Path(__file__).resolve().parent.parent / "OpenDocumentReaderTests" write( - here.parent / "test.ods", + tests / "test.ods", "application/vnd.oasis.opendocument.spreadsheet", spreadsheet(["Alpha", "Beta", "Gamma"]), ) write( - here.parent / "test.odp", + tests / "test.odp", "application/vnd.oasis.opendocument.presentation", presentation(["Intro", "Outro"]), ) - path = here.parent / "test.pdf" + path = tests / "test.pdf" path.write_bytes(pdf(["First", "Second"])) print(f"wrote {path}") - encrypted = here.parent / "test-encrypted.pdf" + encrypted = tests / "test-encrypted.pdf" encrypt_pdf(path, encrypted) print(f"wrote {encrypted}")