diff --git a/.gitignore b/.gitignore index 3882e93..c6c703c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ xcuserdata /fastlane/*.xml /vendor -/.bundle \ No newline at end of file +/.bundle + +.vscode \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index ec08ab7..038455e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,16 +4,15 @@ inherit_mode: AllCops: Exclude: - - 'Carthage/**/*' - - 'Demo/Carthage/**/*' - 'vendor/**/*' Include: - 'fastlane/Pluginfile' + NewCops: enable # this would cause errors with long lanes Metrics/BlockLength: Enabled: true - ExcludedMethods: ['platform', 'for_platform'] + IgnoredMethods: ['platform', 'for_platform'] # Lane description and gem lines can be long Layout/LineLength: diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..78548db --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,17 @@ +disabled_rules: + - identifier_name + - statement_position + - todo + +line_length: 300 + +trailing_whitespace: + ignores_empty_lines: true + severity: warning + +nesting: + type_level: 2 + +excluded: + - .build + - vendor diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/SRGContentProtection.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/SRGContentProtection.xcscheme index 5a3909a..79aa207 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/SRGContentProtection.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/SRGContentProtection.xcscheme @@ -1,6 +1,6 @@ name Unprotected Akamai HLS stream url - https://rts-vod-amd.akamaized.net/ww/hls/10080791/545cbc27-0798-3d5e-ae1b-1aba03c9a5b5/master.m3u8 + https://rts-vod-amd.akamaized.net/ww/13228673/edf35ff9-3ec1-3d47-9b9d-df5a3fa7f159/master.m3u8 name Akamai token-protected HLS stream url - https://srgssruni11ch-lh.akamaihd.net/i/enc11uni_ch@191455/master.m3u8 + https://srgssrch.akamaized.net/hls/live/2022077/srgssr-hls-stream20-ch-dvr/master.m3u8 name @@ -56,7 +56,7 @@ name Akamai MP3 stream url - https://srfaudio-a.akamaihd.net/delivery/world/75f44907-4638-422d-bc80-bbb14c9d9c93.mp3 + https://rts-aod-dd.akamaized.net/ww/13141009/51a55d34-ce77-33ab-8a01-b01c4ffbc56f.mp3 diff --git a/Demo/SRGContentProtection-demo.xcodeproj/project.pbxproj b/Demo/SRGContentProtection-demo.xcodeproj/project.pbxproj index c0ad1b0..023a302 100644 --- a/Demo/SRGContentProtection-demo.xcodeproj/project.pbxproj +++ b/Demo/SRGContentProtection-demo.xcodeproj/project.pbxproj @@ -166,7 +166,7 @@ 6F0EB52820FC7F58009C02CF /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1400; ORGANIZATIONNAME = "SRG SSR"; TargetAttributes = { 6F8A93D720FDCA0800AA6434 = { @@ -262,6 +262,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -325,6 +326,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; diff --git a/Demo/SRGContentProtection-demo.xcodeproj/xcshareddata/xcschemes/SRGContentProtection-demo.xcscheme b/Demo/SRGContentProtection-demo.xcodeproj/xcshareddata/xcschemes/SRGContentProtection-demo.xcscheme index 2aee805..dfde069 100644 --- a/Demo/SRGContentProtection-demo.xcodeproj/xcshareddata/xcschemes/SRGContentProtection-demo.xcscheme +++ b/Demo/SRGContentProtection-demo.xcodeproj/xcshareddata/xcschemes/SRGContentProtection-demo.xcscheme @@ -1,6 +1,6 @@ = 2.0.2, < 5.0) artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.502.0) - aws-sdk-core (3.121.0) + aws-partitions (1.616.0) + aws-sdk-core (3.132.0) aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.239.0) + aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.48.0) - aws-sdk-core (~> 3, >= 3.120.0) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.58.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.103.0) - aws-sdk-core (~> 3, >= 3.120.0) + aws-sdk-s3 (1.114.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) - aws-sigv4 (1.4.0) + aws-sigv4 (1.5.1) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) - claide (1.0.3) + claide (1.1.0) colored (1.2) colored2 (3.1.2) commander (4.6.0) @@ -33,19 +34,20 @@ GEM rake (>= 12.0.0, < 14.0.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - dotenv (2.7.6) - emoji_regex (3.2.2) - excon (0.85.0) - faraday (1.7.2) + dotenv (2.8.1) + emoji_regex (3.2.3) + excon (0.92.4) + faraday (1.10.1) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.1) + faraday-net_http_persistent (~> 1.0) faraday-patron (~> 1.0) faraday-rack (~> 1.0) - multipart-post (>= 1.2, < 3) + faraday-retry (~> 1.0) ruby2_keywords (>= 0.0.4) faraday-cookie_jar (0.0.7) faraday (>= 0.8.0) @@ -54,14 +56,17 @@ GEM faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) faraday-net_http (1.0.1) faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) - faraday_middleware (1.1.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.2.5) - fastlane (2.194.0) + fastimage (2.2.6) + fastlane (2.208.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -100,12 +105,10 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) - fastlane-plugin-trainer (0.4.1) - trainer (>= 0.7.0) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.11.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-core (0.4.1) + google-apis-androidpublisher_v3 (0.25.0) + google-apis-core (>= 0.7, < 2.a) + google-apis-core (0.7.0) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -114,53 +117,53 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-iamcredentials_v1 (0.7.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-playcustomapp_v1 (0.5.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-storage_v1 (0.6.0) - google-apis-core (>= 0.4, < 2.a) + google-apis-iamcredentials_v1 (0.13.0) + google-apis-core (>= 0.7, < 2.a) + google-apis-playcustomapp_v1 (0.10.0) + google-apis-core (>= 0.7, < 2.a) + google-apis-storage_v1 (0.17.0) + google-apis-core (>= 0.7, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) - google-cloud-env (1.5.0) - faraday (>= 0.17.3, < 2.0) - google-cloud-errors (1.1.0) - google-cloud-storage (1.34.1) - addressable (~> 2.5) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.2.0) + google-cloud-storage (1.38.0) + addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) - google-apis-storage_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.17.0) google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (0.17.1) - faraday (>= 0.17.3, < 2.0) + googleauth (1.2.0) + faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) - signet (~> 0.15) + signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.4) + http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) - jmespath (1.4.0) - json (2.5.1) - jwt (2.2.3) + jmespath (1.6.1) + json (2.6.2) + jwt (2.4.1) memoist (0.16.2) mini_magick (4.11.0) - mini_mime (1.1.1) + mini_mime (1.1.2) multi_json (1.15.0) multipart-post (2.0.0) nanaimo (0.3.0) naturally (2.2.1) optparse (0.1.1) - os (1.1.1) + os (1.1.4) plist (3.6.0) - public_suffix (4.0.6) + public_suffix (4.0.7) rake (13.0.6) - representable (3.1.1) + representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) @@ -170,9 +173,9 @@ GEM ruby2_keywords (0.0.5) rubyzip (2.3.2) security (0.1.3) - signet (0.16.0) + signet (0.17.0) addressable (~> 2.8) - faraday (>= 0.17.3, < 2.0) + faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) simctl (1.6.8) @@ -181,10 +184,7 @@ GEM terminal-notifier (2.0.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - trailblazer-option (0.1.1) - trainer (0.9.1) - fastlane (>= 2.25.0) - plist (>= 3.1.0, < 4.0.0) + trailblazer-option (0.1.2) tty-cursor (0.7.1) tty-screen (0.8.1) tty-spinner (0.9.3) @@ -192,14 +192,14 @@ GEM uber (0.1.0) unf (0.1.4) unf_ext - unf_ext (0.0.8) + unf_ext (0.0.8.2) unicode-display_width (1.8.0) webrick (1.7.0) word_wrap (1.0.0) - xcode-install (2.8.0) - claide (>= 0.9.1, < 1.1.0) + xcode-install (2.8.1) + claide (>= 0.9.1) fastlane (>= 2.1.0, < 3.0.0) - xcodeproj (1.21.0) + xcodeproj (1.22.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -216,7 +216,6 @@ PLATFORMS DEPENDENCIES fastlane - fastlane-plugin-trainer xcode-install BUNDLED WITH diff --git a/Package.resolved b/Package.resolved index 7e08c61..31d1baa 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/SRGSSR/libextobjc.git", "state": { "branch": null, - "revision": "30ee5b73bdf57a826978aa146881277f22369be1", - "version": "0.6.0-srg3" + "revision": "9c9a7327410fe3f7cdb695965ced43b9a7766ee0", + "version": "0.6.0-srg4" } }, { @@ -15,8 +15,8 @@ "repositoryURL": "https://github.com/SRGSSR/MAKVONotificationCenter.git", "state": { "branch": null, - "revision": "60395e0601ffd4a784856b423d4cac558366276d", - "version": "1.0.0-srg5" + "revision": "8bde3cdc872085bd31f4cfe546bdf8e6932a0806", + "version": "1.0.0-srg6" } }, { @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/SRGSSR/srgdiagnostics-apple.git", "state": { "branch": null, - "revision": "9921cec150a83df60fe4cde41ffb9e3209b21e92", - "version": "3.0.2" + "revision": "c595e8f186eb41335f0ea48848543ab3804ea22e", + "version": "3.1.0" } }, { @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/SRGSSR/srglogger-apple.git", "state": { "branch": null, - "revision": "5840af9ccbbc23a1269ff53feb3832f56ffde1eb", - "version": "3.0.2" + "revision": "dd98468422044b53e283d970809b8502e1ef5b8d", + "version": "3.1.0" } }, { @@ -42,8 +42,8 @@ "repositoryURL": "https://github.com/SRGSSR/srgnetwork-apple.git", "state": { "branch": null, - "revision": "9d79d6649de885876577c28e7b19f24f7ce16399", - "version": "3.0.3" + "revision": "153a2544391c1aaccae2d38d8b113fd0a03421b8", + "version": "3.1.0" } } ] diff --git a/Package.swift b/Package.swift index 5b892a1..e960471 100644 --- a/Package.swift +++ b/Package.swift @@ -3,14 +3,14 @@ import PackageDescription struct ProjectSettings { - static let marketingVersion: String = "3.0.4" + static let marketingVersion: String = "3.1.0" } let package = Package( name: "SRGContentProtection", defaultLocalization: "en", platforms: [ - .iOS(.v9), + .iOS(.v12), .tvOS(.v12) ], products: [ @@ -20,8 +20,8 @@ let package = Package( ) ], dependencies: [ - .package(name: "SRGDiagnostics", url: "https://github.com/SRGSSR/srgdiagnostics-apple.git", .upToNextMinor(from: "3.0.0")), - .package(name: "SRGNetwork", url: "https://github.com/SRGSSR/srgnetwork-apple.git", .upToNextMinor(from: "3.0.0")) + .package(name: "SRGDiagnostics", url: "https://github.com/SRGSSR/srgdiagnostics-apple.git", .upToNextMinor(from: "3.1.0")), + .package(name: "SRGNetwork", url: "https://github.com/SRGSSR/srgnetwork-apple.git", .upToNextMinor(from: "3.1.0")) ], targets: [ .target( diff --git a/Tests/SRGContentProtectionTests/AkamaiResourceLoaderTestCase.m b/Tests/SRGContentProtectionTests/AkamaiResourceLoaderTestCase.m index 77e2d95..e915f0f 100644 --- a/Tests/SRGContentProtectionTests/AkamaiResourceLoaderTestCase.m +++ b/Tests/SRGContentProtectionTests/AkamaiResourceLoaderTestCase.m @@ -20,7 +20,7 @@ @implementation AkamaiResourceLoaderTestCase - (void)testProtectedResourcePlayback { - NSURL *URL = [NSURL URLWithString:@"https://srgssruni9ch-lh.akamaihd.net/i/enc9uni_ch@191320/master.m3u8"]; + NSURL *URL = [NSURL URLWithString:@"https://srgssrch.akamaized.net/hls/live/2022077/srgssr-hls-stream20-ch-dvr/master.m3u8"]; AVURLAsset *asset = [AVURLAsset srg_akamaiTokenProtectedAssetWithURL:URL options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; @@ -33,7 +33,7 @@ - (void)testProtectedResourcePlayback - (void)testProtectedResourcePlaybackWithParameter { - NSURL *URL = [NSURL URLWithString:@"https://srgssruni9ch-lh.akamaihd.net/i/enc9uni_ch@191320/master.m3u8?__b__=800"]; + NSURL *URL = [NSURL URLWithString:@"https://srgssrch.akamaized.net/hls/live/2022077/srgssr-hls-stream20-ch-dvr/master.m3u8?__b__=800"]; AVURLAsset *asset = [AVURLAsset srg_akamaiTokenProtectedAssetWithURL:URL options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; @@ -46,7 +46,7 @@ - (void)testProtectedResourcePlaybackWithParameter - (void)testNonProtectedResourcePlayback { - NSURL *URL = [NSURL URLWithString:@"http://tagesschau-lh.akamaihd.net/i/tagesschau_1@119231/master.m3u8"]; + NSURL *URL = [NSURL URLWithString:@"https://rtsc3video.akamaized.net/hls/live/2042837/c3video/3/playlist.m3u8"]; AVURLAsset *asset = [AVURLAsset srg_akamaiTokenProtectedAssetWithURL:URL options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; @@ -59,7 +59,7 @@ - (void)testNonProtectedResourcePlayback - (void)testNonProtectedResourcePlaybackWithParameter { - NSURL *URL = [NSURL URLWithString:@"http://tagesschau-lh.akamaihd.net/i/tagesschau_1@119231/master.m3u8?__b__=800"]; + NSURL *URL = [NSURL URLWithString:@"https://rtsc3video.akamaized.net/hls/live/2042837/c3video/3/playlist.m3u8?__b__=800"]; AVURLAsset *asset = [AVURLAsset srg_akamaiTokenProtectedAssetWithURL:URL options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; diff --git a/Tests/SRGContentProtectionTests/AkamaiTokenTestCase.m b/Tests/SRGContentProtectionTests/AkamaiTokenTestCase.m index f7c145e..a68642d 100644 --- a/Tests/SRGContentProtectionTests/AkamaiTokenTestCase.m +++ b/Tests/SRGContentProtectionTests/AkamaiTokenTestCase.m @@ -30,7 +30,7 @@ - (void)testTokenizeAkamaiURL { XCTestExpectation *expectation = [self expectationWithDescription:@"Request ended"]; - [[SRGAkamaiToken tokenizeURL:[NSURL URLWithString:@"https://srgssruni1ch-lh.akamaihd.net/i/enc1uni_ch@190951/master.m3u8"] withSession:[NSURLSession sharedSession] completionBlock:^(NSURL * _Nonnull URL, NSHTTPURLResponse * _Nonnull HTTPResponse, NSError * _Nullable error) { + [[SRGAkamaiToken tokenizeURL:[NSURL URLWithString:@"https://srgssrch.akamaized.net/hls/live/2022077/srgssr-hls-stream20-ch-dvr/master.m3u8"] withSession:[NSURLSession sharedSession] completionBlock:^(NSURL * _Nonnull URL, NSHTTPURLResponse * _Nonnull HTTPResponse, NSError * _Nullable error) { XCTAssertNotNil(TestURLParameter(URL, @"hdnts")); XCTAssertEqual(HTTPResponse.statusCode, 200); XCTAssertNil(error); @@ -44,7 +44,7 @@ - (void)testTokenizeAkamaiURLWithParameters { XCTestExpectation *expectation = [self expectationWithDescription:@"Request ended"]; - [[SRGAkamaiToken tokenizeURL:[NSURL URLWithString:@"https://srgssruni1ch-lh.akamaihd.net/i/enc1uni_ch@190951/master.m3u8&dw=0&__b__=800"] withSession:[NSURLSession sharedSession] completionBlock:^(NSURL * _Nonnull URL, NSHTTPURLResponse * _Nonnull HTTPResponse, NSError * _Nullable error) { + [[SRGAkamaiToken tokenizeURL:[NSURL URLWithString:@"https://srgssrch.akamaized.net/hls/live/2022077/srgssr-hls-stream20-ch-dvr/master.m3u8&dw=0&__b__=800"] withSession:[NSURLSession sharedSession] completionBlock:^(NSURL * _Nonnull URL, NSHTTPURLResponse * _Nonnull HTTPResponse, NSError * _Nullable error) { XCTAssertNotNil(TestURLParameter(URL, @"hdnts")); XCTAssertNotNil(TestURLParameter(URL, @"dw")); XCTAssertNotNil(TestURLParameter(URL, @"__b__")); diff --git a/Tests/SRGContentProtectionTests/FairPlayResourceLoaderTestCase.m b/Tests/SRGContentProtectionTests/FairPlayResourceLoaderTestCase.m index b2243f7..696c4fd 100644 --- a/Tests/SRGContentProtectionTests/FairPlayResourceLoaderTestCase.m +++ b/Tests/SRGContentProtectionTests/FairPlayResourceLoaderTestCase.m @@ -35,7 +35,7 @@ - (void)testProtectedResourcePlaybackWithParameter - (void)testNonProtectedResourcePlayback { - NSURL *URL = [NSURL URLWithString:@"http://tagesschau-lh.akamaihd.net/i/tagesschau_1@119231/master.m3u8"]; + NSURL *URL = [NSURL URLWithString:@"https://rtsc3video.akamaized.net/hls/live/2042837/c3video/3/playlist.m3u8"]; AVURLAsset *asset = [AVURLAsset srg_fairPlayProtectedAssetWithURL:URL certificateURL:FairPlayCertificateURL() options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; @@ -48,7 +48,7 @@ - (void)testNonProtectedResourcePlayback - (void)testNonProtectedResourcePlaybackWithParameter { - NSURL *URL = [NSURL URLWithString:@"http://tagesschau-lh.akamaihd.net/i/tagesschau_1@119231/master.m3u8?__b__=800"]; + NSURL *URL = [NSURL URLWithString:@"https://rtsc3video.akamaized.net/hls/live/2042837/c3video/3/playlist.m3u8?__b__=800"]; AVURLAsset *asset = [AVURLAsset srg_fairPlayProtectedAssetWithURL:URL certificateURL:FairPlayCertificateURL() options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; @@ -74,7 +74,7 @@ - (void)testInvalidResourcePlayback - (void)testAkamaiMP3ResourcePlayback { - NSURL *URL = [NSURL URLWithString:@"https://srfaudio-a.akamaihd.net/delivery/world/75f44907-4638-422d-bc80-bbb14c9d9c93.mp3"]; + NSURL *URL = [NSURL URLWithString:@"https://rts-aod-dd.akamaized.net/ww/13141009/51a55d34-ce77-33ab-8a01-b01c4ffbc56f.mp3"]; AVURLAsset *asset = [AVURLAsset srg_fairPlayProtectedAssetWithURL:URL certificateURL:FairPlayCertificateURL() options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; diff --git a/docs/README.md b/docs/README.md index 30a8c59..f30b770 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,7 +11,7 @@ The SRG Content Protection framework contains the logic required for encrypted m ## Compatibility -The library is suitable for applications running on iOS 9, tvOS 12 and above. The project is meant to be compiled with the latest Xcode version. +The library is suitable for applications running on iOS 12, tvOS 12 and above. The project is meant to be compiled with the latest Xcode version. ## Contributing @@ -45,8 +45,6 @@ If the protection used does not match the one required by the content, playback FairPlay stream playback requires a physical iOS device. Streams will not play in the simulator. -While the HLS specification allows relative URLs in playlist, this implementation supports only Akamai master playlists containing full URLs only (for variants and video / audio / subtitles tracks) on iOS 9 and iOS 10. - ## License See the [LICENSE](../LICENSE) file for more information. diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 76cb279..9ddb7ae 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -9,7 +9,7 @@ # All lines starting with a # are ignored when running `fastlane` # This is the minimum version number required. -fastlane_version '2.96.0' +fastlane_version '2.201.0' default_platform :ios @@ -17,7 +17,7 @@ platform :ios do before_all do ensure_git_status_clean - xcversion(version: '~> 13') + xcversion(version: '~> 14') end desc 'Run library tests' @@ -25,12 +25,9 @@ platform :ios do clean_result_files clean_derived_data - Device = Struct.new(:platform, :name) - TestBuild = Struct.new(:scheme, :scheme_suffix, :in_workspace) - - iphone11 = Device.new('iOS', 'iPhone 11') + iphone13 = Device.new('iOS', 'iPhone 13') appletv = Device.new('tvOS', 'Apple TV') - devices = [iphone11, appletv] + devices = [iphone13, appletv] scheme = swift_package_name swift_package_tests = TestBuild.new(scheme, '', false) @@ -40,8 +37,7 @@ platform :ios do srg_run_tests(devices, test_builds) # Produce JUnit files for CI - srg_trainer - override_junit_test_suite_names(test_builds) + srg_junit_files end after_all do @@ -54,6 +50,9 @@ platform :ios do end end +Device = Struct.new :platform, :name +TestBuild = Struct.new :scheme, :scheme_suffix, :in_workspace + def swift_package_name JSON.parse((sh 'swift package dump-package'))['name'] end @@ -70,13 +69,11 @@ end def srg_run_tests(devices, test_builds) devices.each do |device| test_builds.each do |test_build| - begin - srg_xcodebuild(device, test_build) - rescue StandardError => e - raise e unless e.message.include? '** TEST FAILED **' + srg_xcodebuild(device, test_build) + rescue StandardError => e + raise e unless e.message.include? '** TEST FAILED **' - UI.important('One or more tests failed on ' + device.platform + ' (' + srg_xcodebuild_scheme(test_build) + '). ⚠️') - end + UI.important("One or more tests failed on #{device.platform} (#{srg_xcodebuild_scheme(test_build)}). ⚠️") end end end @@ -84,6 +81,7 @@ end def srg_xcodebuild(device, test_build) xcodebuild( test: true, + xcargs: srg_test_xcargs, workspace: srg_xcodebuild_workspace(test_build), scheme: srg_xcodebuild_scheme(test_build), destination: srg_xcodebuild_destination(device), @@ -92,8 +90,12 @@ def srg_xcodebuild(device, test_build) ) end +def srg_test_xcargs + '-retry-tests-on-failure -testLanguage en -testRegion en-US' +end + def srg_xcodebuild_workspace(test_build) - test_build.in_workspace ? 'Tests/' + srg_xcodebuild_scheme(test_build) + '.xcworkspace' : nil + test_build.in_workspace ? "Tests/#{srg_xcodebuild_scheme(test_build)}.xcworkspace" : nil end def srg_xcodebuild_scheme(test_build) @@ -101,22 +103,30 @@ def srg_xcodebuild_scheme(test_build) end def srg_xcodebuild_destination(device) - 'platform=' + device.platform + ' Simulator,name=' + device.name + "platform=#{device.platform} Simulator,name=#{device.name}" end def srg_xcodebuild_result_bundle_path(device, test_build) - result_bundle_folder_path + test_build.scheme + '-' + device.platform + "#{result_bundle_folder_path}#{test_build.scheme}-#{device.platform}" end def srg_xcodebuild_derived_data_path '.build/DerivedData' end +def srg_junit_files + srg_trainer + override_junit_test_suite_names + expose_junit_files +end + # Convert xcresults to JUnit files def srg_trainer trainer( path: result_bundle_folder_path, output_directory: './fastlane', + extension: raw_extension, + output_remove_retry_attempts: true, fail_build: false ) end @@ -125,21 +135,31 @@ def result_bundle_folder_path './fastlane/xcresult/' end +def raw_extension + '.rawjunit' +end + # Override JUnit test suite names to split iOS and tvOS test results -def override_junit_test_suite_names(test_builds) - test_builds.each do |test_build| - Dir[test_build.scheme + '-*.xml'].each do |file_name| - override_junit_test_suite_name(file_name) - end +def override_junit_test_suite_names + Dir["*#{raw_extension}"].each do |file_name| + override_junit_test_suite_name(file_name) end end def override_junit_test_suite_name(file_name) platform = file_name.split('.').first.split('-').last file = File.open(file_name, 'r') - xml = file.read.gsub('Tests" tests="', '-' + platform + '" tests="') - xml = xml.gsub('-tests" tests="', '-' + platform + '" tests="') - File.open(file_name, 'w') { |f| f.write(xml) } + xml = file.read.gsub('Tests" tests="', "-#{platform}\" tests=\"") + xml = xml.gsub('-tests" tests="', "-#{platform}\" tests=\"") + File.write(file_name, xml) +end + +def expose_junit_files + Dir["*#{raw_extension}"].each do |file_name| + # Rename JUnit files with correct extension + new_file_name = file_name.gsub(raw_extension, '.xml') + File.rename(file_name, new_file_name) unless File.exist?(new_file_name) + end end # More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile deleted file mode 100644 index 72dfbbd..0000000 --- a/fastlane/Pluginfile +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -# Autogenerated by fastlane -# -# Ensure this file is checked in to source control! - -gem 'fastlane-plugin-trainer' diff --git a/fastlane/README.md b/fastlane/README.md index 45a7da7..d812e80 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -1,29 +1,32 @@ fastlane documentation -================ +---- + # Installation Make sure you have the latest version of the Xcode command line tools installed: -``` +```sh xcode-select --install ``` -Install _fastlane_ using -``` -[sudo] gem install fastlane -NV -``` -or alternatively using `brew install fastlane` +For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) # Available Actions + ## iOS + ### ios tests + +```sh +[bundle exec] fastlane ios tests ``` -fastlane ios tests -``` + Run library tests ---- This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. -More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). -The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). + +More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). + +The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).