@@ -51,3 +51,36 @@ func TestCompileWithProfiles(t *testing.T) {
51
51
_ , _ , err = cli .Run ("compile" , "-m" , "avr2" , sketchPath .String ())
52
52
require .NoError (t , err )
53
53
}
54
+
55
+ func TestBuilderDidNotCatchLibsFromUnusedPlatforms (t * testing.T ) {
56
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
57
+ defer env .CleanUp ()
58
+
59
+ // Init the environment explicitly
60
+ _ , _ , err := cli .Run ("core" , "update-index" )
61
+ require .NoError (t , err )
62
+
63
+ // copy sketch into the working directory
64
+ sketchName := "sketch_with_error_including_wire"
65
+ p , err := paths .Getwd ()
66
+ require .NoError (t , err )
67
+ require .NotNil (t , p )
68
+ testSketch := p .Parent ().Join ("testdata" , sketchName )
69
+ sketchPath := cli .SketchbookDir ().Join (sketchName )
70
+ err = testSketch .CopyDirTo (sketchPath )
71
+ require .NoError (t , err )
72
+
73
+ // install two platforms with the Wire library bundled
74
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr" )
75
+ require .NoError (t , err )
76
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:samd" )
77
+ require .NoError (t , err )
78
+
79
+ // compile for AVR
80
+ stdout , stderr , err := cli .Run ("compile" , "-b" , "arduino:avr:uno" , sketchPath .String ())
81
+ require .Error (t , err )
82
+
83
+ // check that the libary resolver did not take the SAMD bundled Wire library into account
84
+ require .NotContains (t , string (stdout ), "samd" )
85
+ require .NotContains (t , string (stderr ), "samd" )
86
+ }
0 commit comments