@@ -2,14 +2,14 @@ import std.file;
22import std.process ;
33import std.stdio : writeln;
44
5- bool envBool (string name)
5+ string envGet (string name)
66{
7- return environment.get (name, null ) == " true " ;
7+ return environment.get (name, null );
88}
99
10- string envGet (string name)
10+ bool envBool (string name)
1111{
12- return environment.get (name, null );
12+ return environment.get (name, null ) == " true " ;
1313}
1414
1515void copyIfExists (string from, string to)
@@ -30,41 +30,51 @@ int main()
3030
3131 // MySQL is not installed by default on OSX build agents
3232 auto mysqlPrefix = " " ;
33- if (environment[" TRAVIS_OS_NAME" ] == " osx" )
33+ if (environment[" TRAVIS_OS_NAME" ] == " osx" )
3434 {
35- if (envGet(" DB" ) == " mysql-5.6" )
36- {
37- spawnShell(" brew update" ).wait;
38- spawnShell(" brew install mysql@5.6 && brew services start mysql56" ).wait;
39- mysqlPrefix = " /usr/local/opt/mysql@5.6/bin/" ;
40- }
41- else if (envGet(" DB" ) == " mysql-latest" )
42- {
43- spawnShell(" brew update" ).wait;
44- spawnShell(" brew install mysql && brew services start mysql" ).wait;
45- }
46- else
47- {
48- writeln(" Envar 'DB' must be 'mysql-5.6' or 'mysql-latest', not '" , envGet(" DB" ), " '" );
49- return 1 ;
50- }
35+ if (envGet(" DB" ) == " mysql-5.6" )
36+ {
37+ spawnShell(" brew update" ).wait;
38+ spawnShell(" brew install mysql@5.6 && brew services start mysql56" ).wait;
39+ mysqlPrefix = " /usr/local/opt/mysql@5.6/bin/" ;
40+ }
41+ else if (envGet(" DB" ) == " mysql-latest" )
42+ {
43+ spawnShell(" brew update" ).wait;
44+ spawnShell(" brew install mysql && brew services start mysql" ).wait;
45+ }
46+ else
47+ {
48+ writeln(" Envar 'DB' must be 'mysql-5.6' or 'mysql-latest', not '" , envGet(" DB" ), " '" );
49+ return 1 ;
50+ }
5151 }
5252
53- // If an alternate dub.selections.json was requested, use it.
54- if (environment.get (" DUB_SELECT" ) != null ) {
53+ // Use the requested version of dub.selections.json.
54+ if (envGet(" DUB_SELECT" ) != null )
55+ {
5556 string dubSelections = " dub.selections." ~ envGet(" DUB_SELECT" )~ " .json" ;
5657 writeln(" Using alternative dub dependencies file: " , dubSelections);
5758 copy(dubSelections, " dub.selections.json" );
5859 copy(" examples/homePage/dub.selections." ~ envGet(" DUB_SELECT" )~ " .json" , " examples/homePage/dub.selections.json" );
5960 }
61+ else if (! envBool(" NO_VIBE" ) && ! envBool(" DUB_UPGRADE" ))
62+ {
63+ writeln(" ERROR: All travis jobs must specify one of the following environment variables:" );
64+ writeln(" DUB_SELECT=... *or* DUB_UPGRADE=true *or* NO_VIBE=true." );
65+ return 1 ;
66+ }
6067
68+ // Download (and maybe upgrade) DUB dependencies
69+ //
70+ // Doing this here, instead of when "dub test" is run later,
71+ // ensures that any intermittent server
72+ // failures are more likely to be correctly marked as "job error"
73+ // rather than "tests failed".
6174 if (envBool(" DUB_UPGRADE" ))
6275 {
6376 // Update all dependencies
64- //
65- // As a bonus, this downloads & resolves deps now so intermittent
66- // failures are more likely to be correctly marked as "job error"
67- // rather than "tests failed".
77+ writeln(" Updating all DUB dependencies..." );
6878 spawnShell(" dub upgrade" ).wait;
6979 chdir(" examples/homePage" );
7080 spawnShell(" dub upgrade" ).wait;
@@ -73,9 +83,7 @@ int main()
7383 else
7484 {
7585 // Don't upgrade dependencies.
76- //
77- // But download & resolve deps now so intermittent failures are more likely
78- // to be correctly marked as "job error" rather than "tests failed".
86+ writeln(" Downloading dependencies WITHOUT upgrading them..." );
7987 spawnShell(" dub upgrade --missing-only" ).wait;
8088 chdir(" examples/homePage" );
8189 spawnShell(" dub upgrade --missing-only" ).wait;
0 commit comments