美文网首页
CocoaPods .podspec文件配置详解

CocoaPods .podspec文件配置详解

作者: 懒人09 | 来源:发表于2018-06-07 11:18 被阅读15次

    在库目录创建完成后,打开终端工具 cd 到与库目录同一目录下使用命令

    pod spec create <podspec文件名>
    

    注意:podspec文件名需与库名称相同

    文件创建完成后根据下面注释修改文件信息

    Pod::Spec.new do |s|
    
      s.name         = "库名称(Module)"
      s.version      = "版本号(0.0.1)"
      s.summary      = "简述"
      s.description  = <<-DESC
      描述
                       DESC
    
      s.homepage     = "库的主页地址,一定要有(https://XXX/Module)"
      # s.screenshots  = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
    
    
      # ―――  Spec License  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
      #
      #  Licensing your code is important. See http://choosealicense.com for more info.
      #  CocoaPods will detect a license file if there is a named LICENSE*
      #  Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
      #
      
      s.license      = "需要配置license文件(MIT)"
      # s.license      = { :type => "MIT", :file => "FILE_LICENSE" }
    
    
      # ――― Author Metadata  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
    
      s.author             = { "作者" => "邮箱" }
      # Or just: s.author    = ""
      # s.authors            = { "" => "" }
      # s.social_media_url   = "http://twitter.com/"
    
      # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
    
      # s.platform     = :ios
      # 支持平台以及最低版本
      s.platform     = :ios, "8.0"
    
      #  When using multiple platforms
      # s.ios.deployment_target = "5.0"
      # s.osx.deployment_target = "10.7"
      # s.watchos.deployment_target = "2.0"
      # s.tvos.deployment_target = "9.0"
    
    
      # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
      # 库地址,当前的版本号
      s.source       = { :git => "https://github.com/XXXX/Module.git", :tag => "#{s.version}" }
    
    
      # ――― Source Code ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #  
      # 开放的库文件
      s.source_files  = "Classes", "Classes/**/*.{h,m}"
      # s.exclude_files = "Classes/Exclude"
    
      # s.public_header_files = "Classes/**/*.h"
    
    
      # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
      #  A list of resources included with the Pod. These are copied into the
    
      # s.resource  = "icon.png"
      # s.resources = "Resources/*.png"
    
      # s.preserve_paths = "FilesToSave", "MoreFilesToSave"
    
    
      # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
      #
      #  Link your library with frameworks, or libraries. Libraries do not include
      #  the lib prefix of their name.
      #
      # 需要调用的系统库
      # s.framework  = "SomeFramework"
      s.frameworks = "UIKit", "Foundation"
    
      # s.library   = "iconv"
      # s.libraries = "iconv", "xml2"
    
      # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
      #
      #  If your library depends on compiler flags you can set them in the xcconfig hash
      #  where they will only apply to your library. If you depend on other Podspecs
      #  you can include multiple dependencies to ensure it works.
    
      # s.requires_arc = true
    
      # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
      # 需要调用的第三方库
      # s.dependency "JSONKit", "~> 1.4"
    

    文件创建完成后使用命令

    pod lib lint
    

    验证信息是否合格

    相关文章

      网友评论

          本文标题:CocoaPods .podspec文件配置详解

          本文链接:https://www.haomeiwen.com/subject/mxwwsftx.html