Skip to content

Commit

Permalink
change build dir default value
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Nov 4, 2024
1 parent c16a573 commit 716995e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ sentry:
log_level: error # possible values: trace, debug, info, warn, error
release: ...
dist: ...
build_path: ...
web_build_path: ...
commits: auto
ignore_missing: true
Expand Down Expand Up @@ -88,6 +89,7 @@ wait_for_processing=false
log_level=error # possible values: trace, debug, info, warn, error
release=...
dist=...
build_path: ...
web_build_path=...
commits=auto
ignore_missing=true
Expand All @@ -109,8 +111,8 @@ ignore_missing=true
| log_level | Configures the log level for sentry-cli | warn (string) | no | SENTRY_LOG_LEVEL |
| release | The release version for source maps, it should match the release set by the SDK | name@version from pubspec (string) | no | SENTRY_RELEASE |
| 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 |
| build_path | The build folder of debug files for upload | `.` current folder (string) | no | - |
| web_build_path | The web build folder of debug files for upload | `build/web` relative to build_path (string) | no | - |
| build_path | The build folder of debug files for upload | `build` (string) | no | - |
| web_build_path | The web build folder of debug files for upload relative to build_path | `web` (string) | no | - |
| commits | Release commits integration | auto (string) | no | - |
| ignore_missing | Ignore missing commits previously used in the release | false (boolean) | no | - |
| bin_dir | The folder where the plugin downloads the sentry-cli binary | .dart_tool/pub/bin/sentry_dart_plugin (string) | no | - |
Expand Down
5 changes: 4 additions & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ sentry:
# default 'warning'
log_level: error

# default to build/web
# default 'build'
#build_path: ...

# default 'web'
#web_build_path: ...

# default to name@version from pubspec
Expand Down
14 changes: 6 additions & 8 deletions lib/src/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ import 'utils/log.dart';

class Configuration {
late final FileSystem _fs = injector.get<FileSystem>();
// cannot use ${Directory.current.path}/build since --split-debug-info allows
// setting a custom path which is a sibling of build
/// The Build folder, defaults to the current directory.

/// The Build folder, defaults `build`.
late String buildFilesFolder;

/// Whether to upload debug symbols, defaults to true
Expand Down Expand Up @@ -67,7 +66,7 @@ class Configuration {
/// The Apps name, defaults to [name] from pubspec
late String name;

/// the Web Build folder, defaults to build/web
/// the Web Build folder, defaults to `web`
late String webBuildFilesFolder;

/// The URL prefix, defaults to null
Expand Down Expand Up @@ -141,12 +140,11 @@ class Configuration {
commits = configValues.commits ?? 'auto';
ignoreMissing = configValues.ignoreMissing ?? false;

buildFilesFolder = configValues.buildPath ?? _fs.currentDirectory.path;
buildFilesFolder = configValues.buildPath ?? 'build';
// uploading JS and Map files need to have the correct folder structure
// otherwise symbolication fails, the default path for the web build folder is build/web
// otherwise symbolication fails, the default path for the web build folder is web
// but can be customized so making it flexible.
final webBuildPath =
configValues.webBuildPath ?? _fs.path.join('build', 'web');
final webBuildPath = configValues.webBuildPath ?? 'web';
webBuildFilesFolder = _fs.path.join(buildFilesFolder, webBuildPath);

project = configValues.project; // or env. var. SENTRY_PROJECT
Expand Down
7 changes: 2 additions & 5 deletions test/configuration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,10 @@ void main() {
expect(sut.uploadSources, false);
expect(sut.commits, 'auto');
expect(sut.ignoreMissing, false);
expect(
sut.buildFilesFolder,
fixture.fs.currentDirectory.path,
);
expect(sut.buildFilesFolder, 'build');
expect(
sut.webBuildFilesFolder,
fixture.fs.path.join(sut.buildFilesFolder, 'build/web'),
fixture.fs.path.join(sut.buildFilesFolder, 'web'),
);
expect(sut.waitForProcessing, false);
expect(sut.binDir, '.dart_tool/pub/bin/sentry_dart_plugin');
Expand Down
20 changes: 10 additions & 10 deletions test/plugin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void main() {
const cli = MockCLI.name;
const orgAndProject = '--org o --project p';
const name = 'name';
const buildDir = '/subdir';
const buildDir = 'build';

/// File types from which we can read configs.
const fileTypes = [
Expand Down Expand Up @@ -84,7 +84,7 @@ void main() {
expect(commandLog, [
'$cli $args debug-files upload $orgAndProject --include-sources $buildDir',
'$cli $args releases $orgAndProject new $release',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/build/web --ext map --ext js',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/web --ext map --ext js',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir --ext dart',
'$cli $args releases $orgAndProject set-commits $release --auto --ignore-missing',
'$cli $args releases $orgAndProject finalize $release'
Expand Down Expand Up @@ -193,7 +193,7 @@ void main() {
final args = commonArgs;
expect(commandLog, [
'$cli $args releases $orgAndProject new $release',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/build/web --ext map --ext js',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/web --ext map --ext js',
'$cli $args releases $orgAndProject set-commits $release --auto',
'$cli $args releases $orgAndProject finalize $release'
]);
Expand All @@ -213,7 +213,7 @@ void main() {
final args = commonArgs;
expect(commandLog, [
'$cli $args releases $orgAndProject new $configRelease',
'$cli $args releases $orgAndProject files $configRelease upload-sourcemaps $buildDir/build/web --ext map --ext js',
'$cli $args releases $orgAndProject files $configRelease upload-sourcemaps $buildDir/web --ext map --ext js',
'$cli $args releases $orgAndProject set-commits $configRelease --auto',
'$cli $args releases $orgAndProject finalize $configRelease'
]);
Expand All @@ -235,7 +235,7 @@ void main() {
final args = commonArgs;
expect(commandLog, [
'$cli $args releases $orgAndProject new $release',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/build/web --ext map --ext js --dist $build',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/web --ext map --ext js --dist $build',
'$cli $args releases $orgAndProject set-commits $release --auto',
'$cli $args releases $orgAndProject finalize $release'
]);
Expand All @@ -256,7 +256,7 @@ void main() {
final args = commonArgs;
expect(commandLog, [
'$cli $args releases $orgAndProject new $configRelease',
'$cli $args releases $orgAndProject files $configRelease upload-sourcemaps $buildDir/build/web --ext map --ext js --dist $build',
'$cli $args releases $orgAndProject files $configRelease upload-sourcemaps $buildDir/web --ext map --ext js --dist $build',
'$cli $args releases $orgAndProject set-commits $configRelease --auto',
'$cli $args releases $orgAndProject finalize $configRelease'
]);
Expand All @@ -277,7 +277,7 @@ void main() {
final args = commonArgs;
expect(commandLog, [
'$cli $args releases $orgAndProject new $release',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/build/web --ext map --ext js --dist $configDist',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/web --ext map --ext js --dist $configDist',
'$cli $args releases $orgAndProject set-commits $release --auto',
'$cli $args releases $orgAndProject finalize $release'
]);
Expand All @@ -301,7 +301,7 @@ void main() {
final args = commonArgs;
expect(commandLog, [
'$cli $args releases $orgAndProject new $release',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/build/web --ext map --ext js --dist $configDist',
'$cli $args releases $orgAndProject files $release upload-sourcemaps $buildDir/web --ext map --ext js --dist $configDist',
'$cli $args releases $orgAndProject set-commits $release --auto',
'$cli $args releases $orgAndProject finalize $release'
]);
Expand All @@ -323,7 +323,7 @@ void main() {
final args = commonArgs;
expect(commandLog, [
'$cli $args releases $orgAndProject new $configRelease',
'$cli $args releases $orgAndProject files $configRelease upload-sourcemaps $buildDir/build/web --ext map --ext js --dist $configDist',
'$cli $args releases $orgAndProject files $configRelease upload-sourcemaps $buildDir/web --ext map --ext js --dist $configDist',
'$cli $args releases $orgAndProject set-commits $configRelease --auto',
'$cli $args releases $orgAndProject finalize $configRelease'
]);
Expand All @@ -348,7 +348,7 @@ void main() {
final args = commonArgs;
expect(commandLog, [
'$cli $args releases $orgAndProject new $configRelease',
'$cli $args releases $orgAndProject files $configRelease upload-sourcemaps $buildDir/build/web --ext map --ext js --dist $configDist --url-prefix ~/app/',
'$cli $args releases $orgAndProject files $configRelease upload-sourcemaps $buildDir/web --ext map --ext js --dist $configDist --url-prefix ~/app/',
'$cli $args releases $orgAndProject set-commits $configRelease --auto',
'$cli $args releases $orgAndProject finalize $configRelease'
]);
Expand Down

0 comments on commit 716995e

Please sign in to comment.