New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get name suffix from the build.yaml file #1898
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c173d32
get name suffix from build.yaml options
trejdych caf12f4
Apply suggestions from code review
rrousselGit a9aad67
Apply suggestions from code review
rrousselGit 7e1b104
add build.yaml sample project and suffix test
trejdych 42f7de3
move build yaml sample to riverpod_generator package
trejdych 42e9278
fix dependency_overrides paths
trejdych 5214536
github actions
trejdych f954dfe
exclude generator samples from analyze
trejdych 30a5994
rename file
trejdych 9f9da56
exclude generator samples from analyze again but this time is better...
trejdych aa8a770
change ensure build test timeout
trejdych 3d0efca
Exclude riverpod_generator & riverpod_lint from codecov
rrousselGit eb3a8f6
Rename e2e folder
rrousselGit eddc00d
Remove redundant exclude
rrousselGit 583551d
Merge branch 'master' of https://github.com/rrousselGit/river_pod int…
rrousselGit d426cc7
Fix build_verify test
rrousselGit 25fa963
Rename again
rrousselGit a1ac3b6
Another typo
rrousselGit 7b63974
Add extra pub get
rrousselGit 3084e83
typo
rrousselGit dd76e5e
Run pub get in integration folder
rrousselGit ba117a3
Update generated files
rrousselGit File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/riverpod_generator/integration/build_yaml/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Files and directories created by pub. | ||
.dart_tool/ | ||
.packages | ||
|
||
# Conventional directory for build output. | ||
build/ |
23 changes: 23 additions & 0 deletions
23
packages/riverpod_generator/integration/build_yaml/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Pub | ||
|
||
Install needed global packages | ||
|
||
```bash | ||
cd riverpod | ||
dart pub global activate melos | ||
``` | ||
|
||
Build the riverpod packages | ||
|
||
```bash | ||
fluttter pub get | ||
``` | ||
|
||
## Start the tests | ||
|
||
```bash | ||
cd examples/build_yaml | ||
flutter pub run build_runner build | ||
|
||
flutter test | ||
``` |
6 changes: 6 additions & 0 deletions
6
packages/riverpod_generator/integration/build_yaml/build.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
targets: | ||
$default: | ||
builders: | ||
riverpod_generator: | ||
options: | ||
provider_name_suffix: 'Pod' |
29 changes: 29 additions & 0 deletions
29
packages/riverpod_generator/integration/build_yaml/lib/main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'main.g.dart'; | ||
|
||
@riverpod | ||
int count(CountRef ref) { | ||
return 1; | ||
} | ||
|
||
@riverpod | ||
FutureOr<int> countFuture(CountFutureRef ref) { | ||
return 1; | ||
} | ||
|
||
@riverpod | ||
class CountNotifier extends _$CountNotifier { | ||
@override | ||
int build() { | ||
return 1; | ||
} | ||
} | ||
|
||
@riverpod | ||
class CountAsyncNotifier extends _$CountAsyncNotifier { | ||
@override | ||
FutureOr<int> build() { | ||
return 1; | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
packages/riverpod_generator/integration/build_yaml/lib/main.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
packages/riverpod_generator/integration/build_yaml/pubspec.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: build_yaml | ||
description: A sample command-line application. | ||
version: 1.0.0 | ||
|
||
environment: | ||
sdk: ">=2.18.4 <3.0.0" | ||
|
||
dependencies: | ||
riverpod: | ||
riverpod_annotation: | ||
|
||
dev_dependencies: | ||
build_runner: ^2.3.2 | ||
build_verify: ^3.0.0 | ||
riverpod_generator: | ||
test: ^1.16.0 |
8 changes: 8 additions & 0 deletions
8
packages/riverpod_generator/integration/build_yaml/pubspec_overrides.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# melos_managed_dependency_overrides: riverpod,riverpod_annotation,riverpod_generator | ||
dependency_overrides: | ||
riverpod: | ||
path: ../../../riverpod | ||
riverpod_annotation: | ||
path: ../../../riverpod_annotation | ||
riverpod_generator: | ||
path: ../.. |
21 changes: 21 additions & 0 deletions
21
packages/riverpod_generator/integration/build_yaml/test/build_yaml_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:build_verify/build_verify.dart'; | ||
import 'package:build_yaml/main.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
test( | ||
'ensure_build', | ||
() => expectBuildClean( | ||
packageRelativeDirectory: | ||
'packages/riverpod_generator/integration/build_yaml', | ||
), | ||
timeout: const Timeout(Duration(minutes: 1)), | ||
); | ||
|
||
test('provider names', () { | ||
expect(countPod.name, 'countPod'); | ||
expect(countFuturePod.name, 'countFuturePod'); | ||
expect(countNotifierPod.name, 'countNotifierPod'); | ||
expect(countAsyncNotifierPod.name, 'countAsyncNotifierPod'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/riverpod_generator/test/build_yaml_config_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:riverpod_generator/src/models.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
test('custom suffix', () async { | ||
const map = {'provider_name_suffix': 'Pod'}; | ||
final options = BuildYamlOptions.fromMap(map); | ||
expect(options.providerNameSuffix, 'Pod'); | ||
}); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this being in the root
examples
folder.it probably should be in the riverpod_generator folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes more sense. I've just changed