Comments (4)
@bpoplauschi this plugin might be of use to you (note that I haven't used it myself so I cannot vouchers for anything)
https://github.com/leavez/cocoapods-binary
from rome.
Hello
I didn't create a pull request because this is the first time I write in ruby so the code might be ( / may be / is ) ugly 😜
It only build new pods (those without corresponding .framework in /Rome folder).
If a new version of a pod is downloaded, it won't be built unless the framework has been previously manually deleted.
post_install.rb
require 'fourflusher'
CONFIGURATION = "Release"
PLATFORMS = { 'iphonesimulator' => 'iOS',
'appletvsimulator' => 'tvOS',
'watchsimulator' => 'watchOS' }
def build_for_iosish_platform(sandbox, build_dir, destination, target, device, simulator)
deployment_target = target.platform_deployment_target
target_label = target.cocoapods_target_label
spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
spec_names.each do |root_name, module_name|
executable_path = "#{build_dir}/#{root_name}"
device_lib = "#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}"
device_framework_lib = File.dirname(device_lib)
simulator_lib = "#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}"
rome_lib = "#{destination}/#{module_name}.framework"
if (module_name.start_with?('Pods-') || File.directory?(rome_lib))
Pod::UI.puts "• Using #{root_name}"
else
Pod::UI.puts "→ Building #{root_name}"
xcodebuild(sandbox, root_name, device, deployment_target)
xcodebuild(sandbox, root_name, simulator, deployment_target)
next unless File.file?(device_lib) && File.file?(simulator_lib)
lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`
puts lipo_log unless File.exist?(executable_path)
FileUtils.mv executable_path, device_lib
FileUtils.mv device_framework_lib, build_dir
FileUtils.rm simulator_lib if File.file?(simulator_lib)
FileUtils.rm device_lib if File.file?(device_lib)
end
end
end
def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil)
args = %W(-project #{sandbox.project_path.basename} -scheme #{target} -configuration #{CONFIGURATION} -sdk #{sdk})
platform = PLATFORMS[sdk]
args += Fourflusher::SimControl.new.destination(:oldest, platform, deployment_target) unless platform.nil?
Pod::Executable.execute_command 'xcodebuild', args, true
end
Pod::HooksManager.register('cocoapods-rome', :post_install) do |installer_context|
Pod::UI.puts "Rome"
sandbox_root = Pathname(installer_context.sandbox_root)
sandbox = Pod::Sandbox.new(sandbox_root)
build_dir = sandbox_root.parent + 'build'
destination = sandbox_root.parent + 'Rome'
FileUtils.mkdir_p build_dir
FileUtils.mkdir_p destination
installer_context.umbrella_targets.each do |umbrella|
umbrella.specs.each do |spec|
consumer = spec.consumer(umbrella.platform_name)
file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
if(file_accessor.vendored_frameworks.count > 0)
file_accessor.vendored_frameworks.each do |framework|
Pod::UI.puts "• Copying #{spec.root.name}"
FileUtils.cp_r framework, destination, :remove_destination => true
end
end
end
end
Dir.chdir(sandbox.project_path.dirname) do
targets = installer_context.umbrella_targets.select { |t| t.specs.any? }
targets.each do |target|
case target.platform_name
when :ios then build_for_iosish_platform(sandbox, build_dir, destination, target, 'iphoneos', 'iphonesimulator')
when :osx then xcodebuild(sandbox, target.cocoapods_target_label)
when :tvos then build_for_iosish_platform(sandbox, build_dir, destination, target, 'appletvos', 'appletvsimulator')
when :watchos then build_for_iosish_platform(sandbox, build_dir, destination, target, 'watchos', 'watchsimulator')
else raise "Unknown platform '#{target.platform_name}'" end
end
end
raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
frameworks = Pathname.glob("#{build_dir}/**/*.framework").reject { |f| f.to_s =~ /Pods.*\.framework/ }
installer_context.umbrella_targets.each do |umbrella|
umbrella.specs.each do |spec|
consumer = spec.consumer(umbrella.platform_name)
file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
frameworks += file_accessor.vendored_libraries
end
end
frameworks.uniq!
frameworks.each do |framework|
FileUtils.cp_r framework, destination, :remove_destination => true
end
build_dir.rmtree if build_dir.directory?
end
Far from perfect, but it will do the trick :)
I hope it won't break anything :D
from rome.
I'm not a big fan of making this based solely on the presence of the .framework
on the filesystem — that's just bound to confuse people.
from rome.
@neonichu Hi there. I see this is an old discussion, but do you have any suggestion about being able to recompile just the pods that are new or upgraded? Basically similar to what pod install
does without the Rome plugin?
In our case, we are using a caching system to store all the precompiled binaries and would like to change them only if needed. As the system is now, running pod install
will rebuild everything and all the binaries will be different (of course).
from rome.
Related Issues (20)
- My Podfile serves ios and macOS apps, can't integrate rome.
- Fails in `integrate_targets=` HOT 2
- Issues installing HOT 6
- `pod install` fails if pod not used by concrete target HOT 2
- Space character in project path is not supported (was: lipo failure with Xcode 9) HOT 5
- Specifying xcconfig params (such as SWIFT_VERSION) for individual pods HOT 3
- Error when trying to build the sample HOT 1
- x86_64 architecture is missing from built frameworks HOT 5
- Bundles are not placed to Rome folder HOT 3
- Rome crashes with cocoapods 1.5.2 HOT 5
- Xcode 10 Building frameworks failing HOT 6
- Issues with adding firebase through rome HOT 6
- pre_compile hook is called to late with CocoaPods 1.6.0.beta.2 HOT 17
- Need support to static framework HOT 2
- Static frameworks with resource_bundles
- Unknown configuration whitelisted: fabric. CocoaPods found debug and release, did you mean one of these HOT 1
- gemspec is locked to cocoapods `=1.8.0.beta.1`
- Is Rome still actively supported? HOT 2
- Error Swift_Version missing HOT 1
- simulator build produces _CodeSignature directories HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rome.