diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3e89ad7c06..0beb4a324c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -4,6 +4,7 @@ on: push: branches: [ main, develop ] pull_request: + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -120,6 +121,8 @@ jobs: environment: name: LCP deployment: false + env: + LCP_URL_SPM: ${{ secrets.LCP_URL_SPM }} steps: - name: Checkout uses: actions/checkout@v6 @@ -128,15 +131,21 @@ jobs: brew install xcodegen # Preload the list of simulator for xcodebuild. The workflow is flaky without it. xcrun simctl list - - name: Check Playground project is up-to-date - run: | - make playground - git diff --exit-code Playground/.xcodegen - if git ls-files --others --exclude-standard Playground/Playground.xcodeproj/ | grep -q .; then echo "Untracked Playground project files found. Run 'make playground' and commit the result."; exit 1; fi - - name: Build Playground + - name: Cache DerivedData + uses: actions/cache@v6 + with: + path: .derivedData + key: ${{ runner.os }}-derived-data-${{ hashFiles('Package.swift') }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-derived-data-${{ hashFiles('Package.swift') }}- + ${{ runner.os }}-derived-data- + - name: Generate Playground project + run: make playground lcp="$LCP_URL_SPM" + - name: Test Playground (LCP only) + if: ${{ env.LCP_URL_SPM != '' }} run: | set -eo pipefail - xcodebuild build -scheme Playground -project Playground/Playground.xcodeproj -destination "platform=$platform,name=$device" | xcbeautify --renderer github-actions + xcodebuild test -scheme Playground -project Playground/Playground.xcodeproj -destination "platform=$platform,name=$device" -only-testing:ReadiumLCPTests -derivedDataPath .derivedData | xcbeautify --renderer github-actions - name: Generate TestApp project working-directory: TestApp env: @@ -146,7 +155,7 @@ jobs: working-directory: TestApp run: | set -eo pipefail - xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device" | xcbeautify --renderer github-actions + xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device" -derivedDataPath ../.derivedData | xcbeautify --renderer github-actions int-spm: name: Integration (Swift Package Manager) diff --git a/.gitignore b/.gitignore index fd73e022df..a915808656 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ out/ # DocC generation .build-docs docs-site +WorkspaceSettings.xcsettings diff --git a/Makefile b/Makefile index cad4d73735..136df25ba2 100644 --- a/Makefile +++ b/Makefile @@ -13,16 +13,21 @@ help: .PHONY: test test: - xcodebuild test -project "TestApp/TestApp.xcodeproj" -scheme TestApp -destination "platform=iOS Simulator,name=iPhone Air" 2> /dev/null \ + xcodebuild test -scheme Readium-Package -destination "platform=iOS Simulator,name=iPhone Air" 2> /dev/null \ | xcbeautify --quieter --disable-logging \ | grep -Ev "^Executed |Test Suite 'All tests'|Test run started\.|Test session results:"; true .SILENT: .PHONY: playground playground: - cd Playground; \ - find . -name ".DS_Store" -delete; \ - xcodegen --use-cache --cache-path .xcodegen; \ + cd Playground; find . -name ".DS_Store" -delete +ifdef lcp + curl --create-dirs --output Playground/R2LCPClient/Package.swift "$(lcp)" + cd Playground; xcodegen -s project+lcp.yml --use-cache --cache-path .xcodegen +else + rm -rf Playground/R2LCPClient + cd Playground; xcodegen -s project.yml --use-cache --cache-path .xcodegen +endif # The repository might be cloned to a different location than "swift-toolkit". # XcodeGen will use the name of the folder in the project, which is not desirable. # This will replace all occurrences of this folder by "swift-toolkit". diff --git a/Package.swift b/Package.swift index 1249ac14cf..bcb18a6246 100644 --- a/Package.swift +++ b/Package.swift @@ -132,18 +132,6 @@ let package = Package( .process("Resources"), ] ), - // These tests require a R2LCPClient.framework to run. - // TODO: Find a solution to run the tests with GitHub action. - // .testTarget( - // name: "ReadiumLCPTests", - // dependencies: [ - // "ReadiumLCP", - // "ReadiumShared", - // "ReadiumStreamer", - // "TestPublications", - // ], - // path: "Tests/LCPTests" - // ), // Shared test publications used across multiple test targets. .target( diff --git a/Playground/.gitignore b/Playground/.gitignore new file mode 100644 index 0000000000..92398832f3 --- /dev/null +++ b/Playground/.gitignore @@ -0,0 +1,3 @@ +/Playground.xcodeproj +/.xcodegen +/R2LCPClient/ diff --git a/Playground/.xcodegen b/Playground/.xcodegen deleted file mode 100644 index dfb2723d10..0000000000 --- a/Playground/.xcodegen +++ /dev/null @@ -1,109 +0,0 @@ -# XCODEGEN VERSION -2.46.0 - -# SPEC -{ - "name" : "Playground", - "options" : { - "bundleIdPrefix" : "org.readium" - }, - "packages" : { - "Readium" : { - "path" : ".." - } - }, - "schemes" : { - "Playground" : { - "build" : { - "targets" : { - "Playground" : "" - } - }, - "test" : { - "testPlans" : [ - { - "defaultPlan" : true, - "path" : "Playground.xctestplan" - } - ] - } - } - }, - "targets" : { - "Playground" : { - "dependencies" : [ - { - "package" : "Readium", - "product" : "ReadiumShared" - }, - { - "package" : "Readium", - "product" : "ReadiumStreamer" - }, - { - "package" : "Readium", - "product" : "ReadiumNavigator" - }, - { - "package" : "Readium", - "product" : "ReadiumOPDS" - } - ], - "deploymentTarget" : "16.0", - "platform" : "iOS", - "settings" : { - "SWIFT_APPROACHABLE_CONCURRENCY" : true, - "SWIFT_DEFAULT_ACTOR_ISOLATION" : "MainActor", - "SWIFT_VERSION" : 6 - }, - "sources" : [ - { - "path" : "Sources" - } - ], - "type" : "application" - } - } -} - -# FILES -Sources -Sources/App -Sources/App/Common -Sources/App/Common/Extensions -Sources/App/Common/Extensions/FileManager+Ext.swift -Sources/App/Common/Extensions/Logger+Ext.swift -Sources/App/Common/UserError.swift -Sources/App/Common/UserError+Readium.swift -Sources/App/Common/Views -Sources/App/Common/Views/HTMLText.swift -Sources/App/Common/Views/JSONView.swift -Sources/App/Data -Sources/App/Data/DocumentList.swift -Sources/App/Data/DocumentRepository.swift -Sources/App/PlaygroundApp.swift -Sources/App/Publication -Sources/App/Publication/PublicationMetadataView.swift -Sources/App/Publication/PublicationView.swift -Sources/Assets.xcassets -Sources/Assets.xcassets/AppIcon.appiconset -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon29x29.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon29x29@2x-1.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon29x29@2x.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon29x29@3x.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon40x40.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon40x40@2x-1.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon40x40@2x.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon40x40@3x.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon60x60@2x.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon60x60@3x.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon76x76.png -Sources/Assets.xcassets/AppIcon.appiconset/AppIcon76x76@2x.png -Sources/Assets.xcassets/AppIcon.appiconset/Contents.json -Sources/Assets.xcassets/AppIcon.appiconset/icon_1024x1024.png -Sources/Assets.xcassets/AppIcon.appiconset/readiumlogo_2048-83.5@2x.png -Sources/Assets.xcassets/Contents.json -Sources/Info.plist -Sources/Recipes -Sources/Recipes/A01-OpenPublication.swift -Sources/Recipes/A02-ReadMetadata.swift" diff --git a/TestApp/Integrations/Local/TestApp.xctestplan b/Playground/Playground+lcp.xctestplan similarity index 75% rename from TestApp/Integrations/Local/TestApp.xctestplan rename to Playground/Playground+lcp.xctestplan index c1c83771d8..5f9ae3af86 100644 --- a/TestApp/Integrations/Local/TestApp.xctestplan +++ b/Playground/Playground+lcp.xctestplan @@ -17,10 +17,12 @@ ], "defaultOptions" : { "codeCoverage" : false, + "language" : "en", + "region" : "US", "targetForVariableExpansion" : { - "containerPath" : "container:TestApp.xcodeproj", - "identifier" : "BED194980D56484BC288A866", - "name" : "TestApp" + "containerPath" : "container:Playground.xcodeproj", + "identifier" : "739B1FD817D42F0264714A50", + "name" : "Playground" } }, "testTargets" : [ @@ -51,6 +53,13 @@ "identifier" : "ReadiumStreamerTests", "name" : "ReadiumStreamerTests" } + }, + { + "target" : { + "containerPath" : "container:Playground.xcodeproj", + "identifier" : "577C8AE113CE8235D663EDDB", + "name" : "ReadiumLCPTests" + } } ], "version" : 1 diff --git a/Playground/Playground.xcodeproj/project.pbxproj b/Playground/Playground.xcodeproj/project.pbxproj deleted file mode 100644 index ef29989202..0000000000 --- a/Playground/Playground.xcodeproj/project.pbxproj +++ /dev/null @@ -1,469 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 77; - objects = { - -/* Begin PBXBuildFile section */ - 07FE4C9817951411354484C0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 59844953100C517348EF23D0 /* Assets.xcassets */; }; - 1BCA1AEC8E94F11FFEF3A0C8 /* ReadiumOPDS in Frameworks */ = {isa = PBXBuildFile; productRef = 41FF3979DE8082AF5E23D69D /* ReadiumOPDS */; }; - 2EE593DC2038FDF776324278 /* FileManager+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5AE9B43C414342BBB5CDDEF /* FileManager+Ext.swift */; }; - 3FA679B6B90C8BD7B5A7DF58 /* JSONView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCB6D3C4C19C2038573D2B90 /* JSONView.swift */; }; - 52805E26E8DF05E511042B97 /* UserError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9F2917BE7D720CB89EBC9C /* UserError.swift */; }; - 52AF5B85A8E5285B966E7CB5 /* DocumentList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D8B2B0C8575F4648E445A44 /* DocumentList.swift */; }; - 6C9BEF9E1487605B673E48AA /* PublicationMetadataView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BD99839EEEAFBFAF8A2264F /* PublicationMetadataView.swift */; }; - 7EBCAA279457CB27B0A3F136 /* PublicationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C1CFC0B9AEB966345163620 /* PublicationView.swift */; }; - 7FB8FD4A23F144C56E82ED91 /* ReadiumStreamer in Frameworks */ = {isa = PBXBuildFile; productRef = 79CBFD1B8193030A2DB6A839 /* ReadiumStreamer */; }; - B19623280F8C457F051B3110 /* PlaygroundApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B77C0B458C816697C5C670E9 /* PlaygroundApp.swift */; }; - BEB5501D6869FDCA129A87B9 /* A02-ReadMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = D608867E2F9CC0B751114DE9 /* A02-ReadMetadata.swift */; }; - CA6204854C325EE686871A2C /* ReadiumNavigator in Frameworks */ = {isa = PBXBuildFile; productRef = 872E0CB31611AD93E229C627 /* ReadiumNavigator */; }; - D2EF387DADE049BCBDBEE738 /* UserError+Readium.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E5C61917B53108BA01753E /* UserError+Readium.swift */; }; - D4ACEB3498FF70895A6B9405 /* HTMLText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DC581D9DDE636037C5FAB4A /* HTMLText.swift */; }; - D5BAB0C814A7AE71E58FED39 /* A01-OpenPublication.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75178DB65AF67E034F3C4A5 /* A01-OpenPublication.swift */; }; - E1D8BAC3D0B056A27DA65AA1 /* Logger+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21B9812F732ED2F093918E79 /* Logger+Ext.swift */; }; - E46744897A309BECE20573D9 /* ReadiumShared in Frameworks */ = {isa = PBXBuildFile; productRef = E01892658E366AE70B7B1386 /* ReadiumShared */; }; - EED944ABA27DA5FBD6370C23 /* DocumentRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C7CDF2688AF525420855AC5 /* DocumentRepository.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 21B9812F732ED2F093918E79 /* Logger+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Logger+Ext.swift"; sourceTree = ""; }; - 2C1CFC0B9AEB966345163620 /* PublicationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicationView.swift; sourceTree = ""; }; - 2E399BE85546465BB3B37527 /* swift-toolkit */ = {isa = PBXFileReference; lastKnownFileType = folder; name = swift-toolkit; path = ..; sourceTree = SOURCE_ROOT; }; - 3A9F2917BE7D720CB89EBC9C /* UserError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserError.swift; sourceTree = ""; }; - 4DC581D9DDE636037C5FAB4A /* HTMLText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLText.swift; sourceTree = ""; }; - 59844953100C517348EF23D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 5BD99839EEEAFBFAF8A2264F /* PublicationMetadataView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicationMetadataView.swift; sourceTree = ""; }; - 5C7CDF2688AF525420855AC5 /* DocumentRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentRepository.swift; sourceTree = ""; }; - 5D8B2B0C8575F4648E445A44 /* DocumentList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentList.swift; sourceTree = ""; }; - A5AE9B43C414342BBB5CDDEF /* FileManager+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileManager+Ext.swift"; sourceTree = ""; }; - A7E5C61917B53108BA01753E /* UserError+Readium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserError+Readium.swift"; sourceTree = ""; }; - B75178DB65AF67E034F3C4A5 /* A01-OpenPublication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "A01-OpenPublication.swift"; sourceTree = ""; }; - B77C0B458C816697C5C670E9 /* PlaygroundApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaygroundApp.swift; sourceTree = ""; }; - BDA9169E926B14087F3B1BA2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; - CCB6D3C4C19C2038573D2B90 /* JSONView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONView.swift; sourceTree = ""; }; - D608867E2F9CC0B751114DE9 /* A02-ReadMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "A02-ReadMetadata.swift"; sourceTree = ""; }; - E40DD68F934F5F0D2981ACA1 /* Playground.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Playground.app; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 2F8D7CF22299B8D14091AB8E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E46744897A309BECE20573D9 /* ReadiumShared in Frameworks */, - 7FB8FD4A23F144C56E82ED91 /* ReadiumStreamer in Frameworks */, - CA6204854C325EE686871A2C /* ReadiumNavigator in Frameworks */, - 1BCA1AEC8E94F11FFEF3A0C8 /* ReadiumOPDS in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 125CAF6B72840AFE3F05FC95 /* Views */ = { - isa = PBXGroup; - children = ( - 4DC581D9DDE636037C5FAB4A /* HTMLText.swift */, - CCB6D3C4C19C2038573D2B90 /* JSONView.swift */, - ); - path = Views; - sourceTree = ""; - }; - 3F42D23B0ABB28C66695E5A5 /* Recipes */ = { - isa = PBXGroup; - children = ( - B75178DB65AF67E034F3C4A5 /* A01-OpenPublication.swift */, - D608867E2F9CC0B751114DE9 /* A02-ReadMetadata.swift */, - ); - path = Recipes; - sourceTree = ""; - }; - 3F6B916872C30820F6241E84 /* Products */ = { - isa = PBXGroup; - children = ( - E40DD68F934F5F0D2981ACA1 /* Playground.app */, - ); - name = Products; - sourceTree = ""; - }; - 4D0CAE133B02D7D170557CBE /* App */ = { - isa = PBXGroup; - children = ( - B77C0B458C816697C5C670E9 /* PlaygroundApp.swift */, - B8E0BBE1E017E8FF9795D4AF /* Common */, - 6C3B230691D6AF2F58824345 /* Data */, - 6BE58A63F0E2175D1974228F /* Publication */, - ); - path = App; - sourceTree = ""; - }; - 64AF3FB125E0EA956222B31B /* Extensions */ = { - isa = PBXGroup; - children = ( - A5AE9B43C414342BBB5CDDEF /* FileManager+Ext.swift */, - 21B9812F732ED2F093918E79 /* Logger+Ext.swift */, - ); - path = Extensions; - sourceTree = ""; - }; - 6BE58A63F0E2175D1974228F /* Publication */ = { - isa = PBXGroup; - children = ( - 5BD99839EEEAFBFAF8A2264F /* PublicationMetadataView.swift */, - 2C1CFC0B9AEB966345163620 /* PublicationView.swift */, - ); - path = Publication; - sourceTree = ""; - }; - 6C3B230691D6AF2F58824345 /* Data */ = { - isa = PBXGroup; - children = ( - 5D8B2B0C8575F4648E445A44 /* DocumentList.swift */, - 5C7CDF2688AF525420855AC5 /* DocumentRepository.swift */, - ); - path = Data; - sourceTree = ""; - }; - 75054112A41CDCE58ADACF92 /* Packages */ = { - isa = PBXGroup; - children = ( - 2E399BE85546465BB3B37527 /* swift-toolkit */, - ); - name = Packages; - sourceTree = ""; - }; - AABC9BE64A1302199D5D2AF8 /* Sources */ = { - isa = PBXGroup; - children = ( - 59844953100C517348EF23D0 /* Assets.xcassets */, - BDA9169E926B14087F3B1BA2 /* Info.plist */, - 4D0CAE133B02D7D170557CBE /* App */, - 3F42D23B0ABB28C66695E5A5 /* Recipes */, - ); - path = Sources; - sourceTree = ""; - }; - B8E0BBE1E017E8FF9795D4AF /* Common */ = { - isa = PBXGroup; - children = ( - 3A9F2917BE7D720CB89EBC9C /* UserError.swift */, - A7E5C61917B53108BA01753E /* UserError+Readium.swift */, - 64AF3FB125E0EA956222B31B /* Extensions */, - 125CAF6B72840AFE3F05FC95 /* Views */, - ); - path = Common; - sourceTree = ""; - }; - E23F411CF4F5D5291A0322DE = { - isa = PBXGroup; - children = ( - 75054112A41CDCE58ADACF92 /* Packages */, - AABC9BE64A1302199D5D2AF8 /* Sources */, - 3F6B916872C30820F6241E84 /* Products */, - ); - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 739B1FD817D42F0264714A50 /* Playground */ = { - isa = PBXNativeTarget; - buildConfigurationList = CBF67F902A381FB2989A98D4 /* Build configuration list for PBXNativeTarget "Playground" */; - buildPhases = ( - E40BECB45945A673BB0CC3F9 /* Sources */, - C071FD4667C21888C52DF25C /* Resources */, - 2F8D7CF22299B8D14091AB8E /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Playground; - packageProductDependencies = ( - E01892658E366AE70B7B1386 /* ReadiumShared */, - 79CBFD1B8193030A2DB6A839 /* ReadiumStreamer */, - 872E0CB31611AD93E229C627 /* ReadiumNavigator */, - 41FF3979DE8082AF5E23D69D /* ReadiumOPDS */, - ); - productName = Playground; - productReference = E40DD68F934F5F0D2981ACA1 /* Playground.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - DF84942AD828BBDD499F04C0 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1430; - TargetAttributes = { - }; - }; - buildConfigurationList = C1581E14B552D0BE7FA2423D /* Build configuration list for PBXProject "Playground" */; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - Base, - en, - ); - mainGroup = E23F411CF4F5D5291A0322DE; - minimizedProjectReferenceProxies = 1; - packageReferences = ( - 69DDD3FA2655009065C0DDED /* XCLocalSwiftPackageReference ".." */, - ); - preferredProjectObjectVersion = 77; - productRefGroup = 3F6B916872C30820F6241E84 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 739B1FD817D42F0264714A50 /* Playground */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - C071FD4667C21888C52DF25C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 07FE4C9817951411354484C0 /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - E40BECB45945A673BB0CC3F9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D5BAB0C814A7AE71E58FED39 /* A01-OpenPublication.swift in Sources */, - BEB5501D6869FDCA129A87B9 /* A02-ReadMetadata.swift in Sources */, - 52AF5B85A8E5285B966E7CB5 /* DocumentList.swift in Sources */, - EED944ABA27DA5FBD6370C23 /* DocumentRepository.swift in Sources */, - 2EE593DC2038FDF776324278 /* FileManager+Ext.swift in Sources */, - D4ACEB3498FF70895A6B9405 /* HTMLText.swift in Sources */, - 3FA679B6B90C8BD7B5A7DF58 /* JSONView.swift in Sources */, - E1D8BAC3D0B056A27DA65AA1 /* Logger+Ext.swift in Sources */, - B19623280F8C457F051B3110 /* PlaygroundApp.swift in Sources */, - 6C9BEF9E1487605B673E48AA /* PublicationMetadataView.swift in Sources */, - 7EBCAA279457CB27B0A3F136 /* PublicationView.swift in Sources */, - D2EF387DADE049BCBDBEE738 /* UserError+Readium.swift in Sources */, - 52805E26E8DF05E511042B97 /* UserError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 18883859C44E4AE8042B204F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - "DEBUG=1", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 4F8F737A22C49C70A327F32E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = Sources/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = org.readium.Playground; - SDKROOT = iphoneos; - SWIFT_APPROACHABLE_CONCURRENCY = YES; - SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; - SWIFT_VERSION = 6.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - DF83FEB514DF89BC00722881 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = Sources/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = org.readium.Playground; - SDKROOT = iphoneos; - SWIFT_APPROACHABLE_CONCURRENCY = YES; - SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; - SWIFT_VERSION = 6.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - FE96C092F5D790A83D093866 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C1581E14B552D0BE7FA2423D /* Build configuration list for PBXProject "Playground" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 18883859C44E4AE8042B204F /* Debug */, - FE96C092F5D790A83D093866 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - CBF67F902A381FB2989A98D4 /* Build configuration list for PBXNativeTarget "Playground" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4F8F737A22C49C70A327F32E /* Debug */, - DF83FEB514DF89BC00722881 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; -/* End XCConfigurationList section */ - -/* Begin XCLocalSwiftPackageReference section */ - 69DDD3FA2655009065C0DDED /* XCLocalSwiftPackageReference ".." */ = { - isa = XCLocalSwiftPackageReference; - relativePath = ..; - }; -/* End XCLocalSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - 41FF3979DE8082AF5E23D69D /* ReadiumOPDS */ = { - isa = XCSwiftPackageProductDependency; - productName = ReadiumOPDS; - }; - 79CBFD1B8193030A2DB6A839 /* ReadiumStreamer */ = { - isa = XCSwiftPackageProductDependency; - productName = ReadiumStreamer; - }; - 872E0CB31611AD93E229C627 /* ReadiumNavigator */ = { - isa = XCSwiftPackageProductDependency; - productName = ReadiumNavigator; - }; - E01892658E366AE70B7B1386 /* ReadiumShared */ = { - isa = XCSwiftPackageProductDependency; - productName = ReadiumShared; - }; -/* End XCSwiftPackageProductDependency section */ - }; - rootObject = DF84942AD828BBDD499F04C0 /* Project object */; -} diff --git a/Playground/Playground.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Playground/Playground.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a625..0000000000 --- a/Playground/Playground.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Playground/Playground.xcodeproj/xcshareddata/xcschemes/Playground.xcscheme b/Playground/Playground.xcodeproj/xcshareddata/xcschemes/Playground.xcscheme deleted file mode 100644 index 42d9cba221..0000000000 --- a/Playground/Playground.xcodeproj/xcshareddata/xcschemes/Playground.xcscheme +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Playground/Playground.xctestplan b/Playground/Playground.xctestplan index 25536a82c6..ae4717bd05 100644 --- a/Playground/Playground.xctestplan +++ b/Playground/Playground.xctestplan @@ -14,7 +14,7 @@ "region" : "US", "targetForVariableExpansion" : { "containerPath" : "container:Playground.xcodeproj", - "identifier" : "BED194980D56484BC288A866", + "identifier" : "739B1FD817D42F0264714A50", "name" : "Playground" } }, diff --git a/Playground/project+lcp.yml b/Playground/project+lcp.yml new file mode 100644 index 0000000000..0ee07919a5 --- /dev/null +++ b/Playground/project+lcp.yml @@ -0,0 +1,41 @@ +include: + - project-base.yml + +packages: + R2LCPClient: + path: R2LCPClient + +schemes: + Playground: + test: + testPlans: + - path: Playground+lcp.xctestplan + defaultPlan: true + +targets: + Playground: + dependencies: + - package: R2LCPClient + product: R2LCPClient + - package: Readium + product: ReadiumLCP + settings: + OTHER_SWIFT_FLAGS: -DLCP + + ReadiumLCPTests: + type: bundle.unit-test + platform: iOS + deploymentTarget: "16.0" + sources: + - path: ../Tests/LCPTests + group: ReadiumLCPTests + - path: ../Tests/Publications/TestPublications.swift + group: ReadiumLCPTests + - path: ../Tests/Publications/Publications + type: folder + group: ReadiumLCPTests + dependencies: + - target: Playground + settings: + GENERATE_INFOPLIST_FILE: YES + OTHER_SWIFT_FLAGS: -DLCP diff --git a/Playground/project-base.yml b/Playground/project-base.yml new file mode 100644 index 0000000000..6f12a55a92 --- /dev/null +++ b/Playground/project-base.yml @@ -0,0 +1,31 @@ +name: Playground +options: + bundleIdPrefix: org.readium +packages: + Readium: + path: .. +schemes: + Playground: + build: + targets: + Playground: +targets: + Playground: + type: application + platform: iOS + deploymentTarget: "16.0" + sources: + - path: Sources + dependencies: + - package: Readium + product: ReadiumShared + - package: Readium + product: ReadiumStreamer + - package: Readium + product: ReadiumNavigator + - package: Readium + product: ReadiumOPDS + settings: + SWIFT_VERSION: 6.0 + SWIFT_APPROACHABLE_CONCURRENCY: Yes + SWIFT_DEFAULT_ACTOR_ISOLATION: MainActor diff --git a/Playground/project.yml b/Playground/project.yml index 25401c4664..ac23484288 100644 --- a/Playground/project.yml +++ b/Playground/project.yml @@ -1,36 +1,9 @@ -name: Playground -options: - bundleIdPrefix: org.readium -packages: - Readium: - path: .. +include: + - project-base.yml + schemes: Playground: - build: - targets: - Playground: test: testPlans: - path: Playground.xctestplan defaultPlan: true -targets: - Playground: - type: application - platform: iOS - deploymentTarget: "16.0" - sources: - - path: Sources - dependencies: - - package: Readium - product: ReadiumShared - - package: Readium - product: ReadiumStreamer - - package: Readium - product: ReadiumNavigator - - package: Readium - product: ReadiumOPDS - settings: - SWIFT_VERSION: 6.0 - SWIFT_APPROACHABLE_CONCURRENCY: Yes - SWIFT_DEFAULT_ACTOR_ISOLATION: MainActor - diff --git a/Support/Readium.xcworkspace/contents.xcworkspacedata b/Support/Readium.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..ebc7cc75a8 --- /dev/null +++ b/Support/Readium.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + diff --git a/TestApp/.gitignore b/TestApp/.gitignore index 1c32784ad9..6d115ab634 100644 --- a/TestApp/.gitignore +++ b/TestApp/.gitignore @@ -1,12 +1,14 @@ -TestApp.xcodeproj -TestApp.xcworkspace -TestApp.xctestplan -project.yml +/TestApp.xcodeproj +/TestApp.xcworkspace +/TestApp.xctestplan +/AllTests.xctestplan +/ReadiumLCPTests.xctestplan +/project.yml # IntelliJ AppCode .idea -Pods/ -Podfile -Podfile.lock +/Pods/ +/Podfile +/Podfile.lock -R2LCPClient/ +/R2LCPClient/ diff --git a/TestApp/Integrations/Local/project+lcp.yml b/TestApp/Integrations/Local/project+lcp.yml index 797e4adb12..0024b04c39 100644 --- a/TestApp/Integrations/Local/project+lcp.yml +++ b/TestApp/Integrations/Local/project+lcp.yml @@ -22,11 +22,7 @@ schemes: TestApp: build: targets: - TestApp: none - test: - testPlans: - - path: TestApp.xctestplan - defaultPlan: true + TestApp: all targets: TestApp: type: application @@ -61,4 +57,3 @@ targets: SWIFT_DEFAULT_ACTOR_ISOLATION: MainActor OTHER_SWIFT_FLAGS: -DLCP DEVELOPMENT_TEAM: ${RD_DEVELOPMENT_TEAM} - diff --git a/TestApp/Integrations/Local/project.yml b/TestApp/Integrations/Local/project.yml index 8f6e794a48..64324fbea0 100644 --- a/TestApp/Integrations/Local/project.yml +++ b/TestApp/Integrations/Local/project.yml @@ -20,11 +20,7 @@ schemes: TestApp: build: targets: - TestApp: none - test: - testPlans: - - path: TestApp.xctestplan - defaultPlan: true + TestApp: all targets: TestApp: type: application diff --git a/TestApp/Makefile b/TestApp/Makefile index a4ac660263..a8aa8e3aea 100644 --- a/TestApp/Makefile +++ b/TestApp/Makefile @@ -23,7 +23,6 @@ clean: @rm -rf Pods @rm -rf TestApp.xcodeproj @rm -rf TestApp.xcworkspace - @rm -rf TestApp.xctestplan @rm -rf R2LCPClient spm: clean @@ -59,8 +58,7 @@ ifdef lcp @cp Integrations/Local/project+lcp.yml project.yml curl --create-dirs --output R2LCPClient/Package.swift "$(lcp)" else - @cp Integrations/Local/project.yml . + @cp Integrations/Local/project.yml project.yml endif - @cp -r Integrations/Local/TestApp.xctestplan . + @touch ../Package.swift xcodegen generate - diff --git a/Tests/LCPTests/LCPDecryptionTests.swift b/Tests/LCPTests/LCPDecryptionTests.swift index 061f48f0bd..c71a03d99b 100644 --- a/Tests/LCPTests/LCPDecryptionTests.swift +++ b/Tests/LCPTests/LCPDecryptionTests.swift @@ -9,7 +9,9 @@ import PDFKit import ReadiumShared import ReadiumStreamer import Testing -import TestPublications +#if SWIFT_PACKAGE + import TestPublications +#endif struct LCPDecryptionTests { let encryptedResource: Resource diff --git a/Tests/Publications/TestPublications.swift b/Tests/Publications/TestPublications.swift index 420e90b60a..5509ece657 100644 --- a/Tests/Publications/TestPublications.swift +++ b/Tests/Publications/TestPublications.swift @@ -6,10 +6,18 @@ import Foundation +#if !SWIFT_PACKAGE + private class BundleFinder {} +#endif + /// Provides access to shared test publication files. public enum TestPublications { - /// Returns the resource bundle containing shared test publications. - public static let bundle = Bundle.module + // Returns the resource bundle containing shared test publications. + #if SWIFT_PACKAGE + public static let bundle = Bundle.module + #else + public static let bundle = Bundle(for: BundleFinder.self) + #endif /// Returns a URL for the specified publication file. ///