xcodebuild_rake 2.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gemrc +1 -0
- data/.gitignore +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +25 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/xcodebuild_rake_init +8 -0
- data/docs/configuration.md +43 -0
- data/docs/installation.md +11 -0
- data/docs/prerequisites.md +34 -0
- data/docs/usage.md +71 -0
- data/lib/.DS_Store +0 -0
- data/lib/ExportOptions.plist +10 -0
- data/lib/model/build_configuration.rb +90 -0
- data/lib/model/release_configuration.rb +46 -0
- data/lib/model/test_destination.rb +41 -0
- data/lib/model/upload_configuration.rb +63 -0
- data/lib/modules/applause_tool.rb +18 -0
- data/lib/modules/plist.rb +31 -0
- data/lib/modules/s3.rb +19 -0
- data/lib/modules/xcode.rb +142 -0
- data/lib/modules/zip.rb +18 -0
- data/lib/tasks/applause_pod.rake +75 -0
- data/lib/tasks/framework.rake +49 -0
- data/lib/tasks/notify.rake +9 -0
- data/lib/tasks/podspec.rake +85 -0
- data/lib/tasks/testapp.rake +48 -0
- data/lib/tasks/version_number.rake +83 -0
- data/lib/xcodebuild_rake.rb +29 -0
- data/lib/xcodebuild_rake/version.rb +3 -0
- data/lib/xcodebuild_safe.sh +38 -0
- data/templates/Rakefile +54 -0
- data/templates/build.yaml +15 -0
- data/xcodebuild_rake.gemspec +32 -0
- metadata +157 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
YAML_SETUP_RELEASE_CONFIGURATION_PLIST_PATH_KEY = 'plist'
|
4
|
+
YAML_SETUP_RELEASE_CONFIGURATION_OUTPUT_PATH_KEY = 'output_path'
|
5
|
+
YAML_SETUP_RELEASE_CONFIGURATION_PRODUCT_NAME_KEY = 'product_name'
|
6
|
+
YAML_SETUP_RELEASE_CONFIGURATION_POD_NAME_KEY = 'pod_name'
|
7
|
+
YAML_SETUP_RELEASE_CONFIGURATION_S3_UPLOAD_BUCKET_KEY = 's3_bucket'
|
8
|
+
YAML_SETUP_RELEASE_CONFIGURATION_S3_UPLOAD_FOLDER_KEY = 's3_upload_folder'
|
9
|
+
YAML_SETUP_RELEASE_CONFIGURATION_TEST_APPS_PLISTS_KEY = 'test_apps_plists'
|
10
|
+
YAML_SETUP_RELEASE_CONFIGURATION_TEST_APPS_VERSION_CODE_FILES_KEY = 'test_apps_version_code_files'
|
11
|
+
YAML_SETUP_RELEASE_CONFIGURATION_EXPORT_OPTIONS_PLIST_KEY = 'export_options_plist'
|
12
|
+
|
13
|
+
class ReleaseConfiguration
|
14
|
+
attr_accessor :plist, :output_path, :product_name, :pod_name, :s3_bucket,
|
15
|
+
:s3_upload_folder, :test_apps_plists, :test_apps_version_code_files,
|
16
|
+
:export_options_plist
|
17
|
+
def parse_setup(setup)
|
18
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_PLIST_PATH_KEY)
|
19
|
+
@plist = setup[YAML_SETUP_RELEASE_CONFIGURATION_PLIST_PATH_KEY]
|
20
|
+
end
|
21
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_OUTPUT_PATH_KEY)
|
22
|
+
@output_path = setup[YAML_SETUP_RELEASE_CONFIGURATION_OUTPUT_PATH_KEY]
|
23
|
+
end
|
24
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_PRODUCT_NAME_KEY)
|
25
|
+
@product_name = setup[YAML_SETUP_RELEASE_CONFIGURATION_PRODUCT_NAME_KEY]
|
26
|
+
end
|
27
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_POD_NAME_KEY)
|
28
|
+
@pod_name = setup[YAML_SETUP_RELEASE_CONFIGURATION_POD_NAME_KEY]
|
29
|
+
end
|
30
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_S3_UPLOAD_BUCKET_KEY)
|
31
|
+
@s3_bucket = setup[YAML_SETUP_RELEASE_CONFIGURATION_S3_UPLOAD_BUCKET_KEY]
|
32
|
+
end
|
33
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_S3_UPLOAD_FOLDER_KEY)
|
34
|
+
@s3_upload_folder = setup[YAML_SETUP_RELEASE_CONFIGURATION_S3_UPLOAD_FOLDER_KEY]
|
35
|
+
end
|
36
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_TEST_APPS_PLISTS_KEY)
|
37
|
+
@test_apps_plists = setup[YAML_SETUP_RELEASE_CONFIGURATION_TEST_APPS_PLISTS_KEY]
|
38
|
+
end
|
39
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_TEST_APPS_VERSION_CODE_FILES_KEY)
|
40
|
+
@test_apps_version_code_files = setup[YAML_SETUP_RELEASE_CONFIGURATION_TEST_APPS_VERSION_CODE_FILES_KEY]
|
41
|
+
end
|
42
|
+
if setup.has_key?(YAML_SETUP_RELEASE_CONFIGURATION_EXPORT_OPTIONS_PLIST_KEY)
|
43
|
+
@export_options_plist = setup[YAML_SETUP_RELEASE_CONFIGURATION_EXPORT_OPTIONS_PLIST_KEY]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
YAML_SETUP_DESTINATION_PLATFORM_KEY = 'platform'
|
4
|
+
YAML_SETUP_DESTINATION_NAME_KEY = 'name'
|
5
|
+
YAML_SETUP_DESTINATION_OS_KEY = 'os'
|
6
|
+
YAML_SETUP_DESTINATION_ARCH_KEY = 'arch'
|
7
|
+
|
8
|
+
class TestDestination
|
9
|
+
attr_accessor :platform, :name, :os_version, :arch
|
10
|
+
def parse_setup(setup)
|
11
|
+
if setup.has_key?(YAML_SETUP_DESTINATION_PLATFORM_KEY)
|
12
|
+
@platform = setup[YAML_SETUP_DESTINATION_PLATFORM_KEY]
|
13
|
+
end
|
14
|
+
if setup.has_key?(YAML_SETUP_DESTINATION_NAME_KEY)
|
15
|
+
@name = setup[YAML_SETUP_DESTINATION_NAME_KEY]
|
16
|
+
end
|
17
|
+
if setup.has_key?(YAML_SETUP_DESTINATION_OS_KEY)
|
18
|
+
@os_version = setup[YAML_SETUP_DESTINATION_OS_KEY]
|
19
|
+
end
|
20
|
+
if setup.has_key?(YAML_SETUP_DESTINATION_ARCH_KEY)
|
21
|
+
@arch = setup[YAML_SETUP_DESTINATION_ARCH_KEY]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
def build_destination_string
|
25
|
+
destination = ''
|
26
|
+
destination = append_value_for_key(destination, @platform, 'platform')
|
27
|
+
destination = append_value_for_key(destination, @name, 'name')
|
28
|
+
destination = append_value_for_key(destination, @os_version, 'OS')
|
29
|
+
destination = append_value_for_key(destination, @arch, 'arch')
|
30
|
+
return destination
|
31
|
+
end
|
32
|
+
def append_value_for_key(destination, value, key)
|
33
|
+
if value
|
34
|
+
if destination.length > 0
|
35
|
+
destination += ','
|
36
|
+
end
|
37
|
+
destination += "#{key}=#{value}"
|
38
|
+
end
|
39
|
+
return destination
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
UPLOAD_CONFIGURATION_YAML_PATH = 'app_upload.yaml'
|
6
|
+
|
7
|
+
YAML_CONFIGURATIONS_KEY = 'configurations'
|
8
|
+
YAML_CONFIG_NAME_KEY = 'name'
|
9
|
+
YAML_CONFIG_SERVICE_KEY = 'service'
|
10
|
+
YAML_CONFIG_APPLICATION_KEY_KEY = 'application_key'
|
11
|
+
YAML_CONFIG_COMPANY_ID_KEY = 'company_id'
|
12
|
+
YAML_CONFIG_APP_ID_KEY = 'app_id'
|
13
|
+
YAML_CONFIG_PUBLISH_EMAIL_KEY = 'publish_email'
|
14
|
+
YAML_CONFIG_DISTRIBUTION_GROUP_KEY = 'distribution_group'
|
15
|
+
|
16
|
+
class UploadConfiguration
|
17
|
+
attr_accessor :application_key, :service, :company_id, :app_id, :publish_email, :distribution_group
|
18
|
+
|
19
|
+
def parse_configuration(setup)
|
20
|
+
if setup.has_key?(YAML_CONFIG_APPLICATION_KEY_KEY)
|
21
|
+
@application_key = setup[YAML_CONFIG_APPLICATION_KEY_KEY]
|
22
|
+
end
|
23
|
+
if setup.has_key?(YAML_CONFIG_SERVICE_KEY)
|
24
|
+
@service = setup[YAML_CONFIG_SERVICE_KEY]
|
25
|
+
end
|
26
|
+
if setup.has_key?(YAML_CONFIG_COMPANY_ID_KEY)
|
27
|
+
@company_id = setup[YAML_CONFIG_COMPANY_ID_KEY]
|
28
|
+
end
|
29
|
+
if setup.has_key?(YAML_CONFIG_APP_ID_KEY)
|
30
|
+
@app_id = setup[YAML_CONFIG_APP_ID_KEY]
|
31
|
+
end
|
32
|
+
if setup.has_key?(YAML_CONFIG_PUBLISH_EMAIL_KEY)
|
33
|
+
@publish_email = setup[YAML_CONFIG_PUBLISH_EMAIL_KEY]
|
34
|
+
if @publish_email.kind_of?(Array) == false
|
35
|
+
@publish_email = [@publish_email]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
if setup.has_key?(YAML_CONFIG_DISTRIBUTION_GROUP_KEY)
|
39
|
+
@distribution_group = setup[YAML_CONFIG_DISTRIBUTION_GROUP_KEY]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class << self
|
44
|
+
def load(configuration_name)
|
45
|
+
upload_config = UploadConfiguration.new
|
46
|
+
yaml = YAML.load_file(UPLOAD_CONFIGURATION_YAML_PATH)
|
47
|
+
if yaml.has_key?(YAML_CONFIGURATIONS_KEY)
|
48
|
+
setups = yaml[YAML_CONFIGURATIONS_KEY]
|
49
|
+
parse_named_config setups, upload_config, configuration_name
|
50
|
+
end
|
51
|
+
return upload_config
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
def parse_named_config(setups, upload_configuration, configuration_name)
|
56
|
+
filtered_setups = setups.select { |s| s[YAML_CONFIG_NAME_KEY] == configuration_name}
|
57
|
+
setup = filtered_setups.first
|
58
|
+
if setup
|
59
|
+
upload_configuration.parse_configuration(setup)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
APPLAUSE_TOOL_DEFAULT_SERVICE = 'sdk'
|
4
|
+
|
5
|
+
module ApplauseTool
|
6
|
+
def upload_app(app_path, company_id, application_id, publish_email_addresses, service = APPLAUSE_TOOL_DEFAULT_SERVICE, distribution_group = nil)
|
7
|
+
distribution = ''
|
8
|
+
if service == APPLAUSE_TOOL_DEFAULT_SERVICE
|
9
|
+
publish_email_addresses.each { |a|
|
10
|
+
distribution += " -e '#{a}'"
|
11
|
+
} unless publish_email_addresses.nil?
|
12
|
+
else
|
13
|
+
company_id = ''
|
14
|
+
distribution = "-g #{distribution_group}"
|
15
|
+
end
|
16
|
+
`applause-tool #{service} distribute --set-as-current #{company_id} #{application_id} '#{app_path}' #{distribution}`
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
PLIST_BUDDY = '/usr/libexec/PlistBuddy'
|
4
|
+
PLIST_VERSION_KEY = "CFBundleShortVersionString"
|
5
|
+
PLIST_BUILD_NUMBER_KEY = "CFBundleVersion"
|
6
|
+
|
7
|
+
module Plist
|
8
|
+
def version(info_plist_path)
|
9
|
+
return print("#{info_plist_path}", "#{PLIST_VERSION_KEY}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def set_version(info_plist_path, version)
|
13
|
+
return set("#{info_plist_path}", "#{PLIST_VERSION_KEY}", "#{version}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def build_number(info_plist_path)
|
17
|
+
return print("#{info_plist_path}", "#{PLIST_BUILD_NUMBER_KEY}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_build_number(info_plist_path, build_number)
|
21
|
+
return set("#{info_plist_path}", "#{PLIST_BUILD_NUMBER_KEY}", "#{build_number}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def set(info_plist_path, key, value)
|
25
|
+
return `#{PLIST_BUDDY} -c "Set :#{key} #{value}" "#{info_plist_path}"`.strip
|
26
|
+
end
|
27
|
+
|
28
|
+
def print(info_plist_path, key)
|
29
|
+
return `#{PLIST_BUDDY} -c "Print :#{key}" "#{info_plist_path}"`.strip
|
30
|
+
end
|
31
|
+
end
|
data/lib/modules/s3.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
require 'aws-sdk'
|
4
|
+
|
5
|
+
module S3
|
6
|
+
def upload_file(file_path, save_path, bucket_name)
|
7
|
+
s3 = Aws::S3::Resource.new(region:'us-west-1' ,endpoint: 'https://s3.amazonaws.com')
|
8
|
+
object = s3.bucket(bucket_name).object(save_path)
|
9
|
+
object.upload_file file_path, acl: 'public-read'
|
10
|
+
return object.public_url
|
11
|
+
end
|
12
|
+
|
13
|
+
def upload_archived_app(app_zip_path, dsym_zip_path, info_plist_path, bucket_name)
|
14
|
+
version = application_version(info_plist_path)
|
15
|
+
app_url = upload_file(app_zip_path, File.join(version, File.basename(app_zip_path)), bucket_name)
|
16
|
+
dsym_url = upload_file(dsym_zip_path, File.join(version, File.basename(dsym_zip_path)), bucket_name)
|
17
|
+
return app_url, dsym_url
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
BUILD_DIR = 'build'
|
4
|
+
TEST_REPORT_DIR = 'test-reports'
|
5
|
+
|
6
|
+
YAML_SETUP_XCPRETTY_KEY = 'xcpretty'
|
7
|
+
YAML_SETUP_XCPRETTY_FLAGS_KEY = 'xcpretty-flags'
|
8
|
+
|
9
|
+
DEFAULT_EXPORT_OPTIONS_PLIST_PATH = File.join(File.expand_path("..", File.dirname(__FILE__)), 'ExportOptions.plist')
|
10
|
+
XCODEBUILD_SAFE_PATH = File.join(File.expand_path("..", File.dirname(__FILE__)), 'xcodebuild_safe.sh')
|
11
|
+
|
12
|
+
# Main methods
|
13
|
+
|
14
|
+
module Xcode
|
15
|
+
def clean(setup_name = YAML_DEFAULT_SETUP_NAME)
|
16
|
+
config = BuildConfiguration.load(setup_name)
|
17
|
+
execute_xcodebuild "xcodebuild #{config.project_load} #{config.project} -scheme \"#{config.scheme}\" -sdk #{config.sdk} -configuration #{config.configuration} clean", config.use_xcpretty, config.xcpretty_flags
|
18
|
+
derived_data_path = Dir.glob(ENV['HOME']+"/Library/Developer/Xcode/DerivedData/#{config.project}*")
|
19
|
+
FileUtils.rm_rf(derived_data_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test(setup_name = YAML_DEFAULT_SETUP_NAME)
|
23
|
+
config = BuildConfiguration.load(setup_name)
|
24
|
+
xcpretty_flags = xcpretty_flag_with_output_path(config.xcpretty_flags, test_report_output_path(config))
|
25
|
+
test_destination = config.test_destination.build_destination_string
|
26
|
+
base_command = xcodebuild_base_command(config)
|
27
|
+
execute_xcodebuild "#{base_command} test -destination '#{test_destination}'", config.use_xcpretty, xcpretty_flags
|
28
|
+
end
|
29
|
+
|
30
|
+
def build(setup_name = YAML_DEFAULT_SETUP_NAME, build_dir = BUILD_DIR)
|
31
|
+
config = BuildConfiguration.load(setup_name)
|
32
|
+
base_command = xcodebuild_base_command(config)
|
33
|
+
execute_xcodebuild "#{base_command}", config.use_xcpretty, config.xcpretty_flags, build_dir
|
34
|
+
end
|
35
|
+
|
36
|
+
def archive(setup_name = YAML_DEFAULT_SETUP_NAME, build_dir = BUILD_DIR)
|
37
|
+
config = BuildConfiguration.load(setup_name)
|
38
|
+
base_command = xcodebuild_base_command(config)
|
39
|
+
execute_xcodebuild "#{base_command} archive", config.use_xcpretty, config.xcpretty_flags, build_dir
|
40
|
+
end
|
41
|
+
|
42
|
+
def archive_and_export_ipa(setup_name = YAML_DEFAULT_SETUP_NAME, build_dir = BUILD_DIR, export_options_path = DEFAULT_EXPORT_OPTIONS_PLIST_PATH)
|
43
|
+
config = BuildConfiguration.load(setup_name)
|
44
|
+
file_name = config.release_configuration.product_name ? config.release_configuration.product_name : config.scheme
|
45
|
+
archive_folder = File.join(Dir.pwd, build_dir)
|
46
|
+
archive_name = file_name + ".xcarchive"
|
47
|
+
archive_path = File.join(archive_folder, archive_name)
|
48
|
+
sdk_option = config.sdk.nil? ? '' : "-sdk #{config.sdk}"
|
49
|
+
execute_xcodebuild "#{xcodebuild_path()} #{config.project_load} \"#{config.project}\" -scheme \"#{config.scheme}\" #{sdk_option} -configuration #{config.configuration} archive -archivePath \"#{archive_path}\"", config.use_xcpretty, config.xcpretty_flags, build_dir
|
50
|
+
execute_xcodebuild "#{xcodebuild_path()} -exportArchive -archivePath \"#{archive_path}\" -exportPath \"#{build_dir}\" -exportOptionsPlist \"#{export_options_path}\"", config.use_xcpretty, config.xcpretty_flags, build_dir
|
51
|
+
Zip.compress("#{archive_path}")
|
52
|
+
end
|
53
|
+
|
54
|
+
def build_universal_framework(setup_name = YAML_DEFAULT_SETUP_NAME, build_dir = BUILD_DIR)
|
55
|
+
config = BuildConfiguration.load(setup_name)
|
56
|
+
device = device_with_sdk(config.sdk)
|
57
|
+
execute_xcodebuild "#{xcodebuild_path()} #{config.project_load} \"#{config.project}\" -scheme \"#{config.scheme}\" -sdk #{device}os -configuration #{config.configuration} clean archive PLATFORM_NAME=#{device}os", config.use_xcpretty, config.xcpretty_flags, build_dir
|
58
|
+
execute_xcodebuild "#{xcodebuild_path()} #{config.project_load} \"#{config.project}\" -scheme \"#{config.scheme}\" -sdk #{device}simulator -configuration #{config.configuration} clean build PLATFORM_NAME=#{device}simulator", config.use_xcpretty, config.xcpretty_flags, build_dir
|
59
|
+
lipo_universal_framework(setup_name, build_dir, device)
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
def execute_xcodebuild(xcodebuild_command, use_xcpretty = true, xcpretty_flags = '-c', build_dir = BUILD_DIR)
|
64
|
+
command = 'xcrun '
|
65
|
+
if rvm_installed()
|
66
|
+
command += 'rvm system do '
|
67
|
+
end
|
68
|
+
command += xcodebuild_command
|
69
|
+
if !build_dir.nil? && build_dir.length > 0
|
70
|
+
full_build_dir = File.join(Dir.pwd, build_dir)
|
71
|
+
command += " BUILD_DIR=\"#{full_build_dir}\""
|
72
|
+
end
|
73
|
+
if use_xcpretty
|
74
|
+
command += " | xcpretty"
|
75
|
+
if xcpretty_flags.length > 0
|
76
|
+
command += " #{xcpretty_flags}"
|
77
|
+
end
|
78
|
+
command += " && exit ${PIPESTATUS[0]}"
|
79
|
+
end
|
80
|
+
system(command) or raise "*** BUILD FAILED ***"
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
def xcodebuild_path()
|
85
|
+
return "#{XCODEBUILD_SAFE_PATH}"
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
def xcodebuild_base_command(config)
|
90
|
+
return "#{xcodebuild_path()} #{config.project_load} \"#{config.project}\" -scheme \"#{config.scheme}\" -sdk #{config.sdk} -configuration #{config.configuration}"
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
def lipo_universal_framework(setup_name = YAML_DEFAULT_SETUP_NAME, build_dir = BUILD_DIR, device)
|
95
|
+
config = BuildConfiguration.load(setup_name)
|
96
|
+
framework_name = config.release_configuration.product_name
|
97
|
+
device_framework = File.join(build_dir, "#{config.configuration}-#{device}os", "#{framework_name}.framework")
|
98
|
+
simulator_framework = File.join(build_dir, "#{config.configuration}-#{device}simulator", "#{framework_name}.framework")
|
99
|
+
universal_framework = File.join(build_dir, "#{framework_name}.framework")
|
100
|
+
modules_subpath = "Modules/#{framework_name}.swiftmodule"
|
101
|
+
|
102
|
+
if File.directory?(universal_framework)
|
103
|
+
FileUtils.rm_rf(universal_framework)
|
104
|
+
end
|
105
|
+
unless File.directory?(build_dir)
|
106
|
+
FileUtils.mkdir_p(build_dir)
|
107
|
+
end
|
108
|
+
FileUtils.cp_r(device_framework, build_dir)
|
109
|
+
simulator_modules = File.join(simulator_framework, modules_subpath)
|
110
|
+
universal_modules = File.join(universal_framework, modules_subpath)
|
111
|
+
Dir.glob(File.join(simulator_modules, "*")) { |r|
|
112
|
+
FileUtils.cp_r(r, universal_modules)
|
113
|
+
}
|
114
|
+
device_binary = File.join(device_framework, framework_name)
|
115
|
+
simulator_binary = File.join(simulator_framework, framework_name)
|
116
|
+
universal_binary = File.join(universal_framework, framework_name)
|
117
|
+
`xcrun lipo -create #{device_binary} #{simulator_binary} -o #{universal_binary}`
|
118
|
+
end
|
119
|
+
|
120
|
+
private
|
121
|
+
def device_with_sdk(sdk)
|
122
|
+
device = sdk
|
123
|
+
device.slice! "os"
|
124
|
+
device.slice! "simulator"
|
125
|
+
return device
|
126
|
+
end
|
127
|
+
|
128
|
+
private
|
129
|
+
def test_report_output_path(config)
|
130
|
+
return "#{Dir.pwd}/#{TEST_REPORT_DIR}/#{config.scheme}.xml"
|
131
|
+
end
|
132
|
+
|
133
|
+
private
|
134
|
+
def xcpretty_flag_with_output_path(xcpretty_flags, path)
|
135
|
+
return xcpretty_flags + " --output #{path}"
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
def rvm_installed()
|
140
|
+
return File.file?(File.join(ENV['HOME'], '.rvm', 'scripts', 'rvm'))
|
141
|
+
end
|
142
|
+
end
|
data/lib/modules/zip.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
module Zip
|
4
|
+
def compress(source_path, destination_path = nil)
|
5
|
+
current_dir = Dir.pwd
|
6
|
+
Dir[source_path].each do |file|
|
7
|
+
puts file
|
8
|
+
if File.directory?(file)
|
9
|
+
filename = "#{file}.zip"
|
10
|
+
puts filename
|
11
|
+
`zip -r "#{filename}" "#{file}"`
|
12
|
+
if destination_path != nil
|
13
|
+
FileUtils.mv(filename, File.join(current_dir, destination_path))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Copyright (c) 2017 Applause Inc. All rights reserved.
|
2
|
+
|
3
|
+
namespace :applause_pod do
|
4
|
+
|
5
|
+
APPLAUSE_PODS_SOURCE = "ssh://git@github.com/ApplauseAQI/cocoa-pods-specs.git"
|
6
|
+
COCOA_PODS_SOURCE = "ssh://git@github.com/CocoaPods/Specs.git"
|
7
|
+
|
8
|
+
desc 'Release new pod version if it was not yet released'
|
9
|
+
task :release do
|
10
|
+
pod_version = pod_version()
|
11
|
+
unless pod_version.nil?
|
12
|
+
if pod_not_published(pod_version)
|
13
|
+
create_tag(pod_version)
|
14
|
+
publish_pod
|
15
|
+
else
|
16
|
+
puts "Pod version already published"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'Validate the pod'
|
22
|
+
task :validate do
|
23
|
+
system("pod lib lint --sources='#{APPLAUSE_PODS_SOURCE}, #{COCOA_PODS_SOURCE}' --allow-warnings")
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Publish the pod to Applause podspec repo'
|
27
|
+
task :publish do
|
28
|
+
system("pod repo push applause --sources='#{APPLAUSE_PODS_SOURCE}, #{COCOA_PODS_SOURCE}' --allow-warnings")
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Updates Applause podspec repo'
|
32
|
+
task :update_repo => :add_repo do
|
33
|
+
system("pod repo update")
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Adds Applause podspec repo'
|
37
|
+
task :add_repo do
|
38
|
+
system("pod repo add applause #{APPLAUSE_PODS_SOURCE}")
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def pod_version
|
43
|
+
podspecs = Pathname.glob(File.join(Dir.pwd, '*.podspec{.json,}'))
|
44
|
+
unless podspecs.empty?
|
45
|
+
podspec_path = podspecs.first
|
46
|
+
puts podspec_path
|
47
|
+
spec = Pod::Specification.from_file(podspec_path)
|
48
|
+
puts "Pod version: #{spec.version}"
|
49
|
+
return spec.version.to_s.strip
|
50
|
+
end
|
51
|
+
puts "Can't find podspec in the directory"
|
52
|
+
return nil
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
def pod_not_published(pod_version)
|
57
|
+
sdk_repo = Git.open('.')
|
58
|
+
return !(sdk_repo.tags.any? { |tag| tag.name == pod_version })
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
def create_tag(pod_version)
|
63
|
+
puts "Creating tag"
|
64
|
+
sdk_repo = Git.open('.')
|
65
|
+
sdk_repo.add_tag(pod_version)
|
66
|
+
sdk_repo.push('origin', "refs/tags/#{pod_version}")
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def publish_pod
|
71
|
+
puts "Publishing pod"
|
72
|
+
Rake::Task["applause_pod:publish"].invoke
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|