Skip to content

Commit 25cb678

Browse files
committed
Imported arduino-builder as legacy module
1 parent 6a2d8de commit 25cb678

File tree

299 files changed

+29766
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+29766
-8
lines changed

commands/compile/compile.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import (
2626
"sort"
2727
"strings"
2828

29-
builder "github.com/arduino/arduino-builder"
30-
"github.com/arduino/arduino-builder/i18n"
31-
"github.com/arduino/arduino-builder/types"
29+
"github.com/arduino/arduino-cli/legacy/builder"
30+
"github.com/arduino/arduino-cli/legacy/builder/i18n"
31+
"github.com/arduino/arduino-cli/legacy/builder/types"
3232
"github.com/arduino/arduino-cli/arduino/cores"
3333
"github.com/arduino/arduino-cli/arduino/cores/packagemanager"
3434
"github.com/arduino/arduino-cli/arduino/sketches"

go.mod

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ module github.com/arduino/arduino-cli
33
go 1.12
44

55
require (
6-
github.com/arduino/arduino-builder v0.0.0-20190412183451-a4859ca30383
76
github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c
87
github.com/arduino/go-paths-helper v0.0.0-20190214132331-c3c98d1bf2e1
98
github.com/arduino/go-properties-orderedmap v0.0.0-20181003091528-89278049acd3
10-
github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b // indirect
9+
github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b
1110
github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b
1211
github.com/bouk/monkey v1.0.0
1312
github.com/cmaglie/pb v1.0.27
@@ -18,7 +17,8 @@ require (
1817
github.com/fatih/color v1.6.0
1918
github.com/fluxio/iohelpers v0.0.0-20160419043813-3a4dd67a94d2 // indirect
2019
github.com/fluxio/multierror v0.0.0-20160419044231-9c68d39025e5 // indirect
21-
github.com/go-errors/errors v1.0.1 // indirect
20+
github.com/fsnotify/fsnotify v1.4.7
21+
github.com/go-errors/errors v1.0.1
2222
github.com/golang/protobuf v1.3.1
2323
github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282
2424
github.com/h2non/filetype v1.0.8 // indirect
@@ -49,6 +49,7 @@ require (
4949
go.bug.st/serial.v1 v0.0.0-20180827123349-5f7892a7bb45
5050
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
5151
golang.org/x/net v0.0.0-20190311183353-d8887717615a
52+
golang.org/x/text v0.3.0
5253
google.golang.org/genproto v0.0.0-20190327125643-d831d65fe17d // indirect
5354
google.golang.org/grpc v1.19.1
5455
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
22
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
3-
github.com/arduino/arduino-builder v0.0.0-20190412183451-a4859ca30383 h1:GnRuHA8ZpNAt4sDNmPy/Cvk75jnzoSS6mWZGVNDj2eE=
4-
github.com/arduino/arduino-builder v0.0.0-20190412183451-a4859ca30383/go.mod h1:Rs4tZQDLujNdbD1dyLjYSP2Y6gvE3U7OMCPNdFn5eCI=
53
github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c h1:agh2JT96G8egU7FEb13L4dq3fnCN7lxXhJ86t69+W7s=
64
github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c/go.mod h1:HK7SpkEax/3P+0w78iRQx1sz1vCDYYw9RXwHjQTB5i8=
75
github.com/arduino/go-paths-helper v0.0.0-20190214132331-c3c98d1bf2e1 h1:S0NpDSqjlkNA510vmRCP5Cq9mPgu3rWDSdeN4SI1Mwc=

legacy/builder/.gitignore

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
bin
2+
src/github.com
3+
src/golang.org
4+
./arduino-builder
5+
6+
# Created by .ignore support plugin (hsz.mobi)
7+
### Go template
8+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
9+
*.o
10+
*.a
11+
*.so
12+
13+
# Folders
14+
_obj
15+
_test
16+
17+
# Architecture specific extensions/prefixes
18+
*.[568vq]
19+
[568vq].out
20+
21+
*.cgo1.go
22+
*.cgo2.c
23+
_cgo_defun.c
24+
_cgo_gotypes.go
25+
_cgo_export.*
26+
27+
_testmain.go
28+
29+
*.exe
30+
*.test
31+
*.prof
32+
33+
34+
35+
### JetBrains template
36+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
37+
38+
*.iml
39+
40+
## Directory-based project format:
41+
.idea/
42+
# if you remove the above rule, at least ignore the following:
43+
44+
# User-specific stuff:
45+
# .idea/workspace.xml
46+
# .idea/tasks.xml
47+
# .idea/dictionaries
48+
49+
# Sensitive or high-churn files:
50+
# .idea/dataSources.ids
51+
# .idea/dataSources.xml
52+
# .idea/sqlDataSources.xml
53+
# .idea/dynamic.xml
54+
# .idea/uiDesigner.xml
55+
56+
# Gradle:
57+
# .idea/gradle.xml
58+
# .idea/libraries
59+
60+
# Mongo Explorer plugin:
61+
# .idea/mongoSettings.xml
62+
63+
## File-based project format:
64+
*.ipr
65+
*.iws
66+
67+
## Plugin-specific files:
68+
69+
# IntelliJ
70+
out/
71+
72+
# mpeltonen/sbt-idea plugin
73+
.idea_modules/
74+
75+
# JIRA plugin
76+
atlassian-ide-plugin.xml
77+
78+
# Crashlytics plugin (for Android Studio and IntelliJ)
79+
com_crashlytics_export_strings.xml
80+
crashlytics.properties
81+
crashlytics-build.properties
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* This file is part of Arduino Builder.
3+
*
4+
* Arduino Builder is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*
18+
* As a special exception, you may use this file as part of a free software
19+
* library without restriction. Specifically, if other files instantiate
20+
* templates or use macros or inline functions from this file, or you compile
21+
* this file and link it with other files to produce an executable, this
22+
* file does not by itself cause the resulting executable to be covered by
23+
* the GNU General Public License. This exception does not however
24+
* invalidate any other reasons why the executable file might be covered by
25+
* the GNU General Public License.
26+
*
27+
* Copyright 2015 Arduino LLC (http://www.arduino.cc/)
28+
*/
29+
30+
package builder
31+
32+
import (
33+
"github.com/arduino/arduino-cli/legacy/builder/constants"
34+
"github.com/arduino/arduino-cli/legacy/builder/i18n"
35+
"github.com/arduino/arduino-cli/legacy/builder/types"
36+
"github.com/arduino/arduino-cli/arduino/cores"
37+
)
38+
39+
type AddAdditionalEntriesToContext struct{}
40+
41+
func (*AddAdditionalEntriesToContext) Run(ctx *types.Context) error {
42+
if ctx.BuildPath != nil {
43+
buildPath := ctx.BuildPath
44+
preprocPath, err := buildPath.Join(constants.FOLDER_PREPROC).Abs()
45+
if err != nil {
46+
return i18n.WrapError(err)
47+
}
48+
sketchBuildPath, err := buildPath.Join(constants.FOLDER_SKETCH).Abs()
49+
if err != nil {
50+
return i18n.WrapError(err)
51+
}
52+
librariesBuildPath, err := buildPath.Join("libraries").Abs()
53+
if err != nil {
54+
return i18n.WrapError(err)
55+
}
56+
coreBuildPath, err := buildPath.Join(constants.FOLDER_CORE).Abs()
57+
if err != nil {
58+
return i18n.WrapError(err)
59+
}
60+
61+
ctx.PreprocPath = preprocPath
62+
ctx.SketchBuildPath = sketchBuildPath
63+
ctx.LibrariesBuildPath = librariesBuildPath
64+
ctx.CoreBuildPath = coreBuildPath
65+
}
66+
67+
if ctx.BuildCachePath != nil {
68+
coreBuildCachePath, err := ctx.BuildCachePath.Join(constants.FOLDER_CORE).Abs()
69+
if err != nil {
70+
return i18n.WrapError(err)
71+
}
72+
73+
ctx.CoreBuildCachePath = coreBuildCachePath
74+
}
75+
76+
if ctx.WarningsLevel == "" {
77+
ctx.WarningsLevel = DEFAULT_WARNINGS_LEVEL
78+
}
79+
80+
ctx.CollectedSourceFiles = &types.UniqueSourceFileQueue{}
81+
82+
ctx.LibrariesResolutionResults = map[string]types.LibraryResolutionResult{}
83+
ctx.HardwareRewriteResults = map[*cores.PlatformRelease][]types.PlatforKeyRewrite{}
84+
85+
return nil
86+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* This file is part of Arduino Builder.
3+
*
4+
* Arduino Builder is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*
18+
* As a special exception, you may use this file as part of a free software
19+
* library without restriction. Specifically, if other files instantiate
20+
* templates or use macros or inline functions from this file, or you compile
21+
* this file and link it with other files to produce an executable, this
22+
* file does not by itself cause the resulting executable to be covered by
23+
* the GNU General Public License. This exception does not however
24+
* invalidate any other reasons why the executable file might be covered by
25+
* the GNU General Public License.
26+
*
27+
* Copyright 2015 Arduino LLC (http://www.arduino.cc/)
28+
*/
29+
30+
package builder
31+
32+
import (
33+
"os"
34+
"strings"
35+
36+
"github.com/arduino/arduino-cli/legacy/builder/constants"
37+
"github.com/arduino/arduino-cli/legacy/builder/types"
38+
)
39+
40+
type AddBuildBoardPropertyIfMissing struct{}
41+
42+
func (*AddBuildBoardPropertyIfMissing) Run(ctx *types.Context) error {
43+
packages := ctx.Hardware
44+
logger := ctx.GetLogger()
45+
46+
for _, aPackage := range packages.Packages {
47+
for _, platform := range aPackage.Platforms {
48+
for _, platformRelease := range platform.Releases {
49+
for _, board := range platformRelease.Boards {
50+
if board.Properties.Get("build.board") == "" {
51+
board.Properties.Set("build.board", strings.ToUpper(platform.Architecture+"_"+board.BoardID))
52+
logger.Fprintln(
53+
os.Stdout,
54+
constants.LOG_LEVEL_WARN,
55+
constants.MSG_MISSING_BUILD_BOARD,
56+
aPackage.Name,
57+
platform.Architecture,
58+
board.BoardID,
59+
board.Properties.Get(constants.BUILD_PROPERTIES_BUILD_BOARD))
60+
}
61+
}
62+
}
63+
}
64+
}
65+
66+
return nil
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* This file is part of Arduino Builder.
3+
*
4+
* Arduino Builder is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*
18+
* As a special exception, you may use this file as part of a free software
19+
* library without restriction. Specifically, if other files instantiate
20+
* templates or use macros or inline functions from this file, or you compile
21+
* this file and link it with other files to produce an executable, this
22+
* file does not by itself cause the resulting executable to be covered by
23+
* the GNU General Public License. This exception does not however
24+
* invalidate any other reasons why the executable file might be covered by
25+
* the GNU General Public License.
26+
*
27+
* Copyright 2015 Arduino LLC (http://www.arduino.cc/)
28+
*/
29+
30+
package builder
31+
32+
import (
33+
"github.com/arduino/arduino-cli/legacy/builder/ctags"
34+
"github.com/arduino/arduino-cli/legacy/builder/types"
35+
)
36+
37+
type AddMissingBuildPropertiesFromParentPlatformTxtFiles struct{}
38+
39+
func (s *AddMissingBuildPropertiesFromParentPlatformTxtFiles) Run(ctx *types.Context) error {
40+
buildProperties := ctx.BuildProperties
41+
42+
newBuildProperties := ctags.CtagsProperties.Clone()
43+
newBuildProperties.Merge(ArduinoPreprocessorProperties)
44+
newBuildProperties.Merge(buildProperties)
45+
ctx.BuildProperties = newBuildProperties
46+
47+
return nil
48+
}

0 commit comments

Comments
 (0)