|
@@ -21,19 +21,26 @@
|
|
|
#
|
|
|
# ------------------------------------------------------------- Constants ------
|
|
|
|
|
|
-SDK_SIM = 'iphonesimulator11.3'
|
|
|
-SDK_SIM_DEST = "'platform=iOS Simulator,name=iPhone 7,OS=11.3'"
|
|
|
+PROJECT_MOBILE = 'MobileVLCKit.xcodeproj'
|
|
|
+
|
|
|
+SDK_SIM_IOS = 'iphonesimulator11.3'
|
|
|
+
|
|
|
+SDK_SIM_DEST_IOS = "'platform=iOS Simulator,name=iPhone 7,OS=11.3'"
|
|
|
|
|
|
SCHEME_IOS = 'MobileVLCKitTests'
|
|
|
-PROJECT_IOS = 'MobileVLCKit.xcodeproj'
|
|
|
|
|
|
VLC_FLAGS_IOS = '-dva x86_64'
|
|
|
|
|
|
+DERIVED_DATA_PATH = 'DerivedData'
|
|
|
+COVERAGE_REPORT_PATH = 'Tests/Coverage'
|
|
|
+
|
|
|
+XCPRETTY = "xcpretty && exit ${PIPESTATUS[0]}"
|
|
|
+
|
|
|
# ----------------------------------------------------------------- Tasks ------
|
|
|
|
|
|
-desc 'Build VLCKit (iOS)'
|
|
|
+desc 'Build MobileVLCKit'
|
|
|
task 'build:vlckit:ios' do
|
|
|
- puts 'Building VLCKit (iOS)'
|
|
|
+ puts 'Building MobileVLCKit'
|
|
|
|
|
|
plugin_file = 'Resources/MobileVLCKit/vlc-plugins-iPhone.h'
|
|
|
required_dirs = ['./libvlc/vlc/install-iPhoneSimulator', './libvlc/vlc/build-iPhoneSimulator']
|
|
@@ -48,11 +55,30 @@ end
|
|
|
desc 'Run MobileVLCKit tests'
|
|
|
task 'test:ios' do
|
|
|
puts 'Running tests for MobileVLCKit'
|
|
|
- sh "xcodebuild -project #{PROJECT_IOS} -scheme #{SCHEME_IOS} -sdk #{SDK_SIM} -destination #{SDK_SIM_DEST} test"
|
|
|
+ sh "xcodebuild -derivedDataPath #{DERIVED_DATA_PATH}/#{SCHEME_IOS} -project #{PROJECT_MOBILE} -scheme #{SCHEME_IOS} -sdk #{SDK_SIM_IOS} -destination #{SDK_SIM_DEST_IOS} test | #{XCPRETTY}"
|
|
|
+end
|
|
|
+
|
|
|
+desc 'Generate code coverage reports (MobileVLCKit)'
|
|
|
+task 'codecov:ios' do
|
|
|
+ puts 'Generating code coverage reports (MobileVLCKit)'
|
|
|
+ generate_coverage(SCHEME_IOS)
|
|
|
end
|
|
|
|
|
|
# ------------------------------------------------------------- Functions ------
|
|
|
|
|
|
+def generate_coverage(scheme)
|
|
|
+ report_name = "#{COVERAGE_REPORT_PATH}/#{scheme}_coverage.txt"
|
|
|
+ scheme_derived_data = "#{DERIVED_DATA_PATH}/#{scheme}"
|
|
|
+
|
|
|
+ if Dir.exist?(scheme_derived_data)
|
|
|
+ sh "mkdir -p #{COVERAGE_REPORT_PATH}"
|
|
|
+ sh "xcrun xccov view #{scheme_derived_data}/Logs/Test/*.xccovreport > #{report_name}"
|
|
|
+ sh "cat #{report_name}"
|
|
|
+ else
|
|
|
+ puts "#{scheme} has not been tested yet. Please run its tests first"
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
def dirs_exist?(directories)
|
|
|
directories.each do |dir|
|
|
|
return false unless Dir.exist?(dir)
|