From 2177271a69190b9f5c0340c4d8a3efa5eb5a108e Mon Sep 17 00:00:00 2001 From: Alessio Perugini Date: Thu, 7 Sep 2023 14:38:46 +0200 Subject: [PATCH] remove unused struct FailIfBuildPathEqualsSketchPath --- .../fail_if_buildpath_equals_sketchpath.go | 33 ------------- ...ail_if_buildpath_equals_sketchpath_test.go | 46 ------------------- 2 files changed, 79 deletions(-) delete mode 100644 legacy/builder/fail_if_buildpath_equals_sketchpath.go delete mode 100644 legacy/builder/test/fail_if_buildpath_equals_sketchpath_test.go diff --git a/legacy/builder/fail_if_buildpath_equals_sketchpath.go b/legacy/builder/fail_if_buildpath_equals_sketchpath.go deleted file mode 100644 index 2ec5c0da662..00000000000 --- a/legacy/builder/fail_if_buildpath_equals_sketchpath.go +++ /dev/null @@ -1,33 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package builder - -import ( - "github.com/arduino/arduino-cli/legacy/builder/types" - "github.com/pkg/errors" -) - -type FailIfBuildPathEqualsSketchPath struct{} - -func (s *FailIfBuildPathEqualsSketchPath) Run(ctx *types.Context) error { - buildPath := ctx.BuildPath.Canonical() - sketchPath := ctx.Sketch.FullPath.Canonical() - if buildPath.EqualsTo(sketchPath) { - return errors.New(tr("Sketch cannot be located in build path. Please specify a different build path")) - } - - return nil -} diff --git a/legacy/builder/test/fail_if_buildpath_equals_sketchpath_test.go b/legacy/builder/test/fail_if_buildpath_equals_sketchpath_test.go deleted file mode 100644 index d24b9d65ee1..00000000000 --- a/legacy/builder/test/fail_if_buildpath_equals_sketchpath_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package test - -import ( - "testing" - - "github.com/arduino/arduino-cli/arduino/sketch" - "github.com/arduino/arduino-cli/legacy/builder" - "github.com/arduino/arduino-cli/legacy/builder/types" - "github.com/arduino/go-paths-helper" - "github.com/stretchr/testify/require" -) - -func TestFailIfBuildPathEqualsSketchPath(t *testing.T) { - ctx := &types.Context{ - Sketch: &sketch.Sketch{FullPath: paths.New("buildPath")}, - BuildPath: paths.New("buildPath"), - } - - command := builder.FailIfBuildPathEqualsSketchPath{} - require.Error(t, command.Run(ctx)) -} - -func TestFailIfBuildPathEqualsSketchPathSketchPathDiffers(t *testing.T) { - ctx := &types.Context{ - Sketch: &sketch.Sketch{FullPath: paths.New("sketchPath")}, - BuildPath: paths.New("buildPath"), - } - - command := builder.FailIfBuildPathEqualsSketchPath{} - NoError(t, command.Run(ctx)) -}