Skip to content

Commit

Permalink
Turned out MSG_MISSING_COMPILER_PATH was useless. See #11 and
Browse files Browse the repository at this point in the history
arduino/Arduino@a89f5e6

Signed-off-by: Federico Fissore <[email protected]>
  • Loading branch information
Federico Fissore committed Sep 23, 2015
1 parent 1f04e67 commit b966748
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 46 deletions.
1 change: 0 additions & 1 deletion src/arduino.cc/builder/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ const MSG_LIBRARY_CAN_USE_SRC_AND_UTILITY_FOLDERS = "Library can't use both 'src
const MSG_LIBRARY_INCOMPATIBLE_ARCH = "WARNING: library {0} claims to run on {1} architecture(s) and may be incompatible with your current board which runs on {2} architecture(s)."
const MSG_LOOKING_FOR_RECIPES = "Looking for recipes like {0}*{1}"
const MSG_MISSING_BUILD_BOARD = "Board {0}:{1}:{2} doesn''t define a ''build.board'' preference. Auto-set to: {3}"
const MSG_MISSING_COMPILER_PATH = "Third-party platform.txt (package '{0}' platform '{1}') does not define compiler.path. Please report this to the third-party hardware maintainer."
const MSG_MISSING_CORE_FOR_BOARD = "Selected board depends on '{0}' core (not installed)."
const MSG_MUST_BE_A_FOLDER = "{0} must be a folder"
const MSG_PACKAGE_UNKNOWN = "{0}: Unknown package"
Expand Down
5 changes: 0 additions & 5 deletions src/arduino.cc/builder/setup_build_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ func (s *SetupBuildProperties) Run(context map[string]interface{}) error {
}
buildProperties[constants.BUILD_PROPERTIES_BUILD_ARCH] = strings.ToUpper(targetPlatform.PlatformId)

if buildProperties[constants.BUILD_PROPERTIES_COMPILER_PATH] == constants.EMPTY_STRING {
targetPackage := context[constants.CTX_TARGET_PACKAGE].(*types.Package)
return utils.Errorf(context, constants.MSG_MISSING_COMPILER_PATH, targetPackage.PackageId, actualPlatform.PlatformId)
}

buildProperties[constants.BUILD_PROPERTIES_BUILD_CORE] = context[constants.CTX_BUILD_CORE].(string)
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)
Expand Down
40 changes: 0 additions & 40 deletions src/arduino.cc/builder/test/setup_build_properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ package test
import (
"arduino.cc/builder"
"arduino.cc/builder/constants"
"arduino.cc/builder/i18n"
"arduino.cc/builder/props"
"arduino.cc/builder/types"
"arduino.cc/builder/utils"
Expand Down Expand Up @@ -148,42 +147,3 @@ func TestSetupBuildPropertiesWithSomeCustomOverrides(t *testing.T) {
require.Equal(t, "\"{compiler.path}{compiler.c.cmd}\" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} \"{source_file}\" -o \"{object_file}\"", buildProperties["recipe.c.o.pattern"])
require.Equal(t, "non existent path with space and a =", buildProperties["tools.avrdude.config.path"])
}

func TestSetupBuildPropertiesWithMissingCompilerPath(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

context := make(map[string]interface{})

buildPath := SetupBuildPath(t, context)
defer os.RemoveAll(buildPath)

context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
context[constants.CTX_HARDWARE_FOLDERS] = []string{filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"}
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools", "./tools_builtin"}
context[constants.CTX_FQBN] = "arduino:avr:uno"
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch1", "sketch.ino")
context[constants.CTX_CUSTOM_BUILD_PROPERTIES] = []string{"name=fake name", "tools.avrdude.config.path=non existent path with space and a ="}

commands := []types.Command{
&builder.SetupHumanLoggerIfMissing{},
&builder.AddAdditionalEntriesToContext{},
&builder.HardwareLoader{},
&builder.ToolsLoader{},
&builder.TargetBoardResolver{},
&builder.SketchLoader{},
}

for _, command := range commands {
err := command.Run(context)
NoError(t, err)
}

targetPlatform := context[constants.CTX_TARGET_PLATFORM].(*types.Platform)
delete(targetPlatform.Properties, constants.BUILD_PROPERTIES_COMPILER_PATH)

command := builder.SetupBuildProperties{}
err := command.Run(context)
require.Error(t, err)

require.Equal(t, i18n.Format(constants.MSG_MISSING_COMPILER_PATH, "arduino", "avr"), err.Error())
}

0 comments on commit b966748

Please sign in to comment.