Skip to content

arduino-cli inception #319

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 67 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
dd4da02
fixed Preprocess container
cmaglie Mar 9, 2018
0b0988e
cli: use types from arduino-cli cores
cmaglie Feb 26, 2018
cc7d3f2
Moved HardwareLoader logic into arduino-cli
cmaglie Feb 28, 2018
8f387ed
Use packagemanager from arduino-cli
cmaglie Mar 5, 2018
cc8f694
Removed a bunch of constants
cmaglie Mar 7, 2018
c2146d4
Using cores.Tool/ToolRelease and removed types.Tool
cmaglie Mar 7, 2018
a11ea7b
WIP: Refactoring builtin_tools_versions.txt detection
cmaglie Mar 8, 2018
a21828b
Now using tools loader from arduino-cli
cmaglie Mar 12, 2018
d203490
PackageManager is no more a singleton
cmaglie Mar 13, 2018
d9b4541
Removed a bunch of unused functions/identifiers
cmaglie Mar 14, 2018
6c1d853
Moved addAdditionalPropertiesToTargetBoard function in arduino-cli
cmaglie Mar 15, 2018
85c6dd0
Now ctags has his own properties hardcoded
cmaglie Mar 23, 2018
e62ce9a
Updated imports for arduino-cli package
cmaglie Apr 17, 2018
84387d2
Moved Library type to arduino-cli
cmaglie May 11, 2018
0124195
Removed dependency from costants in LibrariesLoader
cmaglie May 15, 2018
cc5b5b5
renamed some properties
cmaglie May 15, 2018
f0a9372
moved library loader in arduino-cli
cmaglie May 15, 2018
f37025c
Using paths.* utilities
cmaglie May 16, 2018
067f1d0
moved LibraryToSourceFolder function in arduino-cli
cmaglie May 18, 2018
f1631fd
Using paths.* methods and structure (almost) everywhere
cmaglie May 25, 2018
244e15c
Merge branch 'master' into cli-inception
cmaglie May 31, 2018
53a1772
Merge branch 'master' into cli-inception
cmaglie Jun 1, 2018
f06377e
Moved function LoadLibrariesFromDir to arduino-cli
cmaglie Jun 7, 2018
c40beca
Sligthly improved WarnAboutArchIncompatibleLibraries
cmaglie Jun 7, 2018
b796399
Slightly improved library loader
cmaglie Jun 8, 2018
fc41149
Merge branch 'master' into 'cli-inception'
cmaglie Jun 8, 2018
81d2e00
Using FQBN facilities from arduino-cli
cmaglie Jun 11, 2018
e82d072
Use librarymanager to handle libraries loading
cmaglie Jul 2, 2018
fd8b7dc
Renamed librariesmanager.StatusContext -> librariesmanager.LibrariesM…
cmaglie Jul 16, 2018
4722d66
Using LibraryLocations and librarymanager functions to load libraries
cmaglie Jul 16, 2018
22a1e71
Use libraryresolver to resolve libraries
cmaglie Jul 18, 2018
006c22d
Fixed test libraries downloader
cmaglie Jul 19, 2018
23a0bb4
Using new librarymanager functions to load libraries
cmaglie Jul 19, 2018
1901f83
tests: print error output if something goes wrong with untar
cmaglie Jul 19, 2018
5421327
Using new *manager constructors
cmaglie Jul 25, 2018
fdfea8e
Changed field name Folder->InstallDir
cmaglie Aug 1, 2018
543863f
Changed field name Folder->InstallDir
cmaglie Aug 1, 2018
2f39b70
Changed field name Folder->InstallDir SrcFolder->SourceDir Folder->Dir
cmaglie Aug 1, 2018
b8512df
Changed field name *Folder->*Dir
cmaglie Aug 1, 2018
16a67ec
Using semver for versioning
cmaglie Aug 6, 2018
beb2ff2
Using semver for versioning (part 2)
cmaglie Aug 6, 2018
e866372
Moving under github.com/arduino imports
cmaglie Aug 8, 2018
decc48b
Merge branch 'master' into cli-inception
cmaglie Aug 31, 2018
8a51a33
Renamed field Board.BoardId -> Board.BoardID
cmaglie Aug 31, 2018
f99ab5a
Renamed field Board.BoardId -> Board.BoardID (part 2...)
cmaglie Aug 31, 2018
f9276b5
go-paths-helper API change
cmaglie Aug 31, 2018
48454f7
Merged release 1.4.1 into cli-inception
cmaglie Sep 10, 2018
bb7d413
Use ctx.PackageManager.GetInstalledPlatformRelease instead of Platfor…
cmaglie Sep 12, 2018
e74320a
Adopting ordered properties map
cmaglie Oct 2, 2018
3c198fc
Adopting ordered properties map (part 2)
cmaglie Oct 2, 2018
eb9e737
Adopting ordered properties map (part 3)
cmaglie Oct 2, 2018
ddca16b
Merge branch 'master' into cli-inception
cmaglie Oct 16, 2018
f64c68b
The board loader now detects default arguments in FQBN "config"
cmaglie Oct 16, 2018
75c65fd
Fix travis build
cmaglie Oct 16, 2018
8f0fb63
Fix travis build
cmaglie Oct 16, 2018
b5ab3ed
Added LoggerToIoWriter
cmaglie Apr 1, 2019
6be83c9
Log library discovery process using logger
cmaglie Apr 1, 2019
63f4904
Added Context.ExecStdout/ExecStderr to easy redirect output of execut…
cmaglie Apr 12, 2019
d364baa
Merge tag '1.4.2' into cli-inception
cmaglie Apr 12, 2019
b6797b3
Merge tag '1.4.3' into cli-inception
cmaglie Apr 12, 2019
a4859ca
Merge tag '1.4.4' into cli-inception
cmaglie Apr 12, 2019
14969d0
Removed builder module (moved into arduino-cli) (WIP)
cmaglie May 31, 2019
6c01fcc
Fixed imports
cmaglie May 31, 2019
d64e8c7
Added go.mod
cmaglie May 31, 2019
db05415
Merge remote-tracking branch 'arduino/master' into cli-inception
cmaglie Jul 10, 2019
35e015f
Set correct verbosity on logrus module
cmaglie Aug 27, 2019
7568a17
Update arduino-cli deps
cmaglie Aug 27, 2019
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
Prev Previous commit
Next Next commit
Removed a bunch of constants
  • Loading branch information
cmaglie committed Mar 12, 2018
commit cc8f694faffd50bf6aab27d55723b3341fc25d66
29 changes: 0 additions & 29 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,66 +37,39 @@ const BUILD_PROPERTIES_ARCHIVE_FILE_PATH = "archive_file_path"
const BUILD_PROPERTIES_ARCH_OVERRIDE_CHECK = "architecture.override_check"
const BUILD_PROPERTIES_BOOTLOADER_FILE = "bootloader.file"
const BUILD_PROPERTIES_BOOTLOADER_NOBLINK = "bootloader.noblink"
const BUILD_PROPERTIES_BUILD_ARCH = "build.arch"
const BUILD_PROPERTIES_BUILD_BOARD = "build.board"
const BUILD_PROPERTIES_BUILD_CORE = "build.core"
const BUILD_PROPERTIES_BUILD_CORE_PATH = "build.core.path"
const BUILD_PROPERTIES_BUILD_MCU = "build.mcu"
const BUILD_PROPERTIES_BUILD_PATH = "build.path"
const BUILD_PROPERTIES_BUILD_PROJECT_NAME = "build.project_name"
const BUILD_PROPERTIES_BUILD_SYSTEM_PATH = "build.system.path"
const BUILD_PROPERTIES_BUILD_VARIANT = "build.variant"
const BUILD_PROPERTIES_BUILD_VARIANT_PATH = "build.variant.path"
const BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS = "compiler.c.elf.flags"
const BUILD_PROPERTIES_COMPILER_C_ELF_EXTRAFLAGS = "compiler.c.elf.extra_flags"
const BUILD_PROPERTIES_COMPILER_CPP_FLAGS = "compiler.cpp.flags"
const BUILD_PROPERTIES_COMPILER_PATH = "compiler.path"
const BUILD_PROPERTIES_COMPILER_WARNING_FLAGS = "compiler.warning_flags"
const BUILD_PROPERTIES_EXTRA_TIME_DST = "extra.time.dst"
const BUILD_PROPERTIES_EXTRA_TIME_LOCAL = "extra.time.local"
const BUILD_PROPERTIES_EXTRA_TIME_UTC = "extra.time.utc"
const BUILD_PROPERTIES_EXTRA_TIME_ZONE = "extra.time.zone"
const BUILD_PROPERTIES_FQBN = "build.fqbn"
const BUILD_PROPERTIES_INCLUDES = "includes"
const BUILD_PROPERTIES_OBJECT_FILE = "object_file"
const BUILD_PROPERTIES_OBJECT_FILES = "object_files"
const BUILD_PROPERTIES_PATTERN = "pattern"
const BUILD_PROPERTIES_PID = "pid"
const BUILD_PROPERTIES_PREPROCESSED_FILE_PATH = "preprocessed_file_path"
const BUILD_PROPERTIES_RUNTIME_HARDWARE_PATH = "runtime.hardware.path"
const BUILD_PROPERTIES_RUNTIME_OS = "runtime.os"
const BUILD_PROPERTIES_RUNTIME_PLATFORM_PATH = "runtime.platform.path"
const BUILD_PROPERTIES_RUNTIME_TOOLS_PREFIX = "runtime.tools."
const BUILD_PROPERTIES_RUNTIME_TOOLS_SUFFIX = ".path"
const BUILD_PROPERTIES_RUNTIME_IDE_VERSION = "runtime.ide.version"
const BUILD_PROPERTIES_SOFTWARE = "software"
const BUILD_PROPERTIES_SOURCE_FILE = "source_file"
const BUILD_PROPERTIES_SOURCE_PATH = "build.source.path"
const BUILD_PROPERTIES_TOOLS_KEY = "tools"
const BUILD_PROPERTIES_VID = "vid"
const CTAGS = "ctags"
const EMPTY_STRING = ""
const FILE_BOARDS_LOCAL_TXT = "boards.local.txt"
const FILE_BOARDS_TXT = "boards.txt"
const FILE_BUILTIN_TOOLS_VERSIONS_TXT = "builtin_tools_versions.txt"
const FILE_CTAGS_TARGET = "ctags_target.cpp"
const FILE_CTAGS_TARGET_FOR_GCC_MINUS_E = "ctags_target_for_gcc_minus_e.cpp"
const FILE_GCC_PREPROC_TARGET = "gcc_preproc_target.cpp"
const FILE_PLATFORM_KEYS_REWRITE_TXT = "platform.keys.rewrite.txt"
const FILE_PLATFORM_LOCAL_TXT = "platform.local.txt"
const FILE_PLATFORM_TXT = "platform.txt"
const FILE_PROGRAMMERS_TXT = "programmers.txt"
const FILE_INCLUDES_CACHE = "includes.cache"
const FOLDER_BOOTLOADERS = "bootloaders"
const FOLDER_CORE = "core"
const FOLDER_CORES = "cores"
const FOLDER_HARDWARE = "hardware"
const FOLDER_LIBRARIES = "libraries"
const FOLDER_PREPROC = "preproc"
const FOLDER_SKETCH = "sketch"
const FOLDER_SYSTEM = "system"
const FOLDER_TOOLS = "tools"
const FOLDER_VARIANTS = "variants"
const hooks_core = hooks + ".core"
const HOOKS_CORE_POSTBUILD = hooks_core + hooks_postbuild_suffix
const HOOKS_CORE_PREBUILD = hooks_core + hooks_prebuild_suffix
Expand All @@ -122,8 +95,6 @@ const hooks = "recipe.hooks"
const hooks_sketch = hooks + ".sketch"
const HOOKS_SKETCH_POSTBUILD = hooks_sketch + hooks_postbuild_suffix
const HOOKS_SKETCH_PREBUILD = hooks_sketch + hooks_prebuild_suffix
const IDE_VERSION = "ide_version"
const ID = "_id"
const LIB_CATEGORY_UNCATEGORIZED = "Uncategorized"
const LIB_LICENSE_UNSPECIFIED = "Unspecified"
const LIBRARY_ALL_ARCHS = "*"
Expand Down
55 changes: 27 additions & 28 deletions setup_build_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"strings"
"time"

"github.com/arduino/arduino-builder/constants"
"github.com/arduino/arduino-builder/types"
"github.com/arduino/arduino-builder/utils"
"github.com/arduino/go-properties-map"
Expand All @@ -58,26 +57,26 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
buildProperties.Merge(targetBoard.Properties)

if ctx.BuildPath != "" {
buildProperties[constants.BUILD_PROPERTIES_BUILD_PATH] = ctx.BuildPath
buildProperties["build.path"] = ctx.BuildPath
}
if ctx.Sketch != nil {
buildProperties[constants.BUILD_PROPERTIES_BUILD_PROJECT_NAME] = filepath.Base(ctx.Sketch.MainFile.Name)
buildProperties["build.project_name"] = filepath.Base(ctx.Sketch.MainFile.Name)
}
buildProperties[constants.BUILD_PROPERTIES_BUILD_ARCH] = strings.ToUpper(targetPlatform.Platform.Architecture)

buildProperties[constants.BUILD_PROPERTIES_BUILD_CORE] = ctx.BuildCore
buildProperties[constants.BUILD_PROPERTIES_BUILD_CORE_PATH] = filepath.Join(actualPlatform.Folder, constants.FOLDER_CORES, buildProperties[constants.BUILD_PROPERTIES_BUILD_CORE])
buildProperties[constants.BUILD_PROPERTIES_BUILD_SYSTEM_PATH] = filepath.Join(actualPlatform.Folder, constants.FOLDER_SYSTEM)
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_PLATFORM_PATH] = targetPlatform.Folder
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_HARDWARE_PATH] = filepath.Join(targetPlatform.Folder, "..")
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = ctx.ArduinoAPIVersion
buildProperties[constants.BUILD_PROPERTIES_FQBN] = ctx.FQBN
buildProperties[constants.IDE_VERSION] = ctx.ArduinoAPIVersion
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_OS] = utils.PrettyOSName()

variant := buildProperties[constants.BUILD_PROPERTIES_BUILD_VARIANT]
if variant == constants.EMPTY_STRING {
buildProperties[constants.BUILD_PROPERTIES_BUILD_VARIANT_PATH] = constants.EMPTY_STRING
buildProperties["build.arch"] = strings.ToUpper(targetPlatform.Platform.Architecture)

buildProperties["build.core"] = ctx.BuildCore
buildProperties["build.core.path"] = filepath.Join(actualPlatform.Folder, "cores", buildProperties["build.core"])
buildProperties["build.system.path"] = filepath.Join(actualPlatform.Folder, "system")
buildProperties["runtime.platform.path"] = targetPlatform.Folder
buildProperties["runtime.hardware.path"] = filepath.Join(targetPlatform.Folder, "..")
buildProperties["runtime.ide.version"] = ctx.ArduinoAPIVersion
buildProperties["build.fqbn"] = ctx.FQBN
buildProperties["ide_version"] = ctx.ArduinoAPIVersion
buildProperties["runtime.os"] = utils.PrettyOSName()

variant := buildProperties["build.variant"]
if variant == "" {
buildProperties["build.variant.path"] = ""
} else {
var variantPlatform *cores.PlatformRelease
variantParts := strings.Split(variant, ":")
Expand All @@ -87,17 +86,17 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
} else {
variantPlatform = targetPlatform
}
buildProperties[constants.BUILD_PROPERTIES_BUILD_VARIANT_PATH] = filepath.Join(variantPlatform.Folder, constants.FOLDER_VARIANTS, variant)
buildProperties["build.variant.path"] = filepath.Join(variantPlatform.Folder, "variants", variant)
}

tools := ctx.Tools
for _, tool := range tools {
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_TOOLS_PREFIX+tool.Name+constants.BUILD_PROPERTIES_RUNTIME_TOOLS_SUFFIX] = tool.Folder
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_TOOLS_PREFIX+tool.Name+"-"+tool.Version+constants.BUILD_PROPERTIES_RUNTIME_TOOLS_SUFFIX] = tool.Folder
buildProperties["runtime.tools."+tool.Name+".path"] = tool.Folder
buildProperties["runtime.tools."+tool.Name+"-"+tool.Version+".path"] = tool.Folder
}

if !utils.MapStringStringHas(buildProperties, constants.BUILD_PROPERTIES_SOFTWARE) {
buildProperties[constants.BUILD_PROPERTIES_SOFTWARE] = DEFAULT_SOFTWARE
if !utils.MapStringStringHas(buildProperties, "software") {
buildProperties["software"] = DEFAULT_SOFTWARE
}

if ctx.SketchLocation != "" {
Expand All @@ -106,14 +105,14 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
return err
}
sourcePath = filepath.Dir(sourcePath)
buildProperties[constants.BUILD_PROPERTIES_SOURCE_PATH] = sourcePath
buildProperties["build.source.path"] = sourcePath
}

now := time.Now()
buildProperties[constants.BUILD_PROPERTIES_EXTRA_TIME_UTC] = strconv.FormatInt(now.Unix(), 10)
buildProperties[constants.BUILD_PROPERTIES_EXTRA_TIME_LOCAL] = strconv.FormatInt(timeutils.LocalUnix(now), 10)
buildProperties[constants.BUILD_PROPERTIES_EXTRA_TIME_ZONE] = strconv.Itoa(timeutils.TimezoneOffsetNoDST(now))
buildProperties[constants.BUILD_PROPERTIES_EXTRA_TIME_DST] = strconv.Itoa(timeutils.DaylightSavingsOffset(now))
buildProperties["extra.time.utc"] = strconv.FormatInt(now.Unix(), 10)
buildProperties["extra.time.local"] = strconv.FormatInt(timeutils.LocalUnix(now), 10)
buildProperties["extra.time.zone"] = strconv.Itoa(timeutils.TimezoneOffsetNoDST(now))
buildProperties["extra.time.dst"] = strconv.Itoa(timeutils.DaylightSavingsOffset(now))

ctx.BuildProperties = buildProperties

Expand Down
11 changes: 5 additions & 6 deletions test/ctags_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"testing"

"github.com/arduino/arduino-builder"
"github.com/arduino/arduino-builder/constants"
"github.com/arduino/arduino-builder/types"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -70,7 +69,7 @@ func TestCTagsRunner(t *testing.T) {

&builder.PrintUsedLibrariesIfVerbose{},
&builder.WarnAboutArchIncompatibleLibraries{},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: constants.FILE_CTAGS_TARGET},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: "ctags_target.cpp"},
&builder.CTagsRunner{},
}

Expand Down Expand Up @@ -120,7 +119,7 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {

&builder.PrintUsedLibrariesIfVerbose{},
&builder.WarnAboutArchIncompatibleLibraries{},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: constants.FILE_CTAGS_TARGET},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: "ctags_target.cpp"},
&builder.CTagsRunner{},
}

Expand Down Expand Up @@ -168,7 +167,7 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {

&builder.PrintUsedLibrariesIfVerbose{},
&builder.WarnAboutArchIncompatibleLibraries{},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: constants.FILE_CTAGS_TARGET},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: "ctags_target.cpp"},
&builder.CTagsRunner{},
}

Expand Down Expand Up @@ -215,7 +214,7 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {

&builder.PrintUsedLibrariesIfVerbose{},
&builder.WarnAboutArchIncompatibleLibraries{},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: constants.FILE_CTAGS_TARGET},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: "ctags_target.cpp"},
&builder.CTagsRunner{},
}

Expand Down Expand Up @@ -261,7 +260,7 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {

&builder.PrintUsedLibrariesIfVerbose{},
&builder.WarnAboutArchIncompatibleLibraries{},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: constants.FILE_CTAGS_TARGET},
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: "ctags_target.cpp"},
&builder.CTagsRunner{},
}

Expand Down
25 changes: 12 additions & 13 deletions test/hardware_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"testing"

"github.com/arduino/arduino-builder"
"github.com/arduino/arduino-builder/constants"
"github.com/arduino/arduino-builder/types"
"github.com/arduino/arduino-builder/utils"
"github.com/stretchr/testify/require"
Expand All @@ -61,7 +60,7 @@ func TestLoadHardware(t *testing.T) {
require.Equal(t, 2, len(packages.Packages["arduino"].Platforms))

require.Equal(t, "uno", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["uno"].BoardId)
require.Equal(t, "uno", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["uno"].Properties[constants.ID])
require.Equal(t, "uno", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["uno"].Properties["_id"])

require.Equal(t, "yun", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["yun"].BoardId)
require.Equal(t, "true", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["yun"].Properties["upload.wait_for_upload_port"])
Expand All @@ -73,11 +72,11 @@ func TestLoadHardware(t *testing.T) {
require.Equal(t, "ATmega123", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["diecimila"].Properties["menu.cpu.atmega123"])

avrPlatform := packages.Packages["arduino"].Platforms["avr"]
require.Equal(t, "Arduino AVR Boards", avrPlatform.Releases[""].Properties[constants.PLATFORM_NAME])
require.Equal(t, "Arduino AVR Boards", avrPlatform.Releases[""].Properties["name"])
require.Equal(t, "-v", avrPlatform.Releases[""].Properties["tools.avrdude.bootloader.params.verbose"])
require.Equal(t, "/my/personal/avrdude", avrPlatform.Releases[""].Properties["tools.avrdude.cmd.path"])

require.Equal(t, "AVRISP mkII", avrPlatform.Releases[""].Programmers["avrispmkii"][constants.PROGRAMMER_NAME])
require.Equal(t, "AVRISP mkII", avrPlatform.Releases[""].Programmers["avrispmkii"]["name"])

//require.Equal(t, "{runtime.tools.ctags.path}", packages.Properties["tools.ctags.path"])
//require.Equal(t, "\"{cmd.path}\" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives \"{source_file}\"", packages.Properties["tools.ctags.pattern"])
Expand Down Expand Up @@ -115,7 +114,7 @@ func TestLoadHardwareMixingUserHardwareFolder(t *testing.T) {
require.Equal(t, 2, len(packages.Packages["arduino"].Platforms))

require.Equal(t, "uno", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["uno"].BoardId)
require.Equal(t, "uno", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["uno"].Properties[constants.ID])
require.Equal(t, "uno", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["uno"].Properties["_id"])

require.Equal(t, "yun", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["yun"].BoardId)
require.Equal(t, "true", packages.Packages["arduino"].Platforms["avr"].Releases[""].Boards["yun"].Properties["upload.wait_for_upload_port"])
Expand All @@ -125,15 +124,15 @@ func TestLoadHardwareMixingUserHardwareFolder(t *testing.T) {
require.Equal(t, "arduino_due_x", packages.Packages["arduino"].Platforms["sam"].Releases[""].Boards["arduino_due_x"].BoardId)

avrPlatform := packages.Packages["arduino"].Platforms["avr"].Releases[""]
require.Equal(t, "Arduino AVR Boards", avrPlatform.Properties[constants.PLATFORM_NAME])
require.Equal(t, "Arduino AVR Boards", avrPlatform.Properties["name"])
require.Equal(t, "-v", avrPlatform.Properties["tools.avrdude.bootloader.params.verbose"])
require.Equal(t, "/my/personal/avrdude", avrPlatform.Properties["tools.avrdude.cmd.path"])

require.Equal(t, "AVRISP mkII", avrPlatform.Programmers["avrispmkii"][constants.PROGRAMMER_NAME])
require.Equal(t, "AVRISP mkII", avrPlatform.Programmers["avrispmkii"]["name"])

require.Equal(t, "-w -x c++ -M -MG -MP", avrPlatform.Properties["preproc.includes.flags"])
require.Equal(t, "-w -x c++ -E -CC", avrPlatform.Properties["preproc.macros.flags"])
require.Equal(t, "\"{compiler.path}{compiler.cpp.cmd}\" {compiler.cpp.flags} {preproc.includes.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} \"{source_file}\"", avrPlatform.Properties[constants.RECIPE_PREPROC_INCLUDES])
require.Equal(t, "\"{compiler.path}{compiler.cpp.cmd}\" {compiler.cpp.flags} {preproc.includes.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} \"{source_file}\"", avrPlatform.Properties["recipe.preproc.includes"])
require.False(t, utils.MapStringStringHas(avrPlatform.Properties, "preproc.macros.compatibility_flags"))

require.NotNil(t, packages.Packages["my_avr_platform"])
Expand Down Expand Up @@ -182,25 +181,25 @@ func TestLoadHardwareWithBoardManagerFolderStructure(t *testing.T) {
require.Equal(t, 3, len(samdPlatform.Boards))

require.Equal(t, "arduino_zero_edbg", samdPlatform.Boards["arduino_zero_edbg"].BoardId)
require.Equal(t, "arduino_zero_edbg", samdPlatform.Boards["arduino_zero_edbg"].Properties[constants.ID])
require.Equal(t, "arduino_zero_edbg", samdPlatform.Boards["arduino_zero_edbg"].Properties["_id"])

require.Equal(t, "arduino_zero", samdPlatform.Boards["arduino_zero_native"].Properties["build.variant"])
require.Equal(t, "-D__SAMD21G18A__ {build.usb_flags}", samdPlatform.Boards["arduino_zero_native"].Properties["build.extra_flags"])

require.Equal(t, "Arduino SAMD (32-bits ARM Cortex-M0+) Boards", samdPlatform.Properties[constants.PLATFORM_NAME])
require.Equal(t, "Arduino SAMD (32-bits ARM Cortex-M0+) Boards", samdPlatform.Properties["name"])
require.Equal(t, "-d3", samdPlatform.Properties["tools.openocd.erase.params.verbose"])

require.Equal(t, 3, len(samdPlatform.Programmers))

require.Equal(t, "Atmel EDBG", samdPlatform.Programmers["edbg"][constants.PROGRAMMER_NAME])
require.Equal(t, "Atmel EDBG", samdPlatform.Programmers["edbg"]["name"])
require.Equal(t, "openocd", samdPlatform.Programmers["edbg"]["program.tool"])

avrRedBearPlatform := packages.Packages["RedBearLab"].Platforms["avr"].Releases["1.0.0"]
require.Equal(t, 3, len(avrRedBearPlatform.Boards))

require.Equal(t, "blend", avrRedBearPlatform.Boards["blend"].BoardId)
require.Equal(t, "blend", avrRedBearPlatform.Boards["blend"].Properties[constants.ID])
require.Equal(t, "arduino:arduino", avrRedBearPlatform.Boards["blend"].Properties[constants.BUILD_PROPERTIES_BUILD_CORE])
require.Equal(t, "blend", avrRedBearPlatform.Boards["blend"].Properties["_id"])
require.Equal(t, "arduino:arduino", avrRedBearPlatform.Boards["blend"].Properties["build.core"])
}

func TestLoadLotsOfHardware(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions test/load_vid_pid_specific_properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
package test

import (
"github.com/arduino/arduino-builder"
"github.com/arduino/arduino-builder/types"
"github.com/stretchr/testify/require"
"os"
"path/filepath"
"testing"

"github.com/arduino/arduino-builder"
"github.com/arduino/arduino-builder/types"
"github.com/stretchr/testify/require"
)

func TestLoadVIDPIDSpecificPropertiesWhenNoVIDPIDAreProvided(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions test/platform_keys_rewrite_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
package test

import (
"path/filepath"
"testing"

"github.com/arduino/arduino-builder"
"github.com/arduino/arduino-builder/constants"
"github.com/arduino/arduino-builder/types"
"github.com/stretchr/testify/require"
"path/filepath"
"testing"
)

func TestLoadPlatformKeysRewrite(t *testing.T) {
Expand All @@ -55,15 +55,15 @@ func TestLoadPlatformKeysRewrite(t *testing.T) {
platformKeysRewrite := ctx.PlatformKeyRewrites

require.Equal(t, 13, len(platformKeysRewrite.Rewrites))
require.Equal(t, constants.BUILD_PROPERTIES_COMPILER_PATH, platformKeysRewrite.Rewrites[0].Key)
require.Equal(t, "compiler.path", platformKeysRewrite.Rewrites[0].Key)
require.Equal(t, "{runtime.ide.path}/hardware/tools/avr/bin/", platformKeysRewrite.Rewrites[0].OldValue)
require.Equal(t, "{runtime.tools.avr-gcc.path}/bin/", platformKeysRewrite.Rewrites[0].NewValue)

require.Equal(t, "tools.avrdude.cmd.path", platformKeysRewrite.Rewrites[1].Key)
require.Equal(t, "{runtime.ide.path}/hardware/tools/avr/bin/avrdude", platformKeysRewrite.Rewrites[1].OldValue)
require.Equal(t, "{path}/bin/avrdude", platformKeysRewrite.Rewrites[1].NewValue)

require.Equal(t, constants.BUILD_PROPERTIES_COMPILER_PATH, platformKeysRewrite.Rewrites[3].Key)
require.Equal(t, "compiler.path", platformKeysRewrite.Rewrites[3].Key)
require.Equal(t, "{runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/", platformKeysRewrite.Rewrites[3].OldValue)
require.Equal(t, "{runtime.tools.arm-none-eabi-gcc.path}/bin/", platformKeysRewrite.Rewrites[3].NewValue)

Expand Down
Loading