Skip to content

Commit

Permalink
chore: example run script updates (#1128)
Browse files Browse the repository at this point in the history
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
  • Loading branch information
vaind and marandaneto authored Nov 15, 2022
1 parent 7f2b01d commit a49594a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 39 deletions.
3 changes: 0 additions & 3 deletions flutter/example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

Expand Down
5 changes: 3 additions & 2 deletions flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ flutter:
- assets/sentry-wordmark.png

sentry:
upload_native_symbols: false
upload_native_symbols: true
upload_source_maps: true
include_native_sources: true
project: sentry-flutter
org: sentry-sdks
log_level: error
wait_for_processing: true
commits: true
41 changes: 9 additions & 32 deletions flutter/example/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ set -euo pipefail
# Or try out the Alpha version of the Sentry Dart Plugin that does it automatically for you, feedback is welcomed.
# https://github.com/getsentry/sentry-dart-plugin

export SENTRY_PROJECT=sentry-flutter
export SENTRY_ORG=sentry-sdks
export SENTRY_LOG_LEVEL=info
export OUTPUT_FOLDER_WEB=./build/web/

export SENTRY_RELEASE=$(date +%Y-%m-%d_%H-%M-%S)

echo -e "[\033[92mrun\033[0m] $1"
Expand All @@ -28,10 +23,12 @@ elif [ "$1" == "android" ]; then
launchCmd='adb shell am start -n io.sentry.samples.flutter/io.sentry.samples.flutter.MainActivity'
echo -e "[\033[92mrun\033[0m] Android app installed"
elif [ "$1" == "web" ]; then
# Uses dart2js
flutter build web --dart-define=SENTRY_RELEASE=$SENTRY_RELEASE --source-maps
ls -lah $OUTPUT_FOLDER_WEB
echo -e "[\033[92mrun\033[0m] Built: $OUTPUT_FOLDER_WEB"
buildDir='./build/web/'
port='8132'
ls -lah $buildDir
echo -e "[\033[92mrun\033[0m] Built: $buildDir"
launchCmd="bash -c '( sleep 3 ; open http://127.0.0.1:$port ) & python3 -m http.server --directory $buildDir $port'"
elif [ "$1" == "macos" ]; then
flutter build macos --split-debug-info=$symbolsDir --obfuscate
launchCmd='./build/macos/Build/Products/Release/sentry_flutter_example.app/Contents/MacOS/sentry_flutter_example'
Expand All @@ -41,30 +38,10 @@ else
else
echo -e "[\033[92mrun\033[0m] $1 isn't supported"
fi
exit
exit 1
fi

if [ "$1" == "web" ]; then
echo -e "[\033[92mrun\033[0m] Uploading sourcemaps for $SENTRY_RELEASE"
sentry-cli releases new $SENTRY_RELEASE

sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps . \
--ext dart

pushd $OUTPUT_FOLDER_WEB
sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps . \
--ext map \
--ext js

sentry-cli releases finalize $SENTRY_RELEASE
dart run sentry_dart_plugin

python3 -m http.server 8132
popd
else
# 'symbols' directory contains the Dart debug info files but to include platform-specific ones, use the whole build dir instead.
echo -e "[\033[92mrun\033[0m] Uploading debug information files"
sentry-cli upload-dif --wait --org $SENTRY_ORG --project $SENTRY_PROJECT build

echo "Starting the built app: $($launchCmd)"
$launchCmd
fi
echo "Starting the built app: $launchCmd"
eval $launchCmd
6 changes: 4 additions & 2 deletions flutter/example/web/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
Expand All @@ -12,12 +13,12 @@
<link rel="apple-touch-icon" href="icons/Icon-192.png">

<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
<link rel="shortcut icon" type="image/png" href="favicon.png" />

<title>sentry_flutter_example</title>
<link rel="manifest" href="manifest.json">
<base href="/sentry-dart/">
</head>

<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
Expand All @@ -31,4 +32,5 @@
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>

</html>

0 comments on commit a49594a

Please sign in to comment.