-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
150 lines (127 loc) · 7.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
FLUTTER_BIN?=flutter
all: format build lint test
.PHONY: clean build bump aar examples/flutter test format lint e2e_android_local e2e_ios_local
clean:
cd packages/bugsnag_flutter && $(FLUTTER_BIN) clean --suppress-analytics
cd packages/bugsnag_breadcrumbs_dart_io && $(FLUTTER_BIN) clean --suppress-analytics
cd packages/bugsnag_breadcrumbs_http && $(FLUTTER_BIN) clean --suppress-analytics
cd examples/flutter && $(FLUTTER_BIN) clean --suppress-analytics && \
rm -rf .idea bugsnag_flutter_example.iml \
ios/{Pods,.symlinks,Podfile.lock} \
ios/{Runner.xcworkspace,Runner.xcodeproj,Runner.xcodeproj/project.xcworkspace}/xcuserdata \
android/{.idea,.gradle,gradlew,gradlew.bat,local.properties,bugsnag_flutter_example_android.iml}
rm -rf staging
build: aar examples/flutter
bump: ## Bump the version numbers to $VERSION
ifeq ($(VERSION),)
@$(error VERSION is not defined. Run with `make VERSION=number bump`)
endif
sed -i '' "s/## TBD/## $(VERSION) ($(shell date '+%Y-%m-%d'))/" CHANGELOG.md
sed -i '' "s/^version: .*/version: $(VERSION)/" packages/bugsnag_flutter/pubspec.yaml
sed -i '' "s/^version: .*/version: $(VERSION)/" packages/bugsnag_breadcrumbs_dart_io/pubspec.yaml
sed -i '' "s/^version: .*/version: $(VERSION)/" packages/bugsnag_breadcrumbs_http/pubspec.yaml
sed -i '' "s/^ 'version': .*/ 'version': '$(VERSION)'/" packages/bugsnag_flutter/lib/src/client.dart
staging/bugsnag_flutter:
mkdir -p staging/bugsnag_flutter
cd packages/bugsnag_flutter && cp -a . ../../staging/bugsnag_flutter
rm -f staging/bugsnag_flutter/pubspec.lock
cp -r examples/flutter staging/bugsnag_flutter/example
cp README.md staging/bugsnag_flutter/.
cp LICENSE staging/bugsnag_flutter/.
cp CHANGELOG.md staging/bugsnag_flutter/.
sed -i '' -e '1,2d' staging/bugsnag_flutter/CHANGELOG.md
BSG_FLUTTER_VERSION:=$(shell grep 'version: ' packages/bugsnag_flutter/pubspec.yaml | grep -o '[0-9].*')
staging/%:
mkdir -p staging/$*
cd packages/$* && cp -a . ../../staging/$*
rm -f staging/$*/pubspec.lock
cp LICENSE staging/$*/.
cp CHANGELOG.md staging/$*/.
sed -i '' -e '1,2d' staging/$*/CHANGELOG.md
# Replace the path references to bugsnag_flutter with version-based references, and allow publishing (strip lines with 'publish_to: none')
sed -i '' "s/^ bugsnag_flutter:.*/ bugsnag_flutter: ^$(BSG_FLUTTER_VERSION)/" staging/$*/pubspec.yaml
sed -i '' "s/path:.*/ /;s/publish_to: none/ /" staging/$*/pubspec.yaml
stage: clean staging/bugsnag_flutter staging/bugsnag_breadcrumbs_dart_io staging/bugsnag_breadcrumbs_http
aar:
cd packages/bugsnag_flutter && $(FLUTTER_BIN) build aar --suppress-analytics
examples/flutter:
cd $@ && $(FLUTTER_BIN) pub get
cd $@ && $(FLUTTER_BIN) build apk --suppress-analytics
cd $@ && $(FLUTTER_BIN) build ios --no-codesign --suppress-analytics --no-tree-shake-icons
test:
cd packages/bugsnag_flutter && $(FLUTTER_BIN) test -r expanded --suppress-analytics
cd packages/bugsnag_breadcrumbs_http && $(FLUTTER_BIN) test -r expanded --suppress-analytics
test-fixtures: ## Build the end-to-end test fixtures
@./features/scripts/build_ios_app.sh
@./features/scripts/build_android_app.sh
format:
$(FLUTTER_BIN) format packages/bugsnag_flutter example features/fixtures/app
lint:
cd packages/bugsnag_flutter && $(FLUTTER_BIN) analyze --suppress-analytics
cd packages/bugsnag_breadcrumbs_dart_io && $(FLUTTER_BIN) analyze --suppress-analytics
cd packages/bugsnag_breadcrumbs_http && $(FLUTTER_BIN) analyze --suppress-analytics
e2e_android_local: features/fixtures/app/build/app/outputs/flutter-apk/app-release.apk
$(HOME)/Library/Android/sdk/platform-tools/adb uninstall com.bugsnag.flutter.test.app || true
bundle exec maze-runner --app=$< --farm=local --os=android --os-version=10 $(FEATURES)
features/fixtures/app/build/app/outputs/flutter-apk/app-release.apk: $(shell find packages/bugsnag_flutter features/fixtures/app/android/app/src features/fixtures/app/lib -type f)
cd features/fixtures/app && $(FLUTTER_BIN) build apk
e2e_ios_local: features/fixtures/app/build/ios/ipa/app.ipa
ideviceinstaller --uninstall com.bugsnag.flutter.test.app
bundle exec maze-runner --app=$< --farm=local --os=ios --os-version=15 --apple-team-id=372ZUL2ZB7 --udid="$(shell idevice_id -l)" $(FEATURES)
features/fixtures/app/build/ios/ipa/app.ipa: $(shell find packages/bugsnag_flutter features/fixtures/app/ios/Runner features/fixtures/app/lib -type f)
cd features/fixtures/app && $(FLUTTER_BIN) build ipa --export-options-plist=ios/exportOptions.plist
update-bugsnag-android:
ifeq ($(VERSION),)
@$(error VERSION is not defined. Run with `make VERSION=number update-bugsnag-android`)
endif
sed -i '' "s/'com.bugsnag:bugsnag-android:.*'/'com.bugsnag:bugsnag-android:$(VERSION)'/" packages/bugsnag_flutter/android/build.gradle
update-bugsnag-cocoa:
ifeq ($(VERSION),)
@$(error VERSION is not defined. Run with `make VERSION=number update-bugsnag-cocoa`)
endif
sed -i '' "s/s.dependency 'Bugsnag', '.*'/s.dependency 'Bugsnag', '$(VERSION)'/" packages/bugsnag_flutter/ios/bugsnag_flutter.podspec
update-bugsnag-dependency:
ifeq ($(SUBMODULE),)
@$(error SUBMODULE is not defined. Run with `make SUBMODULE=target update-bugsnag-dependency`)
endif
ifeq ($(SUBMODULE), bugsnag-android)
$(MAKE) update-bugsnag-android
else ifeq ($(SUBMODULE), bugsnag-cocoa)
$(MAKE) update-bugsnag-cocoa
else
@$(error SUBMODULE must be one of bugsnag-android or bugsnag-cocoa)
endif
prerelease: bump stage ## Generates a PR for the $VERSION release
ifeq ($(VERSION),)
@$(error VERSION is not defined. Run with `make VERSION=number prerelease`)
endif
rm -rf staging
@git checkout -b release-v$(VERSION)
@git add packages/bugsnag_flutter/pubspec.yaml packages/bugsnag_breadcrumbs_dart_io/pubspec.yaml packages/bugsnag_breadcrumbs_http/pubspec.yaml packages/bugsnag_flutter/lib/src/client.dart CHANGELOG.md VERSION
@git diff --exit-code || (echo "you have unstaged changes - Makefile may need updating to `git add` some more files"; exit 1)
@git commit -m "Release v$(VERSION)"
@git push origin release-v$(VERSION)
@open "https://github.com/bugsnag/bugsnag-flutter/compare/main...release-v$(VERSION)?expand=1&title=Release%20v$(VERSION)&body="$$(awk 'start && /^## /{exit;};/^## /{start=1;next};start' CHANGELOG.md | hexdump -v -e '/1 "%02x"' | sed 's/\(..\)/%\1/g')
release: stage ## Releases the current main branch as $VERSION
@git fetch origin
ifneq ($(shell git rev-parse --abbrev-ref HEAD),main) # Check the current branch name
@git checkout main
@git rebase origin/main
endif
ifneq ($(shell git diff origin/main..main),)
$(error you have unpushed commits on the main branch)
endif
@git tag v$(PRESET_VERSION)
@git push origin v$(PRESET_VERSION)
@git checkout next
@git rebase origin/next
@git merge main
@git push origin next
# Prep GitHub release
# We could technically do a `hub release` here but a verification step
# before it goes live always seems like a good thing
@open 'https://github.com/bugsnag/bugsnag-flutter/releases/new?title=v$(PRESET_VERSION)&tag=v$(PRESET_VERSION)&body='$$(awk 'start && /^## /{exit;};/^## /{start=1;next};start' CHANGELOG.md | hexdump -v -e '/1 "%02x"' | sed 's/\(..\)/%\1/g')
cd staging/bugsnag_flutter && $(FLUTTER_BIN) pub publish
cd staging/bugsnag_breadcrumbs_dart_io && $(FLUTTER_BIN) pub publish
cd staging/bugsnag_breadcrumbs_http && $(FLUTTER_BIN) pub publish
rm -rf staging