Skip to content

Commit 9fa5da6

Browse files
authored
Merge branch 'develop2' into xcodebuild-extend
2 parents 51d887b + ad062e5 commit 9fa5da6

File tree

162 files changed

+4200
-2063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+4200
-2063
lines changed

conan/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
from conan.internal.model.workspace import Workspace
33
from conan.internal.model.version import Version
44

5-
__version__ = '2.18.0-dev'
5+
__version__ = '2.19.0-dev'
66
conan_version = Version(__version__)

conan/api/subapi/cache.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ def get_backup_sources(self, package_list=None, exclude=True, only_upload=True):
259259
download_cache = DownloadCache(download_cache_path)
260260
return download_cache.get_backup_sources_files(excluded_urls, package_list, only_upload)
261261

262+
def path_to_ref(self, path):
263+
cache = PkgCache(self.conan_api.cache_folder, self.conan_api.config.global_conf)
264+
result = cache.path_to_ref(path)
265+
if result is None:
266+
base, folder = os.path.split(path)
267+
result = cache.path_to_ref(base)
268+
return result
269+
262270

263271
def _resolve_latest_ref(cache, ref):
264272
if ref.revision is None or ref.revision == "latest":

conan/api/subapi/new.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def get_builtin_template(template_name):
9696
from conan.internal.api.new.bazel_7_exe import bazel_exe_files_7
9797
from conan.internal.api.new.autotools_lib import autotools_lib_files
9898
from conan.internal.api.new.autoools_exe import autotools_exe_files
99+
from conan.internal.api.new.premake_lib import premake_lib_files
100+
from conan.internal.api.new.premake_exe import premake_exe_files
99101
from conan.internal.api.new.local_recipes_index import local_recipes_index_files
100102
from conan.internal.api.new.qbs_lib import qbs_lib_files
101103
from conan.internal.api.new.workspace import workspace_files
@@ -114,6 +116,8 @@ def get_builtin_template(template_name):
114116
"bazel_7_exe": bazel_exe_files_7,
115117
"autotools_lib": autotools_lib_files,
116118
"autotools_exe": autotools_exe_files,
119+
"premake_lib": premake_lib_files,
120+
"premake_exe": premake_exe_files,
117121
"alias": alias_file,
118122
"local_recipes_index": local_recipes_index_files,
119123
"qbs_lib": qbs_lib_files,

conan/api/subapi/workspace.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,33 @@ def packages(self):
109109
"""
110110
if not self._folder or not self._enabled:
111111
return
112-
editables = self._ws.packages()
113-
editables = {RecipeReference.loads(r): v.copy() for r, v in editables.items()}
114-
for v in editables.values():
115-
path = os.path.normpath(os.path.join(self._folder, v["path"], "conanfile.py"))
112+
packages = {}
113+
for editable_info in self._ws.packages():
114+
rel_path = editable_info["path"]
115+
path = os.path.normpath(os.path.join(self._folder, rel_path, "conanfile.py"))
116116
if not os.path.isfile(path):
117117
raise ConanException(f"Workspace editable not found: {path}")
118-
v["path"] = path
119-
if v.get("output_folder"):
120-
v["output_folder"] = os.path.normpath(os.path.join(self._folder,
121-
v["output_folder"]))
122-
return editables
118+
ref = editable_info.get("ref")
119+
try:
120+
if ref is None:
121+
conanfile = self._ws.load_conanfile(rel_path)
122+
reference = RecipeReference(name=conanfile.name, version=conanfile.version,
123+
user=conanfile.user, channel=conanfile.channel)
124+
else:
125+
reference = RecipeReference.loads(ref)
126+
reference.validate_ref(reference)
127+
except:
128+
raise ConanException(f"Workspace editable reference could not be deduced by"
129+
f" {rel_path}/conanfile.py or it is not"
130+
f" correctly defined in the conanws.yml file.")
131+
if reference in packages:
132+
raise ConanException(f"Workspace editable reference '{str(reference)}' already exists.")
133+
packages[reference] = {"path": path}
134+
if editable_info.get("output_folder"):
135+
packages[reference]["output_folder"] = (
136+
os.path.normpath(os.path.join(self._folder, editable_info["output_folder"]))
137+
)
138+
return packages
123139

124140
def open(self, require, remotes, cwd=None):
125141
app = ConanApp(self._conan_api)

conan/cli/commands/cache.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ def cache_path(conan_api: ConanAPI, parser, subparser, *args):
6464
return path
6565

6666

67+
@conan_subcommand(formatters={"text": cli_out_write})
68+
def cache_ref(conan_api: ConanAPI, parser, subparser, *args):
69+
"""
70+
Show the reference for a given Conan cache folder
71+
"""
72+
subparser.add_argument("path", help="Path to a Conan cache folder")
73+
args = parser.parse_args(*args)
74+
ref = conan_api.cache.path_to_ref(args.path)
75+
if ref is None:
76+
raise ConanException("Reference for this path not found in cache")
77+
return ref.repr_notime()
78+
79+
6780
@conan_subcommand()
6881
def cache_clean(conan_api: ConanAPI, parser, subparser, *args):
6982
"""

conan/cli/commands/export_pkg.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def export_pkg(conan_api, parser, *args):
3838

3939
cwd = os.getcwd()
4040
path = conan_api.local.get_conanfile_path(args.path, cwd, py=True)
41-
test_conanfile_path = _get_test_conanfile_path(args.test_folder, path)
4241
overrides = eval(args.lockfile_overrides) if args.lockfile_overrides else None
4342
lockfile = conan_api.lockfile.get_lockfile(lockfile=args.lockfile, conanfile_path=path,
4443
cwd=cwd, partial=args.lockfile_partial,
@@ -92,6 +91,9 @@ def export_pkg(conan_api, parser, *args):
9291
lockfile = conan_api.lockfile.update_lockfile(lockfile, deps_graph, args.lockfile_packages,
9392
clean=args.lockfile_clean)
9493

94+
test_package_folder = getattr(conanfile, "test_package_folder", None) \
95+
if args.test_folder is None else args.test_folder
96+
test_conanfile_path = _get_test_conanfile_path(test_package_folder, path)
9597
if test_conanfile_path:
9698
from conan.cli.commands.test import run_test
9799
# same as ``conan create`` the lockfile, and deps graph is the one of the exported-pkg

conan/cli/commands/workspace.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ def print_json(data):
9393

9494

9595
def _print_workspace_info(data):
96+
ret = []
97+
for package_info in data["info"]["packages"]:
98+
ret.append(f"- path: {package_info['path']}")
99+
ref = package_info.get('ref')
100+
if ref:
101+
ret.append(f" ref: {ref}")
102+
data["info"]["packages"] = ret or "(empty)"
96103
print_serial(data["info"])
97104

98105

conan/cli/formatters/graph/info_graph_html.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<label for="show_package_type">Show package type</label>
4545
</div>
4646
<div>
47-
<input type="search" placeholder="Search packages..." oninput="searchPackages(this)">
47+
<input type="search" placeholder="Search packages..." oninput="searchPackages(this)" onkeydown="onSearchKeyDown(event)">
4848
</div>
4949
<div>
5050
<input type="search" placeholder="Exclude packages..." title="Add a comma to exclude an additional package" oninput="excludePackages(this)">
@@ -64,6 +64,7 @@
6464
let hide_build = false;
6565
let hide_test = false;
6666
let search_pkgs = null;
67+
let focus_search = false;
6768
let excluded_pkgs = null;
6869
let collapse_packages = false;
6970
let show_package_type = false;
@@ -135,6 +136,9 @@
135136
if (patterns.some(pattern => label.match(pattern))) {
136137
borderWidth = 3;
137138
borderColor = "Magenta";
139+
if (focus_search) {
140+
focus_search = node_id;
141+
}
138142
}
139143
}
140144
if (node.test) {
@@ -312,6 +316,10 @@
312316
network.setData(data);
313317
network.redraw();
314318
network.moveTo({position: viewPos, scale: scale});
319+
// If we have found a package to focus, we need to move the view
320+
if (typeof focus_search === "string") {
321+
network.focus(focus_search, {animation: true, locked: false});
322+
}
315323
}
316324
function switchBuild() {
317325
hide_build = !hide_build;
@@ -325,13 +333,28 @@
325333
collapse_packages = !collapse_packages;
326334
draw();
327335
}
336+
const debounce = (func, delay) => {
337+
let timeout;
338+
return function(...args) {
339+
clearTimeout(timeout);
340+
timeout = setTimeout(() => func.apply(this, args), delay);
341+
};
342+
};
343+
const debouncedDraw = debounce(draw, 300);
328344
function searchPackages(e) {
329345
search_pkgs = e.value;
330-
draw();
346+
debouncedDraw();
347+
}
348+
function onSearchKeyDown(event) {
349+
if (event.key === "Enter") {
350+
focus_search = true;
351+
draw();
352+
focus_search = false;
353+
}
331354
}
332355
function excludePackages(e) {
333356
excluded_pkgs = e.value;
334-
draw();
357+
debouncedDraw();
335358
}
336359
function showPackageType(e) {
337360
show_package_type = !show_package_type;

conan/cli/formatters/report/diff_html.py

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,56 +32,70 @@
3232
}
3333
</style>
3434
<script>
35+
function debounce(func, delay) {
36+
let timeout;
37+
return function(...args) {
38+
const context = this;
39+
clearTimeout(timeout);
40+
timeout = setTimeout(() => {
41+
func.apply(context, args);
42+
}, delay);
43+
};
44+
}
3545
let includeSearchQuery = "";
3646
let excludeSearchQuery = "";
3747
38-
async function onExcludeSearchInput(event) {
39-
excludeSearchQuery = event.currentTarget.value.toLowerCase();
40-
onSearchInput(event);
41-
}
42-
43-
async function onIncludeSearchInput(event) {
44-
includeSearchQuery = event.currentTarget.value.toLowerCase();
45-
onSearchInput(event);
46-
}
47-
4848
async function onSearchInput(event) {
4949
const sidebar = document.querySelectorAll(".sidebar li");
5050
const content = document.querySelectorAll(".content .diff-content");
51+
const searchingIcon = document.getElementById("searching_icon");
52+
53+
searchingIcon.style.display = "inline-block";
54+
55+
let emptySearch = true;
5156
5257
sidebar.forEach(async function(item) {
5358
const text = item.textContent.toLowerCase();
5459
const shouldInclude = includeSearchQuery === "" || text.includes(includeSearchQuery);
5560
const shouldExclude = excludeSearchQuery !== "" && text.includes(excludeSearchQuery);
61+
const associatedId = item.querySelector("a").getAttribute("href").substring(1)
62+
const contentItem = document.getElementById(associatedId);
5663
5764
if (shouldInclude) {
5865
if (shouldExclude) {
5966
item.style.display = "none";
67+
contentItem.style.display = "none";
6068
} else {
6169
item.style.display = "list-item";
70+
contentItem.style.display = "block";
71+
emptySearch = false;
6272
}
6373
} else {
6474
item.style.display = "none";
75+
contentItem.style.display = "none";
6576
}
6677
6778
});
6879
69-
content.forEach(async function(item) {
70-
const filename = document.getElementById(item.id + "_filename");
71-
const text = filename.dataset.replacedPaths.toLowerCase();
72-
const shouldInclude = includeSearchQuery === "" || text.includes(includeSearchQuery);
73-
const shouldExclude = excludeSearchQuery !== "" && text.includes(excludeSearchQuery);
80+
searchingIcon.style.display = "none";
81+
const emptySearchTag = document.getElementById("empty_search");
82+
if (emptySearch) {
83+
emptySearchTag.style.display = "block";
84+
} else {
85+
emptySearchTag.style.display = "none";
86+
}
87+
}
7488
75-
if (shouldInclude) {
76-
if (shouldExclude) {
77-
item.style.display = "none";
78-
} else {
79-
item.style.display = "block";
80-
}
81-
} else {
82-
item.style.display = "none";
83-
}
84-
});
89+
const debouncedOnSearchInput = debounce(onSearchInput, 500);
90+
91+
async function onExcludeSearchInput(event) {
92+
excludeSearchQuery = event.currentTarget.value.toLowerCase();
93+
debouncedOnSearchInput(event);
94+
}
95+
96+
async function onIncludeSearchInput(event) {
97+
includeSearchQuery = event.currentTarget.value.toLowerCase();
98+
debouncedOnSearchInput(event);
8599
}
86100
</script>
87101
</head>
@@ -96,10 +110,12 @@
96110
<h2>File list:</h2>
97111
<input type="text" id="search-include" placeholder="Include search..." oninput="onIncludeSearchInput(event)" />
98112
<input type="text" id="search-exclude" placeholder="Exclude search..." oninput="onExcludeSearchInput(event)" />
113+
<span id="searching_icon" style="display:none">...</span>
99114
<ul>
100115
{%- for filename in content.keys() %}
101116
<li><a href="#diff_{{- safe_filename(filename) -}}" class="side-link">{{ replace_cache_paths(filename) }}</a></li>
102117
{%- endfor %}
118+
<span id="empty_search" style="display:none">No results found</span>
103119
</ul>
104120
</div>
105121
<div class='content'>

conan/cli/printers/graph.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ def _format_resolved(title, reqs_to_print):
9898
if deprecated:
9999
output.warning("There are deprecated packages in the graph", warn_tag="risk")
100100

101+
if graph.visibility_conflicts:
102+
msg = ["Packages required both with visible=True and visible=False"]
103+
for ref, consumers in graph.visibility_conflicts.items():
104+
msg.append(f" {ref}: Required by {', '.join(str(c) for c in consumers)}")
105+
output.warning("\n".join(msg), warn_tag="risk")
106+
101107

102108
def print_graph_packages(graph):
103109
# I am excluding the "download"-"cache" or remote information, that is not

0 commit comments

Comments
 (0)