Skip to content

Refactored build-properties creation (and removed some legacy code) #2082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions arduino/cores/board.go
Original file line number Diff line number Diff line change
@@ -125,6 +125,8 @@ func (b *Board) GetBuildProperties(userConfigs *properties.Map) (*properties.Map

// Start with board's base properties
buildProperties := b.Properties.Clone()
buildProperties.Set("build.fqbn", b.FQBN())
buildProperties.Set("build.arch", strings.ToUpper(b.PlatformRelease.Platform.Architecture))

// Add all sub-configurations one by one (a config is: option=value)
// Check for residual invalid options...
6 changes: 6 additions & 0 deletions arduino/cores/board_test.go
Original file line number Diff line number Diff line change
@@ -216,9 +216,11 @@ func TestBoardOptions(t *testing.T) {
expConf2560.Set("bootloader.low_fuses", "0xFF")
expConf2560.Set("bootloader.tool", "avrdude")
expConf2560.Set("bootloader.unlock_bits", "0x3F")
expConf2560.Set("build.arch", "AVR")
expConf2560.Set("build.board", "AVR_MEGA2560")
expConf2560.Set("build.core", "arduino")
expConf2560.Set("build.f_cpu", "16000000L")
expConf2560.Set("build.fqbn", "arduino:avr:mega")
expConf2560.Set("build.mcu", "atmega2560")
expConf2560.Set("build.variant", "mega")
expConf2560.Set("menu.cpu.atmega1280", "ATmega1280")
@@ -275,9 +277,11 @@ func TestBoardOptions(t *testing.T) {
expConf1280.Set("bootloader.low_fuses", "0xFF")
expConf1280.Set("bootloader.tool", "avrdude")
expConf1280.Set("bootloader.unlock_bits", "0x3F")
expConf1280.Set("build.arch", "AVR")
expConf1280.Set("build.board", "AVR_MEGA")
expConf1280.Set("build.core", "arduino")
expConf1280.Set("build.f_cpu", "16000000L")
expConf1280.Set("build.fqbn", "arduino:avr:mega")
expConf1280.Set("build.mcu", "atmega1280")
expConf1280.Set("build.variant", "mega")
expConf1280.Set("menu.cpu.atmega1280", "ATmega1280")
@@ -334,9 +338,11 @@ func TestBoardOptions(t *testing.T) {
expWatterott.Set("bootloader.low_fuses", "0xE2")
expWatterott.Set("bootloader.tool", "avrdude")
expWatterott.Set("bootloader.unlock_bits", "0xFF")
expWatterott.Set("build.arch", "AVR")
expWatterott.Set("build.board", "AVR_ATTINY841")
expWatterott.Set("build.core", "tiny841")
expWatterott.Set("build.f_cpu", "8000000L")
expWatterott.Set("build.fqbn", "watterott:avr:attiny841")
expWatterott.Set("build.mcu", "attiny841")
expWatterott.Set("build.variant", "tiny14")
expWatterott.Set("menu.core.arduino", "Standard Arduino")
4 changes: 2 additions & 2 deletions arduino/cores/cores.go
Original file line number Diff line number Diff line change
@@ -336,8 +336,8 @@ func (release *PlatformRelease) RequiresToolRelease(toolRelease *ToolRelease) bo
func (release *PlatformRelease) RuntimeProperties() *properties.Map {
res := properties.NewMap()
if release.InstallDir != nil {
res.Set("runtime.platform.path", release.InstallDir.String())
res.Set("runtime.hardware.path", release.InstallDir.Join("..").String())
res.SetPath("runtime.platform.path", release.InstallDir)
res.SetPath("runtime.hardware.path", release.InstallDir.Join(".."))
}

return res
146 changes: 121 additions & 25 deletions arduino/cores/packagemanager/package_manager.go
Original file line number Diff line number Diff line change
@@ -18,9 +18,13 @@ package packagemanager
import (
"fmt"
"net/url"
"os"
"path"
"path/filepath"
"strconv"
"strings"
"sync"
"time"

"github.com/arduino/arduino-cli/arduino/cores"
"github.com/arduino/arduino-cli/arduino/cores/packageindex"
@@ -29,6 +33,7 @@ import (
"github.com/arduino/arduino-cli/i18n"
paths "github.com/arduino/go-paths-helper"
properties "github.com/arduino/go-properties-orderedmap"
"github.com/arduino/go-timeutils"
"github.com/sirupsen/logrus"
semver "go.bug.st/relaxed-semver"
)
@@ -275,50 +280,141 @@ func (pme *Explorer) ResolveFQBN(fqbn *cores.FQBN) (
return targetPackage, nil, nil, nil, nil,
fmt.Errorf(tr("unknown platform %s:%s"), targetPackage, fqbn.PlatformArch)
}
platformRelease := pme.GetInstalledPlatformRelease(platform)
if platformRelease == nil {
boardPlatformRelease := pme.GetInstalledPlatformRelease(platform)
if boardPlatformRelease == nil {
return targetPackage, nil, nil, nil, nil,
fmt.Errorf(tr("platform %s is not installed"), platform)
}

// Find board
board := platformRelease.Boards[fqbn.BoardID]
board := boardPlatformRelease.Boards[fqbn.BoardID]
if board == nil {
return targetPackage, platformRelease, nil, nil, nil,
return targetPackage, boardPlatformRelease, nil, nil, nil,
fmt.Errorf(tr("board %s not found"), fqbn.StringWithoutConfig())
}

buildProperties, err := board.GetBuildProperties(fqbn.Configs)
boardBuildProperties, err := board.GetBuildProperties(fqbn.Configs)
if err != nil {
return targetPackage, platformRelease, board, nil, nil,
return targetPackage, boardPlatformRelease, board, nil, nil,
fmt.Errorf(tr("getting build properties for board %[1]s: %[2]s"), board, err)
}

// Determine the platform used for the build (in case the board refers
// Determine the platform used for the build and the variant (in case the board refers
// to a core contained in another platform)
buildPlatformRelease := platformRelease
coreParts := strings.Split(buildProperties.Get("build.core"), ":")
if len(coreParts) > 1 {
referredPackage := coreParts[0]
buildPackage := pme.packages[referredPackage]
if buildPackage == nil {
return targetPackage, platformRelease, board, buildProperties, nil,
fmt.Errorf(tr("missing package %[1]s referenced by board %[2]s"), referredPackage, fqbn)
core, corePlatformRelease, variant, variantPlatformRelease, err := pme.determineReferencedPlatformRelease(boardBuildProperties, boardPlatformRelease, fqbn)
if err != nil {
return targetPackage, boardPlatformRelease, board, nil, nil, err
}

// Create the build properties map by overlaying the properties of the
// referenced platform propeties, the board platform properties and the
// board specific properties.
buildProperties := properties.NewMap()
buildProperties.Merge(variantPlatformRelease.Properties)
buildProperties.Merge(corePlatformRelease.Properties)
buildProperties.Merge(boardPlatformRelease.Properties)
buildProperties.Merge(boardBuildProperties)

// Add runtime build properties
buildProperties.Merge(boardPlatformRelease.RuntimeProperties())
buildProperties.SetPath("build.core.path", corePlatformRelease.InstallDir.Join("cores", core))
buildProperties.SetPath("build.system.path", corePlatformRelease.InstallDir.Join("system"))
buildProperties.Set("build.variant.path", "")
if variant != "" {
buildProperties.SetPath("build.variant.path", variantPlatformRelease.InstallDir.Join("variants", variant))
}

for _, tool := range pme.GetAllInstalledToolsReleases() {
buildProperties.Merge(tool.RuntimeProperties())
}
requiredTools, err := pme.FindToolsRequiredForBuild(boardPlatformRelease, corePlatformRelease)
if err != nil {
return targetPackage, boardPlatformRelease, board, buildProperties, corePlatformRelease, err
}
for _, tool := range requiredTools {
buildProperties.Merge(tool.RuntimeProperties())
}
now := time.Now()
buildProperties.Set("extra.time.utc", strconv.FormatInt(now.Unix(), 10))
buildProperties.Set("extra.time.local", strconv.FormatInt(timeutils.LocalUnix(now), 10))
buildProperties.Set("extra.time.zone", strconv.Itoa(timeutils.TimezoneOffsetNoDST(now)))
buildProperties.Set("extra.time.dst", strconv.Itoa(timeutils.DaylightSavingsOffset(now)))

if !buildProperties.ContainsKey("runtime.ide.path") {
if ex, err := os.Executable(); err == nil {
buildProperties.Set("runtime.ide.path", filepath.Dir(ex))
} else {
buildProperties.Set("runtime.ide.path", "")
}
buildPlatform := buildPackage.Platforms[fqbn.PlatformArch]
if buildPlatform == nil {
return targetPackage, platformRelease, board, buildProperties, nil,
fmt.Errorf(tr("missing platform %[1]s:%[2]s referenced by board %[3]s"), referredPackage, fqbn.PlatformArch, fqbn)
}
buildProperties.Set("runtime.os", properties.GetOSSuffix())
buildProperties.Set("build.library_discovery_phase", "0")
// Deprecated properties
buildProperties.Set("ide_version", "10607")
buildProperties.Set("runtime.ide.version", "10607")
if !buildProperties.ContainsKey("software") {
buildProperties.Set("software", "ARDUINO")
}

buildProperties.Merge(pme.GetCustomGlobalProperties())

return targetPackage, boardPlatformRelease, board, buildProperties, corePlatformRelease, nil
}

func (pme *Explorer) determineReferencedPlatformRelease(boardBuildProperties *properties.Map, boardPlatformRelease *cores.PlatformRelease, fqbn *cores.FQBN) (string, *cores.PlatformRelease, string, *cores.PlatformRelease, error) {
core := boardBuildProperties.Get("build.core")
referredCore := ""
if split := strings.Split(core, ":"); len(split) > 1 {
referredCore, core = split[0], split[1]
}

variant := boardBuildProperties.Get("build.variant")
referredVariant := ""
if split := strings.Split(variant, ":"); len(split) > 1 {
referredVariant, variant = split[0], split[1]
}

// core and variant cannot refer to two different platforms
if referredCore != "" && referredVariant != "" && referredCore != referredVariant {
return "", nil, "", nil,
fmt.Errorf(tr("'build.core' and 'build.variant' refer to different platforms: %[1]s and %[2]s"), referredCore+":"+core, referredVariant+":"+variant)
}

// extract the referred platform
var referredPlatformRelease *cores.PlatformRelease
referredPackageName := referredCore
if referredPackageName == "" {
referredPackageName = referredVariant
}
if referredPackageName != "" {
referredPackage := pme.packages[referredPackageName]
if referredPackage == nil {
return "", nil, "", nil,
fmt.Errorf(tr("missing package %[1]s referenced by board %[2]s"), referredPackageName, fqbn)
}
referredPlatform := referredPackage.Platforms[fqbn.PlatformArch]
if referredPlatform == nil {
return "", nil, "", nil,
fmt.Errorf(tr("missing platform %[1]s:%[2]s referenced by board %[3]s"), referredPackageName, fqbn.PlatformArch, fqbn)
}
buildPlatformRelease = pme.GetInstalledPlatformRelease(buildPlatform)
if buildPlatformRelease == nil {
return targetPackage, platformRelease, board, buildProperties, nil,
fmt.Errorf(tr("missing platform release %[1]s:%[2]s referenced by board %[3]s"), referredPackage, fqbn.PlatformArch, fqbn)
referredPlatformRelease = pme.GetInstalledPlatformRelease(referredPlatform)
if referredPlatformRelease == nil {
return "", nil, "", nil,
fmt.Errorf(tr("missing platform release %[1]s:%[2]s referenced by board %[3]s"), referredPackageName, fqbn.PlatformArch, fqbn)
}
}

// No errors... phew!
return targetPackage, platformRelease, board, buildProperties, buildPlatformRelease, nil
corePlatformRelease := boardPlatformRelease
if referredCore != "" {
corePlatformRelease = referredPlatformRelease
}

variantPlatformRelease := boardPlatformRelease
if referredVariant != "" {
variantPlatformRelease = referredPlatformRelease
}

return core, corePlatformRelease, variant, variantPlatformRelease, nil
}

// LoadPackageIndex loads a package index by looking up the local cached file from the specified URL
4 changes: 2 additions & 2 deletions arduino/cores/packagemanager/package_manager_test.go
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ func TestResolveFQBN(t *testing.T) {
require.Equal(t, platformRelease.Platform.String(), "referenced:avr")
require.NotNil(t, board)
require.Equal(t, board.Name(), "Referenced dummy with invalid package")
require.NotNil(t, props)
require.Nil(t, props)
require.Nil(t, buildPlatformRelease)

// Test a board referenced from a non-existent platform/architecture
@@ -156,7 +156,7 @@ func TestResolveFQBN(t *testing.T) {
require.Equal(t, platformRelease.Platform.String(), "referenced:avr")
require.NotNil(t, board)
require.Equal(t, board.Name(), "Referenced dummy with invalid platform")
require.NotNil(t, props)
require.Nil(t, props)
require.Nil(t, buildPlatformRelease)

// Test a board referenced from a non-existent core
3 changes: 0 additions & 3 deletions commands/compile/compile.go
Original file line number Diff line number Diff line change
@@ -174,9 +174,6 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream

builderCtx.BuiltInLibrariesDirs = configuration.IDEBuiltinLibrariesDir(configuration.Settings)

// Will be deprecated.
builderCtx.ArduinoAPIVersion = "10607"

builderCtx.Stdout = outStream
builderCtx.Stderr = errStream
builderCtx.Clean = req.GetClean()
14 changes: 0 additions & 14 deletions commands/upload/upload.go
Original file line number Diff line number Diff line change
@@ -292,20 +292,6 @@ func runProgramAction(pme *packagemanager.Explorer,
uploadProperties.Merge(programmer.Properties)
}

for _, tool := range pme.GetAllInstalledToolsReleases() {
uploadProperties.Merge(tool.RuntimeProperties())
}
if requiredTools, err := pme.FindToolsRequiredForBuild(boardPlatform, buildPlatform); err == nil {
for _, requiredTool := range requiredTools {
logrus.WithField("tool", requiredTool).Info("Tool required for upload")
if requiredTool.IsInstalled() {
uploadProperties.Merge(requiredTool.RuntimeProperties())
} else {
errStream.Write([]byte(tr("Warning: tool '%s' is not installed. It might not be available for your OS.", requiredTool)))
}
}
}

// Certain tools require the user to provide custom fields at run time,
// if they've been provided set them
// For more info:
1 change: 0 additions & 1 deletion legacy/builder/builder.go
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@ var tr = i18n.Tr

const DEFAULT_DEBUG_LEVEL = 5
const DEFAULT_WARNINGS_LEVEL = "none"
const DEFAULT_SOFTWARE = "ARDUINO"

type Builder struct{}

74 changes: 1 addition & 73 deletions legacy/builder/setup_build_properties.go
Original file line number Diff line number Diff line change
@@ -16,30 +16,15 @@
package builder

import (
"os"
"path/filepath"
"strconv"
"strings"
"time"

"github.com/arduino/arduino-cli/arduino/cores"
"github.com/arduino/arduino-cli/legacy/builder/types"
properties "github.com/arduino/go-properties-orderedmap"
timeutils "github.com/arduino/go-timeutils"
"github.com/pkg/errors"
)

type SetupBuildProperties struct{}

func (s *SetupBuildProperties) Run(ctx *types.Context) error {
packages := ctx.Hardware

targetPlatform := ctx.TargetPlatform
actualPlatform := ctx.ActualPlatform

buildProperties := properties.NewMap()
buildProperties.Merge(actualPlatform.Properties)
buildProperties.Merge(targetPlatform.Properties)
buildProperties.Merge(ctx.TargetBoardBuildProperties)

if ctx.BuildPath != nil {
@@ -48,26 +33,6 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
if ctx.Sketch != nil {
buildProperties.Set("build.project_name", ctx.Sketch.MainFile.Base())
}
buildProperties.Set("build.arch", strings.ToUpper(targetPlatform.Platform.Architecture))

// get base folder and use it to populate BUILD_PROPERTIES_RUNTIME_IDE_PATH (arduino and arduino-builder live in the same dir)
ex, err := os.Executable()
exPath := ""
if err == nil {
exPath = filepath.Dir(ex)
}

buildProperties.Set("build.core", ctx.BuildCore)
buildProperties.SetPath("build.core.path", actualPlatform.InstallDir.Join("cores", buildProperties.Get("build.core")))
buildProperties.Set("build.system.path", actualPlatform.InstallDir.Join("system").String())
buildProperties.Set("runtime.platform.path", targetPlatform.InstallDir.String())
buildProperties.Set("runtime.hardware.path", targetPlatform.InstallDir.Join("..").String())
buildProperties.Set("runtime.ide.version", ctx.ArduinoAPIVersion)
buildProperties.Set("runtime.ide.path", exPath)
buildProperties.Set("build.fqbn", ctx.FQBN.String())
buildProperties.Set("ide_version", ctx.ArduinoAPIVersion)
buildProperties.Set("runtime.os", properties.GetOSSuffix())
buildProperties.Set("build.library_discovery_phase", "0")

if ctx.OptimizeForDebug {
if buildProperties.ContainsKey("compiler.optimization_flags.debug") {
@@ -80,51 +45,14 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
}
ctx.OptimizationFlags = buildProperties.Get("compiler.optimization_flags")

variant := buildProperties.Get("build.variant")
if variant == "" {
buildProperties.Set("build.variant.path", "")
} else {
var variantPlatformRelease *cores.PlatformRelease
variantParts := strings.Split(variant, ":")
if len(variantParts) > 1 {
variantPlatform := packages[variantParts[0]].Platforms[targetPlatform.Platform.Architecture]
variantPlatformRelease = ctx.PackageManager.GetInstalledPlatformRelease(variantPlatform)
variant = variantParts[1]
} else {
variantPlatformRelease = targetPlatform
}
buildProperties.SetPath("build.variant.path", variantPlatformRelease.InstallDir.Join("variants", variant))
}

for _, tool := range ctx.AllTools {
buildProperties.SetPath("runtime.tools."+tool.Tool.Name+".path", tool.InstallDir)
buildProperties.SetPath("runtime.tools."+tool.Tool.Name+"-"+tool.Version.String()+".path", tool.InstallDir)
}
for _, tool := range ctx.RequiredTools {
buildProperties.SetPath("runtime.tools."+tool.Tool.Name+".path", tool.InstallDir)
buildProperties.SetPath("runtime.tools."+tool.Tool.Name+"-"+tool.Version.String()+".path", tool.InstallDir)
}

if !buildProperties.ContainsKey("software") {
buildProperties.Set("software", DEFAULT_SOFTWARE)
}

buildProperties.SetPath("build.source.path", ctx.Sketch.FullPath)

now := time.Now()
buildProperties.Set("extra.time.utc", strconv.FormatInt(now.Unix(), 10))
buildProperties.Set("extra.time.local", strconv.FormatInt(timeutils.LocalUnix(now), 10))
buildProperties.Set("extra.time.zone", strconv.Itoa(timeutils.TimezoneOffsetNoDST(now)))
buildProperties.Set("extra.time.dst", strconv.Itoa(timeutils.DaylightSavingsOffset(now)))

buildProperties.Merge(ctx.PackageManager.GetCustomGlobalProperties())

keychainProp := buildProperties.ContainsKey("build.keys.keychain")
signProp := buildProperties.ContainsKey("build.keys.sign_key")
encryptProp := buildProperties.ContainsKey("build.keys.encrypt_key")
// we verify that all the properties for the secure boot keys are defined or none of them is defined.
if (keychainProp || signProp || encryptProp) && !(keychainProp && signProp && encryptProp) {
return errors.Errorf("%s platform does not specify correctly default sign and encryption keys", targetPlatform.Platform)
return errors.Errorf("%s platform does not specify correctly default sign and encryption keys", ctx.TargetPlatform.Platform)
}

ctx.BuildProperties = buildProperties
14 changes: 6 additions & 8 deletions legacy/builder/target_board_resolver.go
Original file line number Diff line number Diff line change
@@ -30,14 +30,13 @@ func (s *TargetBoardResolver) Run(ctx *types.Context) error {
return fmt.Errorf("%s: %w", tr("Error resolving FQBN"), err)
}

core := buildProperties.Get("build.core")
if core == "" {
core = "arduino"
}
// select the core name in case of "package:core" format
core = core[strings.Index(core, ":")+1:]

if ctx.Verbose {
core := buildProperties.Get("build.core")
if core == "" {
core = "arduino"
}
// select the core name in case of "package:core" format
core = core[strings.Index(core, ":")+1:]
ctx.Info(tr("Using board '%[1]s' from platform in folder: %[2]s", targetBoard.BoardID, targetPlatform.InstallDir))
ctx.Info(tr("Using core '%[1]s' from platform in folder: %[2]s", core, buildPlatform.InstallDir))
}
@@ -55,7 +54,6 @@ func (s *TargetBoardResolver) Run(ctx *types.Context) error {
return err
}

ctx.BuildCore = core
ctx.TargetBoard = targetBoard
ctx.TargetBoardBuildProperties = buildProperties
ctx.TargetPlatform = targetPlatform
1 change: 0 additions & 1 deletion legacy/builder/test/builder_test.go
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@ func prepareBuilderTestContext(t *testing.T, sketchPath *paths.Path, fqbn string
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.New("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
ArduinoAPIVersion: "10600",
Verbose: false,
}
}
2 changes: 0 additions & 2 deletions legacy/builder/test/create_build_options_map_test.go
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ func TestCreateBuildOptionsMap(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: &sketch.Sketch{FullPath: paths.New("sketchLocation")},
FQBN: parseFQBN(t, "my:nice:fqbn"),
ArduinoAPIVersion: "ideVersion",
Verbose: true,
BuildPath: paths.New("buildPath"),
OptimizationFlags: "-Os",
@@ -50,7 +49,6 @@ func TestCreateBuildOptionsMap(t *testing.T) {
"fqbn": "my:nice:fqbn",
"hardwareFolders": "hardware,hardware2",
"otherLibrariesFolders": "libraries",
"runtime.ide.version": "ideVersion",
"sketchLocation": "sketchLocation"
}`, ctx.BuildOptionsJson)
}
5 changes: 0 additions & 5 deletions legacy/builder/test/ctags_runner_test.go
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@ func TestCTagsRunner(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -88,7 +87,6 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -136,7 +134,6 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -183,7 +180,6 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -229,7 +225,6 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

8 changes: 0 additions & 8 deletions legacy/builder/test/includes_to_include_folders_test.go
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ func TestIncludesToIncludeFolders(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("downloaded_libraries", "Bridge", "examples", "Bridge", "Bridge.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -72,7 +71,6 @@ func TestIncludesToIncludeFoldersSketchWithIfDef(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("SketchWithIfDef", "SketchWithIfDef.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -107,7 +105,6 @@ func TestIncludesToIncludeFoldersIRremoteLibrary(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch9", "sketch9.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -145,7 +142,6 @@ func TestIncludesToIncludeFoldersANewLibrary(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch10", "sketch10.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -179,7 +175,6 @@ func TestIncludesToIncludeFoldersDuplicateLibs(t *testing.T) {
BuiltInLibrariesDirs: paths.New("downloaded_libraries"),
Sketch: OpenSketch(t, paths.New("user_hardware", "my_avr_platform", "avr", "libraries", "SPI", "examples", "BarometricPressureSensor", "BarometricPressureSensor.ino")),
FQBN: parseFQBN(t, "my_avr_platform:avr:custom_yun"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -217,7 +212,6 @@ func TestIncludesToIncludeFoldersDuplicateLibsWithConflictingLibsOutsideOfPlatfo
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("user_hardware", "my_avr_platform", "avr", "libraries", "SPI", "examples", "BarometricPressureSensor", "BarometricPressureSensor.ino")),
FQBN: parseFQBN(t, "my_avr_platform:avr:custom_yun"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -255,7 +249,6 @@ func TestIncludesToIncludeFoldersDuplicateLibs2(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch_usbhost", "sketch_usbhost.ino")),
FQBN: parseFQBN(t, "arduino:samd:arduino_zero_native"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -293,7 +286,6 @@ func TestIncludesToIncludeFoldersSubfolders(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch_with_subfolders", "sketch_with_subfolders.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

18 changes: 8 additions & 10 deletions legacy/builder/test/load_vid_pid_specific_properties_test.go
Original file line number Diff line number Diff line change
@@ -29,11 +29,10 @@ func TestLoadVIDPIDSpecificPropertiesWhenNoVIDPIDAreProvided(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:micro"),
ArduinoAPIVersion: "10600",
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:micro"),
}

buildPath := SetupBuildPath(t, ctx)
@@ -59,11 +58,10 @@ func TestLoadVIDPIDSpecificProperties(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:micro"),
ArduinoAPIVersion: "10600",
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:micro"),
}

buildPath := SetupBuildPath(t, ctx)
4 changes: 0 additions & 4 deletions legacy/builder/test/merge_sketch_with_bootloader_test.go
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@ func TestMergeSketchWithBootloader(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:uno"),
ArduinoAPIVersion: "10600",
}

buildPath := SetupBuildPath(t, ctx)
@@ -108,7 +107,6 @@ func TestMergeSketchWithBootloaderSketchInBuildPath(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:uno"),
ArduinoAPIVersion: "10600",
}

buildPath := SetupBuildPath(t, ctx)
@@ -179,7 +177,6 @@ func TestMergeSketchWithBootloaderWhenNoBootloaderAvailable(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:uno"),
ArduinoAPIVersion: "10600",
}

buildPath := SetupBuildPath(t, ctx)
@@ -217,7 +214,6 @@ func TestMergeSketchWithBootloaderPathIsParameterized(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "my_avr_platform:avr:mymega:cpu=atmega2560"),
ArduinoAPIVersion: "10600",
}

buildPath := SetupBuildPath(t, ctx)
21 changes: 0 additions & 21 deletions legacy/builder/test/prototypes_adder_test.go
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -81,7 +80,6 @@ func TestPrototypesAdderSketchWithIfDef(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("SketchWithIfDef", "SketchWithIfDef.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -121,7 +119,6 @@ func TestPrototypesAdderBaladuino(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("Baladuino", "Baladuino.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -161,7 +158,6 @@ func TestPrototypesAdderCharWithEscapedDoubleQuote(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("CharWithEscapedDoubleQuote", "CharWithEscapedDoubleQuote.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -201,7 +197,6 @@ func TestPrototypesAdderIncludeBetweenMultilineComment(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("IncludeBetweenMultilineComment", "IncludeBetweenMultilineComment.ino")),
FQBN: parseFQBN(t, "arduino:sam:arduino_due_x_dbg"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -241,7 +236,6 @@ func TestPrototypesAdderLineContinuations(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("LineContinuations", "LineContinuations.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -281,7 +275,6 @@ func TestPrototypesAdderStringWithComment(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("StringWithComment", "StringWithComment.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -321,7 +314,6 @@ func TestPrototypesAdderSketchWithStruct(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("SketchWithStruct", "SketchWithStruct.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -369,7 +361,6 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -415,7 +406,6 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch_no_functions_two_files", "sketch_no_functions_two_files.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -455,7 +445,6 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("sketch_no_functions", "sketch_no_functions.ino")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -501,7 +490,6 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -544,7 +532,6 @@ func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -598,7 +585,6 @@ func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -641,7 +627,6 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
BuiltInLibrariesDirs: paths.New("downloaded_libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -683,7 +668,6 @@ func TestPrototypesAdderSketchWithTypename(t *testing.T) {
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -732,7 +716,6 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:yun"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -778,7 +761,6 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:sam:arduino_due_x_dbg"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -824,7 +806,6 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:uno"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -864,7 +845,6 @@ func TestPrototypesAdderSketchWithDosEol(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, paths.New("eol_processing", "eol_processing.ino")),
FQBN: parseFQBN(t, "arduino:avr:uno"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

@@ -904,7 +884,6 @@ func TestPrototypesAdderSketchWithSubstringFunctionMember(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: OpenSketch(t, sketchLocation),
FQBN: parseFQBN(t, "arduino:avr:uno"),
ArduinoAPIVersion: "10600",
Verbose: true,
}

40 changes: 18 additions & 22 deletions legacy/builder/test/setup_build_properties_test.go
Original file line number Diff line number Diff line change
@@ -29,11 +29,10 @@ func TestSetupBuildProperties(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:uno"),
ArduinoAPIVersion: "10600",
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:uno"),
}

buildPath := SetupBuildPath(t, ctx)
@@ -63,7 +62,7 @@ func TestSetupBuildProperties(t *testing.T) {

requireEquivalentPaths(t, buildProperties.Get("runtime.platform.path"), "downloaded_hardware/arduino/avr")
requireEquivalentPaths(t, buildProperties.Get("runtime.hardware.path"), "downloaded_hardware/arduino")
require.Equal(t, "10600", buildProperties.Get("runtime.ide.version"))
require.Equal(t, "10607", buildProperties.Get("runtime.ide.version"))
require.NotEmpty(t, buildProperties.Get("runtime.os"))

requireEquivalentPaths(t, buildProperties.Get("runtime.tools.arm-none-eabi-gcc.path"), "downloaded_tools/arm-none-eabi-gcc/4.8.3-2014q1")
@@ -93,11 +92,10 @@ func TestSetupBuildPropertiesWithSomeCustomOverrides(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:uno"),
ArduinoAPIVersion: "10600",
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "arduino:avr:uno"),

CustomBuildProperties: []string{"name=fake name", "tools.avrdude.config.path=non existent path with space and a ="},
}
@@ -132,11 +130,10 @@ func TestSetupBuildPropertiesUserHardware(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "my_avr_platform:avr:custom_yun"),
ArduinoAPIVersion: "10600",
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "my_avr_platform:avr:custom_yun"),
}

buildPath := SetupBuildPath(t, ctx)
@@ -168,11 +165,10 @@ func TestSetupBuildPropertiesWithMissingPropsFromParentPlatformTxtFiles(t *testi
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "my_avr_platform:avr:custom_yun"),
ArduinoAPIVersion: "10600",
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "tools_builtin"),
Sketch: OpenSketch(t, paths.New("sketch1", "sketch1.ino")),
FQBN: parseFQBN(t, "my_avr_platform:avr:custom_yun"),
}

buildPath := SetupBuildPath(t, ctx)
@@ -199,7 +195,7 @@ func TestSetupBuildPropertiesWithMissingPropsFromParentPlatformTxtFiles(t *testi

requireEquivalentPaths(t, buildProperties.Get("runtime.platform.path"), "user_hardware/my_avr_platform/avr")
requireEquivalentPaths(t, buildProperties.Get("runtime.hardware.path"), "user_hardware/my_avr_platform")
require.Equal(t, "10600", buildProperties.Get("runtime.ide.version"))
require.Equal(t, "10607", buildProperties.Get("runtime.ide.version"))
require.NotEmpty(t, buildProperties.Get("runtime.os"))

requireEquivalentPaths(t, buildProperties.Get("runtime.tools.arm-none-eabi-gcc.path"), "downloaded_tools/arm-none-eabi-gcc/4.8.3-2014q1")
2 changes: 0 additions & 2 deletions legacy/builder/test/store_build_options_map_test.go
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@ func TestStoreBuildOptionsMap(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("libraries"),
Sketch: &sketch.Sketch{FullPath: paths.New("sketchLocation")},
FQBN: parseFQBN(t, "my:nice:fqbn"),
ArduinoAPIVersion: "ideVersion",
CustomBuildProperties: []string{"custom=prop"},
Verbose: true,
OptimizationFlags: "-Os",
@@ -69,7 +68,6 @@ func TestStoreBuildOptionsMap(t *testing.T) {
"fqbn": "my:nice:fqbn",
"hardwareFolders": "hardware",
"otherLibrariesFolders": "libraries",
"runtime.ide.version": "ideVersion",
"sketchLocation": "sketchLocation"
}`, string(bytes))
}
2 changes: 1 addition & 1 deletion legacy/builder/test/target_board_resolver_test.go
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ func TestTargetBoardResolverCustomCore(t *testing.T) {
require.Equal(t, "avr", targetPlatform.Platform.Architecture)
targetBoard := ctx.TargetBoard
require.Equal(t, "attiny841", targetBoard.BoardID)
require.Equal(t, "tiny841", ctx.BuildCore)
require.Equal(t, "tiny841", ctx.TargetBoardBuildProperties.Get("build.core"))
targetBoardBuildProperties := ctx.TargetBoardBuildProperties
require.Equal(t, "tiny14", targetBoardBuildProperties.Get("build.variant"))
}
Original file line number Diff line number Diff line change
@@ -213,7 +213,6 @@ func makeDefaultContext(t *testing.T) *types.Context {
BuiltInLibrariesDirs: paths.New("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
ArduinoAPIVersion: "10607",
Verbose: true,
DebugPreprocessor: true,
}
3 changes: 0 additions & 3 deletions legacy/builder/types/context.go
Original file line number Diff line number Diff line change
@@ -71,7 +71,6 @@ type Context struct {
OtherLibrariesDirs paths.PathList
LibraryDirs paths.PathList // List of paths pointing to individual library root folders
WatchedLocations paths.PathList
ArduinoAPIVersion string
FQBN *cores.FQBN
CodeCompleteAt string
Clean bool
@@ -95,7 +94,6 @@ type Context struct {
HardwareRewriteResults map[*cores.PlatformRelease][]PlatforKeyRewrite

BuildProperties *properties.Map
BuildCore string
BuildPath *paths.Path
SketchBuildPath *paths.Path
CoreBuildPath *paths.Path
@@ -220,7 +218,6 @@ func (ctx *Context) ExtractBuildOptions() *properties.Map {
additionalFilesRelative = append(additionalFilesRelative, relPath.String())
}
opts.Set("fqbn", ctx.FQBN.String())
opts.Set("runtime.ide.version", ctx.ArduinoAPIVersion)
opts.Set("customBuildProperties", strings.Join(ctx.CustomBuildProperties, ","))
opts.Set("additionalFiles", strings.Join(additionalFilesRelative, ","))
opts.Set("compiler.optimization_flags", ctx.OptimizationFlags)
2 changes: 0 additions & 2 deletions legacy/builder/types/context_test.go
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ func TestInjectBuildOption(t *testing.T) {
OtherLibrariesDirs: paths.NewPathList("fff", "ggg"),
Sketch: &sketch.Sketch{FullPath: paths.New("hhh")},
FQBN: fqbn,
ArduinoAPIVersion: "iii",
CustomBuildProperties: []string{"jjj", "kkk"},
OptimizationFlags: "lll",
}
@@ -48,7 +47,6 @@ func TestInjectBuildOption(t *testing.T) {
"otherLibrariesFolders": "fff,ggg",
"sketchLocation": "hhh",
"fqbn": "aaa:bbb:ccc",
"runtime.ide.version": "iii",
"customBuildProperties": "jjj,kkk",
"additionalFiles": "",
"compiler.optimization_flags": "lll",