Skip to content

Commit

Permalink
v3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mzsoliman committed Aug 6, 2014
1 parent ce9ec06 commit eefeb52
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 6 deletions.
93 changes: 93 additions & 0 deletions Instabug.bundle/Instabug_dsym_upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Copyright 2014 Instabug, Inc. All rights reserved.
#
# Usage:
# * In the project editor, select your target.
# * Click "Build Phases" at the top of the project editor.
# * Click "+" button in the top left corner.
# * Choose "New Run Script Build Phase."
# * Uncomment and paste the following script.
#
# --- INVOCATION SCRIPT BEGIN ---
# # SKIP_SIMULATOR_BUILDS=1
# SCRIPT_SRC=$(find "$PROJECT_DIR" -name 'Instabug_dsym_upload.sh')
# if [ ! "${SCRIPT_SRC}" ]; then
# echo "Instabug: err: script not found. Make sure that you're including Instabug.bundle in your project directory"
# exit 1
# fi
# source "${SCRIPT_SRC}"
# --- INVOCATION SCRIPT END ---

echo "Instabug: Started uploading dSYM"

# Check to make sure the app token exists
if [ ! "${APP_TOKEN}" ]; then
APP_TOKEN=$(grep -r 'Instabug startWithToken:@\"[0-9a-zA-Z]*\"' ./ | grep -o '\"[0-9a-zA-Z]*\"' | cut -d "\"" -f 2)
fi

if [ ! "${APP_TOKEN}" ] || [ -z "${APP_TOKEN}" ];then
echo "Instabug: err: APP_TOKEN not found. Make sure you've added the SDK initialization line [Instabug startWithToken: captureSource: invocationEvent:]"
exit 1
fi
echo "Instabug: found APP_TOKEN=${APP_TOKEN}"

# Check for simulator builds
if [ "$EFFECTIVE_PLATFORM_NAME" == "-iphonesimulator" ]; then
if [ "${SKIP_SIMULATOR_BUILDS}" ] && [ "${SKIP_SIMULATOR_BUILDS}" -eq 1 ]; then
echo "Instabug: Skipping simulator build"
exit 0
fi
fi

# Create temp directory if not exists
TEMP_ROOT="/tmp/Instabug"
if [ ! -d "${TEMP_ROOT}" ]; then
mkdir "${TEMP_ROOT}"
fi
TEMP_DIRECTORY="/tmp/Instabug/$EXECUTABLE_NAME"
if [ ! -d "${TEMP_DIRECTORY}" ]; then
mkdir "${TEMP_DIRECTORY}"
fi

# Check dSYM file
DSYM_PATH=${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
DSYM_UUIDs=$(dwarfdump --uuid ${DSYM_PATH} | cut -d' ' -f2)

# Check if UUIDs exists
DSYM_UUIDs_PATH="${TEMP_DIRECTORY}/UUIDs.dat"
if [ -f "${DSYM_UUIDs_PATH}" ]; then
if grep -Fxq "${DSYM_UUIDs}" "${DSYM_UUIDs_PATH}"; then
exit 0
fi
fi
echo "${DSYM_UUIDs}" >> "${DSYM_UUIDs_PATH}"


# Create dSYM .zip file
DSYM_PATH_ZIP="${TEMP_DIRECTORY}/$DWARF_DSYM_FILE_NAME.zip"
if [ ! -d "$DSYM_PATH" ]; then
echo "Instabug: err: dSYM not found: ${DSYM_PATH}"
exit 1
fi
echo "Instabug: Compressing dSYM file..."
(/usr/bin/zip --recurse-paths --quiet "${DSYM_PATH_ZIP}" "${DSYM_PATH}") || exit 1

# Upload dSYM
echo "Instabug: Uploading dSYM file..."
ENDPOINT="https://www.instabug.com/api/ios/v1/dsym"
STATUS=$(curl "${ENDPOINT}" --write-out %{http_code} --silent --output /dev/null -F dsym=@"${DSYM_PATH_ZIP}" -F token="${APP_TOKEN}")
if [ $STATUS -ne 200 ]; then
echo "Instabug: err: dSYM archive not succesfully uploaded."
echo "Instabug: deleting temporary dSYM archive..."
/bin/rm -f "${DSYM_PATH_ZIP}"
exit 1
fi

# Remove temp dSYM archive
echo "Instabug: deleting temporary dSYM archive..."
/bin/rm -f "${DSYM_PATH_ZIP}"

echo "Instabug: dSYM upload complete."
if [ "$?" -ne 0 ]; then
echo "Instabug: err: an error was encountered uploading dSYM"
exit 1
fi
2 changes: 1 addition & 1 deletion Instabug.framework/Versions/A/Headers/Instabug.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Copyright: (c) 2014 by Instabug, Inc., all rights reserved.
Version: 3.3
Version: 3.4
*/

//===========================================================================================================================================
Expand Down
Binary file modified Instabug.framework/Versions/A/Instabug
Binary file not shown.
67 changes: 62 additions & 5 deletions Instabug.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,65 @@
Pod::Installer::UserProjectIntegrator::TargetIntegrator.class_eval do
unless method_defined?(:integrate_with_instabug!)

INSTABUG_PHASE_NAME = "Upload Instabug dSYM"
INSTABUG_PHASE_SCRIPT = <<'END'
# SKIP_SIMULATOR_BUILDS=1
SCRIPT_SRC=$(find "$PROJECT_DIR" -name 'Instabug_dsym_upload.sh')
if [ ! "${SCRIPT_SRC}" ]; then
echo "Instabug: err: script not found. Make sure that you're including Instabug.bundle in your project directory"
exit 1
fi
source "${SCRIPT_SRC}"
END

def integrate_with_instabug!
integrate_without_instabug!
return if instabug_native_targets.empty?
UI.section("Integrating with Instabug") do
add_instabug_upload_script_phase
user_project.save
end
end

alias integrate_without_instabug! integrate!
alias integrate! integrate_with_instabug!

def add_instabug_upload_script_phase
instabug_native_targets.each do |native_target|
phase = native_target.shell_script_build_phases.select{ |bp| bp.name == INSTABUG_PHASE_NAME }.first ||
native_target.new_shell_script_build_phase(INSTABUG_PHASE_NAME)

phase.shell_path = "/bin/sh"
phase.shell_script = INSTABUG_PHASE_SCRIPT
phase.show_env_vars_in_log = '0'
end
end

def instabug_native_targets
@instabug_native_targets ||=(
target_uuids = target.user_target_uuids
native_targets = target_uuids.map do |uuid|
native_target = user_project.objects_by_uuid[uuid]
unless native_target
raise Informative, "[Error] Unable to find the target with " \
"the `#{uuid}` UUID for the `#{target}` integration library"
end
native_target
end

native_targets.reject do |native_target|
native_target.shell_script_build_phases.any? do |bp|
bp.name == INSTABUG_PHASE_NAME && bp.shell_script == INSTABUG_PHASE_SCRIPT
end
end
)
end
end
end

Pod::Spec.new do |s|
s.name = "Instabug"
s.version = "3.3"
s.version = "3.4"
s.summary = "Bug reporting for mobile apps. Learn more at http://instabug.com"
s.homepage = "http://instabug.com"
s.license = {
Expand All @@ -23,14 +82,12 @@ Pod::Spec.new do |s|
}
s.author = { "Instabug" => "contactus@instabug.com" }
s.platform = :ios, '5.0'
s.source = { :git => "https://github.com/Instabug/Instabug-iOS.git", :tag => "3.3" }
s.source = { :git => "https://github.com/Instabug/Instabug-iOS.git", :tag => "3.4" }
s.source_files = 'Instabug.framework/Versions/A/Headers/*.{h}'
s.resources = 'Instabug.bundle'
s.preserve_paths = 'Instabug.framework/*', 'Instabug.bundle'
s.frameworks = 'QuartzCore', 'CoreGraphics', 'CoreMotion', 'CoreFoundation', 'SystemConfiguration', 'Foundation', 'AVFoundation', 'OpenGLES', 'AudioToolbox', 'GLKit', 'CoreTelephony', 'UIKit', 'CoreLocation', 'MessageUI', 'MobileCoreServices', 'Instabug'
s.libraries = 'c++'
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/Instabug/"' }
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/Instabug/"', 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11', 'CLANG_CXX_LIBRARY' => 'libc++' }
s.requires_arc = true


end

0 comments on commit eefeb52

Please sign in to comment.