From a2ff2bd393a1debbb9152ea9d208b080d0a5b0d0 Mon Sep 17 00:00:00 2001 From: dasmer / eliperkins Date: Thu, 16 Apr 2015 10:34:27 -0400 Subject: [PATCH] Add find header script for public and private headers and use in podspec --- ResearchKit.podspec | 5 +++-- scripts/find_headers.rb | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100755 scripts/find_headers.rb diff --git a/ResearchKit.podspec b/ResearchKit.podspec index 9d907fde..dafefa7f 100644 --- a/ResearchKit.podspec +++ b/ResearchKit.podspec @@ -5,8 +5,9 @@ Pod::Spec.new do |s| s.homepage = 'https://www.github.com/ResearchKit/ResearchKit' s.license = { :type => 'BSD', :file => 'LICENSE' } s.author = { "Apple Inc." => "http://apple.com" } - s.source = { :git => 'https://github.com/ResearchKit/ResearchKit.git', :tag => "v#{s.version}"} - s.public_header_files = 'ResearchKit/ResearchKit.h', 'ResearchKit/ActiveTasks/{ORKActiveStep.h,ORKActiveStepViewController.h,ORKRecorder.h}', 'ResearchKit/Common/{ORKAnswerFormat.h,ORKDefines.h,ORKFormStep.h,ORKHealthAnswerFormat.h,ORKInstructionStep.h,ORKOrderedTask.h,ORKQuestionStep.h,ORKResult.h,ORKStep.h,ORKStepViewController.h,ORKTask.h,ORKTaskViewController.h}', 'ResearchKit/Consent/{ORKConsentDocument.h,ORKConsentReviewStep.h,ORKConsentSection.h,ORKConsentSharingStep.h,ORKConsentSignature.h,ORKVisualConsentStep.h}' + s.source = { :git => 'https://github.com/ResearchKit/ResearchKit.git', :branch => 'stable' } #:tag => "v#{s.version}"} + s.public_header_files = `./scripts/find_headers.rb --public`.split("\n") + s.private_header_files = `./scripts/find_headers.rb --private`.split("\n") s.source_files = 'ResearchKit/**/*.{h,m}' s.resources = 'ResearchKit/**/*.{fsh,vsh}', 'ResearchKit/Animations/**/*.m4v', 'ResearchKit/Artwork.xcassets', 'ResearchKit/Localized/*.lproj' s.platform = :ios, '8.0' diff --git a/scripts/find_headers.rb b/scripts/find_headers.rb new file mode 100755 index 00000000..5fb48125 --- /dev/null +++ b/scripts/find_headers.rb @@ -0,0 +1,48 @@ +#!/usr/bin/env ruby + +require 'pathname' +require 'xcodeproj' +require 'optparse' + +ROOT = Pathname.new(File.expand_path('../../', __FILE__)) + + +options = {} +OptionParser.new do |opts| + opts.banner = "Usage: find_headers.rb [options]" + + opts.on("--public", "Find public headers") do |v| + options[:public] = v + end + + opts.on("--private", "Find private headers") do |v| + options[:private] = v + end +end.parse! + +separator = ARGV.shift || "\n" + +project = Xcodeproj::Project.open(ROOT + 'ResearchKit.xcodeproj') +target = project.targets.find { |t| t.name == 'ResearchKit' } + +public_headers = target.headers_build_phase.files.select do |build_file| + settings = build_file.settings + settings && settings['ATTRIBUTES'].include?('Public') +end + +private_headers = target.headers_build_phase.files.select do |build_file| + settings = build_file.settings + settings && settings['ATTRIBUTES'].include?('Private') +end + +if options[:public] + puts public_headers.map { |build_file| + build_file.file_ref.real_path.relative_path_from ROOT + }.to_a.join(separator) +end + +if options[:private] + puts private_headers.map { |build_file| + build_file.file_ref.real_path.relative_path_from ROOT + }.to_a.join(separator) +end