Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Several Small Changes #44

Closed
wants to merge 7 commits into from

3 participants

@ddrscott
  • allow vender.headers_dir to be an array
  • added back App.configs for BubbleWrap dependency
  • fixed order of operations in option parsing
  • ignore copy of hidden directories (example: .svn) in resource copy.
  • add configuration_build_dir to vender setting

I was originally planning on giving each change as a separate branch, but it because too hard for me to maintain and due to other things that would break in my specific huge vendor project and a Cocao Pods dependency, I couldn't validate my build worked unless ALL these changes where in.
Trying to tease them out into separate branches would have burnt away too much time.

Let me know if you really really really need them separately and I see what I can do.

Look at the commit comments to figure out the changes.

This also include the patch-1 I submitted a couple days ago, so you can ignore that one.

@lrz lrz commented on the diff
lib/motion/project/app.rb
@@ -56,6 +58,14 @@ def config_without_setup
@configs[config_mode] ||= Motion::Project::Config.new('.', config_mode)
end
+ def configs
+ @configs ||= {}
+ MODES.each do |mode|
+ @configs[mode] ||= Motion::Project::Config.new('.', mode)
+ end
+ @configs
+ end
+
@lrz Owner
lrz added a note

What's the rationale behind this change? The problem as I see it is that 2 Config objects will be created and I don't see the point in exposing this new method, since we already have the app.development and app.release methods to isolate development/release settings in the Rakefile.

@ddrscott
ddrscott added a note

The Pods project is still calling App.configs and was crashing during vendor build with a No Method Error.
I think they (the Pods) project needed a deprecation warning or something before removing the public method.
I tried to keep the nature of the old #configs method behavior. I actually don't care how it is implemented, as long as the Pods project works :)

@lrz Owner
lrz added a note

Oh I see, I remember, that was an internal method that BubbleWrap depended upon. We sent a pull request and I believe it has been merged, so there is probably no need to add this method back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lrz lrz commented on the diff
lib/motion/project/vendor.rb
@@ -184,9 +184,13 @@ def build_xcode(platform, opts)
end
end
+ def configuration_build_dir
+ File.absolute_path(@opts[:configuration_build_dir] || 'build')
+ end
+
@lrz Owner
lrz added a note

I believe that c66f4fa is a better solution, as it's simpler and does not introduce a new option. Using ".build" is probably safe enough.

@ddrscott
ddrscott added a note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@colinta colinta closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 30, 2012
  1. @ddrscott

    Merge pull request #1 from ddrscott/patch-1

    ddrscott authored
    Update lib/motion/project/config.rb
Commits on Oct 1, 2012
  1. @ddrscott

    - added support for headers_dir as array

    ddrscott authored
    - added override of CONFIGURATION_BUILD_DIR
  2. @ddrscott
  3. @ddrscott
  4. @ddrscott
  5. @ddrscott

    - add absolute paths to configuration directory

    ddrscott authored
    - build if there's nothing in the directory
  6. @ddrscott

    - ignore .idea project files

    ddrscott authored
This page is out of date. Refresh to see the latest.
View
1  .gitignore
@@ -3,3 +3,4 @@
.DS_Store
*.storyboardc
build
+.idea
View
14 lib/motion/project/app.rb
@@ -35,15 +35,17 @@ class App
true
end
+ MODES = [:development, :release]
+
class << self
def config_mode
@config_mode ||= begin
if mode = ENV['mode']
case mode = mode.intern
- when :development, :release
+ when *MODES
mode
else
- fail "Invalid value for build mode `#{mode}' (must be :development or :release)"
+ fail "Invalid value for build mode `#{mode}' (must be one of #{MODES.inspect})"
end
else
:development
@@ -56,6 +58,14 @@ def config_without_setup
@configs[config_mode] ||= Motion::Project::Config.new('.', config_mode)
end
+ def configs
+ @configs ||= {}
+ MODES.each do |mode|
+ @configs[mode] ||= Motion::Project::Config.new('.', mode)
+ end
+ @configs
+ end
+
@lrz Owner
lrz added a note

What's the rationale behind this change? The problem as I see it is that 2 Config objects will be created and I don't see the point in exposing this new method, since we already have the app.development and app.release methods to isolate development/release settings in the Rakefile.

@ddrscott
ddrscott added a note

The Pods project is still calling App.configs and was crashing during vendor build with a No Method Error.
I think they (the Pods) project needed a deprecation warning or something before removing the public method.
I tried to keep the nature of the old #configs method behavior. I actually don't care how it is implemented, as long as the Pods project works :)

@lrz Owner
lrz added a note

Oh I see, I remember, that was an internal method that BubbleWrap depended upon. We sent a pull request and I believe it has been merged, so there is probably no need to add this method back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
def config
config_without_setup.setup
end
View
3  lib/motion/project/builder.rb
@@ -430,6 +430,9 @@ def build(config, platform, opts)
end
resources_files.each do |res|
res_path = File.join(config.resources_dir, res)
+
+ next if File.directory?(res_path) # skips hidden directories, cp_r will catch everything else
+
if reserved_app_bundle_files.include?(res)
App.fail "Cannot use `#{res_path}' as a resource file because it's a reserved application bundle file"
end
View
18 lib/motion/project/vendor.rb
@@ -130,8 +130,8 @@ def clean_static
def build_xcode(platform, opts)
Dir.chdir(@path) do
build_dir = "build-#{platform}"
- if !File.exist?(build_dir)
- FileUtils.mkdir build_dir
+ if !File.exist?(build_dir) or Dir["#{build_dir}/*"].empty?
+ FileUtils.mkdir_p build_dir
# Prepare Xcode project settings.
xcodeproj = opts.delete(:xcodeproj) || begin
@@ -155,15 +155,15 @@ def build_xcode(platform, opts)
# Build project into `build' directory. We delete the build directory
# each time because Xcode is too stupid to be trusted to use the
# same build directory for different platform builds.
- rm_rf 'build'
+ rm_rf configuration_build_dir
xcopts = ''
xcopts << "-target \"#{target}\" " if target
xcopts << "-scheme \"#{scheme}\" " if scheme
- sh "/usr/bin/xcodebuild -project \"#{xcodeproj}\" #{xcopts} -configuration \"#{configuration}\" -sdk #{platform.downcase}#{@config.sdk_version} #{@config.arch_flags(platform)} CONFIGURATION_BUILD_DIR=build IPHONEOS_DEPLOYMENT_TARGET=#{@config.deployment_target} build"
+ sh "/usr/bin/xcodebuild -project \"#{xcodeproj}\" #{xcopts} -configuration \"#{configuration}\" -sdk #{platform.downcase}#{@config.sdk_version} #{@config.arch_flags(platform)} CONFIGURATION_BUILD_DIR=#{configuration_build_dir} IPHONEOS_DEPLOYMENT_TARGET=#{@config.deployment_target} build"
# Copy .a files into the platform build directory.
prods = opts.delete(:products)
- Dir.glob('build/*.a').each do |lib|
+ Dir.glob("#{configuration_build_dir}/*.a").each do |lib|
next if prods and !prods.include?(File.basename(lib))
lib = File.readlink(lib) if File.symlink?(lib)
sh "/bin/cp \"#{lib}\" \"#{build_dir}\""
@@ -175,7 +175,7 @@ def build_xcode(platform, opts)
headers_dir = opts.delete(:headers_dir)
if !File.exist?(bs_file) and headers_dir
project_dir = File.expand_path(@config.project_dir)
- headers = Dir.glob(File.join(project_dir, headers_dir, '**/*.h'))
+ headers = [headers_dir].flatten.collect{|dir| Dir.glob(File.join(project_dir, dir, '**/*.h'))}.flatten
@config.gen_bridge_metadata(headers, bs_file)
end
@@ -184,9 +184,13 @@ def build_xcode(platform, opts)
end
end
+ def configuration_build_dir
+ File.absolute_path(@opts[:configuration_build_dir] || 'build')
+ end
+
@lrz Owner
lrz added a note

I believe that c66f4fa is a better solution, as it's simpler and does not introduce a new option. Using ".build" is probably safe enough.

@ddrscott
ddrscott added a note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
def clean_xcode
Dir.chdir(@path) do
- ['build', 'build-iPhoneOS', 'build-iPhoneSimulator'].each { |x| rm_rf x }
+ [configuration_build_dir, 'build-iPhoneOS', 'build-iPhoneSimulator'].each { |x| rm_rf x }
end
end
Something went wrong with that request. Please try again.