Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #79 from cvasilak/issue-77.module-map
Browse files Browse the repository at this point in the history
add support for 'module_map' directive
  • Loading branch information
neonichu committed May 22, 2015
2 parents 7f8e3e3 + 377d6dd commit 3102231
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
gemspec

group :development do
gem 'cocoapods', '>= 0.36.0'
gem 'cocoapods', '>= 0.37.0'
gem 'bacon'
gem 'mocha-on-bacon'
gem 'mocha', '~> 0.11.4'
Expand Down
36 changes: 17 additions & 19 deletions Gemfile.lock
Expand Up @@ -14,39 +14,38 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.0)
activesupport (4.2.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
bacon (1.2.0)
claide (0.8.1)
cocoapods (0.36.0)
cocoapods (0.37.1)
activesupport (>= 3.2.15)
claide (~> 0.8.1)
cocoapods-core (= 0.36.0)
cocoapods-downloader (~> 0.8.1)
cocoapods-plugins (~> 0.4.1)
cocoapods-core (= 0.37.1)
cocoapods-downloader (~> 0.9.0)
cocoapods-plugins (~> 0.4.2)
cocoapods-trunk (~> 0.6.0)
cocoapods-try (~> 0.4.3)
cocoapods-try (~> 0.4.4)
colored (~> 1.2)
escape (~> 0.0.4)
molinillo (~> 0.2.1)
molinillo (~> 0.2.3)
nap (~> 0.8)
open4 (~> 1.3)
xcodeproj (~> 0.23.0)
cocoapods-core (0.36.0)
xcodeproj (~> 0.24.1)
cocoapods-core (0.37.1)
activesupport (>= 3.2.15)
fuzzy_match (~> 2.0.4)
nap (~> 0.8.0)
cocoapods-downloader (0.8.1)
cocoapods-plugins (0.4.1)
cocoapods-downloader (0.9.0)
cocoapods-plugins (0.4.2)
nap
cocoapods-trunk (0.6.0)
nap (>= 0.8)
netrc (= 0.7.8)
cocoapods-try (0.4.3)
cocoapods-try (0.4.4)
colored (1.2)
coveralls (0.7.2)
multi_json (~> 1.3)
Expand All @@ -61,16 +60,15 @@ GEM
json (1.8.2)
metaclass (0.0.4)
mime-types (2.4.3)
minitest (5.5.1)
minitest (5.6.1)
mocha (0.11.4)
metaclass (~> 0.0.1)
mocha-on-bacon (0.2.1)
mocha (>= 0.9.8)
molinillo (0.2.1)
molinillo (0.2.3)
multi_json (1.10.1)
nap (0.8.0)
netrc (0.7.8)
open4 (1.3.4)
rake (10.4.2)
rest-client (1.6.7)
mime-types (>= 1.16)
Expand All @@ -82,11 +80,11 @@ GEM
term-ansicolor (1.2.2)
tins (~> 0.8)
thor (0.18.1)
thread_safe (0.3.4)
thread_safe (0.3.5)
tins (0.13.2)
tzinfo (1.2.2)
thread_safe (~> 0.1)
xcodeproj (0.23.0)
xcodeproj (0.24.1)
activesupport (>= 3)
colored (~> 1.2)

Expand All @@ -96,7 +94,7 @@ PLATFORMS
DEPENDENCIES
bacon
bundler (~> 1.3)
cocoapods (>= 0.36.0)
cocoapods (>= 0.37.0)
cocoapods-packager!
coveralls
mocha (~> 0.11.4)
Expand Down
14 changes: 11 additions & 3 deletions lib/cocoapods-packager/builder.rb 100644 → 100755
Expand Up @@ -110,9 +110,15 @@ def copy_headers
headers_source_root = "#{@public_headers_root}/#{@spec.name}"

Dir.glob("#{headers_source_root}/**/*.h").
each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }

if File.exist?("#{@public_headers_root}/#{@spec.name}/#{@spec.name}.h")
each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }

# If custom 'module_map' is specified add it to the framework distribution
# otherwise check if a header exists that is equal to 'spec.name', if so
# create a default 'module_map' one using it.
if !@spec.module_map.nil?
module_map_file = "#{@sandbox_root}/#{@spec.name}/#{@spec.module_map}"
module_map = File.read(module_map_file) if Pathname(module_map_file).exist?
elsif File.exist?("#{@public_headers_root}/#{@spec.name}/#{@spec.name}.h")
module_map = <<MAP
framework module #{@spec.name} {
umbrella header "#{@spec.name}.h"
Expand All @@ -121,7 +127,9 @@ def copy_headers
module * { export * }
}
MAP
end

unless module_map.nil?
@fwk.module_map_path.mkpath unless @fwk.module_map_path.exist?
File.write("#{@fwk.module_map_path}/module.modulemap", module_map)
end
Expand Down
18 changes: 18 additions & 0 deletions spec/command/package_spec.rb 100644 → 100755
Expand Up @@ -94,6 +94,24 @@ module Pod
true.should == true # To make the test pass without any shoulds
end

it "it respects module_map directive" do
SourcesManager.stubs(:search).returns(nil)

command = Command.parse(%w{ package spec/fixtures/FH.podspec })
command.run

modulemap_contents = File.read(Dir.glob("FH-*/ios/FH.framework/Modules/module.modulemap").first)
module_map = <<MAP
framework module FH {
umbrella header "FeedHenry.h"
export *
module * { export * }
}
MAP
modulemap_contents.should == module_map
end

#it "runs with a spec in the master repository" do
# command = Command.parse(%w{ package KFData })
# command.run
Expand Down
18 changes: 18 additions & 0 deletions spec/fixtures/FH.podspec
@@ -0,0 +1,18 @@
Pod::Spec.new do |s|
s.name = 'FH'
s.version = '2.2.8'
s.summary = 'FeedHenry iOS Software Development Kit'
s.homepage = 'https://www.feedhenry.com'
s.social_media_url = 'https://twitter.com/feedhenry'
s.license = 'FeedHenry'
s.author = 'Red Hat, Inc.'
s.source = { :git => 'https://github.com/cvasilak/fh-ios-sdk.git', :branch => 'module_map' }
s.platform = :ios, 7.0
s.source_files = 'fh-ios-sdk/**/*.{h,m}'
s.public_header_files = 'fh-ios-sdk/FeedHenry.h', 'fh-ios-sdk/FH.h', 'fh-ios-sdk/FHAct.h', 'fh-ios-sdk/FHActRequest.h', 'fh-ios-sdk/FHAuthRequest.h', 'fh-ios-sdk/FHCloudProps.h', 'fh-ios-sdk/FHCloudRequest.h', 'fh-ios-sdk/FHConfig.h', 'fh-ios-sdk/FHResponse.h', 'fh-ios-sdk/FHResponseDelegate.h', 'fh-ios-sdk/Sync/FHSyncClient.h', 'fh-ios-sdk/Sync/FHSyncConfig.h', 'fh-ios-sdk/Sync/FHSyncNotificationMessage.h', 'fh-ios-sdk/Sync/FHSyncDelegate.h', 'fh-ios-sdk/Categories/JSON/FHJSON.h', 'fh-ios-sdk/FHDataManager.h'
s.module_map = 'fh-ios-sdk/module.modulemap'
s.requires_arc = true
s.libraries = 'xml2', 'z'
s.dependency 'ASIHTTPRequest/Core', '1.8.2'
s.dependency 'Reachability', '3.2'
end
2 changes: 1 addition & 1 deletion spec/fixtures/PackagerTest/Podfile.lock
Expand Up @@ -27,4 +27,4 @@ DEPENDENCIES:
SPEC CHECKSUMS:
AFNetworking: 6d7b76aa5d04c8c37daad3eef4b7e3f2a7620da3

COCOAPODS: 0.36.0
COCOAPODS: 0.37.1
4 changes: 2 additions & 2 deletions spec/fixtures/Weakly.podspec
Expand Up @@ -8,6 +8,6 @@ Pod::Spec.new do |s|
s.platform = :ios, '8.0'
s.source = { :git => "https://github.com/neonichu/CPDColors.git", :tag => s.version }
s.source_files = 'Code'
s.dependency 'PromiseKit'

s.dependency 'PromiseKit', '~> 1.5'
end

0 comments on commit 3102231

Please sign in to comment.