Skip to content

Commit

Permalink
Implement header list generation using non-deprecated specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Oct 1, 2014
1 parent d74a174 commit e8c1212
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
Binaries/
CoconutKit.xcworkspace/xcuserdata
Tools/Scripts/GeneratedHeaders
9 changes: 8 additions & 1 deletion CoconutKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ Pod::Spec.new do |s|
* Localization in nib files without outlets
* Core Data model management and validation made easy
* Custom controls
* ... and much more!
DESC

s.source_files = 'CoconutKit/Sources/**/*.{h,m}'
s.prefix_header_file = 'CoconutKit/CoconutKit-Prefix.pch'

s.frameworks = 'CoreData', 'CoreGraphics', 'CoreText', 'Foundation', 'MessageUI', 'MobileCoreServices', 'QuartzCore', 'QuickLook', 'UIKit'
s.requires_arc = true
s.preserve_paths = 'CoconutKit/publicHeaders.txt'

# Process the publicHeaders.txt file listing public headers to generate a public header directory as well as a global header file
s.preserve_paths = 'CoconutKit/publicHeaders.txt'
s.prepare_command = 'ruby Tools/Scripts/generate_public_headers.rb'
s.public_header_files = 'Tools/Scripts/GeneratedHeaders/*.h'

# Do not use CoconutKit-resources target, use CocoaPods native bundle creation mechanism
s.resource_bundle = { 'CoconutKit-resources' => ['CoconutKit-resources/{Images,Nibs}/*', 'CoconutKit-resources/*.lproj/*'] }
end
29 changes: 29 additions & 0 deletions Tools/Scripts/generate_public_headers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/ruby

require 'FileUtils'

project_directory = File.expand_path(File.join(File.dirname(__FILE__), '../../CoconutKit'))
generated_headers_directory = File.join(File.dirname(__FILE__), 'GeneratedHeaders')

# Create a directory for generated headers
if Dir.exists?(generated_headers_directory)
FileUtils.rm_rf(generated_headers_directory)
end
FileUtils.mkdir_p(generated_headers_directory)

# Generate the global public header
public_headers = File.read(File.join(project_directory, 'publicHeaders.txt')).split("\n")
File.open(File.join(generated_headers_directory, 'CoconutKit.h'), 'w') do |file|
file.puts(File.read(File.join(project_directory, 'CoconutKit-Prefix.pch')))
public_headers.each do |header|
file.puts "#import <CoconutKit/#{header}>"
end
end

# Symlink all public headers
sources_directory = File.join(project_directory, 'Sources')
public_headers.each do |file_name|
Dir["#{sources_directory}/**/#{file_name}"].each do |file|
FileUtils.ln_s(file, File.join(generated_headers_directory, file_name))
end
end

0 comments on commit e8c1212

Please sign in to comment.