Skip to content

Commit ddca16b

Browse files
committed
Merge branch 'master' into cli-inception
2 parents eb9e737 + bbf7051 commit ddca16b

File tree

6 files changed

+61
-19
lines changed

6 files changed

+61
-19
lines changed

arduino-builder/main.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,8 @@ func (h *foldersFlag) String() string {
9696
return fmt.Sprint(*h)
9797
}
9898

99-
func (h *foldersFlag) Set(csv string) error {
100-
var values []string
101-
if strings.Contains(csv, string(os.PathListSeparator)) {
102-
values = strings.Split(csv, string(os.PathListSeparator))
103-
} else {
104-
values = strings.Split(csv, ",")
105-
}
106-
107-
for _, value := range values {
108-
value = strings.TrimSpace(value)
109-
*h = append(*h, value)
110-
}
111-
99+
func (h *foldersFlag) Set(folder string) error {
100+
*h = append(*h, folder)
112101
return nil
113102
}
114103

create_cmake_rule.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ func (s *ExportProjectCMake) Run(ctx *types.Context) error {
109109

110110
// Use old ctags method to generate export file
111111
commands := []types.Command{
112-
&ContainerMergeCopySketchFiles{},
112+
//&ContainerMergeCopySketchFiles{},
113113
&ContainerAddPrototypes{},
114-
&FilterSketchSource{Source: &ctx.Source, RemoveLineMarkers: true},
115-
&SketchSaver{},
114+
//&FilterSketchSource{Source: &ctx.Source, RemoveLineMarkers: true},
115+
//&SketchSaver{},
116116
}
117117

118118
for _, command := range commands {

ctags/ctags_to_prototypes.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ func functionNameUsedAsFunctionPointerIn(tag *types.CTag, functionTags []*types.
7272
if tag.Line != functionTag.Line && strings.Index(tag.Code, "&"+functionTag.FunctionName) != -1 {
7373
return true
7474
}
75-
if tag.Line != functionTag.Line && strings.Index(tag.Code, functionTag.FunctionName) != -1 &&
76-
(functionTag.Signature == "(void)" || functionTag.Signature == "()") {
75+
if tag.Line != functionTag.Line && strings.Index(strings.TrimSpace(tag.Code), "("+functionTag.FunctionName+")") != -1 {
7776
return true
7877
}
7978
}

test/prototypes_adder_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,3 +907,44 @@ func TestPrototypesAdderSketchWithDosEol(t *testing.T) {
907907
}
908908
// only requires no error as result
909909
}
910+
911+
func TestPrototypesAdderSketchWithSubstringFunctionMember(t *testing.T) {
912+
DownloadCoresAndToolsAndLibraries(t)
913+
sketchLocation := paths.New("sketch_with_class_and_method_substring", "sketch_with_class_and_method_substring.ino")
914+
quotedSketchLocation := utils.QuoteCppString(Abs(t, sketchLocation).String())
915+
916+
ctx := &types.Context{
917+
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
918+
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
919+
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
920+
OtherLibrariesDirs: paths.NewPathList("libraries"),
921+
SketchLocation: sketchLocation,
922+
FQBN: parseFQBN(t, "arduino:avr:uno"),
923+
ArduinoAPIVersion: "10600",
924+
Verbose: true,
925+
}
926+
927+
buildPath := SetupBuildPath(t, ctx)
928+
defer buildPath.RemoveAll()
929+
930+
commands := []types.Command{
931+
932+
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
933+
934+
&builder.ContainerMergeCopySketchFiles{},
935+
936+
&builder.ContainerFindIncludes{},
937+
938+
&builder.PrintUsedLibrariesIfVerbose{},
939+
&builder.WarnAboutArchIncompatibleLibraries{},
940+
941+
&builder.ContainerAddPrototypes{},
942+
}
943+
944+
for _, command := range commands {
945+
err := command.Run(ctx)
946+
NoError(t, err)
947+
}
948+
949+
require.Contains(t, ctx.Source, "class Foo {\nint blooper(int x) { return x+1; }\n};\n\nFoo foo;\n\n#line 7 "+quotedSketchLocation+"\nvoid setup();")
950+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Foo {
2+
int blooper(int x) { return x+1; }
3+
};
4+
5+
Foo foo;
6+
7+
void setup() {
8+
foo.setup();
9+
}
10+
11+
void loop() {
12+
foo.loop();
13+
}

utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func FilterFiles() filterFiles {
153153
}
154154
}
155155

156-
var SOURCE_CONTROL_FOLDERS = map[string]bool{"CVS": true, "RCS": true, ".git": true, ".github": true, ".svn": true, ".hg": true, ".bzr": true, ".vscode": true}
156+
var SOURCE_CONTROL_FOLDERS = map[string]bool{"CVS": true, "RCS": true, ".git": true, ".github": true, ".svn": true, ".hg": true, ".bzr": true, ".vscode": true, ".settings": true}
157157

158158
func IsSCCSOrHiddenFile(file os.FileInfo) bool {
159159
return IsSCCSFile(file) || IsHiddenFile(file)

0 commit comments

Comments
 (0)