File tree Expand file tree Collapse file tree 3 files changed +49
-7
lines changed
test/script_integration_outputs Expand file tree Collapse file tree 3 files changed +49
-7
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,32 @@ function $commandName() {
16
16
fi
17
17
}''' ;
18
18
19
+ String _dartCommandContentPub (String commandName) => '''
20
+ # When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
21
+ # then "flutter" is called instead of "pub".
22
+ # This assumes that the Flutter SDK has been installed in a previous step.
23
+ function $commandName () {
24
+ if grep -Fq "sdk: flutter" "\$ {PWD}/pubspec.yaml"; then
25
+ if [[ \$ TRAVIS_OS_NAME == "windows" ]]; then
26
+ command flutter.bat pub "\$ @"
27
+ else
28
+ command flutter pub "\$ @"
29
+ fi
30
+ else
31
+ if [[ \$ TRAVIS_OS_NAME == "windows" ]]; then
32
+ command pub.bat "\$ @"
33
+ else
34
+ command pub "\$ @"
35
+ fi
36
+ fi
37
+ }''' ;
38
+
19
39
final bashScriptHeader = '''
20
40
#!/bin/bash
21
41
$createdWith
22
42
23
43
# Support built in commands on windows out of the box.
24
- ${_dartCommandContent ('pub' )}
44
+ ${_dartCommandContentPub ('pub' )}
25
45
${_dartCommandContent ('dartfmt' )}
26
46
${_dartCommandContent ('dartanalyzer' )}''' ;
27
47
Original file line number Diff line number Diff line change 2
2
# Created with package:mono_repo v1.2.3
3
3
4
4
# Support built in commands on windows out of the box.
5
+ # When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
6
+ # then "flutter" is called instead of "pub".
7
+ # This assumes that the Flutter SDK has been installed in a previous step.
5
8
function pub() {
6
- if [[ $TRAVIS_OS_NAME == " windows" ]]; then
7
- command pub.bat " $@ "
9
+ if grep -Fq " sdk: flutter" " ${PWD} /pubspec.yaml" ; then
10
+ if [[ $TRAVIS_OS_NAME == " windows" ]]; then
11
+ command flutter.bat pub " $@ "
12
+ else
13
+ command flutter pub " $@ "
14
+ fi
8
15
else
9
- command pub " $@ "
16
+ if [[ $TRAVIS_OS_NAME == " windows" ]]; then
17
+ command pub.bat " $@ "
18
+ else
19
+ command pub " $@ "
20
+ fi
10
21
fi
11
22
}
12
23
function dartfmt() {
Original file line number Diff line number Diff line change 2
2
# Created with package:mono_repo v4.0.0-dev
3
3
4
4
# Support built in commands on windows out of the box.
5
+ # When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
6
+ # then "flutter" is called instead of "pub".
7
+ # This assumes that the Flutter SDK has been installed in a previous step.
5
8
function pub() {
6
- if [[ $TRAVIS_OS_NAME == " windows" ]]; then
7
- command pub.bat " $@ "
9
+ if grep -Fq " sdk: flutter" " ${PWD} /pubspec.yaml" ; then
10
+ if [[ $TRAVIS_OS_NAME == " windows" ]]; then
11
+ command flutter.bat pub " $@ "
12
+ else
13
+ command flutter pub " $@ "
14
+ fi
8
15
else
9
- command pub " $@ "
16
+ if [[ $TRAVIS_OS_NAME == " windows" ]]; then
17
+ command pub.bat " $@ "
18
+ else
19
+ command pub " $@ "
20
+ fi
10
21
fi
11
22
}
12
23
function dartfmt() {
You can’t perform that action at this time.
0 commit comments