cocoapods-meitu-swift-ast 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e2f752e5cceb336dc8855fe1a47f4810f81b9c6ae421af5950449ecf9d0e7304
4
+ data.tar.gz: 19d9b19fa6a7c1c53ae8a15c0f4ac7c3e520ccb07107970ab28b5aa8dfefac6c
5
+ SHA512:
6
+ metadata.gz: b6d42083d8e68519df79f4bf39f778c54b2fbab1bed8fb23fa46811776564735dae9c913421db1f3b04855647258515f7d88814f0a32022966399b7f06f19c65
7
+ data.tar.gz: 0b59c40b487fd3062d4a4dfca3ebe255f6faa5078c01d73a7203ad87001b57029606a8e0fdb1ba865e3afb2f9ec66b05d01b2277361c6572733125bc071c1f5c
@@ -0,0 +1,46 @@
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 Ast < Command
21
+ self.summary = 'Short description of cocoapods-meitu-swift-ast.'
22
+
23
+ self.description = <<-DESC
24
+ Longer description of cocoapods-meitu-swift-ast.
25
+ DESC
26
+
27
+ self.arguments = [
28
+ CLAide::Argument.new('meitu-swift-ast', false) # false indicates it's optional
29
+ ]
30
+
31
+ def initialize(argv)
32
+ @name = argv.shift_argument
33
+ super
34
+ end
35
+
36
+ def validate!
37
+ super
38
+ help! 'A Pod name is required.' unless @name
39
+ end
40
+
41
+ def run
42
+ UI.puts "Add your implementation for the cocoapods-meitu-swift-ast plugin in #{__FILE__}"
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,42 @@
1
+ require 'cocoapods-meitu-swift-ast/command/ast'
2
+ require 'cocoapods'
3
+
4
+ # 使用常量定义颜色代码,提高可读性
5
+ RED = "\e[31m"
6
+ GREEN = "\e[32m"
7
+ RESET = "\e[0m"
8
+
9
+ def add_ast_path(installer,aggregate_targets)
10
+ name = aggregate_targets[0].name
11
+ xcconfig_path = installer.sandbox.target_support_files_root.to_s + "/#{name}/#{name}.debug.xcconfig"
12
+ xcconfig_content = File.read xcconfig_path
13
+ xcconfig_original_ld_flags = xcconfig_content.match(/OTHER_LDFLAGS = ([^\n]+)\n/)[1]
14
+ paths_str = ""
15
+ count = 0
16
+ installer.pod_targets.each do |target|
17
+ if target.should_build? && target.uses_swift?
18
+ count += 1
19
+ path = "$(TARGET_BUILD_DIR)/#{target.name}/#{target.name}.framework/Modules/#{target.name}.swiftmodule/$(NATIVE_ARCH_ACTUAL)-apple-$(SHALLOW_BUNDLE_TRIPLE).swiftmodule"
20
+ paths_str << " -Wl,-add_ast_path,#{path}"
21
+ end
22
+ end
23
+ puts "#{GREEN}add_ast_path count: #{count}#{GREEN}"
24
+ xcconfig_new_ld_flags = <<~CONTENT
25
+ OTHER_LDFLAGS = #{xcconfig_original_ld_flags} #{paths_str}
26
+ CONTENT
27
+ xcconfig_content.gsub! /OTHER_LDFLAGS = ([^\n]+)\n/, xcconfig_new_ld_flags
28
+ File.open(xcconfig_path, 'w') do |f|
29
+ f.puts xcconfig_content
30
+ end
31
+ end
32
+
33
+ module Pod
34
+ class Installer
35
+ alias sxl_run_plugins_post_install_hooks run_plugins_post_install_hooks
36
+ def run_plugins_post_install_hooks
37
+ add_ast_path(self,aggregate_targets)
38
+ sxl_run_plugins_post_install_hooks
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsMeituSwiftAst
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-meitu-swift-ast/gem_version'
@@ -0,0 +1 @@
1
+ require 'cocoapods-meitu-swift-ast/command'
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-meitu-swift-ast
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - sxl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-02-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A short description of cocoapods-meitu-swift-ast.
42
+ email:
43
+ - sxl3@meitu.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/cocoapods-meitu-swift-ast.rb
49
+ - lib/cocoapods-meitu-swift-ast/command.rb
50
+ - lib/cocoapods-meitu-swift-ast/command/ast.rb
51
+ - lib/cocoapods-meitu-swift-ast/gem_version.rb
52
+ - lib/cocoapods_plugin.rb
53
+ homepage: https://github.com/EXAMPLE/cocoapods-meitu-swift-ast
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.4.16
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: A longer description of cocoapods-meitu-swift-ast.
76
+ test_files: []