美文网首页
cocoapod制作私有库repo

cocoapod制作私有库repo

作者: 洲洲哥 | 来源:发表于2021-11-09 16:48 被阅读0次

闲来没事,整理好久之前的文档。制作私有库和公共库还是有一定的差别的。甚至还有快速模式,后面给大家展开叙述

1:创建两个远程仓库

  1. 创建ios_spece远程仓库,用来存放本地podspec。
  2. 创建podProject远程仓库,用来存放项目工程文件。

2:处理ios_spece远程仓库

前往文件夹 ~/.cocoapods/repos

打开终端,在终端切换到当前目录下,然后进行pod repo add操作

在终端输入:

pod repo add ios_spece https://gitee.com/whuizhou/i-os_speace.git
(1中创建的ios_spece远程仓库的地址)

3:创建pod的项目工程

创建pod工程

3.1 修改podspec文件

Pod::Spec.new do |s|
  s.name             = 'shareSDK'
  s.version          = '1.0.0'
  s.summary          = 'SHARE-SDK'

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'https://gitee.com/whuizhou'
  
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { '大哥还是当年的大哥' => 'wangh@email.com' }
  s.source           = { :git => 'https://gitee.com/whuizhou/repo-share-p.git', :tag => s.version.to_s }
  #*** 这里一定要修改为工程的git地址

  s.ios.deployment_target = '9.0'

  s.source_files = 'shareSDK/Classes/**/*'
  
  # s.resource_bundles = {
  #   'shareSDK' => ['shareSDK/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking'
   s.dependency 'SDWebImage'
end

设置初始版本为1.0.0
引用了SDWebImage

3.2 校验本地podspec文件

到工程的目录下,验证podspec文件

pod lib lint shareSDK.podspec --allow-warnings --verbose

验证结果
 ** BUILD SUCCEEDED **

   Testing with `xcodebuild`.
 -> shareSDK (1.0.2)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Building targets in parallel
    - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    - NOTE  | xcodebuild:  note: Build preparation complete
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Analyzing workspace
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - WARN  | xcodebuild:  /Users/zzg/Library/Developer/Xcode/DerivedData/App-gjchcgjwyytzwnbeodicecfxkczb/Build/Products/Release-iphonesimulator/shareSDK/shareSDK.framework/Headers/shareSDK-umbrella.h:13:9: warning: double-quoted include "LogTool.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')

shareSDK passed validation.

3.3 本地文件上传到远程仓库中,并打对应的tag号

  1. 上传本地工程到远端仓库
  2. tag版本号,一定要与s.version 一致
s.version          = '1.0.0'

打tag

// 打tag号
git tag -m "1.0.2标签" -a 1.0.2
// 推送tag
git push --tags
// 查看tag
git tag
  1. 检验podspecs文件的有效性
pod lib lint /Users/zzg/Desktop/SHARE/shareSDK.podspec --use-libraries --allow-warnings

校验结果如下

-> shareSDK (1.0.2)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Building targets in parallel
    - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    - NOTE  | xcodebuild:  note: Build preparation complete
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Analyzing workspace
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')

shareSDK passed validation.

4:向私有的ios_space远程仓库提交podspec

pod repo push ios_speace shareSDK.podspec --sources='https://gitee.com/whuizhou/i-os_speace.git,https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git' --use-libraries --allow-warnings --verbose

如果引用的有其他第三方库,或者其他私有地址一定要在后面写上

source='地址' --use-libraries --allow-warnings --verbose

这里用的是清华源

5:使用自己的私有库

在工程的podfile文件的头一行里写

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
source "https://gitee.com/whuizhou/i-os_speace.git"

完成podfile文件如下

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
source "https://gitee.com/whuizhou/i-os_speace.git"


target 'dddd' do
    platform :ios, '9.0'
    pod 'shareSDK', '~> 1.0.2'


end

如果觉得可以还可添加“洲洲哥”的微信公众号,随时获取

相关文章

  • cocoapod制作私有库repo

    闲来没事,整理好久之前的文档。制作私有库和公共库还是有一定的差别的。甚至还有快速模式,后面给大家展开叙述 1:创建...

  • cocoapods远程私有库

    制作私有远程库repo 1、pod repo //查看当前所有的repo 2、准备私有repo的url需要在代码...

  • Pod私有库制作

    ##Pod私有库制作 ####目录 +安装CocoaPods +创建远程内部私有Spec Repo仓库 +模板创建...

  • 从0到1构建自己的CocoaPods库

    参考文章: 在CocoaPods上制作自己的库 COCOAPODS创建私有PODS 如何制作自己的CocoaPod...

  • 制作CocoaPod依赖库

    随着模块化的盛行,使用cocoaPod制作私有库,将代码模块化解耦已是大项目代码管理的所需。制作私有库,代码模块化...

  • [Cocoapods] 如何发布一个私有Pod

    发布私有CocoaPod Spec 创建private pod主要步骤 创建私有Spec Repo 1、创建git...

  • iOS 组件化初识

    一、创建本地repo,并与远端repo私有索引库关联 GitLab创建repo私有库 本地创建repo索引文件,并...

  • CocoaPods 私有库

    名词私有库名字私有库地址私有repo 名字私有repo 地址 1、创建pod模板 随后会开始创建项目,项目路径如下...

  • 创建私有库

    前言 网上有很多制作私有库的博客,按照大部分博客做下来,本地~/.cocoapod/repos目录结构如下: 如上...

  • CocoaPod 制作私有库(Private Pods)

    前言 官网关于这个知识点已有详细的介绍,但是对我来说:1.知识点比较凌乱 2.英文描述,很多时候不能很好理解其含义...

网友评论

      本文标题:cocoapod制作私有库repo

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