cocoapods-flutter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 80d23650431c98658b2d1e060d8acd61cafee1b8
4
+ data.tar.gz: 6d1564cfe8e9e72bfb445016abf63b3a5dcb718f
5
+ SHA512:
6
+ metadata.gz: 447da98c4e1575b36a9615eb8ef23a4b185d1e6291c334982014deab3a45d24c657e0dc1fc9dc01c08415c6a353bd97cf23c0fac9d48cf0b516f328b54167749
7
+ data.tar.gz: 2a64bbb5bb134eca98389f9daa288bff01bf8dda7effff2818a5dc5debea839e2055032ae1e3e87203884d383aecaf3f14ad47812555d058af76fc5ada8d7bc4
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-flutter.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
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Mrdaios
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2018 mrdaios <mrdaios@gmail.com>
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.
@@ -0,0 +1,11 @@
1
+ # cocoapods-flutter
2
+
3
+ A description of cocoapods-flutter.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-flutter
8
+
9
+ ## Usage
10
+
11
+ $ pod spec flutter POD_NAME
@@ -0,0 +1,13 @@
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
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods-flutter.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-flutter'
8
+ spec.version = Pod::Flutter::VERSION
9
+ spec.authors = ['mrdaios']
10
+ spec.email = ['mrdaios@gmail.com']
11
+ spec.description = %q{A short description of cocoapods-flutter.}
12
+ spec.summary = %q{A longer description of cocoapods-flutter.}
13
+ spec.homepage = 'https://github.com/EXAMPLE/cocoapods-flutter'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
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
@@ -0,0 +1,5 @@
1
+ module Pod
2
+ module Flutter
3
+ VERSION = "0.0.1".freeze
4
+ end
5
+ end
@@ -0,0 +1,75 @@
1
+ module Pod
2
+ class Command
3
+ class Flutter < Command
4
+ def build
5
+ verbose_flag = @flutter_verbose ? '--verbose' : ''
6
+ local_engine_flag = !@flutter_local_engine.nil? ? "--local-engine=#{@flutter_local_engine}" : ''
7
+ track_widget_creation_flag = @flutter_track_widget_creation_flag ? '--track-widget-creation' : ''
8
+
9
+ # build framework
10
+ if @flutter_build_mode != 'debug'
11
+ puts ' ├─Building Dart code...'
12
+ system "#{@flutter_root}/bin/flutter --suppress-analytics \
13
+ build aot \
14
+ --output-dir=#{@flutter_build_dir}/aot \
15
+ --target-platform=ios \
16
+ --target=\"#{@flutter_target}\" \
17
+ --#{@flutter_build_mode} \
18
+ #{local_engine_flag} \
19
+ #{track_widget_creation_flag} \
20
+ #{verbose_flag} \
21
+ "
22
+ puts 'done'
23
+
24
+ system "cp -r -- \"#{@flutter_build_dir}/aot/#{@flutter_application_frame_name}.framework\" \"#{@flutter_derived_dir}\""
25
+ else
26
+ # Build stub for all requested architectures.
27
+ system "mkdir -p -- \"#{@flutter_derived_dir}/#{@flutter_application_frame_name}.framework\""
28
+
29
+ system "echo \"static const int Moo = 88;\" | xcrun clang -x c \
30
+ -dynamiclib \
31
+ -Xlinker -rpath -Xlinker '@executable_path/Frameworks' \
32
+ -Xlinker -rpath -Xlinker '@loader_path/Frameworks' \
33
+ -install_name '@rpath/#{@flutter_application_frame_name}.framework/#{@flutter_application_frame_name}' \
34
+ -o \"#{@flutter_derived_dir}/#{@flutter_application_frame_name}.framework/#{@flutter_application_frame_name}\"
35
+ "
36
+
37
+ end
38
+
39
+ # copy plist
40
+ plistPath = File.join(@flutter_application_path, '.ios/Flutter/AppFrameworkInfo.plist')
41
+ if !File.exist?(plistPath)
42
+ plistPath = File.join(@flutter_application_path, 'ios/Flutter/AppFrameworkInfo.plist')
43
+ end
44
+ if File.exist?(plistPath)
45
+ system "cp -- \"#{plistPath}\" \"#{@flutter_derived_dir}/#{@flutter_application_frame_name}.framework/Info.plist\""
46
+ #修改plist信息
47
+ system "/usr/libexec/PlistBuddy -c \"Set:CFBundleExecutable #{@flutter_application_frame_name}\" \"#{@flutter_derived_dir}/#{@flutter_application_frame_name}.framework/Info.plist\""
48
+ end
49
+
50
+ # build bundle
51
+ precompilation_flag = ""
52
+ if ENV["CURRENT_ARCH"] != "x86-64" && @flutter_build_mode != "debug"
53
+ precompilation_flag = "--precompiled"
54
+ end
55
+
56
+ puts " ├─Assembling Flutter resources..."
57
+ system "#{@flutter_root}/bin/flutter --suppress-analytics \
58
+ build bundle \
59
+ --target-platform=ios \
60
+ --target=\"#{@flutter_target}\" \
61
+ --snapshot=\"#{@flutter_build_dir}/snapshot_blob.bin\" \
62
+ --#{@flutter_build_mode} \
63
+ --depfile=\"#{@flutter_build_dir}/snapshot_blob.bin.d\" \
64
+ --asset-dir=\"#{@flutter_derived_dir}/flutter_assets\" \
65
+ #{precompilation_flag} \
66
+ #{local_engine_flag} \
67
+ #{track_widget_creation_flag} \
68
+ #{verbose_flag} \
69
+ "
70
+ puts "done"
71
+ puts " └─Compiling, linking and signing..."
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,2 @@
1
+ require 'pod/command/flutter'
2
+ require 'cocoapods-flutter/build'
@@ -0,0 +1,109 @@
1
+ module Pod
2
+ class Command
3
+ class Flutter < Command
4
+ self.summary = 'Short description of cocoapods-flutter.'
5
+
6
+ self.description = <<-DESC
7
+ Longer description of cocoapods-flutter.
8
+ DESC
9
+
10
+ self.arguments = []
11
+
12
+ def self.options
13
+ [
14
+ ['--root', 'Flutter SDK path default FLUTTER_ROOT.'],
15
+ ['--application-path', 'Flutter Project path defalut is Dir.pwd.'],
16
+ ['--target', 'Flutter target default is lib/main.dart.'],
17
+ ['--build-mode', 'Flutter build model, debug、release(default)'],
18
+ ['--build-dir', 'Flutter build dir, default build.'],
19
+ # ['--build-name', 'Flutter build name.'],
20
+ # ['--build-number', 'Flutter build number.'],
21
+ ['--derived-dir', 'Flutter derived dir, default Flutter'],
22
+ ['--application-frame-name', 'Flutter applicationFrame Name, default App'],
23
+
24
+ ['--local-engine', 'TRACK_WIDGET_CREATION.'],
25
+ ['--track-widget-creation-flag', 'LOCAL_ENGINE.'],
26
+ ['--verbose', 'VERBOSE_SCRIPT_LOGGING.']
27
+ ]
28
+ end
29
+
30
+ def initialize(argv)
31
+ @flutter_root = File.expand_path(argv.option('root', ENV['FLUTTER_ROOT']))
32
+ @flutter_application_path = argv.option('application-path', Dir.pwd)
33
+ @flutter_target = File.expand_path(argv.option('target', 'lib/main.dart'))
34
+ @flutter_build_mode = argv.option('build-mode', 'debug')
35
+ @flutter_build_dir = argv.option('build-dir', 'build')
36
+ @flutter_build_name = argv.option('build-name', '1.0.0')
37
+ @flutter_build_number = argv.option('build-number', '1')
38
+ @flutter_derived_dir = argv.option('derived-dir', 'Flutter')
39
+ @flutter_artifact_variant = nil
40
+ @flutter_application_frame_name = argv.option('application-frame-name', 'App')
41
+
42
+ @flutter_local_engine = argv.option('local-engine', ENV['LOCAL_ENGINE'])
43
+ @flutter_track_widget_creation_flag = argv.flag?('track-widget-creation-flag', ENV['TRACK_WIDGET_CREATION'])
44
+ @flutter_verbose = argv.flag?('verbose', ENV['VERBOSE_SCRIPT_LOGGING'])
45
+ super
46
+ end
47
+
48
+ def validate!
49
+ super
50
+ help! 'FLUTTER_ROOT is required.' unless @flutter_root
51
+ help! 'application-path is required.' unless File.exist?(@flutter_application_path)
52
+ help! 'target is required.' unless File.exist?(@flutter_target)
53
+ help! 'build-mode is required.' unless @flutter_build_mode
54
+ end
55
+
56
+ def run
57
+ copy_framework
58
+ build
59
+ end
60
+
61
+ def copy_framework
62
+ # 拷贝framework
63
+ case @flutter_build_mode
64
+ when 'release'
65
+ @flutter_artifact_variant = 'ios-release'
66
+ when 'profile'
67
+ @flutter_artifact_variant = 'ios-profile'
68
+ when 'debug'
69
+ @flutter_artifact_variant = 'ios'
70
+ end
71
+ help! "Unknown FLUTTER_BUILD_MODE: #{@flutter_build_mode}" unless @flutter_artifact_variant
72
+
73
+ framework_path = File.join(@flutter_root, 'bin/cache/artifacts/engine/', @flutter_artifact_variant)
74
+ runnerPath = File.join(@flutter_application_path, '.ios/')
75
+ if File.exist?(runnerPath)
76
+ enginePath = File.join(runnerPath,'flutter/engine')
77
+ system "rm -rf -- #{enginePath}"
78
+ system "mkdir -p -- #{enginePath}"
79
+
80
+ system "cp -r -- #{framework_path}/Flutter.podspec #{enginePath}"
81
+ system "cp -r -- #{framework_path}/Flutter.framework #{enginePath}"
82
+ system "find \"#{enginePath}/Flutter.framework\" -type f -exec chmod a-w \"{}\" \\;"
83
+ else
84
+ system "rm -rf -- #{@flutter_derived_dir}/Flutter.framework"
85
+ system "mkdir -p -- #{@flutter_derived_dir}/Flutter.framework"
86
+
87
+ system "cp -r -- #{framework_path}/Flutter.podspec #{@flutter_derived_dir}"
88
+ system "cp -r -- #{framework_path}/Flutter.framework #{@flutter_derived_dir}"
89
+ system "find \"#{@flutter_derived_dir}/Flutter.framework\" -type f -exec chmod a-w \"{}\" \\;"
90
+ end
91
+ end
92
+
93
+ def putConfig
94
+ puts <<-EOF
95
+ FLUTTER_ROOT=#{@flutter_root}
96
+ FLUTTER_APPLICATION_PATH=#{@flutter_application_path}
97
+ FLUTTER_TARGET=#{@flutter_target}
98
+ FLUTTER_DERIVED_DIR=#{@flutter_derived_dir}
99
+ FLUTTER_BUILD_MODE=#{@flutter_build_mode}
100
+ FLUTTER_BUILD_DIR=#{@flutter_build_dir}
101
+ FLUTTER_BUILD_NAME=#{@flutter_build_name}
102
+ FLUTTER_BUILD_NUMBER=#{@flutter_build_number}
103
+ EOF
104
+ end
105
+
106
+ def thin; end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Flutter do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ flutter }).should.be.instance_of Command::Flutter
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,50 @@
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
+ #-----------------------------------------------------------------------------#
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-flutter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - mrdaios
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-21 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-flutter.
42
+ email:
43
+ - mrdaios@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - cocoapods-flutter.gemspec
55
+ - lib/cocoapods-flutter.rb
56
+ - lib/cocoapods-flutter/build.rb
57
+ - lib/cocoapods_plugin.rb
58
+ - lib/pod/command/flutter.rb
59
+ - spec/command/flutter_spec.rb
60
+ - spec/spec_helper.rb
61
+ homepage: https://github.com/EXAMPLE/cocoapods-flutter
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.5.2.3
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: A longer description of cocoapods-flutter.
85
+ test_files:
86
+ - spec/command/flutter_spec.rb
87
+ - spec/spec_helper.rb