├── .github └── workflows │ ├── objective-c-xcode.yml │ └── swift.yml ├── .gitignore ├── .travis.yml ├── Coverage_Gather.md ├── Example ├── HDCoverage.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ ├── HDCoverage-Example.xcscheme │ │ └── HDCoverageDemo.xcscheme ├── HDCoverage.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── HDCoverageDemo │ ├── AppDelegate.swift │ ├── CoverageTest │ │ ├── HDOC.h │ │ ├── HDOC.m │ │ └── HDSwift.swift │ ├── HDCoverageDemo-Bridging-Header.h │ ├── HDCoverageSFramework │ │ └── HDCoverageSFramework.framework │ │ │ ├── HDCoverageSFramework │ │ │ ├── Headers │ │ │ ├── HDCoverageSFramework-Swift.h │ │ │ ├── HDCoverageSFramework.h │ │ │ └── HDOCSFramework.h │ │ │ ├── Info.plist │ │ │ ├── Modules │ │ │ ├── HDCoverageSFramework.swiftmodule │ │ │ │ ├── Project │ │ │ │ │ └── x86_64-apple-ios-simulator.swiftsourceinfo │ │ │ │ ├── x86_64-apple-ios-simulator.abi.json │ │ │ │ ├── x86_64-apple-ios-simulator.swiftdoc │ │ │ │ └── x86_64-apple-ios-simulator.swiftmodule │ │ │ └── module.modulemap │ │ │ └── _CodeSignature │ │ │ ├── CodeDirectory │ │ │ ├── CodeRequirements │ │ │ ├── CodeRequirements-1 │ │ │ ├── CodeResources │ │ │ └── CodeSignature │ ├── SceneDelegate.swift │ ├── Sources │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ └── Info.plist │ ├── Tools │ │ ├── HDCoverageTools.swift │ │ └── InstrProfiling.h │ ├── ViewController.swift │ └── pgImageModule │ │ └── Classes │ │ ├── NetworkImage │ │ ├── UIButton+JX.swift │ │ └── UIImageView+JX.swift │ │ ├── Public │ │ ├── UIButton+PGWeb.h │ │ ├── UIButton+PGWeb.m │ │ ├── UIImageView+PGWeb.h │ │ └── UIImageView+PGWeb.m │ │ └── SDWebImage │ │ ├── Core │ │ ├── NSData+ImageContentType.h │ │ ├── NSData+ImageContentType.m │ │ ├── PGSDImageCache.h │ │ ├── PGSDImageCache.m │ │ ├── PGSDWebImageDownloader.h │ │ ├── PGSDWebImageDownloader.m │ │ ├── PGSDWebImageDownloaderOperation.h │ │ ├── PGSDWebImageDownloaderOperation.m │ │ ├── PGSDWebImageManager.h │ │ ├── PGSDWebImageManager.m │ │ ├── PGSDWebImagePrefetcher.h │ │ ├── PGSDWebImagePrefetcher.m │ │ ├── SDAnimatedImage.h │ │ ├── SDAnimatedImage.m │ │ ├── SDAnimatedImagePlayer.h │ │ ├── SDAnimatedImagePlayer.m │ │ ├── SDAnimatedImageRep.h │ │ ├── SDAnimatedImageRep.m │ │ ├── SDAnimatedImageView+WebCache.h │ │ ├── SDAnimatedImageView+WebCache.m │ │ ├── SDAnimatedImageView.h │ │ ├── SDAnimatedImageView.m │ │ ├── SDDiskCache.h │ │ ├── SDDiskCache.m │ │ ├── SDGraphicsImageRenderer.h │ │ ├── SDGraphicsImageRenderer.m │ │ ├── SDImageAPNGCoder.h │ │ ├── SDImageAPNGCoder.m │ │ ├── SDImageAWebPCoder.h │ │ ├── SDImageAWebPCoder.m │ │ ├── SDImageCacheConfig.h │ │ ├── SDImageCacheConfig.m │ │ ├── SDImageCacheDefine.h │ │ ├── SDImageCacheDefine.m │ │ ├── SDImageCachesManager.h │ │ ├── SDImageCachesManager.m │ │ ├── SDImageCoder.h │ │ ├── SDImageCoder.m │ │ ├── SDImageCoderHelper.h │ │ ├── SDImageCoderHelper.m │ │ ├── SDImageCodersManager.h │ │ ├── SDImageCodersManager.m │ │ ├── SDImageFrame.h │ │ ├── SDImageFrame.m │ │ ├── SDImageGIFCoder.h │ │ ├── SDImageGIFCoder.m │ │ ├── SDImageGraphics.h │ │ ├── SDImageGraphics.m │ │ ├── SDImageHEICCoder.h │ │ ├── SDImageHEICCoder.m │ │ ├── SDImageIOAnimatedCoder.h │ │ ├── SDImageIOAnimatedCoder.m │ │ ├── SDImageIOCoder.h │ │ ├── SDImageIOCoder.m │ │ ├── SDImageLoader.h │ │ ├── SDImageLoader.m │ │ ├── SDImageLoadersManager.h │ │ ├── SDImageLoadersManager.m │ │ ├── SDImageTransformer.h │ │ ├── SDImageTransformer.m │ │ ├── SDMemoryCache.h │ │ ├── SDMemoryCache.m │ │ ├── SDWebImageCacheKeyFilter.h │ │ ├── SDWebImageCacheKeyFilter.m │ │ ├── SDWebImageCacheSerializer.h │ │ ├── SDWebImageCacheSerializer.m │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageCompat.m │ │ ├── SDWebImageDefine.h │ │ ├── SDWebImageDefine.m │ │ ├── SDWebImageDownloaderConfig.h │ │ ├── SDWebImageDownloaderConfig.m │ │ ├── SDWebImageDownloaderDecryptor.h │ │ ├── SDWebImageDownloaderDecryptor.m │ │ ├── SDWebImageDownloaderRequestModifier.h │ │ ├── SDWebImageDownloaderRequestModifier.m │ │ ├── SDWebImageDownloaderResponseModifier.h │ │ ├── SDWebImageDownloaderResponseModifier.m │ │ ├── SDWebImageError.h │ │ ├── SDWebImageError.m │ │ ├── SDWebImageIndicator.h │ │ ├── SDWebImageIndicator.m │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImageOperation.m │ │ ├── SDWebImageOptionsProcessor.h │ │ ├── SDWebImageOptionsProcessor.m │ │ ├── SDWebImageTransition.h │ │ ├── SDWebImageTransition.m │ │ ├── UIButton+WebCache.h │ │ ├── UIButton+WebCache.m │ │ ├── UIImage+ExtendedCacheData.h │ │ ├── UIImage+ExtendedCacheData.m │ │ ├── UIImage+ForceDecode.h │ │ ├── UIImage+ForceDecode.m │ │ ├── UIImage+GIF.h │ │ ├── UIImage+GIF.m │ │ ├── UIImage+MemoryCacheCost.h │ │ ├── UIImage+MemoryCacheCost.m │ │ ├── UIImage+Metadata.h │ │ ├── UIImage+Metadata.m │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImage+MultiFormat.m │ │ ├── UIImage+Transform.h │ │ ├── UIImage+Transform.m │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImageView+HighlightedWebCache.m │ │ ├── UIImageView+WebCache.h │ │ ├── UIImageView+WebCache.m │ │ ├── UIView+WebCache.h │ │ ├── UIView+WebCache.m │ │ ├── UIView+WebCacheOperation.h │ │ └── UIView+WebCacheOperation.m │ │ ├── Private │ │ ├── SDAssociatedObject.h │ │ ├── SDAssociatedObject.m │ │ ├── SDAsyncBlockOperation.h │ │ ├── SDAsyncBlockOperation.m │ │ ├── SDDeviceHelper.h │ │ ├── SDDeviceHelper.m │ │ ├── SDDisplayLink.h │ │ ├── SDDisplayLink.m │ │ ├── SDFileAttributeHelper.h │ │ ├── SDFileAttributeHelper.m │ │ ├── SDImageAssetManager.h │ │ ├── SDImageAssetManager.m │ │ ├── SDImageCachesManagerOperation.h │ │ ├── SDImageCachesManagerOperation.m │ │ ├── SDImageIOAnimatedCoderInternal.h │ │ ├── SDInternalMacros.h │ │ ├── SDInternalMacros.m │ │ ├── SDWeakProxy.h │ │ ├── SDWeakProxy.m │ │ ├── SDWebImageTransitionInternal.h │ │ ├── SDmetamacros.h │ │ ├── UIColor+SDHexString.h │ │ └── UIColor+SDHexString.m │ │ ├── SDWebImage.h │ │ └── webp │ │ ├── SDWebImageWebPCoder │ │ ├── SDImageWebPCoder.h │ │ ├── SDImageWebPCoder.m │ │ ├── UIImage+WebP.h │ │ └── UIImage+WebP.m │ │ └── libwebp │ │ └── src │ │ ├── dec │ │ ├── alpha_dec.c │ │ ├── alphai_dec.h │ │ ├── buffer_dec.c │ │ ├── common_dec.h │ │ ├── frame_dec.c │ │ ├── idec_dec.c │ │ ├── io_dec.c │ │ ├── quant_dec.c │ │ ├── tree_dec.c │ │ ├── vp8_dec.c │ │ ├── vp8_dec.h │ │ ├── vp8i_dec.h │ │ ├── vp8l_dec.c │ │ ├── vp8li_dec.h │ │ ├── webp_dec.c │ │ └── webpi_dec.h │ │ ├── demux │ │ ├── anim_decode.c │ │ ├── demux.c │ │ ├── libwebpdemux.pc.in │ │ └── libwebpdemux.rc │ │ ├── dsp │ │ ├── alpha_processing.c │ │ ├── alpha_processing_mips_dsp_r2.c │ │ ├── alpha_processing_neon.c │ │ ├── alpha_processing_sse2.c │ │ ├── alpha_processing_sse41.c │ │ ├── common_sse2.h │ │ ├── common_sse41.h │ │ ├── cost.c │ │ ├── cost_mips32.c │ │ ├── cost_mips_dsp_r2.c │ │ ├── cost_neon.c │ │ ├── cost_sse2.c │ │ ├── cpu.c │ │ ├── dec.c │ │ ├── dec_clip_tables.c │ │ ├── dec_mips32.c │ │ ├── dec_mips_dsp_r2.c │ │ ├── dec_msa.c │ │ ├── dec_neon.c │ │ ├── dec_sse2.c │ │ ├── dec_sse41.c │ │ ├── dsp.h │ │ ├── enc.c │ │ ├── enc_mips32.c │ │ ├── enc_mips_dsp_r2.c │ │ ├── enc_msa.c │ │ ├── enc_neon.c │ │ ├── enc_sse2.c │ │ ├── enc_sse41.c │ │ ├── filters.c │ │ ├── filters_mips_dsp_r2.c │ │ ├── filters_msa.c │ │ ├── filters_neon.c │ │ ├── filters_sse2.c │ │ ├── lossless.c │ │ ├── lossless.h │ │ ├── lossless_common.h │ │ ├── lossless_enc.c │ │ ├── lossless_enc_mips32.c │ │ ├── lossless_enc_mips_dsp_r2.c │ │ ├── lossless_enc_msa.c │ │ ├── lossless_enc_neon.c │ │ ├── lossless_enc_sse2.c │ │ ├── lossless_enc_sse41.c │ │ ├── lossless_mips_dsp_r2.c │ │ ├── lossless_msa.c │ │ ├── lossless_neon.c │ │ ├── lossless_sse2.c │ │ ├── mips_macro.h │ │ ├── msa_macro.h │ │ ├── neon.h │ │ ├── quant.h │ │ ├── rescaler.c │ │ ├── rescaler_mips32.c │ │ ├── rescaler_mips_dsp_r2.c │ │ ├── rescaler_msa.c │ │ ├── rescaler_neon.c │ │ ├── rescaler_sse2.c │ │ ├── ssim.c │ │ ├── ssim_sse2.c │ │ ├── upsampling.c │ │ ├── upsampling_mips_dsp_r2.c │ │ ├── upsampling_msa.c │ │ ├── upsampling_neon.c │ │ ├── upsampling_sse2.c │ │ ├── upsampling_sse41.c │ │ ├── yuv.c │ │ ├── yuv.h │ │ ├── yuv_mips32.c │ │ ├── yuv_mips_dsp_r2.c │ │ ├── yuv_neon.c │ │ ├── yuv_sse2.c │ │ └── yuv_sse41.c │ │ ├── enc │ │ ├── alpha_enc.c │ │ ├── analysis_enc.c │ │ ├── backward_references_cost_enc.c │ │ ├── backward_references_enc.c │ │ ├── backward_references_enc.h │ │ ├── config_enc.c │ │ ├── cost_enc.c │ │ ├── cost_enc.h │ │ ├── filter_enc.c │ │ ├── frame_enc.c │ │ ├── histogram_enc.c │ │ ├── histogram_enc.h │ │ ├── iterator_enc.c │ │ ├── near_lossless_enc.c │ │ ├── picture_csp_enc.c │ │ ├── picture_enc.c │ │ ├── picture_psnr_enc.c │ │ ├── picture_rescale_enc.c │ │ ├── picture_tools_enc.c │ │ ├── predictor_enc.c │ │ ├── quant_enc.c │ │ ├── syntax_enc.c │ │ ├── token_enc.c │ │ ├── tree_enc.c │ │ ├── vp8i_enc.h │ │ ├── vp8l_enc.c │ │ ├── vp8li_enc.h │ │ └── webp_enc.c │ │ ├── libwebp.pc.in │ │ ├── libwebp.rc │ │ ├── libwebpdecoder.pc.in │ │ ├── libwebpdecoder.rc │ │ ├── mux │ │ ├── anim_encode.c │ │ ├── animi.h │ │ ├── libwebpmux.pc.in │ │ ├── libwebpmux.rc │ │ ├── muxedit.c │ │ ├── muxi.h │ │ ├── muxinternal.c │ │ └── muxread.c │ │ ├── utils │ │ ├── bit_reader_inl_utils.h │ │ ├── bit_reader_utils.c │ │ ├── bit_reader_utils.h │ │ ├── bit_writer_utils.c │ │ ├── bit_writer_utils.h │ │ ├── color_cache_utils.c │ │ ├── color_cache_utils.h │ │ ├── endian_inl_utils.h │ │ ├── filters_utils.c │ │ ├── filters_utils.h │ │ ├── huffman_encode_utils.c │ │ ├── huffman_encode_utils.h │ │ ├── huffman_utils.c │ │ ├── huffman_utils.h │ │ ├── quant_levels_dec_utils.c │ │ ├── quant_levels_dec_utils.h │ │ ├── quant_levels_utils.c │ │ ├── quant_levels_utils.h │ │ ├── random_utils.c │ │ ├── random_utils.h │ │ ├── rescaler_utils.c │ │ ├── rescaler_utils.h │ │ ├── thread_utils.c │ │ ├── thread_utils.h │ │ ├── utils.c │ │ └── utils.h │ │ └── webp │ │ ├── decode.h │ │ ├── demux.h │ │ ├── encode.h │ │ ├── format_constants.h │ │ ├── mux.h │ │ ├── mux_types.h │ │ ├── types.h │ │ └── types.h.bak ├── HDCoverageFramework │ ├── HDCoverageFramework.h │ ├── HDOCFramework.h │ ├── HDOCFramework.m │ ├── HDSwiftFramework.swift │ └── Info.plist ├── HDCoverageFrameworkTests │ ├── HDCoverageFrameworkTests.m │ └── Info.plist ├── Podfile ├── Podfile.lock ├── Pods │ ├── AFNetworking │ │ ├── AFNetworking │ │ │ ├── AFCompatibilityMacros.h │ │ │ ├── AFHTTPSessionManager.h │ │ │ ├── AFHTTPSessionManager.m │ │ │ ├── AFNetworkReachabilityManager.h │ │ │ ├── AFNetworkReachabilityManager.m │ │ │ ├── AFNetworking.h │ │ │ ├── AFSecurityPolicy.h │ │ │ ├── AFSecurityPolicy.m │ │ │ ├── AFURLRequestSerialization.h │ │ │ ├── AFURLRequestSerialization.m │ │ │ ├── AFURLResponseSerialization.h │ │ │ ├── AFURLResponseSerialization.m │ │ │ ├── AFURLSessionManager.h │ │ │ └── AFURLSessionManager.m │ │ ├── LICENSE │ │ ├── README.md │ │ └── UIKit+AFNetworking │ │ │ ├── AFAutoPurgingImageCache.h │ │ │ ├── AFAutoPurgingImageCache.m │ │ │ ├── AFImageDownloader.h │ │ │ ├── AFImageDownloader.m │ │ │ ├── AFNetworkActivityIndicatorManager.h │ │ │ ├── AFNetworkActivityIndicatorManager.m │ │ │ ├── UIActivityIndicatorView+AFNetworking.h │ │ │ ├── UIActivityIndicatorView+AFNetworking.m │ │ │ ├── UIButton+AFNetworking.h │ │ │ ├── UIButton+AFNetworking.m │ │ │ ├── UIImageView+AFNetworking.h │ │ │ ├── UIImageView+AFNetworking.m │ │ │ ├── UIKit+AFNetworking.h │ │ │ ├── UIProgressView+AFNetworking.h │ │ │ ├── UIProgressView+AFNetworking.m │ │ │ ├── UIRefreshControl+AFNetworking.h │ │ │ ├── UIRefreshControl+AFNetworking.m │ │ │ ├── WKWebView+AFNetworking.h │ │ │ └── WKWebView+AFNetworking.m │ ├── Local Podspecs │ │ └── HDCoverage.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ └── Target Support Files │ │ ├── AFNetworking │ │ ├── AFNetworking-Info.plist │ │ ├── AFNetworking-dummy.m │ │ ├── AFNetworking-prefix.pch │ │ ├── AFNetworking-umbrella.h │ │ ├── AFNetworking.debug.xcconfig │ │ ├── AFNetworking.modulemap │ │ ├── AFNetworking.release.xcconfig │ │ └── AFNetworking.xcconfig │ │ ├── HDCoverage │ │ ├── HDCoverage-Info.plist │ │ ├── HDCoverage-dummy.m │ │ ├── HDCoverage-prefix.pch │ │ ├── HDCoverage-umbrella.h │ │ ├── HDCoverage.debug.xcconfig │ │ ├── HDCoverage.modulemap │ │ ├── HDCoverage.release.xcconfig │ │ └── HDCoverage.xcconfig │ │ └── Pods-HDCoverageDemo │ │ ├── Pods-HDCoverageDemo-Info.plist │ │ ├── Pods-HDCoverageDemo-acknowledgements.markdown │ │ ├── Pods-HDCoverageDemo-acknowledgements.plist │ │ ├── Pods-HDCoverageDemo-dummy.m │ │ ├── Pods-HDCoverageDemo-frameworks.sh │ │ ├── Pods-HDCoverageDemo-umbrella.h │ │ ├── Pods-HDCoverageDemo.debug.xcconfig │ │ ├── Pods-HDCoverageDemo.modulemap │ │ └── Pods-HDCoverageDemo.release.xcconfig └── Tests │ ├── Info.plist │ └── Tests.swift ├── HDCoverage.podspec ├── HDCoverage ├── Classes │ ├── HDGatherCoverage.h │ └── HDGatherCoverage.m ├── GitdiffUtils │ ├── changeSourcePath.rb │ ├── deleteExtraData.rb │ ├── diffParser.rb │ └── trollop.rb ├── hd_buildsetting_env.sh ├── hd_coverage_buildsettings.rb ├── hd_coverage_env.sh ├── hd_macho_copy.sh ├── hd_parse_profraw.sh └── hd_parse_profraw_gather.sh ├── HDCoverageSFramework └── HDCoverageSFramework.zip ├── Img ├── auto_create_coverage.png ├── coverage.jpg ├── coverage_gather1.png ├── coverage_gather2.png ├── coverage_gather3.png ├── coverage_gather4.png ├── coverage_result1.png ├── coverage_result2.png ├── coverage_test.png ├── image-20211022144208211.png ├── image-20211029141436560.png └── 代码覆盖率-iBIu支持V1.1.pdf ├── LICENSE ├── README.md ├── Source-based ├── bar_oc │ ├── bar.ll │ ├── bar.m │ ├── bar_coverage │ ├── bar_coverage.profdata │ ├── bar_coverage_html │ │ ├── coverage │ │ │ └── Users │ │ │ │ └── denglibing │ │ │ │ └── HDProject │ │ │ │ └── HarryProject │ │ │ │ └── iOS │ │ │ │ └── HDCoverage │ │ │ │ └── Source-based │ │ │ │ └── bar_oc │ │ │ │ └── bar.m.html │ │ ├── index.html │ │ └── style.css │ ├── bar_coverage_profdata.text │ ├── bar_no_coverage │ ├── default.profraw │ └── main.s ├── bar_swift │ ├── bar_coverage │ ├── bar_coverage.profdata │ ├── bar_coverage_html │ │ ├── coverage │ │ │ └── Users │ │ │ │ └── denglibing │ │ │ │ └── HDProject │ │ │ │ └── HarryProject │ │ │ │ └── iOS │ │ │ │ └── HDCoverage │ │ │ │ └── Source-based │ │ │ │ └── bar_swift │ │ │ │ └── bar.swift.html │ │ ├── index.html │ │ └── style.css │ ├── bar_coverage_profdata.text │ ├── bar_no_coverage │ ├── bars.swift │ ├── bars │ │ └── bar.swift │ ├── default.profraw │ └── default.txt └── foo_c │ ├── foo │ ├── foo.cc │ ├── foo.json │ ├── foo.profdata │ ├── foo.profraw │ └── no_coverage_foo ├── _Pods.xcodeproj ├── cocoapods-coverage └── cocoapods-hdcoverage │ ├── .gitignore │ ├── Gemfile │ ├── LICENSE.txt │ ├── README.md │ ├── Rakefile │ ├── cocoapods-hdcoverage-0.0.1.gem │ ├── cocoapods-hdcoverage.gemspec │ ├── lib │ ├── cocoapods-hdcoverage.rb │ ├── cocoapods-hdcoverage │ │ ├── command.rb │ │ ├── command │ │ │ └── hdcoverage.rb │ │ └── gem_version.rb │ └── cocoapods_plugin.rb │ └── spec │ ├── command │ └── hdcoverage_spec.rb │ └── spec_helper.rb └── pod_release.sh /.github/workflows/objective-c-xcode.yml: -------------------------------------------------------------------------------- 1 | name: Xcode - Build and Analyze 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | name: Build and analyse default scheme using xcodebuild command 12 | runs-on: macos-latest 13 | 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v3 17 | - name: Set Default Scheme 18 | run: | 19 | scheme_list=$(xcodebuild -list -json | tr -d "\n") 20 | default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]") 21 | echo $default | cat >default 22 | echo Using default scheme: $default 23 | - name: Build 24 | env: 25 | scheme: ${{ 'default' }} 26 | run: | 27 | if [ $scheme = default ]; then scheme=$(cat default); fi 28 | if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi 29 | file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` 30 | xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]} 31 | -------------------------------------------------------------------------------- /.github/workflows/swift.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Swift project 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift 3 | 4 | name: Swift 5 | 6 | on: 7 | push: 8 | branches: [ "master" ] 9 | pull_request: 10 | branches: [ "master" ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: macos-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - name: Build 20 | run: swift build -v 21 | - name: Run tests 22 | run: swift test -v 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # macOS 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 26 | # Carthage/Checkouts 27 | 28 | Carthage/Build 29 | 30 | # We recommend against adding the Pods directory to your .gitignore. However 31 | # you should judge for yourself, the pros and cons are mentioned at: 32 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 33 | # 34 | # Note: if you ignore the Pods directory, make sure to uncomment 35 | # `pod install` in .travis.yml 36 | # 37 | # Pods/ 38 | 39 | # 代码覆盖率相关文件 40 | Example/CoverageResult/ 41 | 42 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/ 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/HDCoverage.xcworkspace -scheme HDCoverage-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/HDCoverage.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/HDCoverage.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/HDCoverage.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // HDCoverageDemo 4 | // 5 | // Created by denglibing on 2021/10/24. 6 | // Copyright © 2021 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @main 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 14 | HDCoverageTools.shared.registerCoverage(moduleName: "HDCoverage") 15 | return true 16 | } 17 | 18 | // MARK: UISceneSession Lifecycle 19 | 20 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 21 | // Called when a new scene session is being created. 22 | // Use this method to select a configuration to create the new scene with. 23 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 24 | } 25 | 26 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 27 | // Called when the user discards a scene session. 28 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 29 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 30 | } 31 | 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/CoverageTest/HDOC.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDOC.h 3 | // HDCoverageDemo 4 | // 5 | // Created by denglibing on 2021/10/15. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface HDOC : NSObject 13 | 14 | + (void)projectOCAction:(NSInteger)tag; 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/CoverageTest/HDOC.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDOC.m 3 | // HDCoverageDemo 4 | // 5 | // Created by denglibing on 2021/10/15. 6 | // 7 | 8 | #import "HDOC.h" 9 | 10 | @implementation HDOC 11 | 12 | + (void)projectOCAction:(NSInteger)tag { 13 | if (tag == 1) { 14 | NSLog(@"projectOCAction: %d", 1); 15 | } 16 | else if (tag == 2) { 17 | NSLog(@"projectOCAction: %d", 2); 18 | } 19 | else if (tag == 3) { 20 | NSLog(@"projectOCAction: %d", 3); 21 | } 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/CoverageTest/HDSwift.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HDSwift.swift 3 | // HDCoverageDemo 4 | // 5 | // Created by denglibing on 2021/10/21. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | struct HDSwift { 12 | static func projectSwiftAction(_ tag: Int) { 13 | if (tag == 1) { 14 | print("projectSwiftAction: 1") 15 | } 16 | else if (tag == 2) { 17 | print("projectSwiftAction: 2") 18 | } 19 | else if (tag == 3) { 20 | print("projectSwiftAction: 3") 21 | } 22 | 23 | UIView.animate(withDuration: 0.1, delay: 0.3, options: .allowAnimatedContent) { 24 | if arc4random() % 2 == 0 { 25 | print("animate block 1") 26 | } 27 | else { 28 | print("animate block 2") 29 | } 30 | } completion: { _ in 31 | print("completion block") 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageDemo-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "HDOC.h" 6 | #import "InstrProfiling.h" 7 | #import 8 | #import 9 | #import 10 | 11 | 12 | #import "UIButton+PGWeb.h" 13 | #import "UIImageView+PGWeb.h" 14 | #import "SDAnimatedImageView.h" 15 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/HDCoverageSFramework: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/HDCoverageSFramework -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Headers/HDCoverageSFramework.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDCoverageSFramework.h 3 | // HDCoverageSFramework 4 | // 5 | // Created by denglibing on 2022/2/24. 6 | // 7 | 8 | #import 9 | 10 | #import "HDOCSFramework.h" 11 | 12 | //! Project version number for HDCoverageSFramework. 13 | FOUNDATION_EXPORT double HDCoverageSFrameworkVersionNumber; 14 | 15 | //! Project version string for HDCoverageSFramework. 16 | FOUNDATION_EXPORT const unsigned char HDCoverageSFrameworkVersionString[]; 17 | 18 | // In this header, you should import all the public headers of your framework using statements like #import 19 | 20 | 21 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Headers/HDOCSFramework.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDOCSFramework.h 3 | // HDCoverageSFramework 4 | // 5 | // Created by denglibing on 2022/2/24. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface HDOCSFramework : NSObject 13 | 14 | + (void)frameworkOCStaticFrameworkAction:(NSInteger)tag; 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Info.plist -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Modules/HDCoverageSFramework.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Modules/HDCoverageSFramework.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Modules/HDCoverageSFramework.swiftmodule/x86_64-apple-ios-simulator.abi.json: -------------------------------------------------------------------------------- 1 | { 2 | "ABIRoot": { 3 | "kind": "Root", 4 | "name": "TopLevel", 5 | "printedName": "TopLevel", 6 | "json_format_version": 8 7 | }, 8 | "ConstValues": [] 9 | } -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Modules/HDCoverageSFramework.swiftmodule/x86_64-apple-ios-simulator.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Modules/HDCoverageSFramework.swiftmodule/x86_64-apple-ios-simulator.swiftdoc -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Modules/HDCoverageSFramework.swiftmodule/x86_64-apple-ios-simulator.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Modules/HDCoverageSFramework.swiftmodule/x86_64-apple-ios-simulator.swiftmodule -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module HDCoverageSFramework { 2 | umbrella header "HDCoverageSFramework.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | 8 | module HDCoverageSFramework.Swift { 9 | header "HDCoverageSFramework-Swift.h" 10 | requires objc 11 | } 12 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/_CodeSignature/CodeDirectory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/_CodeSignature/CodeDirectory -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/_CodeSignature/CodeRequirements: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/_CodeSignature/CodeRequirements -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/_CodeSignature/CodeRequirements-1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/_CodeSignature/CodeRequirements-1 -------------------------------------------------------------------------------- /Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/_CodeSignature/CodeSignature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Example/HDCoverageDemo/HDCoverageSFramework/HDCoverageSFramework.framework/_CodeSignature/CodeSignature -------------------------------------------------------------------------------- /Example/HDCoverageDemo/Sources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/Sources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/Sources/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/Sources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UIApplicationSupportsIndirectInputEvents 43 | 44 | UIFileSharingEnabled 45 | 46 | UILaunchStoryboardName 47 | LaunchScreen 48 | UIMainStoryboardFile 49 | Main 50 | UIRequiredDeviceCapabilities 51 | 52 | armv7 53 | 54 | UISupportedInterfaceOrientations 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationLandscapeLeft 58 | UIInterfaceOrientationLandscapeRight 59 | 60 | UISupportedInterfaceOrientations~ipad 61 | 62 | UIInterfaceOrientationPortrait 63 | UIInterfaceOrientationPortraitUpsideDown 64 | UIInterfaceOrientationLandscapeLeft 65 | UIInterfaceOrientationLandscapeRight 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/Tools/HDCoverageTools.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Tools.swift 3 | // HDCoverageDemo 4 | // 5 | // Created by denglibing on 2021/10/27. 6 | // 7 | 8 | import Foundation 9 | 10 | class HDCoverageTools: NSObject { 11 | static var shared = HDCoverageTools() 12 | 13 | func registerCoverage(moduleName: String) { 14 | let name = "\(moduleName).profraw" 15 | print("registerCoverage, moduleName: \(moduleName)") 16 | let fileManager = FileManager.default 17 | do { 18 | let documentDirectory = try fileManager.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 19 | let filePath: NSString = documentDirectory.appendingPathComponent(name).path as NSString 20 | print("HDCoverageGather filePath: \(filePath)") 21 | __llvm_profile_set_filename(filePath.utf8String) 22 | } catch { 23 | print(error) 24 | } 25 | // saveAndUpload() 26 | } 27 | 28 | // 合适的时机代码覆盖率上报 29 | func saveAndUpload() { 30 | __llvm_profile_write_file() 31 | debugPrint("HDCoverageTools.shared.saveAndUpload") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/Tools/InstrProfiling.h: -------------------------------------------------------------------------------- 1 | // 2 | // InstrProfiling.h 3 | // HDCoverageDemo 4 | // 5 | // Created by denglibing on 2021/10/20. 6 | // 7 | 8 | #ifndef PROFILE_INSTRPROFILING_H_ 9 | #define PROFILE_INSTRPROFILING_H_ 10 | 11 | // https://clang.llvm.org/docs/SourceBasedCodeCoverage.html 12 | int __llvm_profile_runtime = 0; 13 | void __llvm_profile_initialize_file(void); 14 | const char *__llvm_profile_get_filename(void); 15 | void __llvm_profile_set_filename(const char *); 16 | int __llvm_profile_write_file(void); 17 | int __llvm_profile_register_write_file_atexit(void); 18 | const char *__llvm_profile_get_path_prefix(void); 19 | #endif /* PROFILE_INSTRPROFILING_H_ */ 20 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/NetworkImage/UIButton+JX.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+JX.swift 3 | // pgImageModule 4 | // 5 | // Created by denglibing on 2021/6/28. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | extension JXImageWrapper where Base: UIButton { 12 | /// 加载网络图片 13 | /// - Parameters: 14 | /// - url: 图片URL 15 | /// - placeholder: 兜底图片 16 | /// - options: 图片加载设置 17 | public func setImage(url: URL?, state: UIControl.State, placeholder: UIImage? = nil, options: OptionsInfo, completionHandler: ((Result) -> Void)? = nil) { 18 | let options = JXImageParsedOptionsInfo(defaultOptions + options) 19 | _setImage(url: url, state: state, placeholder: placeholder, options: options, completionHandler: completionHandler) 20 | } 21 | 22 | func _setImage(url: URL?, state: UIControl.State, placeholder: UIImage?, options: JXImageParsedOptionsInfo, completionHandler: ((Result) -> Void)? = nil) { 23 | let options2: [PGWebImageOptions: Any] = [.enable: options.webpEnable ?? true, .degradeQuality: options.degradeQuality ?? true, .ccSize: options.ccSize ?? .zero, .imageSize: options.imageSize ?? .zero, .cacheOnly: options.cacheOnly ?? false] 24 | base.jx_setImage(with: url, for: state, placeholder: placeholder, options: options2) { image in 25 | completionHandler?(.success(image)) 26 | } failure: { error in 27 | #warning("错误信息需要完善") 28 | let error2 = error ?? NSError(domain: "com.imagemodule.error", code: -1234, userInfo: nil) 29 | completionHandler?(.failure(error2 as NSError)) 30 | } 31 | } 32 | } 33 | 34 | extension UIButton: JXImageCompatible {} 35 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/Public/UIButton+PGWeb.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGImageView+Addtion.h 3 | // pgBusinessFoundationModule 4 | // 5 | // Created by denglibing on 2020/7/13. 6 | // 7 | 8 | #import 9 | #import "UIImageView+PGWeb.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIButton (PGWeb) 14 | 15 | /// 加载图片 16 | /// @param url 图片链接 17 | /// @param placeholder 兜底图片 18 | /// @param options 图片设置 19 | /// @warning 此API专用于`ObjC`,`Swift`请不要使用此API,使用`imageView.jx.setImage` 20 | - (void)jx_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholder:(nullable UIImage *)placeholder options:(NSDictionary *)options; 21 | 22 | /// 加载图片 23 | /// @param url 图片链接 24 | /// @param placeholder 兜底图片 25 | /// @param options 图片设置 26 | /// @param success 成功回调 27 | /// @param failure 失败回调 28 | /// @warning 此API专用于`ObjC`,`Swift`请不要使用此API,使用`imageView.jx.setImage` 29 | - (void)jx_setImageWithURL:(nullable NSURL *)url 30 | forState:(UIControlState)state 31 | placeholder:(nullable UIImage *)placeholder 32 | options:(NSDictionary *)options 33 | success:(nullable void (^)(UIImage *image))success 34 | failure:(nullable void (^)(NSError *_Nullable error))failure; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #import "SDWebImageCompat.h" 13 | 14 | /** 15 | You can use switch case like normal enum. It's also recommended to add a default case. You should not assume anything about the raw value. 16 | For custom coder plugin, it can also extern the enum for supported format. See `SDImageCoder` for more detailed information. 17 | */ 18 | typedef NSInteger SDImageFormat NS_TYPED_EXTENSIBLE_ENUM; 19 | static const SDImageFormat SDImageFormatUndefined = -1; 20 | static const SDImageFormat SDImageFormatJPEG = 0; 21 | static const SDImageFormat SDImageFormatPNG = 1; 22 | static const SDImageFormat SDImageFormatGIF = 2; 23 | static const SDImageFormat SDImageFormatTIFF = 3; 24 | static const SDImageFormat SDImageFormatWebP = 4; 25 | static const SDImageFormat SDImageFormatHEIC = 5; 26 | static const SDImageFormat SDImageFormatHEIF = 6; 27 | static const SDImageFormat SDImageFormatPDF = 7; 28 | static const SDImageFormat SDImageFormatSVG = 8; 29 | 30 | /** 31 | NSData category about the image content type and UTI. 32 | */ 33 | @interface NSData (ImageContentType) 34 | 35 | /** 36 | * Return image format 37 | * 38 | * @param data the input image data 39 | * 40 | * @return the image format as `SDImageFormat` (enum) 41 | */ 42 | + (SDImageFormat)jx_imageFormatForImageData:(nullable NSData *)data; 43 | 44 | /** 45 | * Convert SDImageFormat to UTType 46 | * 47 | * @param format Format as SDImageFormat 48 | * @return The UTType as CFStringRef 49 | * @note For unknown format, `kUTTypeImage` abstract type will return 50 | */ 51 | + (nonnull CFStringRef)jx_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(jx_UTType(from:)); 52 | 53 | /** 54 | * Convert UTType to SDImageFormat 55 | * 56 | * @param uttype The UTType as CFStringRef 57 | * @return The Format as SDImageFormat 58 | * @note For unknown type, `SDImageFormatUndefined` will return 59 | */ 60 | + (SDImageFormat)jx_imageFormatFromUTType:(nonnull CFStringRef)uttype; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDAnimatedImageRep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | /** 14 | A subclass of `NSBitmapImageRep` to fix that GIF duration issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`. 15 | This also fix the GIF loop count issue, which will use the Netscape standard (See http://www6.uniovi.es/gifanim/gifabout.htm) to only place once when the `kCGImagePropertyGIFLoopCount` is nil. This is what modern browser's behavior. 16 | Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image. 17 | This also support APNG format using `SDImageAPNGCoder`. Which provide full alpha-channel support and the correct duration match the `kCGImagePropertyAPNGUnclampedDelayTime`. 18 | */ 19 | @interface SDAnimatedImageRep : NSBitmapImageRep 20 | 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageAPNGCoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDImageIOAnimatedCoder.h" 11 | 12 | /** 13 | Built in coder using ImageIO that supports APNG encoding/decoding 14 | */ 15 | @interface SDImageAPNGCoder : SDImageIOAnimatedCoder 16 | 17 | @property (nonatomic, class, readonly, nonnull) SDImageAPNGCoder *sharedCoder; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageAPNGCoder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageAPNGCoder.h" 10 | #if SD_MAC 11 | #import 12 | #else 13 | #import 14 | #endif 15 | 16 | @implementation SDImageAPNGCoder 17 | 18 | + (instancetype)sharedCoder { 19 | static SDImageAPNGCoder *coder; 20 | static dispatch_once_t onceToken; 21 | dispatch_once(&onceToken, ^{ 22 | coder = [[SDImageAPNGCoder alloc] init]; 23 | }); 24 | return coder; 25 | } 26 | 27 | #pragma mark - Subclass Override 28 | 29 | + (SDImageFormat)imageFormat { 30 | return SDImageFormatPNG; 31 | } 32 | 33 | + (NSString *)imageUTType { 34 | return (__bridge NSString *)kUTTypePNG; 35 | } 36 | 37 | + (NSString *)dictionaryProperty { 38 | return (__bridge NSString *)kCGImagePropertyPNGDictionary; 39 | } 40 | 41 | + (NSString *)unclampedDelayTimeProperty { 42 | return (__bridge NSString *)kCGImagePropertyAPNGUnclampedDelayTime; 43 | } 44 | 45 | + (NSString *)delayTimeProperty { 46 | return (__bridge NSString *)kCGImagePropertyAPNGDelayTime; 47 | } 48 | 49 | + (NSString *)loopCountProperty { 50 | return (__bridge NSString *)kCGImagePropertyAPNGLoopCount; 51 | } 52 | 53 | + (NSUInteger)defaultLoopCount { 54 | return 0; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageAWebPCoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDImageIOAnimatedCoder.h" 11 | 12 | /** 13 | This coder is used for Google WebP and Animated WebP(AWebP) image format. 14 | Image/IO provide the WebP decoding support in iOS 14/macOS 11/tvOS 14/watchOS 7+. 15 | @note Currently Image/IO seems does not supports WebP encoding, if you need WebP encoding, use the custom codec below. 16 | @note If you need to support lower firmware version for WebP, you can have a try at https://github.com/SDWebImage/SDWebImageWebPCoder 17 | */ 18 | API_AVAILABLE(ios(14.0), tvos(14.0), macos(11.0), watchos(7.0)) 19 | @interface SDImageAWebPCoder : SDImageIOAnimatedCoder 20 | 21 | @property (nonatomic, class, readonly, nonnull) SDImageAWebPCoder *sharedCoder; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageCoder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCoder.h" 10 | 11 | SDImageCoderOption const SDImageCoderDecodeFirstFrameOnly = @"decodeFirstFrameOnly"; 12 | SDImageCoderOption const SDImageCoderDecodeScaleFactor = @"decodeScaleFactor"; 13 | SDImageCoderOption const SDImageCoderDecodePreserveAspectRatio = @"decodePreserveAspectRatio"; 14 | SDImageCoderOption const SDImageCoderDecodeThumbnailPixelSize = @"decodeThumbnailPixelSize"; 15 | 16 | SDImageCoderOption const SDImageCoderEncodeFirstFrameOnly = @"encodeFirstFrameOnly"; 17 | SDImageCoderOption const SDImageCoderEncodeCompressionQuality = @"encodeCompressionQuality"; 18 | SDImageCoderOption const SDImageCoderEncodeBackgroundColor = @"encodeBackgroundColor"; 19 | SDImageCoderOption const SDImageCoderEncodeMaxPixelSize = @"encodeMaxPixelSize"; 20 | SDImageCoderOption const SDImageCoderEncodeMaxFileSize = @"encodeMaxFileSize"; 21 | SDImageCoderOption const SDImageCoderEncodeEmbedThumbnail = @"encodeEmbedThumbnail"; 22 | 23 | SDImageCoderOption const SDImageCoderWebImageContext = @"webImageContext"; 24 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageCodersManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDImageCoder.h" 11 | 12 | /** 13 | Global object holding the array of coders, so that we avoid passing them from object to object. 14 | Uses a priority queue behind scenes, which means the latest added coders have the highest priority. 15 | This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data. 16 | That way, users can add their custom coders while preserving our existing prebuilt ones 17 | 18 | Note: the `coders` getter will return the coders in their reversed order 19 | Example: 20 | - by default we internally set coders = `IOCoder`, `GIFCoder`, `APNGCoder` 21 | - calling `coders` will return `@[IOCoder, GIFCoder, APNGCoder]` 22 | - call `[addCoder:[MyCrazyCoder new]]` 23 | - calling `coders` now returns `@[IOCoder, GIFCoder, APNGCoder, MyCrazyCoder]` 24 | 25 | Coders 26 | ------ 27 | A coder must conform to the `SDImageCoder` protocol or even to `SDProgressiveImageCoder` if it supports progressive decoding 28 | Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat` 29 | Those methods are called on each coder in the array (using the priority order) until one of them returns YES. 30 | That means that coder can decode that data / encode to that format 31 | */ 32 | @interface SDImageCodersManager : NSObject 33 | 34 | /** 35 | Returns the global shared coders manager instance. 36 | */ 37 | @property (nonatomic, class, readonly, nonnull) SDImageCodersManager *sharedManager; 38 | 39 | /** 40 | All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority 41 | */ 42 | @property (nonatomic, copy, nullable) NSArray> *coders; 43 | 44 | /** 45 | Add a new coder to the end of coders array. Which has the highest priority. 46 | 47 | @param coder coder 48 | */ 49 | - (void)addCoder:(nonnull id)coder; 50 | 51 | /** 52 | Remove a coder in the coders array. 53 | 54 | @param coder coder 55 | */ 56 | - (void)removeCoder:(nonnull id)coder; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageFrame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | #import "SDWebImageCompat.h" 12 | 13 | /** 14 | This class is used for creating animated images via `animatedImageWithFrames` in `SDImageCoderHelper`. 15 | @note If you need to specify animated images loop count, use `jx_imageLoopCount` property in `UIImage+Metadata.h`. 16 | */ 17 | @interface SDImageFrame : NSObject 18 | 19 | /** 20 | The image of current frame. You should not set an animated image. 21 | */ 22 | @property (nonatomic, strong, readonly, nonnull) UIImage *image; 23 | /** 24 | The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero. 25 | */ 26 | @property (nonatomic, readonly, assign) NSTimeInterval duration; 27 | 28 | /** 29 | Create a frame instance with specify image and duration 30 | 31 | @param image current frame's image 32 | @param duration current frame's duration 33 | @return frame instance 34 | */ 35 | + (instancetype _Nonnull)frameWithImage:(UIImage *_Nonnull)image duration:(NSTimeInterval)duration; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageFrame.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageFrame.h" 10 | 11 | @interface SDImageFrame () 12 | 13 | @property (nonatomic, strong, readwrite, nonnull) UIImage *image; 14 | @property (nonatomic, readwrite, assign) NSTimeInterval duration; 15 | 16 | @end 17 | 18 | @implementation SDImageFrame 19 | 20 | + (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration { 21 | SDImageFrame *frame = [[SDImageFrame alloc] init]; 22 | frame.image = image; 23 | frame.duration = duration; 24 | 25 | return frame; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageGIFCoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDImageIOAnimatedCoder.h" 11 | 12 | /** 13 | Built in coder using ImageIO that supports animated GIF encoding/decoding 14 | @note `SDImageIOCoder` supports GIF but only as static (will use the 1st frame). 15 | @note Use `SDImageGIFCoder` for fully animated GIFs. For `UIImageView`, it will produce animated `UIImage`(`NSImage` on macOS) for rendering. For `SDAnimatedImageView`, it will use `SDAnimatedImage` for rendering. 16 | @note The recommended approach for animated GIFs is using `SDAnimatedImage` with `SDAnimatedImageView`. It's more performant than `UIImageView` for GIF displaying(especially on memory usage) 17 | */ 18 | @interface SDImageGIFCoder : SDImageIOAnimatedCoder 19 | 20 | @property (nonatomic, class, readonly, nonnull) SDImageGIFCoder *sharedCoder; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageGIFCoder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageGIFCoder.h" 10 | #if SD_MAC 11 | #import 12 | #else 13 | #import 14 | #endif 15 | 16 | @implementation SDImageGIFCoder 17 | 18 | + (instancetype)sharedCoder { 19 | static SDImageGIFCoder *coder; 20 | static dispatch_once_t onceToken; 21 | dispatch_once(&onceToken, ^{ 22 | coder = [[SDImageGIFCoder alloc] init]; 23 | }); 24 | return coder; 25 | } 26 | 27 | #pragma mark - Subclass Override 28 | 29 | + (SDImageFormat)imageFormat { 30 | return SDImageFormatGIF; 31 | } 32 | 33 | + (NSString *)imageUTType { 34 | return (__bridge NSString *)kUTTypeGIF; 35 | } 36 | 37 | + (NSString *)dictionaryProperty { 38 | return (__bridge NSString *)kCGImagePropertyGIFDictionary; 39 | } 40 | 41 | + (NSString *)unclampedDelayTimeProperty { 42 | return (__bridge NSString *)kCGImagePropertyGIFUnclampedDelayTime; 43 | } 44 | 45 | + (NSString *)delayTimeProperty { 46 | return (__bridge NSString *)kCGImagePropertyGIFDelayTime; 47 | } 48 | 49 | + (NSString *)loopCountProperty { 50 | return (__bridge NSString *)kCGImagePropertyGIFLoopCount; 51 | } 52 | 53 | + (NSUInteger)defaultLoopCount { 54 | return 1; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageGraphics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import 11 | 12 | /** 13 | These following graphics context method are provided to easily write cross-platform(AppKit/UIKit) code. 14 | For UIKit, these methods just call the same method in `UIGraphics.h`. See the documentation for usage. 15 | For AppKit, these methods use `NSGraphicsContext` to create image context and match the behavior like UIKit. 16 | @note If you don't care bitmap format (ARGB8888) and just draw image, use `SDGraphicsImageRenderer` instead. It's more performant on RAM usage.` 17 | */ 18 | 19 | /// Returns the current graphics context. 20 | FOUNDATION_EXPORT CGContextRef __nullable SDGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED; 21 | /// Creates a bitmap-based graphics context and makes it the current context. 22 | FOUNDATION_EXPORT void SDGraphicsBeginImageContext(CGSize size); 23 | /// Creates a bitmap-based graphics context with the specified options. 24 | FOUNDATION_EXPORT void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); 25 | /// Removes the current bitmap-based graphics context from the top of the stack. 26 | FOUNDATION_EXPORT void SDGraphicsEndImageContext(void); 27 | /// Returns an image based on the contents of the current bitmap-based graphics context. 28 | FOUNDATION_EXPORT UIImage * __nullable SDGraphicsGetImageFromCurrentImageContext(void); 29 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageHEICCoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDImageIOAnimatedCoder.h" 11 | 12 | /** 13 | This coder is used for HEIC (HEIF with HEVC container codec) image format. 14 | Image/IO provide the static HEIC (.heic) support in iOS 11/macOS 10.13/tvOS 11/watchOS 4+. 15 | Image/IO provide the animated HEIC (.heics) support in iOS 13/macOS 10.15/tvOS 13/watchOS 6+. 16 | See https://nokiatech.github.io/heif/technical.html for the standard. 17 | @note This coder is not in the default coder list for now, since HEIC animated image is really rare, and Apple's implementation still contains performance issues. You can enable if you need this. 18 | @note If you need to support lower firmware version for HEIF, you can have a try at https://github.com/SDWebImage/SDWebImageHEIFCoder 19 | */ 20 | API_AVAILABLE(ios(13.0), tvos(13.0), macos(10.15), watchos(6.0)) 21 | @interface SDImageHEICCoder : SDImageIOAnimatedCoder 22 | 23 | @property (nonatomic, class, readonly, nonnull) SDImageHEICCoder *sharedCoder; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageIOCoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDImageCoder.h" 11 | 12 | /** 13 | Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding. 14 | 15 | GIF 16 | Also supports static GIF (meaning will only handle the 1st frame). 17 | For a full GIF support, we recommend `SDAnimatedImageView` to keep both CPU and memory balanced. 18 | 19 | HEIC 20 | This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf 21 | Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13) 22 | Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU)) 23 | Encode(Software): macOS 10.13 24 | Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU)) 25 | */ 26 | @interface SDImageIOCoder : NSObject 27 | 28 | @property (nonatomic, class, readonly, nonnull) SDImageIOCoder *sharedCoder; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDImageLoadersManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageLoader.h" 10 | 11 | /** 12 | A loaders manager to manage multiple loaders 13 | */ 14 | @interface SDImageLoadersManager : NSObject 15 | 16 | /** 17 | Returns the global shared loaders manager instance. By default we will set [`SDWebImageDownloader.sharedDownloader`] into the loaders array. 18 | */ 19 | @property (nonatomic, class, readonly, nonnull) SDImageLoadersManager *sharedManager; 20 | 21 | /** 22 | All image loaders in manager. The loaders array is a priority queue, which means the later added loader will have the highest priority 23 | */ 24 | @property (nonatomic, copy, nullable) NSArray>* loaders; 25 | 26 | /** 27 | Add a new image loader to the end of loaders array. Which has the highest priority. 28 | 29 | @param loader loader 30 | */ 31 | - (void)addLoader:(nonnull id)loader; 32 | 33 | /** 34 | Remove an image loader in the loaders array. 35 | 36 | @param loader loader 37 | */ 38 | - (void)removeLoader:(nonnull id)loader; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageCacheKeyFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | typedef NSString * _Nullable(^SDWebImageCacheKeyFilterBlock)(NSURL * _Nonnull url); 13 | 14 | /** 15 | This is the protocol for cache key filter. 16 | We can use a block to specify the cache key filter. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. 17 | */ 18 | @protocol SDWebImageCacheKeyFilter 19 | 20 | - (nullable NSString *)cacheKeyForURL:(nonnull NSURL *)url; 21 | 22 | @end 23 | 24 | /** 25 | A cache key filter class with block. 26 | */ 27 | @interface SDWebImageCacheKeyFilter : NSObject 28 | 29 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block; 30 | + (nonnull instancetype)cacheKeyFilterWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageCacheKeyFilter.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCacheKeyFilter.h" 10 | 11 | @interface SDWebImageCacheKeyFilter () 12 | 13 | @property (nonatomic, copy, nonnull) SDWebImageCacheKeyFilterBlock block; 14 | 15 | @end 16 | 17 | @implementation SDWebImageCacheKeyFilter 18 | 19 | - (instancetype)initWithBlock:(SDWebImageCacheKeyFilterBlock)block { 20 | self = [super init]; 21 | if (self) { 22 | self.block = block; 23 | } 24 | return self; 25 | } 26 | 27 | + (instancetype)cacheKeyFilterWithBlock:(SDWebImageCacheKeyFilterBlock)block { 28 | SDWebImageCacheKeyFilter *cacheKeyFilter = [[SDWebImageCacheKeyFilter alloc] initWithBlock:block]; 29 | return cacheKeyFilter; 30 | } 31 | 32 | - (NSString *)cacheKeyForURL:(NSURL *)url { 33 | if (!self.block) { 34 | return nil; 35 | } 36 | return self.block(url); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageCacheSerializer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | typedef NSData * _Nullable(^SDWebImageCacheSerializerBlock)(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL); 13 | 14 | /** 15 | This is the protocol for cache serializer. 16 | We can use a block to specify the cache serializer. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. 17 | */ 18 | @protocol SDWebImageCacheSerializer 19 | 20 | /// Provide the image data associated to the image and store to disk cache 21 | /// @param image The loaded image 22 | /// @param data The original loaded image data 23 | /// @param imageURL The image URL 24 | - (nullable NSData *)cacheDataWithImage:(nonnull UIImage *)image originalData:(nullable NSData *)data imageURL:(nullable NSURL *)imageURL; 25 | 26 | @end 27 | 28 | /** 29 | A cache serializer class with block. 30 | */ 31 | @interface SDWebImageCacheSerializer : NSObject 32 | 33 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheSerializerBlock)block; 34 | + (nonnull instancetype)cacheSerializerWithBlock:(nonnull SDWebImageCacheSerializerBlock)block; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageCacheSerializer.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCacheSerializer.h" 10 | 11 | @interface SDWebImageCacheSerializer () 12 | 13 | @property (nonatomic, copy, nonnull) SDWebImageCacheSerializerBlock block; 14 | 15 | @end 16 | 17 | @implementation SDWebImageCacheSerializer 18 | 19 | - (instancetype)initWithBlock:(SDWebImageCacheSerializerBlock)block { 20 | self = [super init]; 21 | if (self) { 22 | self.block = block; 23 | } 24 | return self; 25 | } 26 | 27 | + (instancetype)cacheSerializerWithBlock:(SDWebImageCacheSerializerBlock)block { 28 | SDWebImageCacheSerializer *cacheSerializer = [[SDWebImageCacheSerializer alloc] initWithBlock:block]; 29 | return cacheSerializer; 30 | } 31 | 32 | - (NSData *)cacheDataWithImage:(UIImage *)image originalData:(NSData *)data imageURL:(nullable NSURL *)imageURL { 33 | if (!self.block) { 34 | return nil; 35 | } 36 | return self.block(image, data, imageURL); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageCompat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if !__has_feature(objc_arc) 12 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 13 | #endif 14 | 15 | #if !OS_OBJECT_USE_OBJC 16 | #error SDWebImage need ARC for dispatch object 17 | #endif 18 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageDownloaderConfig.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageDownloaderConfig.h" 10 | 11 | static SDWebImageDownloaderConfig * _defaultDownloaderConfig; 12 | 13 | @implementation SDWebImageDownloaderConfig 14 | 15 | + (SDWebImageDownloaderConfig *)defaultDownloaderConfig { 16 | static dispatch_once_t onceToken; 17 | dispatch_once(&onceToken, ^{ 18 | _defaultDownloaderConfig = [SDWebImageDownloaderConfig new]; 19 | }); 20 | return _defaultDownloaderConfig; 21 | } 22 | 23 | - (instancetype)init { 24 | self = [super init]; 25 | if (self) { 26 | _maxConcurrentDownloads = 6; 27 | _downloadTimeout = 15.0; 28 | _executionOrder = SDWebImageDownloaderFIFOExecutionOrder; 29 | } 30 | return self; 31 | } 32 | 33 | - (id)copyWithZone:(NSZone *)zone { 34 | SDWebImageDownloaderConfig *config = [[[self class] allocWithZone:zone] init]; 35 | config.maxConcurrentDownloads = self.maxConcurrentDownloads; 36 | config.downloadTimeout = self.downloadTimeout; 37 | config.minimumProgressInterval = self.minimumProgressInterval; 38 | config.sessionConfiguration = [self.sessionConfiguration copyWithZone:zone]; 39 | config.operationClass = self.operationClass; 40 | config.executionOrder = self.executionOrder; 41 | config.urlCredential = self.urlCredential; 42 | config.username = self.username; 43 | config.password = self.password; 44 | 45 | return config; 46 | } 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageDownloaderDecryptor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | typedef NSData * _Nullable (^SDWebImageDownloaderDecryptorBlock)(NSData * _Nonnull data, NSURLResponse * _Nullable response); 13 | 14 | /** 15 | This is the protocol for downloader decryptor. Which decrypt the original encrypted data before decoding. Note progressive decoding is not compatible for decryptor. 16 | We can use a block to specify the downloader decryptor. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. 17 | */ 18 | @protocol SDWebImageDownloaderDecryptor 19 | 20 | /// Decrypt the original download data and return a new data. You can use this to decrypt the data using your preferred algorithm. 21 | /// @param data The original download data 22 | /// @param response The URL response for data. If you modify the original URL response via response modifier, the modified version will be here. This arg is nullable. 23 | /// @note If nil is returned, the image download will be marked as failed with error `SDWebImageErrorBadImageData` 24 | - (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response; 25 | 26 | @end 27 | 28 | /** 29 | A downloader response modifier class with block. 30 | */ 31 | @interface SDWebImageDownloaderDecryptor : NSObject 32 | 33 | /// Create the data decryptor with block 34 | /// @param block A block to control decrypt logic 35 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block; 36 | 37 | /// Create the data decryptor with block 38 | /// @param block A block to control decrypt logic 39 | + (nonnull instancetype)decryptorWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block; 40 | 41 | @end 42 | 43 | /// Convenience way to create decryptor for common data encryption. 44 | @interface SDWebImageDownloaderDecryptor (Conveniences) 45 | 46 | /// Base64 Encoded image data decryptor 47 | @property (class, readonly, nonnull) SDWebImageDownloaderDecryptor *base64Decryptor; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageDownloaderDecryptor.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageDownloaderDecryptor.h" 10 | 11 | @interface SDWebImageDownloaderDecryptor () 12 | 13 | @property (nonatomic, copy, nonnull) SDWebImageDownloaderDecryptorBlock block; 14 | 15 | @end 16 | 17 | @implementation SDWebImageDownloaderDecryptor 18 | 19 | - (instancetype)initWithBlock:(SDWebImageDownloaderDecryptorBlock)block { 20 | self = [super init]; 21 | if (self) { 22 | self.block = block; 23 | } 24 | return self; 25 | } 26 | 27 | + (instancetype)decryptorWithBlock:(SDWebImageDownloaderDecryptorBlock)block { 28 | SDWebImageDownloaderDecryptor *decryptor = [[SDWebImageDownloaderDecryptor alloc] initWithBlock:block]; 29 | return decryptor; 30 | } 31 | 32 | - (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response { 33 | if (!self.block) { 34 | return nil; 35 | } 36 | return self.block(data, response); 37 | } 38 | 39 | @end 40 | 41 | @implementation SDWebImageDownloaderDecryptor (Conveniences) 42 | 43 | + (SDWebImageDownloaderDecryptor *)base64Decryptor { 44 | static SDWebImageDownloaderDecryptor *decryptor; 45 | static dispatch_once_t onceToken; 46 | dispatch_once(&onceToken, ^{ 47 | decryptor = [SDWebImageDownloaderDecryptor decryptorWithBlock:^NSData * _Nullable(NSData * _Nonnull data, NSURLResponse * _Nullable response) { 48 | NSData *modifiedData = [[NSData alloc] initWithBase64EncodedData:data options:NSDataBase64DecodingIgnoreUnknownCharacters]; 49 | return modifiedData; 50 | }]; 51 | }); 52 | return decryptor; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageDownloaderRequestModifier.h" 10 | 11 | @interface SDWebImageDownloaderRequestModifier () 12 | 13 | @property (nonatomic, copy, nonnull) SDWebImageDownloaderRequestModifierBlock block; 14 | 15 | @end 16 | 17 | @implementation SDWebImageDownloaderRequestModifier 18 | 19 | - (instancetype)initWithBlock:(SDWebImageDownloaderRequestModifierBlock)block { 20 | self = [super init]; 21 | if (self) { 22 | self.block = block; 23 | } 24 | return self; 25 | } 26 | 27 | + (instancetype)requestModifierWithBlock:(SDWebImageDownloaderRequestModifierBlock)block { 28 | SDWebImageDownloaderRequestModifier *requestModifier = [[SDWebImageDownloaderRequestModifier alloc] initWithBlock:block]; 29 | return requestModifier; 30 | } 31 | 32 | - (NSURLRequest *)modifiedRequestWithRequest:(NSURLRequest *)request { 33 | if (!self.block) { 34 | return nil; 35 | } 36 | return self.block(request); 37 | } 38 | 39 | @end 40 | 41 | @implementation SDWebImageDownloaderRequestModifier (Conveniences) 42 | 43 | - (instancetype)initWithMethod:(NSString *)method { 44 | return [self initWithMethod:method headers:nil body:nil]; 45 | } 46 | 47 | - (instancetype)initWithHeaders:(NSDictionary *)headers { 48 | return [self initWithMethod:nil headers:headers body:nil]; 49 | } 50 | 51 | - (instancetype)initWithBody:(NSData *)body { 52 | return [self initWithMethod:nil headers:nil body:body]; 53 | } 54 | 55 | - (instancetype)initWithMethod:(NSString *)method headers:(NSDictionary *)headers body:(NSData *)body { 56 | method = method ? [method copy] : @"GET"; 57 | headers = [headers copy]; 58 | body = [body copy]; 59 | return [self initWithBlock:^NSURLRequest * _Nullable(NSURLRequest * _Nonnull request) { 60 | NSMutableURLRequest *mutableRequest = [request mutableCopy]; 61 | mutableRequest.HTTPMethod = method; 62 | mutableRequest.HTTPBody = body; 63 | for (NSString *header in headers) { 64 | NSString *value = headers[header]; 65 | [mutableRequest setValue:value forHTTPHeaderField:header]; 66 | } 67 | return [mutableRequest copy]; 68 | }]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageError.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageCompat.h" 11 | 12 | FOUNDATION_EXPORT NSErrorDomain const _Nonnull SDWebImageErrorDomain; 13 | 14 | /// The HTTP status code for invalid download response (NSNumber *) 15 | FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey; 16 | 17 | /// SDWebImage error domain and codes 18 | typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) { 19 | SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL 20 | SDWebImageErrorBadImageData = 1001, // The image data can not be decoded to image, or the image data is empty 21 | SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached` 22 | SDWebImageErrorBlackListed = 1003, // The URL is blacklisted because of unrecoverable failure marked by downloader (such as 404), you can use `.retryFailed` option to avoid this 23 | SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized 24 | SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image download response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey` 25 | SDWebImageErrorCancelled = 2002, // The image loading operation is cancelled before finished, during either async disk cache query, or waiting before actual network request. For actual network request error, check `NSURLErrorDomain` error domain and code. 26 | SDWebImageErrorInvalidDownloadResponse = 2003, // When using response modifier, the modified download response is nil and marked as failed. 27 | }; 28 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageError.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageError.h" 11 | 12 | NSErrorDomain const _Nonnull SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 13 | NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey = @"SDWebImageErrorDownloadStatusCodeKey"; 14 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | /// A protocol represents cancelable operation. 12 | @protocol SDWebImageOperation 13 | 14 | - (void)cancel; 15 | 16 | @end 17 | 18 | /// NSOperation conform to `SDWebImageOperation`. 19 | @interface NSOperation (SDWebImageOperation) 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageOperation.h" 10 | 11 | /// NSOperation conform to `SDWebImageOperation`. 12 | @implementation NSOperation (SDWebImageOperation) 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/SDWebImageOptionsProcessor.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageOptionsProcessor.h" 10 | 11 | @interface SDWebImageOptionsResult () 12 | 13 | @property (nonatomic, assign) SDWebImageOptions options; 14 | @property (nonatomic, copy, nullable) SDWebImageContext *context; 15 | 16 | @end 17 | 18 | @implementation SDWebImageOptionsResult 19 | 20 | - (instancetype)initWithOptions:(SDWebImageOptions)options context:(SDWebImageContext *)context { 21 | self = [super init]; 22 | if (self) { 23 | self.options = options; 24 | self.context = context; 25 | } 26 | return self; 27 | } 28 | 29 | @end 30 | 31 | @interface SDWebImageOptionsProcessor () 32 | 33 | @property (nonatomic, copy, nonnull) SDWebImageOptionsProcessorBlock block; 34 | 35 | @end 36 | 37 | @implementation SDWebImageOptionsProcessor 38 | 39 | - (instancetype)initWithBlock:(SDWebImageOptionsProcessorBlock)block { 40 | self = [super init]; 41 | if (self) { 42 | self.block = block; 43 | } 44 | return self; 45 | } 46 | 47 | + (instancetype)optionsProcessorWithBlock:(SDWebImageOptionsProcessorBlock)block { 48 | SDWebImageOptionsProcessor *optionsProcessor = [[SDWebImageOptionsProcessor alloc] initWithBlock:block]; 49 | return optionsProcessor; 50 | } 51 | 52 | - (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context { 53 | if (!self.block) { 54 | return nil; 55 | } 56 | return self.block(url, options, context); 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+ExtendedCacheData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #import "SDWebImageCompat.h" 13 | 14 | @interface UIImage (ExtendedCacheData) 15 | 16 | /** 17 | Read and Write the extended object and bind it to the image. Which can hold some extra metadata like Image's scale factor, URL rich link, date, etc. 18 | The extended object should conforms to NSCoding, which we use `NSKeyedArchiver` and `NSKeyedUnarchiver` to archive it to data, and write to disk cache. 19 | @note The disk cache preserve both of the data and extended data with the same cache key. For manual query, use the `SDDiskCache` protocol method `extendedDataForKey:` instead. 20 | @note You can specify arbitrary object conforms to NSCoding (NSObject protocol here is used to support object using `NS_ROOT_CLASS`, which is not NSObject subclass). If you load image from disk 21 | cache, you should check the extended object class to avoid corrupted data. 22 | @warning This object don't need to implements NSSecureCoding (but it's recommended), because we allows arbitrary class. 23 | */ 24 | @property (nonatomic, strong, nullable) id jx_extendedObject; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+ExtendedCacheData.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #import "UIImage+ExtendedCacheData.h" 13 | 14 | @implementation UIImage (ExtendedCacheData) 15 | 16 | - (id)jx_extendedObject { 17 | return objc_getAssociatedObject(self, @selector(jx_extendedObject)); 18 | } 19 | 20 | - (void)setJx_extendedObject:(id)jx_extendedObject { 21 | objc_setAssociatedObject(self, @selector(jx_extendedObject), jx_extendedObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+ForceDecode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | /** 12 | UIImage category about force decode feature (avoid Image/IO's lazy decoding during rendering behavior). 13 | */ 14 | @interface UIImage (ForceDecode) 15 | 16 | /** 17 | A bool value indicating whether the image has already been decoded. This can help to avoid extra force decode. 18 | */ 19 | @property (nonatomic, assign) BOOL jx_isDecoded; 20 | 21 | /** 22 | Decode the provided image. This is useful if you want to force decode the image before rendering to improve performance. 23 | 24 | @param image The image to be decoded 25 | @return The decoded image 26 | */ 27 | + (nullable UIImage *)jx_decodedImageWithImage:(nullable UIImage *)image; 28 | 29 | /** 30 | Decode and scale down the provided image 31 | 32 | @param image The image to be decoded 33 | @return The decoded and scaled down image 34 | */ 35 | + (nullable UIImage *)jx_decodedAndScaledDownImageWithImage:(nullable UIImage *)image; 36 | 37 | /** 38 | Decode and scale down the provided image with limit bytes 39 | 40 | @param image The image to be decoded 41 | @param bytes The limit bytes size. Provide 0 to use the build-in limit. 42 | @return The decoded and scaled down image 43 | */ 44 | + (nullable UIImage *)jx_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+ForceDecode.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCoderHelper.h" 10 | #import "UIImage+ForceDecode.h" 11 | #import "objc/runtime.h" 12 | 13 | @implementation UIImage (ForceDecode) 14 | 15 | - (BOOL)jx_isDecoded { 16 | NSNumber *value = objc_getAssociatedObject(self, @selector(jx_isDecoded)); 17 | return value.boolValue; 18 | } 19 | 20 | - (void)setJx_isDecoded:(BOOL)jx_isDecoded { 21 | objc_setAssociatedObject(self, @selector(jx_isDecoded), @(jx_isDecoded), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 22 | } 23 | 24 | + (nullable UIImage *)jx_decodedImageWithImage:(nullable UIImage *)image { 25 | if (!image) { 26 | return nil; 27 | } 28 | return [SDImageCoderHelper decodedImageWithImage:image]; 29 | } 30 | 31 | + (nullable UIImage *)jx_decodedAndScaledDownImageWithImage:(nullable UIImage *)image { 32 | return [self jx_decodedAndScaledDownImageWithImage:image limitBytes:0]; 33 | } 34 | 35 | + (nullable UIImage *)jx_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes { 36 | if (!image) { 37 | return nil; 38 | } 39 | return [SDImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:bytes]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageCompat.h" 11 | 12 | /** 13 | This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directly use `SDImageCoder`. 14 | */ 15 | @interface UIImage (GIF) 16 | 17 | /** 18 | Creates an animated UIImage from an NSData. 19 | This will create animated image if the data is Animated GIF. And will create a static image is the data is Static GIF. 20 | 21 | @param data The GIF data 22 | @return The created image 23 | */ 24 | + (nullable UIImage *)jx_imageWithGIFData:(nullable NSData *)data; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+GIF.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDImageGIFCoder.h" 11 | #import "UIImage+GIF.h" 12 | 13 | @implementation UIImage (GIF) 14 | 15 | + (nullable UIImage *)jx_imageWithGIFData:(nullable NSData *)data { 16 | if (!data) { 17 | return nil; 18 | } 19 | return [[SDImageGIFCoder sharedCoder] decodedImageWithData:data options:0]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+MemoryCacheCost.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | /** 12 | UIImage category for memory cache cost. 13 | */ 14 | @interface UIImage (MemoryCacheCost) 15 | 16 | /** 17 | The memory cache cost for specify image used by image cache. The cost function is the bytes size held in memory. 18 | If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost. 19 | 20 | For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Return full frame bytes size when `image.images` is not nil for animated image. 21 | For `NSImage`, this method return the single frame bytes size because `NSImage` does not store all frames in memory. 22 | @note Note that because of the limitations of category this property can get out of sync if you create another instance with CGImage or other methods. 23 | @note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frame's total 24 | bytes. 25 | */ 26 | @property (assign, nonatomic) NSUInteger jx_memoryCost; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+MemoryCacheCost.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImage+MemoryCacheCost.h" 10 | #import "objc/runtime.h" 11 | //#import "NSImage+Compatibility.h" 12 | 13 | FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) { 14 | CGImageRef imageRef = image.CGImage; 15 | if (!imageRef) { 16 | return 0; 17 | } 18 | NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef); 19 | NSUInteger frameCount; 20 | #if SD_MAC 21 | frameCount = 1; 22 | #elif SD_UIKIT || SD_WATCH 23 | frameCount = image.images.count > 0 ? image.images.count : 1; 24 | #endif 25 | NSUInteger cost = bytesPerFrame * frameCount; 26 | return cost; 27 | } 28 | 29 | @implementation UIImage (MemoryCacheCost) 30 | 31 | - (NSUInteger)jx_memoryCost { 32 | NSNumber *value = objc_getAssociatedObject(self, @selector(jx_memoryCost)); 33 | NSUInteger memoryCost; 34 | if (value != nil) { 35 | memoryCost = [value unsignedIntegerValue]; 36 | } else { 37 | memoryCost = SDMemoryCacheCostForImage(self); 38 | } 39 | return memoryCost; 40 | } 41 | 42 | - (void)setJx_memoryCost:(NSUInteger)jx_memoryCost { 43 | objc_setAssociatedObject(self, @selector(jx_memoryCost), @(jx_memoryCost), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+Metadata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "NSData+ImageContentType.h" 10 | #import "SDWebImageCompat.h" 11 | 12 | /** 13 | UIImage category for image metadata, including animation, loop count, format, incremental, etc. 14 | */ 15 | @interface UIImage (Metadata) 16 | 17 | /** 18 | * UIKit: 19 | * For static image format, this value is always 0. 20 | * For animated image format, 0 means infinite looping. 21 | * Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. 22 | * AppKit: 23 | * NSImage currently only support animated via GIF imageRep unlike UIImage. 24 | * The getter of this property will get the loop count from GIF imageRep 25 | * The setter of this property will set the loop count from GIF imageRep 26 | */ 27 | @property (nonatomic, assign) NSUInteger jx_imageLoopCount; 28 | 29 | /** 30 | * UIKit: 31 | * Check the `images` array property. 32 | * AppKit: 33 | * NSImage currently only support animated via GIF imageRep unlike UIImage. It will check the imageRep's frame count. 34 | */ 35 | @property (nonatomic, assign, readonly) BOOL jx_isAnimated; 36 | 37 | /** 38 | * UIKit: 39 | * Check the `isSymbolImage` property. Also check the system PDF(iOS 11+) && SVG(iOS 13+) support. 40 | * AppKit: 41 | * NSImage supports PDF && SVG && EPS imageRep, check the imageRep class. 42 | */ 43 | @property (nonatomic, assign, readonly) BOOL jx_isVector; 44 | 45 | /** 46 | * The image format represent the original compressed image data format. 47 | * If you don't manually specify a format, this information is retrieve from CGImage using `CGImageGetUTType`, which may return nil for non-CG based image. At this time it will return 48 | * `SDImageFormatUndefined` as default value. 49 | * @note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. 50 | */ 51 | @property (nonatomic, assign) SDImageFormat jx_imageFormat; 52 | 53 | /** 54 | A bool value indicating whether the image is during incremental decoding and may not contains full pixels. 55 | */ 56 | @property (nonatomic, assign) BOOL jx_isIncremental; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIImage+MultiFormat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCodersManager.h" 10 | #import "UIImage+MultiFormat.h" 11 | 12 | @implementation UIImage (MultiFormat) 13 | 14 | + (nullable UIImage *)jx_imageWithData:(nullable NSData *)data { 15 | return [self jx_imageWithData:data scale:1]; 16 | } 17 | 18 | + (nullable UIImage *)jx_imageWithData:(nullable NSData *)data scale:(CGFloat)scale { 19 | return [self jx_imageWithData:data scale:scale firstFrameOnly:NO]; 20 | } 21 | 22 | + (nullable UIImage *)jx_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly { 23 | if (!data) { 24 | return nil; 25 | } 26 | SDImageCoderOptions *options = @{SDImageCoderDecodeScaleFactor : @(MAX(scale, 1)), SDImageCoderDecodeFirstFrameOnly : @(firstFrameOnly)}; 27 | return [[SDImageCodersManager sharedManager] decodedImageWithData:data options:options]; 28 | } 29 | 30 | - (nullable NSData *)jx_imageData { 31 | return [self jx_imageDataAsFormat:SDImageFormatUndefined]; 32 | } 33 | 34 | - (nullable NSData *)jx_imageDataAsFormat:(SDImageFormat)imageFormat { 35 | return [self jx_imageDataAsFormat:imageFormat compressionQuality:1]; 36 | } 37 | 38 | - (nullable NSData *)jx_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality { 39 | return [self jx_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:NO]; 40 | } 41 | 42 | - (nullable NSData *)jx_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly { 43 | SDImageCoderOptions *options = @{SDImageCoderEncodeCompressionQuality : @(compressionQuality), SDImageCoderEncodeFirstFrameOnly : @(firstFrameOnly)}; 44 | return [[SDImageCodersManager sharedManager] encodedDataWithImage:self format:imageFormat options:options]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Core/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "SDWebImageOperation.h" 11 | 12 | /** 13 | These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external. 14 | All the stored operations are weak, so it will be dealloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them. 15 | */ 16 | @interface UIView (WebCacheOperation) 17 | 18 | /** 19 | * Get the image load operation for key 20 | * 21 | * @param key key for identifying the operations 22 | * @return the image load operation 23 | */ 24 | - (nullable id)jx_imageLoadOperationForKey:(nullable NSString *)key; 25 | 26 | /** 27 | * Set the image load operation (storage in a UIView based weak map table) 28 | * 29 | * @param operation the operation 30 | * @param key key for storing the operation 31 | */ 32 | - (void)jx_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; 33 | 34 | /** 35 | * Cancel all operations for the current UIView and key 36 | * 37 | * @param key key for identifying the operations 38 | */ 39 | - (void)jx_cancelImageLoadOperationWithKey:(nullable NSString *)key; 40 | 41 | /** 42 | * Just remove the operations corresponding to the current UIView and key without cancelling them 43 | * 44 | * @param key key for identifying the operations 45 | */ 46 | - (void)jx_removeImageLoadOperationWithKey:(nullable NSString *)key; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDAssociatedObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | /// Copy the associated object from source image to target image. The associated object including all the category read/write properties. 12 | /// @param source source 13 | /// @param target target 14 | FOUNDATION_EXPORT void SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target); 15 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDAssociatedObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDAssociatedObject.h" 10 | 11 | #import "UIImage+ExtendedCacheData.h" 12 | #import "UIImage+ForceDecode.h" 13 | #import "UIImage+MemoryCacheCost.h" 14 | #import "UIImage+Metadata.h" 15 | 16 | void SDImageCopyAssociatedObject(UIImage* _Nullable source, UIImage* _Nullable target) { 17 | if (!source || !target) { 18 | return; 19 | } 20 | // Image Metadata 21 | target.jx_isIncremental = source.jx_isIncremental; 22 | target.jx_imageLoopCount = source.jx_imageLoopCount; 23 | target.jx_imageFormat = source.jx_imageFormat; 24 | // Force Decode 25 | target.jx_isDecoded = source.jx_isDecoded; 26 | // Extended Cache Data 27 | target.jx_extendedObject = source.jx_extendedObject; 28 | } 29 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDAsyncBlockOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | @class SDAsyncBlockOperation; 12 | typedef void (^SDAsyncBlock)(SDAsyncBlockOperation * __nonnull asyncOperation); 13 | 14 | /// A async block operation, success after you call `completer` (not like `NSBlockOperation` which is for sync block, success on return) 15 | @interface SDAsyncBlockOperation : NSOperation 16 | 17 | - (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block; 18 | + (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block; 19 | - (void)complete; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDDeviceHelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | /// Device information helper methods 13 | @interface SDDeviceHelper : NSObject 14 | 15 | + (NSUInteger)totalMemory; 16 | + (NSUInteger)freeMemory; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDDeviceHelper.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDDeviceHelper.h" 10 | #import 11 | 12 | @implementation SDDeviceHelper 13 | 14 | + (NSUInteger)totalMemory { 15 | return (NSUInteger)[[NSProcessInfo processInfo] physicalMemory]; 16 | } 17 | 18 | + (NSUInteger)freeMemory { 19 | mach_port_t host_port = mach_host_self(); 20 | mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); 21 | vm_size_t page_size; 22 | vm_statistics_data_t vm_stat; 23 | kern_return_t kern; 24 | 25 | kern = host_page_size(host_port, &page_size); 26 | if (kern != KERN_SUCCESS) return 0; 27 | kern = host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size); 28 | if (kern != KERN_SUCCESS) return 0; 29 | return vm_stat.free_count * page_size; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDDisplayLink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | /// Cross-platform display link wrapper. Do not retain the target 13 | /// Use `CADisplayLink` on iOS/tvOS, `CVDisplayLink` on macOS, `NSTimer` on watchOS 14 | @interface SDDisplayLink : NSObject 15 | 16 | @property (readonly, nonatomic, weak, nullable) id target; 17 | @property (readonly, nonatomic, assign, nonnull) SEL selector; 18 | @property (readonly, nonatomic) CFTimeInterval duration; 19 | @property (readonly, nonatomic) BOOL isRunning; 20 | 21 | + (nonnull instancetype)displayLinkWithTarget:(nonnull id)target selector:(nonnull SEL)sel; 22 | 23 | - (void)addToRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode; 24 | - (void)removeFromRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode; 25 | 26 | - (void)start; 27 | - (void)stop; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDFileAttributeHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // This file is from https://gist.github.com/zydeco/6292773 3 | // 4 | // Created by Jesús A. Álvarez on 2008-12-17. 5 | // Copyright 2008-2009 namedfork.net. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | /// File Extended Attribute (xattr) helper methods 11 | @interface SDFileAttributeHelper : NSObject 12 | 13 | + (nullable NSArray *)extendedAttributeNamesAtPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; 14 | + (BOOL)hasExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; 15 | + (nullable NSData *)extendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; 16 | + (BOOL)setExtendedAttribute:(nonnull NSString *)name value:(nonnull NSData *)value atPath:(nonnull NSString *)path traverseLink:(BOOL)follow overwrite:(BOOL)overwrite error:(NSError * _Nullable * _Nullable)err; 17 | + (BOOL)removeExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDImageAssetManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | /// A Image-Asset manager to work like UIKit/AppKit's image cache behavior 13 | /// Apple parse the Asset Catalog compiled file(`Assets.car`) by CoreUI.framework, however it's a private framework and there are no other ways to directly get the data. So we just process the normal bundle files :) 14 | @interface SDImageAssetManager : NSObject 15 | 16 | @property (nonatomic, strong, nonnull) NSMapTable *imageTable; 17 | 18 | + (nonnull instancetype)sharedAssetManager; 19 | - (nullable NSString *)getPathForName:(nonnull NSString *)name bundle:(nonnull NSBundle *)bundle preferredScale:(nonnull CGFloat *)scale; 20 | - (nullable UIImage *)imageForName:(nonnull NSString *)name; 21 | - (void)storeImage:(nonnull UIImage *)image forName:(nonnull NSString *)name; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDImageCachesManagerOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | /// This is used for operation management, but not for operation queue execute 13 | @interface SDImageCachesManagerOperation : NSOperation 14 | 15 | @property (nonatomic, assign, readonly) NSUInteger pendingCount; 16 | 17 | - (void)beginWithTotalCount:(NSUInteger)totalCount; 18 | - (void)completeOne; 19 | - (void)done; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDImageCachesManagerOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCachesManagerOperation.h" 10 | #import "SDInternalMacros.h" 11 | 12 | @implementation SDImageCachesManagerOperation { 13 | SD_LOCK_DECLARE(_pendingCountLock); 14 | } 15 | 16 | @synthesize executing = _executing; 17 | @synthesize finished = _finished; 18 | @synthesize cancelled = _cancelled; 19 | @synthesize pendingCount = _pendingCount; 20 | 21 | - (instancetype)init { 22 | if (self = [super init]) { 23 | SD_LOCK_INIT(_pendingCountLock); 24 | _pendingCount = 0; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)beginWithTotalCount:(NSUInteger)totalCount { 30 | self.executing = YES; 31 | self.finished = NO; 32 | _pendingCount = totalCount; 33 | } 34 | 35 | - (NSUInteger)pendingCount { 36 | SD_LOCK(_pendingCountLock); 37 | NSUInteger pendingCount = _pendingCount; 38 | SD_UNLOCK(_pendingCountLock); 39 | return pendingCount; 40 | } 41 | 42 | - (void)completeOne { 43 | SD_LOCK(_pendingCountLock); 44 | _pendingCount = _pendingCount > 0 ? _pendingCount - 1 : 0; 45 | SD_UNLOCK(_pendingCountLock); 46 | } 47 | 48 | - (void)cancel { 49 | self.cancelled = YES; 50 | [self reset]; 51 | } 52 | 53 | - (void)done { 54 | self.finished = YES; 55 | self.executing = NO; 56 | [self reset]; 57 | } 58 | 59 | - (void)reset { 60 | SD_LOCK(_pendingCountLock); 61 | _pendingCount = 0; 62 | SD_UNLOCK(_pendingCountLock); 63 | } 64 | 65 | - (void)setFinished:(BOOL)finished { 66 | [self willChangeValueForKey:@"isFinished"]; 67 | _finished = finished; 68 | [self didChangeValueForKey:@"isFinished"]; 69 | } 70 | 71 | - (void)setExecuting:(BOOL)executing { 72 | [self willChangeValueForKey:@"isExecuting"]; 73 | _executing = executing; 74 | [self didChangeValueForKey:@"isExecuting"]; 75 | } 76 | 77 | - (void)setCancelled:(BOOL)cancelled { 78 | [self willChangeValueForKey:@"isCancelled"]; 79 | _cancelled = cancelled; 80 | [self didChangeValueForKey:@"isCancelled"]; 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDImageIOAnimatedCoder.h" 11 | 12 | // AVFileTypeHEIC/AVFileTypeHEIF is defined in AVFoundation via iOS 11, we use this without import AVFoundation 13 | #define kSDUTTypeHEIC ((__bridge CFStringRef)@"public.heic") 14 | #define kSDUTTypeHEIF ((__bridge CFStringRef)@"public.heif") 15 | // HEIC Sequence (Animated Image) 16 | #define kSDUTTypeHEICS ((__bridge CFStringRef)@"public.heics") 17 | // kUTTypeWebP seems not defined in public UTI framework, Apple use the hardcode string, we define them :) 18 | #define kSDUTTypeWebP ((__bridge CFStringRef)@"org.webmproject.webp") 19 | 20 | @interface SDImageIOAnimatedCoder () 21 | 22 | + (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source; 23 | + (NSUInteger)imageLoopCountWithSource:(nonnull CGImageSourceRef)source; 24 | + (nullable UIImage *)createFrameAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize options:(nullable NSDictionary *)options; 25 | + (BOOL)canEncodeToFormat:(SDImageFormat)format; 26 | + (BOOL)canDecodeFromFormat:(SDImageFormat)format; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDInternalMacros.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDInternalMacros.h" 10 | 11 | void jx_executeCleanupBlock(__strong jx_cleanupBlock_t *block) { (*block)(); } 12 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDWeakProxy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | /// A weak proxy which forward all the message to the target 13 | @interface SDWeakProxy : NSProxy 14 | 15 | @property (nonatomic, weak, readonly, nullable) id target; 16 | 17 | - (nonnull instancetype)initWithTarget:(nonnull id)target; 18 | + (nonnull instancetype)proxyWithTarget:(nonnull id)target; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDWeakProxy.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWeakProxy.h" 10 | 11 | @implementation SDWeakProxy 12 | 13 | - (instancetype)initWithTarget:(id)target { 14 | _target = target; 15 | return self; 16 | } 17 | 18 | + (instancetype)proxyWithTarget:(id)target { 19 | return [[SDWeakProxy alloc] initWithTarget:target]; 20 | } 21 | 22 | - (id)forwardingTargetForSelector:(SEL)selector { 23 | return _target; 24 | } 25 | 26 | - (void)forwardInvocation:(NSInvocation *)invocation { 27 | void *null = NULL; 28 | [invocation setReturnValue:&null]; 29 | } 30 | 31 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { 32 | return [NSObject instanceMethodSignatureForSelector:@selector(init)]; 33 | } 34 | 35 | - (BOOL)respondsToSelector:(SEL)aSelector { 36 | return [_target respondsToSelector:aSelector]; 37 | } 38 | 39 | - (BOOL)isEqual:(id)object { 40 | return [_target isEqual:object]; 41 | } 42 | 43 | - (NSUInteger)hash { 44 | return [_target hash]; 45 | } 46 | 47 | - (Class)superclass { 48 | return [_target superclass]; 49 | } 50 | 51 | - (Class)class { 52 | return [_target class]; 53 | } 54 | 55 | - (BOOL)isKindOfClass:(Class)aClass { 56 | return [_target isKindOfClass:aClass]; 57 | } 58 | 59 | - (BOOL)isMemberOfClass:(Class)aClass { 60 | return [_target isMemberOfClass:aClass]; 61 | } 62 | 63 | - (BOOL)conformsToProtocol:(Protocol *)aProtocol { 64 | return [_target conformsToProtocol:aProtocol]; 65 | } 66 | 67 | - (BOOL)isProxy { 68 | return YES; 69 | } 70 | 71 | - (NSString *)description { 72 | return [_target description]; 73 | } 74 | 75 | - (NSString *)debugDescription { 76 | return [_target debugDescription]; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/SDWebImageTransitionInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | #import 14 | 15 | /// Helper method for Core Animation transition 16 | FOUNDATION_EXPORT CAMediaTimingFunction * _Nullable SDTimingFunctionFromAnimationOptions(SDWebImageAnimationOptions options); 17 | FOUNDATION_EXPORT CATransition * _Nullable SDTransitionFromAnimationOptions(SDWebImageAnimationOptions options); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/UIColor+SDHexString.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | @interface UIColor (SDHexString) 12 | 13 | /** 14 | Convenience way to get hex string from color. The output should always be 32-bit RGBA hex string like `#00000000`. 15 | */ 16 | @property (nonatomic, copy, readonly, nonnull) NSString *jx_hexString; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/Private/UIColor+SDHexString.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIColor+SDHexString.h" 10 | 11 | @implementation UIColor (SDHexString) 12 | 13 | - (NSString *)jx_hexString { 14 | CGFloat red, green, blue, alpha; 15 | #if SD_UIKIT 16 | if (![self getRed:&red green:&green blue:&blue alpha:&alpha]) { 17 | [self getWhite:&red alpha:&alpha]; 18 | green = red; 19 | blue = red; 20 | } 21 | #else 22 | @try { 23 | [self getRed:&red green:&green blue:&blue alpha:&alpha]; 24 | } @catch (NSException *exception) { 25 | [self getWhite:&red alpha:&alpha]; 26 | green = red; 27 | blue = red; 28 | } 29 | #endif 30 | 31 | red = roundf(red * 255.f); 32 | green = roundf(green * 255.f); 33 | blue = roundf(blue * 255.f); 34 | alpha = roundf(alpha * 255.f); 35 | 36 | uint hex = ((uint)alpha << 24) | ((uint)red << 16) | ((uint)green << 8) | ((uint)blue); 37 | 38 | return [NSString stringWithFormat:@"#%08x", hex]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/SDWebImageWebPCoder/SDImageWebPCoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImage.h" 10 | 11 | /** 12 | Built in coder that supports WebP and animated WebP 13 | */ 14 | @interface SDImageWebPCoder : NSObject 15 | 16 | @property (nonatomic, class, readonly, nonnull) SDImageWebPCoder *sharedCoder; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/SDWebImageWebPCoder/UIImage+WebP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | // This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directlly use `SDImageCoder` 10 | @interface UIImage (WebP) 11 | 12 | /** 13 | Create a image from the WebP data. 14 | This will create animated image if the data is Animated WebP. And will create a static image is the data is Static WebP. 15 | 16 | @param data The WebP data 17 | @return The created image 18 | */ 19 | + (nullable UIImage *)jx_imageWithWebPData:(nullable NSData *)data; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/SDWebImageWebPCoder/UIImage+WebP.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageWebPCoder.h" 10 | #import "UIImage+WebP.h" 11 | 12 | @implementation UIImage (WebP) 13 | 14 | + (nullable UIImage *)jx_imageWithWebPData:(nullable NSData *)data { 15 | if (!data) { 16 | return nil; 17 | } 18 | return [[SDImageWebPCoder sharedCoder] decodedImageWithData:data options:0]; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/dec/alphai_dec.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Alpha decoder: internal header. 11 | // 12 | // Author: Urvang (urvang@google.com) 13 | 14 | #ifndef WEBP_DEC_ALPHAI_DEC_H_ 15 | #define WEBP_DEC_ALPHAI_DEC_H_ 16 | 17 | #include "webpi_dec.h" 18 | #include "filters_utils.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | struct VP8LDecoder; // Defined in dec/vp8li.h. 25 | 26 | typedef struct ALPHDecoder ALPHDecoder; 27 | struct ALPHDecoder { 28 | int width_; 29 | int height_; 30 | int method_; 31 | WEBP_FILTER_TYPE filter_; 32 | int pre_processing_; 33 | struct VP8LDecoder* vp8l_dec_; 34 | VP8Io io_; 35 | int use_8b_decode_; // Although alpha channel requires only 1 byte per 36 | // pixel, sometimes VP8LDecoder may need to allocate 37 | // 4 bytes per pixel internally during decode. 38 | uint8_t* output_; 39 | const uint8_t* prev_line_; // last output row (or NULL) 40 | }; 41 | 42 | //------------------------------------------------------------------------------ 43 | // internal functions. Not public. 44 | 45 | // Deallocate memory associated to dec->alpha_plane_ decoding 46 | void WebPDeallocateAlphaMemory(VP8Decoder* const dec); 47 | 48 | //------------------------------------------------------------------------------ 49 | 50 | #ifdef __cplusplus 51 | } // extern "C" 52 | #endif 53 | 54 | #endif // WEBP_DEC_ALPHAI_DEC_H_ 55 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/dec/common_dec.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Definitions and macros common to encoding and decoding 11 | // 12 | // Author: Skal (pascal.massimino@gmail.com) 13 | 14 | #ifndef WEBP_DEC_COMMON_DEC_H_ 15 | #define WEBP_DEC_COMMON_DEC_H_ 16 | 17 | // intra prediction modes 18 | enum { B_DC_PRED = 0, // 4x4 modes 19 | B_TM_PRED = 1, 20 | B_VE_PRED = 2, 21 | B_HE_PRED = 3, 22 | B_RD_PRED = 4, 23 | B_VR_PRED = 5, 24 | B_LD_PRED = 6, 25 | B_VL_PRED = 7, 26 | B_HD_PRED = 8, 27 | B_HU_PRED = 9, 28 | NUM_BMODES = B_HU_PRED + 1 - B_DC_PRED, // = 10 29 | 30 | // Luma16 or UV modes 31 | DC_PRED = B_DC_PRED, V_PRED = B_VE_PRED, 32 | H_PRED = B_HE_PRED, TM_PRED = B_TM_PRED, 33 | B_PRED = NUM_BMODES, // refined I4x4 mode 34 | NUM_PRED_MODES = 4, 35 | 36 | // special modes 37 | B_DC_PRED_NOTOP = 4, 38 | B_DC_PRED_NOLEFT = 5, 39 | B_DC_PRED_NOTOPLEFT = 6, 40 | NUM_B_DC_MODES = 7 }; 41 | 42 | enum { MB_FEATURE_TREE_PROBS = 3, 43 | NUM_MB_SEGMENTS = 4, 44 | NUM_REF_LF_DELTAS = 4, 45 | NUM_MODE_LF_DELTAS = 4, // I4x4, ZERO, *, SPLIT 46 | MAX_NUM_PARTITIONS = 8, 47 | // Probabilities 48 | NUM_TYPES = 4, // 0: i16-AC, 1: i16-DC, 2:chroma-AC, 3:i4-AC 49 | NUM_BANDS = 8, 50 | NUM_CTX = 3, 51 | NUM_PROBAS = 11 52 | }; 53 | 54 | #endif // WEBP_DEC_COMMON_DEC_H_ 55 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/demux/libwebpdemux.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libwebpdemux 7 | Description: Library for parsing the WebP graphics format container 8 | Version: @PACKAGE_VERSION@ 9 | Requires: libwebp >= 0.2.0 10 | Cflags: -I${includedir} 11 | Libs: -L${libdir} -lwebpdemux 12 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/demux/libwebpdemux.rc: -------------------------------------------------------------------------------- 1 | #define APSTUDIO_READONLY_SYMBOLS 2 | #include "winres.h" 3 | #undef APSTUDIO_READONLY_SYMBOLS 4 | 5 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 6 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 7 | 8 | VS_VERSION_INFO VERSIONINFO 9 | FILEVERSION 1,0,1,0 10 | PRODUCTVERSION 1,0,1,0 11 | FILEFLAGSMASK 0x3fL 12 | #ifdef _DEBUG 13 | FILEFLAGS 0x1L 14 | #else 15 | FILEFLAGS 0x0L 16 | #endif 17 | FILEOS 0x40004L 18 | FILETYPE 0x2L 19 | FILESUBTYPE 0x0L 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "040904b0" 24 | BEGIN 25 | VALUE "CompanyName", "Google, Inc." 26 | VALUE "FileDescription", "libwebpdemux DLL" 27 | VALUE "FileVersion", "1.1.0" 28 | VALUE "InternalName", "libwebpdemux.dll" 29 | VALUE "LegalCopyright", "Copyright (C) 2019" 30 | VALUE "OriginalFilename", "libwebpdemux.dll" 31 | VALUE "ProductName", "WebP Image Demuxer" 32 | VALUE "ProductVersion", "1.1.0" 33 | END 34 | END 35 | BLOCK "VarFileInfo" 36 | BEGIN 37 | VALUE "Translation", 0x409, 1200 38 | END 39 | END 40 | 41 | #endif // English (United States) resources 42 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/dsp/dec_sse41.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // SSE4 version of some decoding functions. 11 | // 12 | // Author: Skal (pascal.massimino@gmail.com) 13 | 14 | #include "dsp.h" 15 | 16 | #if defined(WEBP_USE_SSE41) 17 | 18 | #include 19 | #include "vp8i_dec.h" 20 | #include "utils.h" 21 | 22 | static void HE16_SSE41(uint8_t* dst) { // horizontal 23 | int j; 24 | const __m128i kShuffle3 = _mm_set1_epi8(3); 25 | for (j = 16; j > 0; --j) { 26 | const __m128i in = _mm_cvtsi32_si128(WebPMemToUint32(dst - 4)); 27 | const __m128i values = _mm_shuffle_epi8(in, kShuffle3); 28 | _mm_storeu_si128((__m128i*)dst, values); 29 | dst += BPS; 30 | } 31 | } 32 | 33 | //------------------------------------------------------------------------------ 34 | // Entry point 35 | 36 | extern void VP8DspInitSSE41(void); 37 | 38 | WEBP_TSAN_IGNORE_FUNCTION void VP8DspInitSSE41(void) { 39 | VP8PredLuma16[3] = HE16_SSE41; 40 | } 41 | 42 | #else // !WEBP_USE_SSE41 43 | 44 | WEBP_DSP_INIT_STUB(VP8DspInitSSE41) 45 | 46 | #endif // WEBP_USE_SSE41 47 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/libwebp.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libwebp 7 | Description: Library for the WebP graphics format 8 | Version: @PACKAGE_VERSION@ 9 | Cflags: -I${includedir} 10 | Libs: -L${libdir} -lwebp 11 | Libs.private: -lm @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ 12 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/libwebp.rc: -------------------------------------------------------------------------------- 1 | #define APSTUDIO_READONLY_SYMBOLS 2 | #include "winres.h" 3 | #undef APSTUDIO_READONLY_SYMBOLS 4 | 5 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 6 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 7 | 8 | VS_VERSION_INFO VERSIONINFO 9 | FILEVERSION 1,0,1,0 10 | PRODUCTVERSION 1,0,1,0 11 | FILEFLAGSMASK 0x3fL 12 | #ifdef _DEBUG 13 | FILEFLAGS 0x1L 14 | #else 15 | FILEFLAGS 0x0L 16 | #endif 17 | FILEOS 0x40004L 18 | FILETYPE 0x2L 19 | FILESUBTYPE 0x0L 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "040904b0" 24 | BEGIN 25 | VALUE "CompanyName", "Google, Inc." 26 | VALUE "FileDescription", "libwebp DLL" 27 | VALUE "FileVersion", "1.1.0" 28 | VALUE "InternalName", "libwebp.dll" 29 | VALUE "LegalCopyright", "Copyright (C) 2019" 30 | VALUE "OriginalFilename", "libwebp.dll" 31 | VALUE "ProductName", "WebP Image Codec" 32 | VALUE "ProductVersion", "1.1.0" 33 | END 34 | END 35 | BLOCK "VarFileInfo" 36 | BEGIN 37 | VALUE "Translation", 0x409, 1200 38 | END 39 | END 40 | 41 | #endif // English (United States) resources 42 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/libwebpdecoder.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libwebpdecoder 7 | Description: Library for the WebP graphics format (decode only) 8 | Version: @PACKAGE_VERSION@ 9 | Cflags: -I${includedir} 10 | Libs: -L${libdir} -lwebpdecoder 11 | Libs.private: -lm @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ 12 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/libwebpdecoder.rc: -------------------------------------------------------------------------------- 1 | #define APSTUDIO_READONLY_SYMBOLS 2 | #include "winres.h" 3 | #undef APSTUDIO_READONLY_SYMBOLS 4 | 5 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 6 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 7 | 8 | VS_VERSION_INFO VERSIONINFO 9 | FILEVERSION 1,0,1,0 10 | PRODUCTVERSION 1,0,1,0 11 | FILEFLAGSMASK 0x3fL 12 | #ifdef _DEBUG 13 | FILEFLAGS 0x1L 14 | #else 15 | FILEFLAGS 0x0L 16 | #endif 17 | FILEOS 0x40004L 18 | FILETYPE 0x2L 19 | FILESUBTYPE 0x0L 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "040904b0" 24 | BEGIN 25 | VALUE "CompanyName", "Google, Inc." 26 | VALUE "FileDescription", "libwebpdecoder DLL" 27 | VALUE "FileVersion", "1.1.0" 28 | VALUE "InternalName", "libwebpdecoder.dll" 29 | VALUE "LegalCopyright", "Copyright (C) 2019" 30 | VALUE "OriginalFilename", "libwebpdecoder.dll" 31 | VALUE "ProductName", "WebP Image Decoder" 32 | VALUE "ProductVersion", "1.1.0" 33 | END 34 | END 35 | BLOCK "VarFileInfo" 36 | BEGIN 37 | VALUE "Translation", 0x409, 1200 38 | END 39 | END 40 | 41 | #endif // English (United States) resources 42 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/mux/animi.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Internal header for animation related functions. 11 | // 12 | // Author: Hui Su (huisu@google.com) 13 | 14 | #ifndef WEBP_MUX_ANIMI_H_ 15 | #define WEBP_MUX_ANIMI_H_ 16 | 17 | #include "mux.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | // Picks the optimal rectangle between two pictures, starting with initial 24 | // values of offsets and dimensions that are passed in. The initial 25 | // values will be clipped, if necessary, to make sure the rectangle is 26 | // within the canvas. "use_argb" must be true for both pictures. 27 | // Parameters: 28 | // prev_canvas, curr_canvas - (in) two input pictures to compare. 29 | // is_lossless, quality - (in) encoding settings. 30 | // x_offset, y_offset, width, height - (in/out) rectangle between the two 31 | // input pictures. 32 | // Returns true on success. 33 | int WebPAnimEncoderRefineRect( 34 | const struct WebPPicture* const prev_canvas, 35 | const struct WebPPicture* const curr_canvas, 36 | int is_lossless, float quality, int* const x_offset, int* const y_offset, 37 | int* const width, int* const height); 38 | 39 | #ifdef __cplusplus 40 | } // extern "C" 41 | #endif 42 | 43 | #endif // WEBP_MUX_ANIMI_H_ 44 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/mux/libwebpmux.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libwebpmux 7 | Description: Library for manipulating the WebP graphics format container 8 | Version: @PACKAGE_VERSION@ 9 | Requires: libwebp >= 0.2.0 10 | Cflags: -I${includedir} 11 | Libs: -L${libdir} -lwebpmux 12 | Libs.private: -lm 13 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/mux/libwebpmux.rc: -------------------------------------------------------------------------------- 1 | #define APSTUDIO_READONLY_SYMBOLS 2 | #include "winres.h" 3 | #undef APSTUDIO_READONLY_SYMBOLS 4 | 5 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 6 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 7 | 8 | VS_VERSION_INFO VERSIONINFO 9 | FILEVERSION 1,0,1,0 10 | PRODUCTVERSION 1,0,1,0 11 | FILEFLAGSMASK 0x3fL 12 | #ifdef _DEBUG 13 | FILEFLAGS 0x1L 14 | #else 15 | FILEFLAGS 0x0L 16 | #endif 17 | FILEOS 0x40004L 18 | FILETYPE 0x2L 19 | FILESUBTYPE 0x0L 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "040904b0" 24 | BEGIN 25 | VALUE "CompanyName", "Google, Inc." 26 | VALUE "FileDescription", "libwebpmux DLL" 27 | VALUE "FileVersion", "1.1.0" 28 | VALUE "InternalName", "libwebpmux.dll" 29 | VALUE "LegalCopyright", "Copyright (C) 2019" 30 | VALUE "OriginalFilename", "libwebpmux.dll" 31 | VALUE "ProductName", "WebP Image Muxer" 32 | VALUE "ProductVersion", "1.1.0" 33 | END 34 | END 35 | BLOCK "VarFileInfo" 36 | BEGIN 37 | VALUE "Translation", 0x409, 1200 38 | END 39 | END 40 | 41 | #endif // English (United States) resources 42 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/utils/color_cache_utils.c: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Color Cache for WebP Lossless 11 | // 12 | // Author: Jyrki Alakuijala (jyrki@google.com) 13 | 14 | #include 15 | #include 16 | #include 17 | #include "color_cache_utils.h" 18 | #include "utils.h" 19 | 20 | //------------------------------------------------------------------------------ 21 | // VP8LColorCache. 22 | 23 | int VP8LColorCacheInit(VP8LColorCache* const cc, int hash_bits) { 24 | const int hash_size = 1 << hash_bits; 25 | assert(cc != NULL); 26 | assert(hash_bits > 0); 27 | cc->colors_ = (uint32_t*)WebPSafeCalloc((uint64_t)hash_size, 28 | sizeof(*cc->colors_)); 29 | if (cc->colors_ == NULL) return 0; 30 | cc->hash_shift_ = 32 - hash_bits; 31 | cc->hash_bits_ = hash_bits; 32 | return 1; 33 | } 34 | 35 | void VP8LColorCacheClear(VP8LColorCache* const cc) { 36 | if (cc != NULL) { 37 | WebPSafeFree(cc->colors_); 38 | cc->colors_ = NULL; 39 | } 40 | } 41 | 42 | void VP8LColorCacheCopy(const VP8LColorCache* const src, 43 | VP8LColorCache* const dst) { 44 | assert(src != NULL); 45 | assert(dst != NULL); 46 | assert(src->hash_bits_ == dst->hash_bits_); 47 | memcpy(dst->colors_, src->colors_, 48 | ((size_t)1u << dst->hash_bits_) * sizeof(*dst->colors_)); 49 | } 50 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/utils/filters_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Spatial prediction using various filters 11 | // 12 | // Author: Urvang (urvang@google.com) 13 | 14 | #ifndef WEBP_UTILS_FILTERS_UTILS_H_ 15 | #define WEBP_UTILS_FILTERS_UTILS_H_ 16 | 17 | #include "types.h" 18 | #include "dsp.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | // Fast estimate of a potentially good filter. 25 | WEBP_FILTER_TYPE WebPEstimateBestFilter(const uint8_t* data, 26 | int width, int height, int stride); 27 | 28 | #ifdef __cplusplus 29 | } // extern "C" 30 | #endif 31 | 32 | #endif // WEBP_UTILS_FILTERS_UTILS_H_ 33 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/utils/huffman_encode_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Author: Jyrki Alakuijala (jyrki@google.com) 11 | // 12 | // Entropy encoding (Huffman) for webp lossless 13 | 14 | #ifndef WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ 15 | #define WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ 16 | 17 | #include "types.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | // Struct for holding the tree header in coded form. 24 | typedef struct { 25 | uint8_t code; // value (0..15) or escape code (16,17,18) 26 | uint8_t extra_bits; // extra bits for escape codes 27 | } HuffmanTreeToken; 28 | 29 | // Struct to represent the tree codes (depth and bits array). 30 | typedef struct { 31 | int num_symbols; // Number of symbols. 32 | uint8_t* code_lengths; // Code lengths of the symbols. 33 | uint16_t* codes; // Symbol Codes. 34 | } HuffmanTreeCode; 35 | 36 | // Struct to represent the Huffman tree. 37 | typedef struct { 38 | uint32_t total_count_; // Symbol frequency. 39 | int value_; // Symbol value. 40 | int pool_index_left_; // Index for the left sub-tree. 41 | int pool_index_right_; // Index for the right sub-tree. 42 | } HuffmanTree; 43 | 44 | // Turn the Huffman tree into a token sequence. 45 | // Returns the number of tokens used. 46 | int VP8LCreateCompressedHuffmanTree(const HuffmanTreeCode* const tree, 47 | HuffmanTreeToken* tokens, int max_tokens); 48 | 49 | // Create an optimized tree, and tokenize it. 50 | // 'buf_rle' and 'huff_tree' are pre-allocated and the 'tree' is the constructed 51 | // huffman code tree. 52 | void VP8LCreateHuffmanTree(uint32_t* const histogram, int tree_depth_limit, 53 | uint8_t* const buf_rle, HuffmanTree* const huff_tree, 54 | HuffmanTreeCode* const tree); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif // WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ 61 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/utils/quant_levels_dec_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Alpha plane de-quantization utility 11 | // 12 | // Author: Vikas Arora (vikasa@google.com) 13 | 14 | #ifndef WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ 15 | #define WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ 16 | 17 | #include "types.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | // Apply post-processing to input 'data' of size 'width'x'height' assuming that 24 | // the source was quantized to a reduced number of levels. 'stride' is in bytes. 25 | // Strength is in [0..100] and controls the amount of dithering applied. 26 | // Returns false in case of error (data is NULL, invalid parameters, 27 | // malloc failure, ...). 28 | int WebPDequantizeLevels(uint8_t* const data, int width, int height, int stride, 29 | int strength); 30 | 31 | #ifdef __cplusplus 32 | } // extern "C" 33 | #endif 34 | 35 | #endif // WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ 36 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/utils/quant_levels_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Alpha plane quantization utility 11 | // 12 | // Author: Vikas Arora (vikasa@google.com) 13 | 14 | #ifndef WEBP_UTILS_QUANT_LEVELS_UTILS_H_ 15 | #define WEBP_UTILS_QUANT_LEVELS_UTILS_H_ 16 | 17 | #include 18 | 19 | #include "types.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | // Replace the input 'data' of size 'width'x'height' with 'num-levels' 26 | // quantized values. If not NULL, 'sse' will contain the sum of squared error. 27 | // Valid range for 'num_levels' is [2, 256]. 28 | // Returns false in case of error (data is NULL, or parameters are invalid). 29 | int QuantizeLevels(uint8_t* const data, int width, int height, int num_levels, 30 | uint64_t* const sse); 31 | 32 | #ifdef __cplusplus 33 | } // extern "C" 34 | #endif 35 | 36 | #endif // WEBP_UTILS_QUANT_LEVELS_UTILS_H_ 37 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/utils/random_utils.c: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Pseudo-random utilities 11 | // 12 | // Author: Skal (pascal.massimino@gmail.com) 13 | 14 | #include 15 | #include "random_utils.h" 16 | 17 | //------------------------------------------------------------------------------ 18 | 19 | // 31b-range values 20 | static const uint32_t kRandomTable[VP8_RANDOM_TABLE_SIZE] = { 21 | 0x0de15230, 0x03b31886, 0x775faccb, 0x1c88626a, 0x68385c55, 0x14b3b828, 22 | 0x4a85fef8, 0x49ddb84b, 0x64fcf397, 0x5c550289, 0x4a290000, 0x0d7ec1da, 23 | 0x5940b7ab, 0x5492577d, 0x4e19ca72, 0x38d38c69, 0x0c01ee65, 0x32a1755f, 24 | 0x5437f652, 0x5abb2c32, 0x0faa57b1, 0x73f533e7, 0x685feeda, 0x7563cce2, 25 | 0x6e990e83, 0x4730a7ed, 0x4fc0d9c6, 0x496b153c, 0x4f1403fa, 0x541afb0c, 26 | 0x73990b32, 0x26d7cb1c, 0x6fcc3706, 0x2cbb77d8, 0x75762f2a, 0x6425ccdd, 27 | 0x24b35461, 0x0a7d8715, 0x220414a8, 0x141ebf67, 0x56b41583, 0x73e502e3, 28 | 0x44cab16f, 0x28264d42, 0x73baaefb, 0x0a50ebed, 0x1d6ab6fb, 0x0d3ad40b, 29 | 0x35db3b68, 0x2b081e83, 0x77ce6b95, 0x5181e5f0, 0x78853bbc, 0x009f9494, 30 | 0x27e5ed3c 31 | }; 32 | 33 | void VP8InitRandom(VP8Random* const rg, float dithering) { 34 | memcpy(rg->tab_, kRandomTable, sizeof(rg->tab_)); 35 | rg->index1_ = 0; 36 | rg->index2_ = 31; 37 | rg->amp_ = (dithering < 0.0) ? 0 38 | : (dithering > 1.0) ? (1 << VP8_RANDOM_DITHER_FIX) 39 | : (uint32_t)((1 << VP8_RANDOM_DITHER_FIX) * dithering); 40 | } 41 | 42 | //------------------------------------------------------------------------------ 43 | 44 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/utils/random_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Pseudo-random utilities 11 | // 12 | // Author: Skal (pascal.massimino@gmail.com) 13 | 14 | #ifndef WEBP_UTILS_RANDOM_UTILS_H_ 15 | #define WEBP_UTILS_RANDOM_UTILS_H_ 16 | 17 | #include 18 | #include "types.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #define VP8_RANDOM_DITHER_FIX 8 // fixed-point precision for dithering 25 | #define VP8_RANDOM_TABLE_SIZE 55 26 | 27 | typedef struct { 28 | int index1_, index2_; 29 | uint32_t tab_[VP8_RANDOM_TABLE_SIZE]; 30 | int amp_; 31 | } VP8Random; 32 | 33 | // Initializes random generator with an amplitude 'dithering' in range [0..1]. 34 | void VP8InitRandom(VP8Random* const rg, float dithering); 35 | 36 | // Returns a centered pseudo-random number with 'num_bits' amplitude. 37 | // (uses D.Knuth's Difference-based random generator). 38 | // 'amp' is in VP8_RANDOM_DITHER_FIX fixed-point precision. 39 | static WEBP_INLINE int VP8RandomBits2(VP8Random* const rg, int num_bits, 40 | int amp) { 41 | int diff; 42 | assert(num_bits + VP8_RANDOM_DITHER_FIX <= 31); 43 | diff = rg->tab_[rg->index1_] - rg->tab_[rg->index2_]; 44 | if (diff < 0) diff += (1u << 31); 45 | rg->tab_[rg->index1_] = diff; 46 | if (++rg->index1_ == VP8_RANDOM_TABLE_SIZE) rg->index1_ = 0; 47 | if (++rg->index2_ == VP8_RANDOM_TABLE_SIZE) rg->index2_ = 0; 48 | // sign-extend, 0-center 49 | diff = (int)((uint32_t)diff << 1) >> (32 - num_bits); 50 | diff = (diff * amp) >> VP8_RANDOM_DITHER_FIX; // restrict range 51 | diff += 1 << (num_bits - 1); // shift back to 0.5-center 52 | return diff; 53 | } 54 | 55 | static WEBP_INLINE int VP8RandomBits(VP8Random* const rg, int num_bits) { 56 | return VP8RandomBits2(rg, num_bits, rg->amp_); 57 | } 58 | 59 | #ifdef __cplusplus 60 | } // extern "C" 61 | #endif 62 | 63 | #endif // WEBP_UTILS_RANDOM_UTILS_H_ 64 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/webp/types.h: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Common types + memory wrappers 11 | // 12 | // Author: Skal (pascal.massimino@gmail.com) 13 | 14 | #ifndef WEBP_WEBP_TYPES_H_ 15 | #define WEBP_WEBP_TYPES_H_ 16 | 17 | #include // for size_t 18 | 19 | #ifndef _MSC_VER 20 | #include 21 | #if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \ 22 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 23 | #define WEBP_INLINE inline 24 | #else 25 | #define WEBP_INLINE 26 | #endif 27 | #else 28 | typedef signed char int8_t; 29 | typedef unsigned char uint8_t; 30 | typedef signed short int16_t; 31 | typedef unsigned short uint16_t; 32 | typedef signed int int32_t; 33 | typedef unsigned int uint32_t; 34 | typedef unsigned long long int uint64_t; 35 | typedef long long int int64_t; 36 | #define WEBP_INLINE __forceinline 37 | #endif /* _MSC_VER */ 38 | 39 | #ifndef WEBP_EXTERN 40 | // This explicitly marks library functions and allows for changing the 41 | // signature for e.g., Windows DLL builds. 42 | # if defined(__GNUC__) && __GNUC__ >= 4 43 | # define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) 44 | # else 45 | # define WEBP_EXTERN extern 46 | # endif /* __GNUC__ >= 4 */ 47 | #endif /* WEBP_EXTERN */ 48 | 49 | // Macro to check ABI compatibility (same major revision number) 50 | #define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8)) 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | // Allocates 'size' bytes of memory. Returns NULL upon error. Memory 57 | // must be deallocated by calling WebPFree(). This function is made available 58 | // by the core 'libwebp' library. 59 | WEBP_EXTERN void* WebPMalloc(size_t size); 60 | 61 | // Releases memory returned by the WebPDecode*() functions (from decode.h). 62 | WEBP_EXTERN void WebPFree(void* ptr); 63 | 64 | #ifdef __cplusplus 65 | } // extern "C" 66 | #endif 67 | 68 | #endif // WEBP_WEBP_TYPES_H_ 69 | -------------------------------------------------------------------------------- /Example/HDCoverageDemo/pgImageModule/Classes/SDWebImage/webp/libwebp/src/webp/types.h.bak: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Common types + memory wrappers 11 | // 12 | // Author: Skal (pascal.massimino@gmail.com) 13 | 14 | #ifndef WEBP_WEBP_TYPES_H_ 15 | #define WEBP_WEBP_TYPES_H_ 16 | 17 | #include // for size_t 18 | 19 | #ifndef _MSC_VER 20 | #include 21 | #if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \ 22 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 23 | #define WEBP_INLINE inline 24 | #else 25 | #define WEBP_INLINE 26 | #endif 27 | #else 28 | typedef signed char int8_t; 29 | typedef unsigned char uint8_t; 30 | typedef signed short int16_t; 31 | typedef unsigned short uint16_t; 32 | typedef signed int int32_t; 33 | typedef unsigned int uint32_t; 34 | typedef unsigned long long int uint64_t; 35 | typedef long long int int64_t; 36 | #define WEBP_INLINE __forceinline 37 | #endif /* _MSC_VER */ 38 | 39 | #ifndef WEBP_EXTERN 40 | // This explicitly marks library functions and allows for changing the 41 | // signature for e.g., Windows DLL builds. 42 | # if defined(__GNUC__) && __GNUC__ >= 4 43 | # define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) 44 | # else 45 | # define WEBP_EXTERN extern 46 | # endif /* __GNUC__ >= 4 */ 47 | #endif /* WEBP_EXTERN */ 48 | 49 | // Macro to check ABI compatibility (same major revision number) 50 | #define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8)) 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | // Allocates 'size' bytes of memory. Returns NULL upon error. Memory 57 | // must be deallocated by calling WebPFree(). This function is made available 58 | // by the core 'libwebp' library. 59 | WEBP_EXTERN void* WebPMalloc(size_t size); 60 | 61 | // Releases memory returned by the WebPDecode*() functions (from decode.h). 62 | WEBP_EXTERN void WebPFree(void* ptr); 63 | 64 | #ifdef __cplusplus 65 | } // extern "C" 66 | #endif 67 | 68 | #endif // WEBP_WEBP_TYPES_H_ 69 | -------------------------------------------------------------------------------- /Example/HDCoverageFramework/HDCoverageFramework.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDCoverageFramework.h 3 | // HDCoverageFramework 4 | // 5 | // Created by denglibing on 2021/10/30. 6 | // Copyright © 2021 CocoaPods. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for HDCoverageFramework. 12 | FOUNDATION_EXPORT double HDCoverageFrameworkVersionNumber; 13 | 14 | //! Project version string for HDCoverageFramework. 15 | FOUNDATION_EXPORT const unsigned char HDCoverageFrameworkVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | #import "HDOCFramework.h" 19 | 20 | int __llvm_profile_runtime = 0; 21 | void __llvm_profile_initialize_file(void); 22 | const char *__llvm_profile_get_filename(); 23 | void __llvm_profile_set_filename(const char *); 24 | int __llvm_profile_write_file(); 25 | int __llvm_profile_register_write_file_atexit(void); 26 | const char *__llvm_profile_get_path_prefix(); 27 | -------------------------------------------------------------------------------- /Example/HDCoverageFramework/HDOCFramework.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDOCFramework.h 3 | // HDCoverFramework 4 | // 5 | // Created by denglibing on 2021/10/15. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface HDOCFramework : NSObject 13 | 14 | + (void)frameworkOCAction:(NSInteger)tag; 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/HDCoverageFramework/HDOCFramework.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDOCFramework.m 3 | // HDCoverFramework 4 | // 5 | // Created by denglibing on 2021/10/15. 6 | // 7 | 8 | #import "HDOCFramework.h" 9 | 10 | @implementation HDOCFramework 11 | 12 | + (void)frameworkOCAction:(NSInteger)tag { 13 | if (tag == 1) { 14 | NSLog(@"frameworkOCAction: %d", 1); 15 | } 16 | else if (tag == 2) { 17 | NSLog(@"frameworkOCAction: %d", 2); 18 | } 19 | else if (tag == 3) { 20 | NSLog(@"frameworkOCAction: new line"); 21 | NSLog(@"frameworkOCAction: %d", 3); 22 | if (random() % 2 == 0) { 23 | NSLog(@"frameworkOCAction: new line random() %% 2 = 0"); 24 | } 25 | else { 26 | NSLog(@"frameworkOCAction: new line random() %% 2 = 1"); 27 | } 28 | } 29 | // NSDictionary * envir = [[NSProcessInfo processInfo] environment]; 30 | // NSLog(@"envir : %@", envir); 31 | 32 | // NSLog(@"Target name: %@",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]); 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Example/HDCoverageFramework/HDSwiftFramework.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HDSwiftDemo.swift 3 | // HDCoverFramework 4 | // 5 | // Created by denglibing on 2021/10/20. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct HDSwiftFramework { 11 | static public func saveProfile() { 12 | let name = "HDCoverFramework.profraw" 13 | let fileManager = FileManager.default 14 | do { 15 | let documentDirectory = try fileManager.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 16 | let filePath: NSString = documentDirectory.appendingPathComponent(name).path as NSString 17 | __llvm_profile_set_filename(filePath.utf8String) 18 | __llvm_profile_write_file() 19 | } catch { 20 | print(error) 21 | } 22 | } 23 | 24 | public static func frameworkSwiftAction(_ tag: Int) { 25 | if (tag == 1) { 26 | print("frameworkSwiftAction: 1") 27 | } 28 | else if (tag == 2) { 29 | print("frameworkSwiftAction: new line") 30 | print("frameworkSwiftAction: 2") 31 | if (arc4random() % 2 == 0) { 32 | print("frameworkSwiftAction: arc4random() %% 2 = 0") 33 | } 34 | else { 35 | print("frameworkSwiftAction: arc4random() %% 2 = 1") 36 | } 37 | } 38 | else if (tag == 3) { 39 | print("frameworkSwiftAction: 3") 40 | } 41 | 42 | // 如果是动态库,需要自己处理插桩的代码,并且找到动态库的可执行文件进行计算 43 | // 如果是静态库,则不需要下面的代码,直接使用主工程的即可 44 | // saveProfile() 45 | } 46 | } 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/HDCoverageFramework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/HDCoverageFrameworkTests/HDCoverageFrameworkTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDCoverageFrameworkTests.m 3 | // HDCoverageFrameworkTests 4 | // 5 | // Created by denglibing on 2021/10/30. 6 | // Copyright © 2021 CocoaPods. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDCoverageFrameworkTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation HDCoverageFrameworkTests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Example/HDCoverageFrameworkTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (4.0.1): 3 | - AFNetworking/NSURLSession (= 4.0.1) 4 | - AFNetworking/Reachability (= 4.0.1) 5 | - AFNetworking/Security (= 4.0.1) 6 | - AFNetworking/Serialization (= 4.0.1) 7 | - AFNetworking/UIKit (= 4.0.1) 8 | - AFNetworking/NSURLSession (4.0.1): 9 | - AFNetworking/Reachability 10 | - AFNetworking/Security 11 | - AFNetworking/Serialization 12 | - AFNetworking/Reachability (4.0.1) 13 | - AFNetworking/Security (4.0.1) 14 | - AFNetworking/Serialization (4.0.1) 15 | - AFNetworking/UIKit (4.0.1): 16 | - AFNetworking/NSURLSession 17 | - HDCoverage (1.1.4) 18 | 19 | DEPENDENCIES: 20 | - AFNetworking 21 | - HDCoverage (from `../`) 22 | 23 | SPEC REPOS: 24 | trunk: 25 | - AFNetworking 26 | 27 | EXTERNAL SOURCES: 28 | HDCoverage: 29 | :path: "../" 30 | 31 | SPEC CHECKSUMS: 32 | AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce 33 | HDCoverage: 403bd6edce698969531607551a8fd15d96c14f7a 34 | 35 | PODFILE CHECKSUM: 4beeeb1da34c97346b60fc4b8f9146b6ab766252 36 | 37 | COCOAPODS: 1.11.3 38 | -------------------------------------------------------------------------------- /Example/Pods/AFNetworking/AFNetworking/AFCompatibilityMacros.h: -------------------------------------------------------------------------------- 1 | // AFCompatibilityMacros.h 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #ifndef AFCompatibilityMacros_h 23 | #define AFCompatibilityMacros_h 24 | 25 | #ifdef API_AVAILABLE 26 | #define AF_API_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__) 27 | #else 28 | #define AF_API_AVAILABLE(...) 29 | #endif // API_AVAILABLE 30 | 31 | #ifdef API_UNAVAILABLE 32 | #define AF_API_UNAVAILABLE(...) API_UNAVAILABLE(__VA_ARGS__) 33 | #else 34 | #define AF_API_UNAVAILABLE(...) 35 | #endif // API_UNAVAILABLE 36 | 37 | #if __has_warning("-Wunguarded-availability-new") 38 | #define AF_CAN_USE_AT_AVAILABLE 1 39 | #else 40 | #define AF_CAN_USE_AT_AVAILABLE 0 41 | #endif 42 | 43 | #if ((__IPHONE_OS_VERSION_MAX_ALLOWED && __IPHONE_OS_VERSION_MAX_ALLOWED < 100000) || (__MAC_OS_VERSION_MAX_ALLOWED && __MAC_OS_VERSION_MAX_ALLOWED < 101200) ||(__WATCH_OS_MAX_VERSION_ALLOWED && __WATCH_OS_MAX_VERSION_ALLOWED < 30000) ||(__TV_OS_MAX_VERSION_ALLOWED && __TV_OS_MAX_VERSION_ALLOWED < 100000)) 44 | #define AF_CAN_INCLUDE_SESSION_TASK_METRICS 0 45 | #else 46 | #define AF_CAN_INCLUDE_SESSION_TASK_METRICS 1 47 | #endif 48 | 49 | #endif /* AFCompatibilityMacros_h */ 50 | -------------------------------------------------------------------------------- /Example/Pods/AFNetworking/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | // AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | #import 26 | 27 | #ifndef _AFNETWORKING_ 28 | #define _AFNETWORKING_ 29 | 30 | #import "AFURLRequestSerialization.h" 31 | #import "AFURLResponseSerialization.h" 32 | #import "AFSecurityPolicy.h" 33 | 34 | #if !TARGET_OS_WATCH 35 | #import "AFNetworkReachabilityManager.h" 36 | #endif 37 | 38 | #import "AFURLSessionManager.h" 39 | #import "AFHTTPSessionManager.h" 40 | 41 | #endif /* _AFNETWORKING_ */ 42 | -------------------------------------------------------------------------------- /Example/Pods/AFNetworking/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2020 Alamofire Software Foundation (http://alamofire.org/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.h 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS || TARGET_OS_TV 27 | 28 | #import 29 | 30 | /** 31 | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task. 32 | */ 33 | @interface UIActivityIndicatorView (AFNetworking) 34 | 35 | ///---------------------------------- 36 | /// @name Animating for Session Tasks 37 | ///---------------------------------- 38 | 39 | /** 40 | Binds the animating state to the state of the specified task. 41 | 42 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 43 | */ 44 | - (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task; 45 | 46 | @end 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Example/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIKit+AFNetworking.h 2 | // 3 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #ifndef _UIKIT_AFNETWORKING_ 26 | #define _UIKIT_AFNETWORKING_ 27 | 28 | #if TARGET_OS_IOS || TARGET_OS_TV 29 | #import "AFAutoPurgingImageCache.h" 30 | #import "AFImageDownloader.h" 31 | #import "UIActivityIndicatorView+AFNetworking.h" 32 | #import "UIButton+AFNetworking.h" 33 | #import "UIImageView+AFNetworking.h" 34 | #import "UIProgressView+AFNetworking.h" 35 | #endif 36 | 37 | #if TARGET_OS_IOS 38 | #import "AFNetworkActivityIndicatorManager.h" 39 | #import "UIRefreshControl+AFNetworking.h" 40 | #import "WKWebView+AFNetworking.h" 41 | #endif 42 | 43 | #endif /* _UIKIT_AFNETWORKING_ */ 44 | -------------------------------------------------------------------------------- /Example/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if TARGET_OS_IOS 28 | 29 | #import 30 | 31 | NS_ASSUME_NONNULL_BEGIN 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task. 35 | */ 36 | @interface UIRefreshControl (AFNetworking) 37 | 38 | ///----------------------------------- 39 | /// @name Refreshing for Session Tasks 40 | ///----------------------------------- 41 | 42 | /** 43 | Binds the refreshing state to the state of the specified task. 44 | 45 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 46 | */ 47 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/HDCoverage.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HDCoverage", 3 | "version": "1.1.4", 4 | "summary": "Swift&OC Coverage Shell, Set Build-Settings and Copy MachO file, let work automatic", 5 | "description": "Swift&OC Coverage Shell, Set Build-Settings and Copy MachO file, let work automatic\n0.1.0: add shells and ruby files\n1.0.0: release\n1.0.1: move files\n1.0.2: perfect shells\n1.0.3: optimize macho_copy.sh (auto open code coverage result folder)\n1.0.4: optimize parse_profraw.sh (auto open code coverage result folder)\n1.0.5: optimize hdcoverage_env.sh (auto get project_path)\n1.0.8: adaptor jd biu env\n1.0.9: add $OTHER_LDFLAGS value\n1.1.0: support gather code coverage\n1.1.1: support use Cocoapods Dynamic Library demo\n1.1.2: rsolve the issue of multi computer build coverage exceptions\n1.1.3: support block code coverage, fix .o bug\n1.1.4: fix `pod install` error", 6 | "homepage": "https://github.com/erduoniba/hdcoverage", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "denglibing": "denglibing3@jd.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/erduoniba/hdcoverage.git", 16 | "tag": "1.1.4" 17 | }, 18 | "source_files": "HDCoverage/**/*.{sh,rb}", 19 | "platforms": { 20 | "osx": null, 21 | "ios": null, 22 | "tvos": null, 23 | "watchos": null 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (4.0.1): 3 | - AFNetworking/NSURLSession (= 4.0.1) 4 | - AFNetworking/Reachability (= 4.0.1) 5 | - AFNetworking/Security (= 4.0.1) 6 | - AFNetworking/Serialization (= 4.0.1) 7 | - AFNetworking/UIKit (= 4.0.1) 8 | - AFNetworking/NSURLSession (4.0.1): 9 | - AFNetworking/Reachability 10 | - AFNetworking/Security 11 | - AFNetworking/Serialization 12 | - AFNetworking/Reachability (4.0.1) 13 | - AFNetworking/Security (4.0.1) 14 | - AFNetworking/Serialization (4.0.1) 15 | - AFNetworking/UIKit (4.0.1): 16 | - AFNetworking/NSURLSession 17 | - HDCoverage (1.1.4) 18 | 19 | DEPENDENCIES: 20 | - AFNetworking 21 | - HDCoverage (from `../`) 22 | 23 | SPEC REPOS: 24 | trunk: 25 | - AFNetworking 26 | 27 | EXTERNAL SOURCES: 28 | HDCoverage: 29 | :path: "../" 30 | 31 | SPEC CHECKSUMS: 32 | AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce 33 | HDCoverage: 403bd6edce698969531607551a8fd15d96c14f7a 34 | 35 | PODFILE CHECKSUM: 4beeeb1da34c97346b60fc4b8f9146b6ab766252 36 | 37 | COCOAPODS: 1.11.3 38 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/AFNetworking/AFNetworking-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/AFNetworking/AFNetworking-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_AFNetworking : NSObject 3 | @end 4 | @implementation PodsDummy_AFNetworking 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/AFNetworking/AFNetworking-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/AFNetworking/AFNetworking-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "AFNetworking.h" 14 | #import "AFHTTPSessionManager.h" 15 | #import "AFURLSessionManager.h" 16 | #import "AFCompatibilityMacros.h" 17 | #import "AFNetworkReachabilityManager.h" 18 | #import "AFSecurityPolicy.h" 19 | #import "AFURLRequestSerialization.h" 20 | #import "AFURLResponseSerialization.h" 21 | #import "AFAutoPurgingImageCache.h" 22 | #import "AFImageDownloader.h" 23 | #import "AFNetworkActivityIndicatorManager.h" 24 | #import "UIActivityIndicatorView+AFNetworking.h" 25 | #import "UIButton+AFNetworking.h" 26 | #import "UIImageView+AFNetworking.h" 27 | #import "UIKit+AFNetworking.h" 28 | #import "UIProgressView+AFNetworking.h" 29 | #import "UIRefreshControl+AFNetworking.h" 30 | #import "WKWebView+AFNetworking.h" 31 | 32 | FOUNDATION_EXPORT double AFNetworkingVersionNumber; 33 | FOUNDATION_EXPORT const unsigned char AFNetworkingVersionString[]; 34 | 35 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/AFNetworking/AFNetworking.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/AFNetworking 8 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 9 | PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/AFNetworking/AFNetworking.modulemap: -------------------------------------------------------------------------------- 1 | framework module AFNetworking { 2 | umbrella header "AFNetworking-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/AFNetworking/AFNetworking.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/AFNetworking 8 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 9 | PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/AFNetworking/AFNetworking.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/AFNetworking 7 | PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking 8 | SKIP_INSTALL = YES 9 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HDCoverage/HDCoverage-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.1.4 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HDCoverage/HDCoverage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_HDCoverage : NSObject 3 | @end 4 | @implementation PodsDummy_HDCoverage 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HDCoverage/HDCoverage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HDCoverage/HDCoverage-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double HDCoverageVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char HDCoverageVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HDCoverage/HDCoverage.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HDCoverage 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 8 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HDCoverage/HDCoverage.modulemap: -------------------------------------------------------------------------------- 1 | framework module HDCoverage { 2 | umbrella header "HDCoverage-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HDCoverage/HDCoverage.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HDCoverage 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 8 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HDCoverage/HDCoverage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HDCoverage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HDCoverageDemo/Pods-HDCoverageDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HDCoverageDemo/Pods-HDCoverageDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_HDCoverageDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_HDCoverageDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HDCoverageDemo/Pods-HDCoverageDemo-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_HDCoverageDemoVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_HDCoverageDemoVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HDCoverageDemo/Pods-HDCoverageDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking" "${PODS_CONFIGURATION_BUILD_DIR}/HDCoverage" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking/AFNetworking.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/HDCoverage/HDCoverage.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "HDCoverage" 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 10 | PODS_ROOT = ${SRCROOT}/Pods 11 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HDCoverageDemo/Pods-HDCoverageDemo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_HDCoverageDemo { 2 | umbrella header "Pods-HDCoverageDemo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HDCoverageDemo/Pods-HDCoverageDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking" "${PODS_CONFIGURATION_BUILD_DIR}/HDCoverage" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking/AFNetworking.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/HDCoverage/HDCoverage.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "HDCoverage" 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 10 | PODS_ROOT = ${SRCROOT}/Pods 11 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Example/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import HDCoverage 3 | 4 | class Tests: XCTestCase { 5 | 6 | override func setUp() { 7 | super.setUp() 8 | // Put setup code here. This method is called before the invocation of each test method in the class. 9 | } 10 | 11 | override func tearDown() { 12 | // Put teardown code here. This method is called after the invocation of each test method in the class. 13 | super.tearDown() 14 | } 15 | 16 | func testExample() { 17 | // This is an example of a functional test case. 18 | XCTAssert(true, "Pass") 19 | } 20 | 21 | func testPerformanceExample() { 22 | // This is an example of a performance test case. 23 | self.measure() { 24 | // Put the code you want to measure the time of here. 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /HDCoverage.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint HDCoverage.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'HDCoverage' 11 | s.version = '1.1.4' 12 | s.summary = 'Swift&OC Coverage Shell, Set Build-Settings and Copy MachO file, let work automatic' 13 | s.description = <<-DESC 14 | Swift&OC Coverage Shell, Set Build-Settings and Copy MachO file, let work automatic 15 | 0.1.0: add shells and ruby files 16 | 1.0.0: release 17 | 1.0.1: move files 18 | 1.0.2: perfect shells 19 | 1.0.3: optimize macho_copy.sh (auto open code coverage result folder) 20 | 1.0.4: optimize parse_profraw.sh (auto open code coverage result folder) 21 | 1.0.5: optimize hdcoverage_env.sh (auto get project_path) 22 | 1.0.8: adaptor jd biu env 23 | 1.0.9: add $OTHER_LDFLAGS value 24 | 1.1.0: support gather code coverage 25 | 1.1.1: support use Cocoapods Dynamic Library demo 26 | 1.1.2: rsolve the issue of multi computer build coverage exceptions 27 | 1.1.3: support block code coverage, fix .o bug 28 | 1.1.4: fix `pod install` error 29 | DESC 30 | 31 | s.homepage = 'https://github.com/erduoniba/hdcoverage' 32 | s.license = { :type => 'MIT', :file => 'LICENSE' } 33 | s.author = { 'denglibing' => 'denglibing3@jd.com' } 34 | s.source = { :git => 'https://github.com/erduoniba/hdcoverage.git', :tag => s.version.to_s } 35 | 36 | s.source_files = 'HDCoverage/**/*.{sh,rb}' 37 | 38 | # s.resource_bundles = { 39 | # 'HDCoverage' => ['HDCoverage/Assets/*.png'] 40 | # } 41 | 42 | # s.public_header_files = 'Pod/Classes/**/*.h' 43 | # s.frameworks = 'UIKit', 'MapKit' 44 | # s.dependency 'AFNetworking', '~> 2.3' 45 | end 46 | -------------------------------------------------------------------------------- /HDCoverage/Classes/HDGatherCoverage.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDGatherCoverage.h 3 | // HDCoverage 4 | // 5 | // Created by denglibing on 2021/10/27. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface HDGatherCoverage : NSObject 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /HDCoverage/Classes/HDGatherCoverage.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDGatherCoverage.m 3 | // HDCoverage 4 | // 5 | // Created by denglibing on 2021/10/27. 6 | // 7 | 8 | #import "HDGatherCoverage.h" 9 | 10 | @implementation HDGatherCoverage 11 | 12 | int __llvm_profile_runtime = 0; 13 | void __llvm_profile_initialize_file(void); 14 | const char *__llvm_profile_get_filename(); 15 | void __llvm_profile_set_filename(const char *); 16 | int __llvm_profile_write_file(); 17 | int __llvm_profile_register_write_file_atexit(void); 18 | const char *__llvm_profile_get_path_prefix(); 19 | 20 | + (void)load { 21 | [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(didEnterBackgroundNotification) name:UIApplicationDidEnterBackgroundNotification object:nil]; 22 | } 23 | 24 | + (void)didEnterBackgroundNotification { 25 | [self saveAndUpload]; 26 | } 27 | 28 | + (void)saveAndUpload { 29 | NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];//获取app版本信息 30 | NSString *targetName = [infoDictionary objectForKey:@"CFBundleExecutable"]; 31 | NSLog(@"CFBundleExecutable: %@",targetName); 32 | NSString *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject; 33 | NSString *filePath = [documentPath stringByAppendingPathComponent:[NSString stringWithFormat:@"coverage_files/%@.profraw", targetName]]; 34 | NSLog(@"filePath: %@", filePath); 35 | __llvm_profile_set_filename(filePath.UTF8String); 36 | __llvm_profile_write_file(); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /HDCoverage/GitdiffUtils/changeSourcePath.rb: -------------------------------------------------------------------------------- 1 | require_relative 'trollop' 2 | 3 | module GitUtils 4 | def changeSourcesPath(coverage_info_file, build_source_path, local_source_path) 5 | coverage_info_path = File.dirname(coverage_info_file) 6 | 7 | puts "======" 8 | puts "coverage_info_file: #{coverage_info_file}" 9 | puts "build_source_path: #{build_source_path}" 10 | puts "local_source_path: #{local_source_path}" 11 | # puts file_map 12 | puts "======" 13 | 14 | # r:utf-8表示以utf-8编码读取文件,要与当前代码文件的编码相同 15 | File.open(coverage_info_file,"r:utf-8") do |lines| 16 | #将文件中所有的ostr替换为nstr,并将替换后文件内容赋值给buffer 17 | puts "lines : #{lines}" 18 | buffer = lines.read.gsub(build_source_path, local_source_path) 19 | #以写的方式打开文件,将buffer覆盖写入文件 20 | File.open(coverage_info_file,"w"){|l| 21 | l.write(buffer) 22 | } 23 | end 24 | end 25 | end 26 | 27 | if __FILE__ == $0 28 | include GitUtils 29 | 30 | opts = Trollop::options do 31 | opt :build_source_path, 'Path for build source', :type => :string 32 | opt :local_source_path, 'Path for local source', :type => :string 33 | opt :coverage_info_file, 'Path for covage info file', :type => :string 34 | end 35 | 36 | Trollop::die :build_source_path, 'must be provided' if opts[:build_source_path].nil? 37 | Trollop::die :local_source_path, 'must be provided' if opts[:local_source_path].nil? 38 | Trollop::die :coverage_info_file, 'must be provided' if opts[:coverage_info_file].nil? 39 | GitUtils.changeSourcesPath(opts[:coverage_info_file], opts[:build_source_path], opts[:local_source_path]) 40 | end 41 | -------------------------------------------------------------------------------- /HDCoverage/GitdiffUtils/deleteExtraData.rb: -------------------------------------------------------------------------------- 1 | require_relative 'trollop' 2 | 3 | module GitUtils 4 | def deleteExtraData(coverage_info_file) 5 | coverage_info_file_path = File.dirname(coverage_info_file) 6 | coverage_correct_info_file_path = "coverage_info_correct.info" 7 | 8 | puts "======" 9 | puts "coverage_info_file_path: #{coverage_info_file_path}" 10 | puts "coverage_correct_info_file_path: #{coverage_correct_info_file_path}" 11 | puts "======" 12 | 13 | coverage_correct_info_file = File.new(coverage_correct_info_file_path, "w+") 14 | 15 | extraLine = false 16 | File.open(coverage_info_file).each do |line| 17 | # info包含 JD_vendored_libs 等数据为脏数据,需要移除 18 | if line.start_with? 'SF:' 19 | if line.include? "JD_vendored_libs" 20 | extraLine = true 21 | next 22 | else 23 | puts "contain yes: #{line}" 24 | extraLine = false 25 | end 26 | end 27 | 28 | if extraLine == false 29 | coverage_correct_info_file.syswrite(line) 30 | end 31 | end 32 | end 33 | end 34 | 35 | if __FILE__ == $0 36 | include GitUtils 37 | 38 | opts = Trollop::options do 39 | opt :coverage_info_file, 'Path for covage info file', :type => :string 40 | end 41 | 42 | GitUtils.deleteExtraData(opts[:coverage_info_file]) 43 | end 44 | -------------------------------------------------------------------------------- /HDCoverage/hd_coverage_buildsettings.rb: -------------------------------------------------------------------------------- 1 | # 引入库 2 | require 'xcodeproj' 3 | 4 | #打开项目工程.xcodeproj 5 | project_path = ARGV[0] 6 | puts 'project_path is %s' % project_path 7 | project = Xcodeproj::Project.open(project_path) 8 | 9 | # 遍历配置 10 | project.targets.each do |target| 11 | target.build_configurations.each do |config| 12 | #获得build settings 13 | build_settings = config.build_settings 14 | #build_settings是一个哈希,里面是一个个配置 15 | build_settings["OTHER_SWIFT_FLAGS"] = "-profile-generate -profile-coverage-mapping" 16 | build_settings["OTHER_CFLAGS"] = "-fprofile-instr-generate -fcoverage-mapping" 17 | build_settings["OTHER_LDFLAGS"] = "-fprofile-instr-generate" 18 | end 19 | end 20 | 21 | project.save 22 | -------------------------------------------------------------------------------- /HDCoverage/hd_coverage_env.sh: -------------------------------------------------------------------------------- 1 | # 获取当前脚本的绝对路径 2 | scripts="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | 4 | # 插入代码覆盖率需要Xcode BuildSettings 的指令(这里取消,直接在Podfile操作更加好管理,具体看post_install) 5 | #sh ${scripts}/hd_buildsetting_env.sh $PROJECT_FILE_PATH 6 | 7 | # 执行相关拷贝操作:拷贝代码覆盖率需要的MachO文件及llvm聚合脚本到项目的根目录/CoverResult 中 8 | sh ${scripts}/hd_macho_copy.sh 9 | -------------------------------------------------------------------------------- /HDCoverageSFramework/HDCoverageSFramework.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/HDCoverageSFramework/HDCoverageSFramework.zip -------------------------------------------------------------------------------- /Img/auto_create_coverage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/auto_create_coverage.png -------------------------------------------------------------------------------- /Img/coverage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/coverage.jpg -------------------------------------------------------------------------------- /Img/coverage_gather1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/coverage_gather1.png -------------------------------------------------------------------------------- /Img/coverage_gather2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/coverage_gather2.png -------------------------------------------------------------------------------- /Img/coverage_gather3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/coverage_gather3.png -------------------------------------------------------------------------------- /Img/coverage_gather4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/coverage_gather4.png -------------------------------------------------------------------------------- /Img/coverage_result1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/coverage_result1.png -------------------------------------------------------------------------------- /Img/coverage_result2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/coverage_result2.png -------------------------------------------------------------------------------- /Img/coverage_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/coverage_test.png -------------------------------------------------------------------------------- /Img/image-20211022144208211.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/image-20211022144208211.png -------------------------------------------------------------------------------- /Img/image-20211029141436560.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/image-20211029141436560.png -------------------------------------------------------------------------------- /Img/代码覆盖率-iBIu支持V1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Img/代码覆盖率-iBIu支持V1.1.pdf -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 denglibing 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Source-based/bar_oc/bar.m: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int add(int x, int y) { 4 | return x + y; 5 | } 6 | 7 | void printTest(int x) { 8 | printf("begin\n"); 9 | if ( x > 100) { 10 | printf("input > 100 \n"); 11 | } 12 | else if ( x > 60) { 13 | printf(" 60 < input <= 100\n"); 14 | } 15 | else if ( x > 0) { 16 | printf(" 0 < input <= 60\n"); 17 | } 18 | else { 19 | printf(" input <= 0\n"); 20 | } 21 | printf("end\n"); 22 | } 23 | 24 | int main(void) { 25 | 26 | printTest(12); 27 | printTest(8); 28 | printTest(0); 29 | 30 | int r = add(1, 2); 31 | printf("result: %d\n", r); 32 | 33 | 34 | return 0; 35 | } 36 | 37 | 38 | /* 39 | // 覆盖率编译 40 | clang -fprofile-instr-generate -fcoverage-mapping bar.m -o bar_coverage 41 | // 正常编译 42 | clang bar.m -o bar_no_coverage 43 | 44 | // 执行代码,会在当前目录得到 default.profraw 45 | ./bar_coverage 46 | 47 | // 生成执行的代码数据 48 | xcrun llvm-profdata merge -sparse default.profraw -o bar_coverage.profdata 49 | 50 | # 查看profdata数据 51 | xcrun llvm-profdata show -all-functions -instr bar_coverage.profdata > bar_coverage_profdata.text 52 | 53 | # 导出为html 54 | xcrun llvm-cov show ./bar_coverage -instr-profile=bar_coverage.profdata -use-color -format=html -output-dir bar_coverage_html 55 | 56 | # 生成汇编 57 | xcrun -sdk iphonesimulator clang -S -fobjc-arc bar.m -o main.s 58 | 59 | */ 60 | 61 | -------------------------------------------------------------------------------- /Source-based/bar_oc/bar_coverage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/bar_oc/bar_coverage -------------------------------------------------------------------------------- /Source-based/bar_oc/bar_coverage.profdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/bar_oc/bar_coverage.profdata -------------------------------------------------------------------------------- /Source-based/bar_oc/bar_coverage_html/index.html: -------------------------------------------------------------------------------- 1 |

Coverage Report

Created: 2021-11-04 22:38

Click here for information about interpreting this report.

FilenameFunction CoverageLine CoverageRegion Coverage
Users/denglibing/HDProject/HarryProject/iOS/HDCoverage/Source-based/bar_oc/bar.m
 100.00% (3/3)
  87.10% (27/31)
  83.33% (10/12)
Totals
 100.00% (3/3)
  87.10% (27/31)
  83.33% (10/12)
Generated by llvm-cov -- llvm version 12.0.0
-------------------------------------------------------------------------------- /Source-based/bar_oc/bar_coverage_profdata.text: -------------------------------------------------------------------------------- 1 | Counters: 2 | main: 3 | Hash: 0x0000000000000018 4 | Counters: 1 5 | Function count: 1 6 | printTest: 7 | Hash: 0x03e0e16a652906a0 8 | Counters: 4 9 | Function count: 3 10 | add: 11 | Hash: 0x0000000000000018 12 | Counters: 1 13 | Function count: 1 14 | Instrumentation level: Front-end 15 | Functions shown: 3 16 | Total functions: 3 17 | Maximum function count: 3 18 | Maximum internal block count: 2 19 | -------------------------------------------------------------------------------- /Source-based/bar_oc/bar_no_coverage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/bar_oc/bar_no_coverage -------------------------------------------------------------------------------- /Source-based/bar_oc/default.profraw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/bar_oc/default.profraw -------------------------------------------------------------------------------- /Source-based/bar_swift/bar_coverage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/bar_swift/bar_coverage -------------------------------------------------------------------------------- /Source-based/bar_swift/bar_coverage.profdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/bar_swift/bar_coverage.profdata -------------------------------------------------------------------------------- /Source-based/bar_swift/bar_coverage_html/index.html: -------------------------------------------------------------------------------- 1 |

Coverage Report

Created: 2022-04-16 23:19

Click here for information about interpreting this report.

FilenameFunction CoverageLine CoverageRegion CoverageBranch Coverage
Users/denglibing/HDProject/HarryProject/iOS/hdcoverage/Source-based/bar_swift/bar.swift
 100.00% (6/6)
  82.61% (19/23)
  85.71% (12/14)
- (0/0)
Totals
 100.00% (6/6)
  82.61% (19/23)
  85.71% (12/14)
- (0/0)
Generated by llvm-cov -- llvm version 13.0.0
-------------------------------------------------------------------------------- /Source-based/bar_swift/bar_coverage_profdata.text: -------------------------------------------------------------------------------- 1 | Counters: 2 | bar.swift:$s12bar_coverage3addyS2i_SitF: 3 | Hash: 0x0000000000000000 4 | Counters: 1 5 | Function count: 1 6 | bar.swift:__tlcd_line:24:1: 7 | Hash: 0x0000000000000000 8 | Counters: 1 9 | Function count: 1 10 | bar.swift:__tlcd_line:23:1: 11 | Hash: 0x0000000000000000 12 | Counters: 1 13 | Function count: 1 14 | bar.swift:$s12bar_coverage4mainyySiF: 15 | Hash: 0x0000000000000000 16 | Counters: 4 17 | Function count: 3 18 | bar.swift:__tlcd_line:25:1: 19 | Hash: 0x0000000000000000 20 | Counters: 1 21 | Function count: 1 22 | bar.swift:__tlcd_line:26:1: 23 | Hash: 0x0000000000000000 24 | Counters: 1 25 | Function count: 1 26 | Instrumentation level: Front-end 27 | Functions shown: 6 28 | Total functions: 6 29 | Maximum function count: 3 30 | Maximum internal block count: 2 31 | -------------------------------------------------------------------------------- /Source-based/bar_swift/bar_no_coverage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/bar_swift/bar_no_coverage -------------------------------------------------------------------------------- /Source-based/bar_swift/bars.swift: -------------------------------------------------------------------------------- 1 | func add(_ x: Int, _ y: Int) -> Int { 2 | return x + y 3 | } 4 | 5 | func main(_ x: Int) { 6 | print("begin") 7 | if ( x > 100) { 8 | print("input > 100") 9 | } 10 | else if ( x > 60) { 11 | print(" 60 < input <= 100") 12 | } 13 | else if ( x > 0) { 14 | print(" 0 < input <= 60") 15 | } 16 | else { 17 | print(" input <= 0") 18 | } 19 | print("end") 20 | } 21 | 22 | 23 | main(12) 24 | main(8) 25 | main(0) 26 | print("\(add(1, 2))") 27 | 28 | 29 | /* 30 | // 覆盖率编译 31 | swiftc -profile-generate -profile-coverage-mapping barswift -o bar_coverage 32 | // 正常编译 33 | swiftc barswift -o bar_no_coverage 34 | 35 | // 执行代码,会在当前目录得到 defaultprofraw 36 | /bar_coverage 37 | 38 | // 生成执行的代码数据 39 | xcrun llvm-profdata merge -sparse default.profraw -o bar_coverage.profdata 40 | 41 | # 查看profdata数据 42 | xcrun llvm-profdata show -all-functions -instr bar_coverageprofdata > bar_coverage_profdatatext 43 | 44 | # 导出为html 45 | xcrun llvm-cov show ./bar_coverage -instr-profile=bar_coverage.profdata -use-color -format=html -output-dir bar_coverage_html 46 | 47 | # -path-equivalence 解决多台设备生成具体覆盖率为0的问题 48 | xcrun llvm-cov show -instr-profile=bar_coverage.profdata -use-color -format=html bar_coverage -output-dir=bar_coverage_html -path-equivalence=/Users/denglibing/HDProject/HarryProject/iOS/hdcoverage/Source-based/bar_swift/,/Users/denglibing/HDProject/HarryProject/iOS/hdcoverage/Source-based/bar_swift/bars/ 49 | */ 50 | 51 | -------------------------------------------------------------------------------- /Source-based/bar_swift/bars/bar.swift: -------------------------------------------------------------------------------- 1 | func add(_ x: Int, _ y: Int) -> Int { 2 | return x + y 3 | } 4 | 5 | func main(_ x: Int) { 6 | print("begin") 7 | if ( x > 100) { 8 | print("input > 100") 9 | } 10 | else if ( x > 60) { 11 | print(" 60 < input <= 100") 12 | } 13 | else if ( x > 0) { 14 | print(" 0 < input <= 60") 15 | } 16 | else { 17 | print(" input <= 0") 18 | } 19 | print("end") 20 | } 21 | 22 | 23 | main(12) 24 | main(8) 25 | main(0) 26 | print("\(add(1, 2))") 27 | 28 | 29 | /* 30 | // 覆盖率编译 31 | swiftc -profile-generate -profile-coverage-mapping barswift -o bar_coverage 32 | // 正常编译 33 | swiftc barswift -o bar_no_coverage 34 | 35 | // 执行代码,会在当前目录得到 defaultprofraw 36 | /bar_coverage 37 | 38 | // 生成执行的代码数据 39 | xcrun llvm-profdata merge -sparse default.profraw -o bar_coverage.profdata 40 | 41 | # 查看profdata数据 42 | xcrun llvm-profdata show -all-functions -instr bar_coverageprofdata > bar_coverage_profdatatext 43 | 44 | # 导出为html 45 | xcrun llvm-cov show ./bar_coverage -instr-profile=bar_coverage.profdata -use-color -format=html -output-dir bar_coverage_html 46 | */ 47 | 48 | -------------------------------------------------------------------------------- /Source-based/bar_swift/default.profraw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/bar_swift/default.profraw -------------------------------------------------------------------------------- /Source-based/bar_swift/default.txt: -------------------------------------------------------------------------------- 1 | 1|func add(_ x: Int, _ y: Int) -> Int { 2 | 2| return x + y 3 | 3|} 4 | 4| 5 | 5|func main(_ x: Int) { 6 | 6| print("begin") 7 | 7| if ( x > 100) { 8 | 8| print("input > 100") 9 | 9| } 10 | 10| else if ( x > 60) { 11 | 11| print(" 60 < input <= 100") 12 | 12| } 13 | 13| else if ( x > 0) { 14 | 14| print(" 0 < input <= 60") 15 | 15| } 16 | 16| else { 17 | 17| print(" input <= 0") 18 | 18| } 19 | 19| print("end") 20 | 20|} 21 | 21| 22 | 22| 23 | 23|main(12) 24 | 24|main(8) 25 | 25|main(0) 26 | 26|print("\(add(1, 2))") 27 | 28 | -------------------------------------------------------------------------------- /Source-based/foo_c/foo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/foo_c/foo -------------------------------------------------------------------------------- /Source-based/foo_c/foo.cc: -------------------------------------------------------------------------------- 1 | #define BAR(x) ((x) || (x)) 2 | template void foo(T x) { 3 | for (unsigned I = 0; I < 10; ++I) { BAR(I); } 4 | } 5 | 6 | int main() { 7 | foo(0); 8 | foo(0); 9 | return 0; 10 | } 11 | 12 | // xcrun llvm-cov report ./foo -instr-profile=foo.profdata 13 | //xcrun llvm-cov report ./foo -instr-profile=foo.profdata 14 | -------------------------------------------------------------------------------- /Source-based/foo_c/foo.profdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/foo_c/foo.profdata -------------------------------------------------------------------------------- /Source-based/foo_c/foo.profraw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/foo_c/foo.profraw -------------------------------------------------------------------------------- /Source-based/foo_c/no_coverage_foo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/Source-based/foo_c/no_coverage_foo -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | pkg 3 | .idea/ 4 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in cocoapods-hdcoverage.gemspec 4 | gemspec 5 | 6 | group :development do 7 | gem 'cocoapods' 8 | 9 | gem 'mocha' 10 | gem 'bacon' 11 | gem 'mocha-on-bacon' 12 | gem 'prettybacon' 13 | end 14 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 denglibing 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/README.md: -------------------------------------------------------------------------------- 1 | # cocoapods-hdcoverage 2 | 3 | A description of cocoapods-hdcoverage. 4 | 5 | ## Installation 6 | 7 | $ gem install cocoapods-hdcoverage 8 | 9 | ## Usage 10 | 11 | $ pod spec hdcoverage POD_NAME 12 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/gem_tasks' 2 | 3 | def specs(dir) 4 | FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ') 5 | end 6 | 7 | desc 'Runs all the specs' 8 | task :specs do 9 | sh "bundle exec bacon #{specs('**')}" 10 | end 11 | 12 | task :default => :specs 13 | 14 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/cocoapods-hdcoverage-0.0.1.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erduoniba/hdcoverage/a91b3981638db3451458d45e9f829a2f687e529f/cocoapods-coverage/cocoapods-hdcoverage/cocoapods-hdcoverage-0.0.1.gem -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/cocoapods-hdcoverage.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'cocoapods-hdcoverage/gem_version.rb' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = 'cocoapods-hdcoverage' 8 | spec.version = CocoapodsHdcoverage::VERSION 9 | spec.authors = ['denglibing'] 10 | spec.email = ['denglibing3@jd.com'] 11 | spec.description = %q{A short description of cocoapods-hdcoverage.} 12 | spec.summary = %q{A longer description of cocoapods-hdcoverage.} 13 | spec.homepage = 'https://github.com/EXAMPLE/cocoapods-hdcoverage' 14 | spec.license = 'MIT' 15 | 16 | spec.files = Dir['lib/**/*'] 17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 19 | spec.require_paths = ['lib'] 20 | 21 | spec.add_development_dependency 'bundler', '~> 1.3' 22 | spec.add_development_dependency 'rake' 23 | end -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/lib/cocoapods-hdcoverage.rb: -------------------------------------------------------------------------------- 1 | require 'cocoapods-hdcoverage/gem_version' 2 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/lib/cocoapods-hdcoverage/command.rb: -------------------------------------------------------------------------------- 1 | require 'cocoapods-hdcoverage/command/hdcoverage' 2 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/lib/cocoapods-hdcoverage/command/hdcoverage.rb: -------------------------------------------------------------------------------- 1 | module Pod 2 | class Command 3 | # This is an example of a cocoapods plugin adding a top-level subcommand 4 | # to the 'pod' command. 5 | # 6 | # You can also create subcommands of existing or new commands. Say you 7 | # wanted to add a subcommand to `list` to show newly deprecated pods, 8 | # (e.g. `pod list deprecated`), there are a few things that would need 9 | # to change. 10 | # 11 | # - move this file to `lib/pod/command/list/deprecated.rb` and update 12 | # the class to exist in the the Pod::Command::List namespace 13 | # - change this class to extend from `List` instead of `Command`. This 14 | # tells the plugin system that it is a subcommand of `list`. 15 | # - edit `lib/cocoapods_plugins.rb` to require this file 16 | # 17 | # @todo Create a PR to add your plugin to CocoaPods/cocoapods.org 18 | # in the `plugins.json` file, once your plugin is released. 19 | # 20 | class Hdcoverage < Command 21 | self.summary = 'Short description of cocoapods-hdcoverage.' 22 | 23 | self.description = <<-DESC 24 | Longer description of cocoapods-hdcoverage. 25 | DESC 26 | 27 | self.arguments = 'NAME' 28 | 29 | def initialize(argv) 30 | @name = argv.shift_argument 31 | super 32 | end 33 | 34 | def validate! 35 | super 36 | help! 'A Pod name is required.' unless @name 37 | end 38 | 39 | def run 40 | UI.puts "Add your implementation for the cocoapods-hdcoverage plugin in #{__FILE__}" 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/lib/cocoapods-hdcoverage/gem_version.rb: -------------------------------------------------------------------------------- 1 | module CocoapodsHdcoverage 2 | VERSION = "0.0.1" 3 | end 4 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/lib/cocoapods_plugin.rb: -------------------------------------------------------------------------------- 1 | require 'cocoapods-hdcoverage/command' 2 | # 引用 cocoapods 包 3 | require 'cocoapods' 4 | 5 | module CocoapodsHdcoverage 6 | # 注册 pod install 钩子 7 | Pod::HooksManager.register('cocoapods-hdcoverage', :post_install) do |context| 8 | p "cocoapods-hdcoverage hook post_install" 9 | end 10 | 11 | def method_name 12 | 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/spec/command/hdcoverage_spec.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../spec_helper', __FILE__) 2 | 3 | module Pod 4 | describe Command::Hdcoverage do 5 | describe 'CLAide' do 6 | it 'registers it self' do 7 | Command.parse(%w{ hdcoverage }).should.be.instance_of Command::Hdcoverage 8 | end 9 | end 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /cocoapods-coverage/cocoapods-hdcoverage/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | ROOT = Pathname.new(File.expand_path('../../', __FILE__)) 3 | $:.unshift((ROOT + 'lib').to_s) 4 | $:.unshift((ROOT + 'spec').to_s) 5 | 6 | require 'bundler/setup' 7 | require 'bacon' 8 | require 'mocha-on-bacon' 9 | require 'pretty_bacon' 10 | require 'pathname' 11 | require 'cocoapods' 12 | 13 | Mocha::Configuration.prevent(:stubbing_non_existent_method) 14 | 15 | require 'cocoapods_plugin' 16 | 17 | #-----------------------------------------------------------------------------# 18 | 19 | module Pod 20 | 21 | # Disable the wrapping so the output is deterministic in the tests. 22 | # 23 | UI.disable_wrap = true 24 | 25 | # Redirects the messages to an internal store. 26 | # 27 | module UI 28 | @output = '' 29 | @warnings = '' 30 | 31 | class << self 32 | attr_accessor :output 33 | attr_accessor :warnings 34 | 35 | def puts(message = '') 36 | @output << "#{message}\n" 37 | end 38 | 39 | def warn(message = '', actions = []) 40 | @warnings << "#{message}\n" 41 | end 42 | 43 | def print(message) 44 | @output << message 45 | end 46 | end 47 | end 48 | end 49 | 50 | #-----------------------------------------------------------------------------# 51 | -------------------------------------------------------------------------------- /pod_release.sh: -------------------------------------------------------------------------------- 1 | function pushTagAndPodTrunk { 2 | git tag -m $1 $2 3 | git push orgin $2 4 | 5 | pod trunk push HDCoverage.podspec --allow-warnings 6 | } 7 | 8 | function main { 9 | echo "git commit msg: $1, tag: $2" 10 | 11 | git add . 12 | git commit -m $1 13 | git push -u orgin master 14 | 15 | if [ $? -eq 0 ]; then 16 | echo "git push success" 17 | pushTagAndPodTrunk $1 $2 18 | else 19 | echo "git push faild" 20 | pushTagAndPodTrunk $1 $2 21 | fi 22 | 23 | } 24 | 25 | main $1 $2 26 | --------------------------------------------------------------------------------