Skip to content

Commit fa25112

Browse files
authored
Add support for build files folder parameter (#235)
1 parent 024ce3f commit fa25112

File tree

6 files changed

+39
-6
lines changed

6 files changed

+39
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
7+
- Add support for build files folder parameter ([#235](https://github.com/getsentry/sentry-dart-plugin/pull/235))
8+
39
## 2.0.0
410

511
### Breaking Changes

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,16 @@ ignore_missing=true
106106
| url | URL | e.g. https<area>://mysentry.invalid/ (string) | no | SENTRY_URL |
107107
| wait_for_processing | Wait for server-side processing of uploaded files | false (boolean) | no | - |
108108
| log_level | Configures the log level for sentry-cli | warn (string) | no | SENTRY_LOG_LEVEL |
109-
| release | The release version for source maps, it should match the release set by the SDK | default: name@version from pubspec (string) | no | SENTRY_RELEASE |
110-
| dist | The dist/build number for source maps, it should match the dist set by the SDK | default: the number after the '+' char from 'version' pubspec (string) | no | SENTRY_DIST |
111-
| web_build_path | The web build folder | default: build/web (string) | no | - |
112-
| commits | Release commits integration | default: auto | no | - |
113-
| ignore_missing | Ignore missing commits previously used in the release | default: false | no | - |
109+
| release | The release version for source maps, it should match the release set by the SDK | name@version from pubspec (string) | no | SENTRY_RELEASE |
110+
| dist | The dist/build number for source maps, it should match the dist set by the SDK | the number after the '+' char from 'version' pubspec (string) | no | SENTRY_DIST |
111+
| build_path | The build folder of debug files for upload | `.` current folder (string) | no | - |
112+
| web_build_path | The web build folder of debug files for upload | `build/web` relative to build_path (string) | no | - |
113+
| commits | Release commits integration | auto (string) | no | - |
114+
| ignore_missing | Ignore missing commits previously used in the release | false (boolean) | no | - |
114115
| bin_dir | The folder where the plugin downloads the sentry-cli binary | .dart_tool/pub/bin/sentry_dart_plugin (string) | no | - |
115116
| bin_path | Path to the sentry-cli binary to use instead of downloading. Make sure to use the correct version. | null (string) | no | - |
116117

118+
117119
## Release
118120

119121
Per default, the release is build from pubspec.yaml's name, version & build: `name@version+build`. The build number, if present, is used as the `dist` parameter.

lib/src/configuration.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Configuration {
1818
// cannot use ${Directory.current.path}/build since --split-debug-info allows
1919
// setting a custom path which is a sibling of build
2020
/// The Build folder, defaults to the current directory.
21-
late final String buildFilesFolder = _fs.currentDirectory.path;
21+
late String buildFilesFolder;
2222

2323
/// Whether to upload debug symbols, defaults to true
2424
late bool uploadDebugSymbols;
@@ -131,6 +131,8 @@ class Configuration {
131131
commits = configValues.commits ?? 'auto';
132132
ignoreMissing = configValues.ignoreMissing ?? false;
133133

134+
buildFilesFolder =
135+
configValues.buildPath ?? _fs.currentDirectory.path;
134136
// uploading JS and Map files need to have the correct folder structure
135137
// otherwise symbolication fails, the default path for the web build folder is build/web
136138
// but can be customized so making it flexible.

lib/src/configuration_values.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ConfigurationValues {
1616
final String? logLevel;
1717
final String? release;
1818
final String? dist;
19+
final String? buildPath;
1920
final String? webBuildPath;
2021
final String? commits;
2122
final bool? ignoreMissing;
@@ -36,6 +37,7 @@ class ConfigurationValues {
3637
this.logLevel,
3738
this.release,
3839
this.dist,
40+
this.buildPath,
3941
this.webBuildPath,
4042
this.commits,
4143
this.ignoreMissing,
@@ -83,6 +85,7 @@ class ConfigurationValues {
8385
logLevel: sentryArguments['log_level'],
8486
release: sentryArguments['release'],
8587
dist: sentryArguments['dist'],
88+
buildPath: sentryArguments['build_path'],
8689
webBuildPath: sentryArguments['web_build_path'],
8790
commits: sentryArguments['commits'],
8891
ignoreMissing: boolFromString(sentryArguments['ignore_missing']),
@@ -95,6 +98,7 @@ class ConfigurationValues {
9598
return ConfigurationValues(
9699
version: configReader.getString('version'),
97100
name: configReader.getString('name'),
101+
98102
uploadDebugSymbols: configReader.getBool(
99103
'upload_debug_symbols',
100104
deprecatedKey: 'upload_native_symbols',
@@ -112,6 +116,7 @@ class ConfigurationValues {
112116
logLevel: configReader.getString('log_level'),
113117
release: configReader.getString('release'),
114118
dist: configReader.getString('dist'),
119+
buildPath: configReader.getString('build_path'),
115120
webBuildPath: configReader.getString('web_build_path'),
116121
commits: configReader.getString('commits'),
117122
ignoreMissing: configReader.getBool('ignore_missing'),
@@ -156,6 +161,7 @@ class ConfigurationValues {
156161
logLevel: args.logLevel ?? file.logLevel,
157162
release: platformEnv.release ?? args.release ?? file.release,
158163
dist: platformEnv.dist ?? args.dist ?? file.dist,
164+
buildPath: args.buildPath ?? file.buildPath,
159165
webBuildPath: args.webBuildPath ?? file.webBuildPath,
160166
commits: args.commits ?? file.commits,
161167
ignoreMissing: args.ignoreMissing ?? file.ignoreMissing,

test/configuration_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void main() {
6262
logLevel: 'warning',
6363
release: 'release-args-config',
6464
dist: 'dist-args-config',
65+
buildPath: 'build_path-args-config',
6566
webBuildPath: 'web_build_path-args-config',
6667
commits: 'commits-args-config',
6768
ignoreMissing: true,
@@ -82,6 +83,7 @@ void main() {
8283
logLevel: 'debug',
8384
release: 'release-file-config',
8485
dist: 'dist-file-config',
86+
buildPath: 'build_path-file-config',
8587
webBuildPath: 'web_build_path-file-config',
8688
commits: 'commits-file-config',
8789
ignoreMissing: false,
@@ -108,6 +110,7 @@ void main() {
108110
expect(sut.logLevel, 'warning');
109111
expect(sut.release, 'release-args-config');
110112
expect(sut.dist, 'dist-args-config');
113+
expect(sut.buildFilesFolder, 'build_path-args-config');
111114
expect(
112115
sut.webBuildFilesFolder,
113116
fixture.fs.path.join(
@@ -138,6 +141,7 @@ void main() {
138141
logLevel: 'debug',
139142
release: 'release-file-config',
140143
dist: 'dist-file-config',
144+
buildPath: 'build_path-file-config',
141145
webBuildPath: 'web_build_path-file-config',
142146
commits: 'commits-file-config',
143147
ignoreMissing: true,
@@ -153,6 +157,7 @@ void main() {
153157

154158
expect(sut.name, 'name-file-config');
155159
expect(sut.version, 'version-file-config');
160+
156161
expect(sut.uploadDebugSymbols, false);
157162
expect(sut.uploadSourceMaps, true);
158163
expect(sut.uploadSources, true);
@@ -164,6 +169,7 @@ void main() {
164169
expect(sut.logLevel, 'debug');
165170
expect(sut.release, 'release-file-config');
166171
expect(sut.dist, 'dist-file-config');
172+
expect(sut.buildFilesFolder, 'build_path-file-config');
167173
expect(
168174
sut.webBuildFilesFolder,
169175
fixture.fs.path
@@ -193,6 +199,10 @@ void main() {
193199
expect(sut.uploadSources, false);
194200
expect(sut.commits, 'auto');
195201
expect(sut.ignoreMissing, false);
202+
expect(
203+
sut.buildFilesFolder,
204+
fixture.fs.currentDirectory.path,
205+
);
196206
expect(
197207
sut.webBuildFilesFolder,
198208
fixture.fs.path.join(sut.buildFilesFolder, 'build/web'),

test/configureation_values_test.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ void main() {
2727
"--sentry-define=log_level=fixture-log_level",
2828
"--sentry-define=release=fixture-release",
2929
"--sentry-define=dist=fixture-dist",
30+
"--sentry-define=build_path=fixture-build_path",
3031
"--sentry-define=web_build_path=fixture-web_build_path",
3132
"--sentry-define=commits=fixture-commits",
3233
"--sentry-define=ignore_missing=true",
@@ -35,6 +36,7 @@ void main() {
3536
final sut = ConfigurationValues.fromArguments(arguments);
3637
expect(sut.name, 'fixture-name');
3738
expect(sut.version, 'fixture-version');
39+
3840
expect(sut.uploadDebugSymbols, true);
3941
expect(sut.uploadSourceMaps, true);
4042
expect(sut.uploadSources, true);
@@ -46,6 +48,7 @@ void main() {
4648
expect(sut.logLevel, 'fixture-log_level');
4749
expect(sut.release, 'fixture-release');
4850
expect(sut.dist, 'fixture-dist');
51+
expect(sut.buildPath, 'fixture-build_path');
4952
expect(sut.webBuildPath, 'fixture-web_build_path');
5053
expect(sut.commits, 'fixture-commits');
5154
expect(sut.ignoreMissing, true);
@@ -76,6 +79,7 @@ void main() {
7679
final config = '''
7780
name: fixture-name
7881
version: fixture-version
82+
7983
upload_debug_symbols: true
8084
upload_source_maps: true
8185
upload_sources: true
@@ -84,6 +88,7 @@ void main() {
8488
log_level: fixture-log_level
8589
release: fixture-release
8690
dist: fixture-dist
91+
build_path: fixture-build_path
8792
web_build_path: fixture-web_build_path
8893
commits: fixture-commits
8994
ignore_missing: true
@@ -110,6 +115,7 @@ void main() {
110115
final sut = ConfigurationValues.fromReader(reader);
111116
expect(sut.name, 'fixture-name');
112117
expect(sut.version, 'fixture-version');
118+
113119
expect(sut.uploadDebugSymbols, true);
114120
expect(sut.uploadSourceMaps, true);
115121
expect(sut.uploadSources, true);
@@ -121,6 +127,7 @@ void main() {
121127
expect(sut.logLevel, 'fixture-log_level');
122128
expect(sut.release, 'fixture-release');
123129
expect(sut.dist, 'fixture-dist');
130+
expect(sut.buildPath, 'fixture-build_path');
124131
expect(sut.webBuildPath, 'fixture-web_build_path');
125132
expect(sut.commits, 'fixture-commits');
126133
expect(sut.ignoreMissing, true);

0 commit comments

Comments
 (0)