Skip to content

Commit ee6b995

Browse files
committed
Update UPGRADING.md
1 parent ac517be commit ee6b995

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

Diff for: docs/UPGRADING.md

+95
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,101 @@ Here you can find a list of migration guides to handle breaking changes between
44

55
## Unreleased
66

7+
### Change public library interface
8+
9+
#### `builder` package
10+
11+
This part refers to the `builder` package declared in `arduino/builder/`.
12+
13+
`GenBuildPath()` function has been moved to package `sketch` in `arduino/sketch/sketch.go`. The signature is unchanged.
14+
15+
`EnsureBuildPathExists` function from has been completely removed, in its place use
16+
`github.com/arduino/go-paths-helper.MkDirAll()`.
17+
18+
`SketchSaveItemCpp` function signature is changed from `path string, contents []byte, destPath string` to
19+
`path *paths.Path, contents []byte, destPath *paths.Path`. `paths` is `github.com/arduino/go-paths-helper`.
20+
21+
`SketchLoad` function has been removed, in its place use `sketch.New` from `arduino/sketch/sketch.go`.
22+
23+
```diff
24+
- SketchLoad("/some/path", "")
25+
+ sketch.New(paths.New("some/path))
26+
}
27+
```
28+
29+
If you need to set a custom build path you must instead set it after creating the Sketch.
30+
31+
```diff
32+
- SketchLoad("/some/path", "/my/build/path")
33+
+ s, err := sketch.New(paths.New("some/path))
34+
+ s.BuildPath = paths.new("/my/build/path")
35+
}
36+
```
37+
38+
`SketchCopyAdditionalFiles` function signature is changed from
39+
`sketch *sketch.Sketch, destPath string, overrides map[string]string` to
40+
`sketch *sketch.Sketch, destPath *paths.Path, overrides map[string]string`.
41+
42+
#### `sketch` package
43+
44+
This part refers to the `sketch` package declared in `arduino/sketch/`.
45+
46+
`Item` struct has been removed, use `go-paths-helper.Path` in its place.
47+
48+
`NewItem` has been removed too, use `go-paths-helper.New` in its place.
49+
50+
`GetSourceBytes` has been removed, in its place use `go-paths-helper.Path.ReadFile`. `GetSourceStr` too has been
51+
removed, in its place:
52+
53+
```diff
54+
- s, err := item.GetSourceStr()
55+
+ data, err := file.ReadFile()
56+
+ s := string(data)
57+
}
58+
```
59+
60+
`ItemByPath` type and its member functions have been removed, use `go-paths-helper.PathList` in its place.
61+
62+
`Sketch.LocationPath` has been renamed to `FullPath` and its type changed from `string` to `go-paths-helper.Path`.
63+
64+
`Sketch.MainFile` type has changed from `*Item` to `go-paths-helper.Path`. `Sketch.OtherSketchFiles`,
65+
`Sketch.AdditionalFiles` and `Sketch.RootFolderFiles` type has changed from `[]*Item` to `go-paths-helper.PathList`.
66+
67+
`New` signature has been changed from `sketchFolderPath, mainFilePath, buildPath string, allFilesPaths []string` to
68+
`path *go-paths-helper.Path`.
69+
70+
`CheckSketchCasing` function is now private, the check is done internally by `New`.
71+
72+
`InvalidSketchFoldernameError` has been renamed `InvalidSketchFolderNameError`.
73+
74+
#### `sketches` package
75+
76+
This part refers to the `sketches` package declared in `arduino/sketches/`.
77+
78+
`Sketch` struct has been merged with `sketch.Sketch` struct.
79+
80+
`Metadata` and `BoardMetadata` structs have been moved to `sketch` package.
81+
82+
`NewSketchFromPath` has been deleted, use `sketch.New` in its place.
83+
84+
`ImportMetadata` is now private called internally by `sketch.New`.
85+
86+
`ExportMetadata` has been moved to `sketch` package.
87+
88+
`BuildPath` has been removed, use `sketch.Sketch.BuildPath` in its place.
89+
90+
`CheckForPdeFiles` has been moved to `sketch` package.
91+
92+
#### `types` package
93+
94+
This part refers to the `types` package declared in `legacy/builder/types/`.
95+
96+
`Sketch` has been removed, use `sketch.Sketch` in its place.
97+
98+
`SketchToLegacy` and `SketchFromLegacy` have been removed, nothing replaces them.
99+
100+
`Context.Sketch` types has been changed from `Sketch` to `sketch.Sketch`.
101+
7102
### Change of behaviour of gRPC `Init` function
8103

9104
Previously the `Init` function was used to both create a new `CoreInstance` and initialize it, so that the internal

0 commit comments

Comments
 (0)