Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
d710b642
Commit
d710b642
authored
May 14, 2021
by
Silvano Cerza
Committed by
Silvano Cerza
May 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Improved lib detection: check for matching name in library.properties (#1276)" (#1290)
This reverts commit
15e81edd
.
parent
7b5a22a4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
55 deletions
+5
-55
arduino/libraries/librariesresolver/cpp.go
arduino/libraries/librariesresolver/cpp.go
+5
-8
arduino/libraries/librariesresolver/cpp_test.go
arduino/libraries/librariesresolver/cpp_test.go
+0
-15
test/test_compile.py
test/test_compile.py
+0
-25
test/testdata/sketch_with_conflicting_libraries_include/sketch_with_conflicting_libraries_include.ino
...ies_include/sketch_with_conflicting_libraries_include.ino
+0
-7
No files found.
arduino/libraries/librariesresolver/cpp.go
View file @
d710b642
...
...
@@ -121,7 +121,6 @@ func computePriority(lib *libraries.Library, header, arch string) int {
header
=
strings
.
TrimSuffix
(
header
,
filepath
.
Ext
(
header
))
header
=
simplify
(
header
)
name
:=
simplify
(
lib
.
Name
)
realName
:=
simplify
(
lib
.
RealName
)
priority
:=
0
...
...
@@ -138,17 +137,15 @@ func computePriority(lib *libraries.Library, header, arch string) int {
priority
+=
0
}
if
realName
==
header
&&
name
==
header
{
priority
+=
600
}
else
if
realName
==
header
||
name
==
header
{
if
name
==
header
{
priority
+=
500
}
else
if
realName
==
header
+
"-master"
||
name
==
header
+
"-master"
{
}
else
if
name
==
header
+
"-master"
{
priority
+=
400
}
else
if
strings
.
HasPrefix
(
realName
,
header
)
||
strings
.
HasPrefix
(
name
,
header
)
{
}
else
if
strings
.
HasPrefix
(
name
,
header
)
{
priority
+=
300
}
else
if
strings
.
HasSuffix
(
realName
,
header
)
||
strings
.
HasSuffix
(
name
,
header
)
{
}
else
if
strings
.
HasSuffix
(
name
,
header
)
{
priority
+=
200
}
else
if
strings
.
Contains
(
realName
,
header
)
||
strings
.
Contains
(
name
,
header
)
{
}
else
if
strings
.
Contains
(
name
,
header
)
{
priority
+=
100
}
...
...
arduino/libraries/librariesresolver/cpp_test.go
View file @
d710b642
...
...
@@ -143,18 +143,3 @@ func TestCppHeaderResolver(t *testing.T) {
require
.
Equal
(
t
,
"Calculus Unified Lib"
,
resolve
(
"calculus_lib.h"
,
l6
,
l7
))
require
.
Equal
(
t
,
"Calculus Unified Lib"
,
resolve
(
"calculus_lib.h"
,
l7
,
l6
))
}
func
TestCppHeaderResolverWithLibrariesInStrangeDirectoryNames
(
t
*
testing
.
T
)
{
resolver
:=
NewCppResolver
()
librarylist
:=
libraries
.
List
{}
librarylist
.
Add
(
&
libraries
.
Library
{
Name
:
"onewire_2_3_4"
,
RealName
:
"OneWire"
,
Architectures
:
[]
string
{
"*"
}})
librarylist
.
Add
(
&
libraries
.
Library
{
Name
:
"onewireng_2_3_4"
,
RealName
:
"OneWireNg"
,
Architectures
:
[]
string
{
"avr"
}})
resolver
.
headers
[
"OneWire.h"
]
=
librarylist
require
.
Equal
(
t
,
"onewire_2_3_4"
,
resolver
.
ResolveFor
(
"OneWire.h"
,
"avr"
)
.
Name
)
librarylist2
:=
libraries
.
List
{}
librarylist2
.
Add
(
&
libraries
.
Library
{
Name
:
"OneWire"
,
RealName
:
"OneWire"
,
Architectures
:
[]
string
{
"*"
}})
librarylist2
.
Add
(
&
libraries
.
Library
{
Name
:
"onewire_2_3_4"
,
RealName
:
"OneWire"
,
Architectures
:
[]
string
{
"avr"
}})
resolver
.
headers
[
"OneWire.h"
]
=
librarylist2
require
.
Equal
(
t
,
"OneWire"
,
resolver
.
ResolveFor
(
"OneWire.h"
,
"avr"
)
.
Name
)
}
test/test_compile.py
View file @
d710b642
...
...
@@ -998,31 +998,6 @@ def test_recompile_with_different_library(run_command, data_dir):
assert
f"Using previously compiled file:
{
obj_path
}
"
not
in
res
.
stdout
def
test_compile_with_conflicting_libraries_include
(
run_command
,
data_dir
,
copy_sketch
):
assert
run_command
(
"update"
)
assert
run_command
(
"core install arduino:avr@1.8.3"
)
# Install conflicting libraries
git_url
=
"https://github.com/pstolarz/OneWireNg.git"
one_wire_ng_lib_path
=
Path
(
data_dir
,
"libraries"
,
"onewireng_0_8_1"
)
assert
Repo
.
clone_from
(
git_url
,
one_wire_ng_lib_path
,
multi_options
=
[
"-b 0.8.1"
])
git_url
=
"https://github.com/PaulStoffregen/OneWire.git"
one_wire_lib_path
=
Path
(
data_dir
,
"libraries"
,
"onewire_2_3_5"
)
assert
Repo
.
clone_from
(
git_url
,
one_wire_lib_path
,
multi_options
=
[
"-b v2.3.5"
])
sketch_path
=
copy_sketch
(
"sketch_with_conflicting_libraries_include"
)
fqbn
=
"arduino:avr:uno"
res
=
run_command
(
f"compile -b
{
fqbn
}
{
sketch_path
}
--verbose"
)
assert
res
.
ok
lines
=
[
l
.
strip
()
for
l
in
res
.
stdout
.
splitlines
()]
assert
'Multiple libraries were found for "OneWire.h"'
in
lines
assert
f"Used:
{
one_wire_lib_path
}
"
in
lines
assert
f"Not used:
{
one_wire_ng_lib_path
}
"
in
lines
def
test_compile_with_invalid_build_options_json
(
run_command
,
data_dir
):
assert
run_command
(
"update"
)
...
...
test/testdata/sketch_with_conflicting_libraries_include/sketch_with_conflicting_libraries_include.ino
deleted
100644 → 0
View file @
7b5a22a4
#include "OneWire.h"
void
setup
()
{
}
void
loop
()
{
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment