wenweiwei пре 3 година
родитељ
комит
ee0adfa9f0
5 измењених фајлова са 97 додато и 97 уклоњено
  1. 5 13
      BFCommonKit.podspec
  2. 69 0
      BFShell/build_lib.py
  3. 1 32
      Example/Podfile
  4. 22 16
      Example/Podfile.lock
  5. 0 36
      build_lib.py

+ 5 - 13
BFCommonKit.podspec

@@ -8,7 +8,7 @@
 # update framework 2021.11.1
 Pod::Spec.new do |s|
   s.name             = 'BFCommonKit'
-  s.version          = '1.5.3'
+  s.version          = '1.5.2'
   s.summary          = '基础库'
   s.swift_version    = '5.0'
   s.description      = <<-DESC
@@ -26,15 +26,6 @@ TODO: Add long description of the pod here.
     gg.dependency 'BFCommonKit/BFEnums'
     gg.dependency 'BFCommonKit/BFCategorys'
   end
-  s.subspec 'BFBase' do |bb|
-    bb.source_files = 'BFCommonKit/Classes/BFBase/**/*'
-    bb.frameworks = 'UIKit', 'WebKit'
-    bb.dependency 'Alamofire','5.4.4'
-    bb.dependency 'SnapKit','5.0.1'
-    bb.dependency 'BFCommonKit/BFUtility'
-    bb.dependency 'BFCommonKit/BFConfig'
-    bb.dependency 'BFCommonKit/BFCategorys'
-  end
   s.subspec 'BFEnums' do |ee|
     ee.source_files = 'BFCommonKit/Classes/BFEnums/*'
     ee.frameworks = 'Foundation'
@@ -55,8 +46,9 @@ TODO: Add long description of the pod here.
     uu.dependency 'BFCommonKit/BFCategorys'
     uu.dependency 'BFCommonKit/BFConfig'
   end
-   s.resource_bundles = {
+  s.pod_target_xcconfig = { 'skip_validation' => true }
+  s.resource_bundles = {
       'BFCommonKit_Resources' => ['BFCommonKit/Assets/*']
-    }
-   s.prepare_command = '/usr/local/bin/Python3 build_lib.py'
+  }
+  # s.prepare_command = '/usr/local/bin/Python3 BFShell/build_lib.py'
 end

+ 69 - 0
BFShell/build_lib.py

@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+import glob
+import os
+
+
+def del_files(path):
+    try:
+        fileNames = glob.glob(path + r'/*')
+        for fileName in fileNames:
+            try:
+                os.remove(fileName)
+                print("del_files - remove:%s" % fileNames)
+            except:
+                print("del_files - remove:删除文件失败")
+            else:
+                print("del_files - remove:删除文件完成")
+    except:
+        try:
+            os.mkdir(fileName)
+            print("del_files - mkdir:%s " % fileName)
+        except:
+            print("del_files - mkdir:删除文件夹失败")
+            del_files(fileName)
+            os.rmdir(fileName)
+        else:
+            print("del_files - mkdir:删除文件夹完成")
+    else:
+        print("del_files - glob:获取rifleName失败")
+
+
+# 替换文件内容
+def replace_swiftUIText(code_file):
+    try:
+        fo = open(code_file, 'r')
+        code_text = fo.read()
+        print("替换前:", code_text)
+        if "canImport(SwiftUI) && canImport(Combine)" in code_text and "canImport(SwiftUI) && canImport(Combine) && (" \
+                                                                       "arch(arm64) || arch(x86_64))" not in code_text:
+            code_text = code_text.replace("canImport(SwiftUI) && canImport(Combine)", "canImport(SwiftUI) && canImport("
+                                                                                      "Combine) "
+                                                                                      "&& (arch(arm64) || arch(x86_64))")
+            print("替换后:", code_text)
+            os.remove(code_file)
+            fo = open(code_file, 'w+')
+            fo.write(code_text)
+            fo.closed
+        else:
+            print("没有变化")
+    except IOError:
+        print("文件错误")
+    else:
+        print("没有变化")
+
+
+
+#def search_file(file_name, search_path, pathsep = os.pathsep):
+#  for path in search_path.split(pathsep):
+#    candidate = os.path.join(path, file_name)
+#    if os.path.isfile(candidate):
+#      return os.path.abspath(candidate)
+#
+
+replace_swiftUIText("/../Pods/Kingfisher/Sources/General/KFOptionsSetter.swift")
+del_files("./Pods/Kingfisher/Sources/SwiftUI")
+
+fo = open("/Users/sanw/Desktop/file.txt", "a+")
+fo.write("\n当前工作目录路径getcwd:%s \n" % os.getcwd())
+fo.write("当前工作目录路径path:%s \n" % os.path.abspath('.'))
+fo.close()

+ 1 - 32
Example/Podfile

@@ -4,39 +4,8 @@ platform :ios, '10.0'
 
 target 'BFCommonKit_Example' do
   pod 'BFCommonKit', :path => '../'
+# pod "BFCommonKit",      :git => 'https://git.yishihui.com/iOS/BFCommonKit.git'
 
-#  post_install do |installer|
-#    
-#    remove_swift_ui("./Pods/Kingfisher/Sources/General/KFOptionsSetter.swift")
-#    remove_swift_ui("./Pods/Kingfisher/Sources/SwiftUI/KFImage.swift")
-#    remove_swift_ui("./Pods/Kingfisher/Sources/SwiftUI/ImageBinder.swift")
-#    remove_swift_ui("./Pods/Kingfisher/Sources/SwiftUI/KFImageOptions.swift")
-#    remove_swift_ui_realm("./Pods/RealmSwift/RealmSwift/SwiftUI.swift")
-##    remove_RealmSwift_swift_ui
-#    installer.pods_project.targets.each do |target|
-#      target.build_configurations.each do |config|
-#        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
-#      end
-#    end
-#  end
-#
-#def remove_swift_ui(code_file)
-#  code_text = File.read(code_file)
-#  code_text.gsub!(/#if canImport\(SwiftUI\) && canImport\(Combine\)(\n)/,"#if canImport(SwiftUI) && canImport(Combine) && (arch(arm64) || arch(x86_64))\n")
-#  system("rm -rf " + code_file)
-#  aFile = File.new(code_file, 'w+')
-#  aFile.syswrite(code_text)
-#  aFile.close()
-#end
-#
-#def remove_swift_ui_realm (code_file)
-#  code_text = File.read(code_file)
-#  code_text.gsub!(/#if canImport\(SwiftUI\) && canImport\(Combine\) && swif/,'#if canImport(SwiftUI) && canImport(Combine) && (arch(arm64) || arch(x86_64)) && swif')
-#  system("rm -rf " + code_file)
-#  aFile = File.new(code_file, 'w+')
-#  aFile.syswrite(code_text)
-#  aFile.close()
-#end
   target 'BFCommonKit_Tests' do
     inherit! :search_paths
   end

+ 22 - 16
Example/Podfile.lock

@@ -1,24 +1,25 @@
 PODS:
   - Alamofire (5.4.4)
-  - BFCommonKit (1.5.2):
-    - BFCommonKit/BFBase (= 1.5.2)
-    - BFCommonKit/BFCategorys (= 1.5.2)
-    - BFCommonKit/BFConfig (= 1.5.2)
-    - BFCommonKit/BFEnums (= 1.5.2)
-    - BFCommonKit/BFUtility (= 1.5.2)
-  - BFCommonKit/BFBase (1.5.2):
+  - BFCommonKit (1.5.1):
+    - BFCommonKit/BFBase (= 1.5.1)
+    - BFCommonKit/BFCategorys (= 1.5.1)
+    - BFCommonKit/BFConfig (= 1.5.1)
+    - BFCommonKit/BFDebug (= 1.5.1)
+    - BFCommonKit/BFEnums (= 1.5.1)
+    - BFCommonKit/BFUtility (= 1.5.1)
+  - BFCommonKit/BFBase (1.5.1):
     - Alamofire (= 5.4.4)
     - BFCommonKit/BFCategorys
     - BFCommonKit/BFConfig
     - BFCommonKit/BFUtility
     - SnapKit (= 5.0.1)
-  - BFCommonKit/BFCategorys (1.5.2):
+  - BFCommonKit/BFCategorys (1.5.1):
     - KingfisherWebP (= 1.3.0)
-  - BFCommonKit/BFConfig (1.5.2):
+  - BFCommonKit/BFConfig (1.5.1)
+  - BFCommonKit/BFDebug (1.5.1):
     - BFCommonKit/BFCategorys
-    - BFCommonKit/BFEnums
-  - BFCommonKit/BFEnums (1.5.2)
-  - BFCommonKit/BFUtility (1.5.2):
+  - BFCommonKit/BFEnums (1.5.1)
+  - BFCommonKit/BFUtility (1.5.1):
     - Alamofire (= 5.4.4)
     - BFCommonKit/BFCategorys
     - BFCommonKit/BFConfig
@@ -44,7 +45,7 @@ PODS:
   - Toast-Swift (5.0.1)
 
 DEPENDENCIES:
-  - BFCommonKit (from `../`)
+  - BFCommonKit (from `https://git.yishihui.com/iOS/BFCommonKit.git`)
 
 SPEC REPOS:
   trunk:
@@ -58,11 +59,16 @@ SPEC REPOS:
 
 EXTERNAL SOURCES:
   BFCommonKit:
-    :path: "../"
+    :git: https://git.yishihui.com/iOS/BFCommonKit.git
+
+CHECKOUT OPTIONS:
+  BFCommonKit:
+    :commit: 9e22d927c65e9cc8897a70252d926ae8e29de932
+    :git: https://git.yishihui.com/iOS/BFCommonKit.git
 
 SPEC CHECKSUMS:
   Alamofire: f3b09a368f1582ab751b3fff5460276e0d2cf5c9
-  BFCommonKit: ec15384f735bbd393fdd653740604f21356edda3
+  BFCommonKit: fbebd7d46eaa7adaf5311aae2230b68ab5e99788
   KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
   Kingfisher: 016c8b653a35add51dd34a3aba36b580041acc74
   KingfisherWebP: dec17a5eb1af2658791bde1f93ae9a853678f826
@@ -70,6 +76,6 @@ SPEC CHECKSUMS:
   SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
   Toast-Swift: 9b6a70f28b3bf0b96c40d46c0c4b9d6639846711
 
-PODFILE CHECKSUM: fd1b20f56952d87658f4bfdd521ed9e96cd560a3
+PODFILE CHECKSUM: 0095dbc4586435a6e9b112e8dfea839e27a2ec07
 
 COCOAPODS: 1.11.2

+ 0 - 36
build_lib.py

@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-import os
-
-
-def remove_swiftUI(code_file):
-    try:
-        fo = open(code_file, 'r')
-        code_text = fo.read()
-        print("替换前:", code_text)
-        if "canImport(SwiftUI) && canImport(Combine)" in code_text and "canImport(SwiftUI) && canImport(Combine) && (" \
-                                                                       "arch(arm64) || arch(x86_64))" not in code_text:
-            code_text = code_text.replace("canImport(SwiftUI) && canImport(Combine)", "canImport(SwiftUI) && canImport("
-                                                                                      "Combine) "
-                                                                                      "&& (arch(arm64) || arch(x86_64))")
-            print("替换后:", code_text)
-            os.remove(code_file)
-            fo = open(code_file, 'w+')
-            fo.write(code_text)
-            fo.closed
-        else:
-            print("没有变化")
-    except IOError:
-        print("文件错误")
-    else:
-        print("没有变化")
-
-
-remove_swiftUI("/Users/sanw/Desktop/BytesFlow/Projects/BFCommonKit/Trunk/Example/Pods/Kingfisher/Sources/General"
-               "/KFOptionsSetter.swift")
-remove_swiftUI("/Users/sanw/Desktop/BytesFlow/Projects/BFCommonKit/Trunk/Example/Pods/Kingfisher/Sources/SwiftUI"
-               "/KFImage.swift")
-remove_swiftUI("/Users/sanw/Desktop/BytesFlow/Projects/BFCommonKit/Trunk/Example/Pods/Kingfisher/Sources/SwiftUI"
-               "/ImageBinder.swift")
-remove_swiftUI("/Users/sanw/Desktop/BytesFlow/Projects/BFCommonKit/Trunk/Example/Pods/Kingfisher/Sources/SwiftUI"
-               "/KFImageOptions.swift")
-# remove_swiftUI("./Example/Pods/RealmSwift/RealmSwift/SwiftUI.swift")