1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qbs.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39
40 #include "builtindeclarations.h"
41
42 #include "deprecationinfo.h"
43
44 #include <logging/translator.h>
45 #include <tools/error.h>
46 #include <tools/qbsassert.h>
47 #include <tools/stringconstants.h>
48
49 #include <QtCore/qstringlist.h>
50
51 #include <initializer_list>
52 #include <utility>
53
54 namespace qbs {
55 namespace Internal {
56
57 class AClassWithPublicConstructor : public BuiltinDeclarations { };
58 Q_GLOBAL_STATIC(AClassWithPublicConstructor, theInstance)
59
60 const char QBS_LANGUAGE_VERSION[] = "1.0";
61
BuiltinDeclarations()62 BuiltinDeclarations::BuiltinDeclarations()
63 : m_languageVersion(Version::fromString(QLatin1String(QBS_LANGUAGE_VERSION)))
64 , m_typeMap(std::initializer_list<std::pair<QString, ItemType>>({
65 { QStringLiteral("Artifact"), ItemType::Artifact },
66 { QStringLiteral("Depends"), ItemType::Depends },
67 { QStringLiteral("Export"), ItemType::Export },
68 { QStringLiteral("FileTagger"), ItemType::FileTagger },
69 { QStringLiteral("Group"), ItemType::Group },
70 { QStringLiteral("JobLimit"), ItemType::JobLimit },
71 { QStringLiteral("Module"), ItemType::Module },
72 { QStringLiteral("ModuleProvider"), ItemType::ModuleProvider },
73 { QStringLiteral("Parameter"), ItemType::Parameter },
74 { QStringLiteral("Parameters"), ItemType::Parameters },
75 { QStringLiteral("Probe"), ItemType::Probe },
76 { QStringLiteral("Product"), ItemType::Product },
77 { QStringLiteral("Profile"), ItemType::Profile },
78 { QStringLiteral("Project"), ItemType::Project },
79 { QStringLiteral("Properties"), ItemType::Properties }, // Callers have to handle the SubProject case.
80 { QStringLiteral("PropertyOptions"), ItemType::PropertyOptions },
81 { QStringLiteral("Rule"), ItemType::Rule },
82 { QStringLiteral("Scanner"), ItemType::Scanner },
83 { QStringLiteral("SubProject"), ItemType::SubProject },
84 { QStringLiteral("Transformer"), ItemType::Transformer }
85 }))
86 {
87 addArtifactItem();
88 addDependsItem();
89 addExportItem();
90 addFileTaggerItem();
91 addGroupItem();
92 addJobLimitItem();
93 addModuleItem();
94 addModuleProviderItem();
95 addProbeItem();
96 addProductItem();
97 addProfileItem();
98 addProjectItem();
99 addPropertiesItem();
100 addPropertyOptionsItem();
101 addRuleItem();
102 addSubprojectItem();
103 addTransformerItem();
104 addScannerItem();
105 }
106
instance()107 const BuiltinDeclarations &BuiltinDeclarations::instance()
108 {
109 return *theInstance;
110 }
111
languageVersion() const112 Version BuiltinDeclarations::languageVersion() const
113 {
114 return m_languageVersion;
115 }
116
allTypeNames() const117 QStringList BuiltinDeclarations::allTypeNames() const
118 {
119 return m_typeMap.keys();
120 }
121
declarationsForType(ItemType type) const122 ItemDeclaration BuiltinDeclarations::declarationsForType(ItemType type) const
123 {
124 return m_builtins.value(type);
125 }
126
typeForName(const QString & typeName,const CodeLocation & location) const127 ItemType BuiltinDeclarations::typeForName(const QString &typeName,
128 const CodeLocation &location) const
129 {
130 const auto it = m_typeMap.constFind(typeName);
131 if (it == m_typeMap.constEnd())
132 throw ErrorInfo(Tr::tr("Unexpected item type '%1'.").arg(typeName), location);
133 return it.value();
134 }
135
nameForType(ItemType itemType) const136 QString BuiltinDeclarations::nameForType(ItemType itemType) const
137 {
138 // Iterating is okay here, as this mapping is not used in hot code paths.
139 if (itemType == ItemType::PropertiesInSubProject)
140 return QStringLiteral("Properties");
141 for (auto it = m_typeMap.constBegin(); it != m_typeMap.constEnd(); ++it) {
142 if (it.value() == itemType)
143 return it.key();
144 }
145 QBS_CHECK(false);
146 return {};
147 }
148
argumentNamesForScriptFunction(ItemType itemType,const QString & scriptName) const149 QStringList BuiltinDeclarations::argumentNamesForScriptFunction(ItemType itemType,
150 const QString &scriptName) const
151 {
152 const ItemDeclaration itemDecl = declarationsForType(itemType);
153 const auto properties = itemDecl.properties();
154 for (const PropertyDeclaration &propDecl : properties) {
155 if (propDecl.name() == scriptName)
156 return propDecl.functionArgumentNames();
157 }
158 QBS_CHECK(false);
159 return {};
160 }
161
insert(const ItemDeclaration & decl)162 void BuiltinDeclarations::insert(const ItemDeclaration &decl)
163 {
164 m_builtins.insert(decl.type(), decl);
165 }
166
conditionProperty()167 static PropertyDeclaration conditionProperty()
168 {
169 return PropertyDeclaration(StringConstants::conditionProperty(), PropertyDeclaration::Boolean,
170 StringConstants::trueValue());
171 }
172
alwaysRunProperty()173 static PropertyDeclaration alwaysRunProperty()
174 {
175 return PropertyDeclaration(StringConstants::alwaysRunProperty(), PropertyDeclaration::Boolean,
176 StringConstants::falseValue());
177 }
178
nameProperty()179 static PropertyDeclaration nameProperty()
180 {
181 return PropertyDeclaration(StringConstants::nameProperty(), PropertyDeclaration::String);
182 }
183
buildDirProperty()184 static PropertyDeclaration buildDirProperty()
185 {
186 return PropertyDeclaration(StringConstants::buildDirectoryProperty(),
187 PropertyDeclaration::Path);
188 }
189
prepareScriptProperty()190 static PropertyDeclaration prepareScriptProperty()
191 {
192 PropertyDeclaration decl(StringConstants::prepareProperty(), PropertyDeclaration::Variant,
193 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
194 decl.setFunctionArgumentNames(
195 QStringList()
196 << StringConstants::projectVar() << StringConstants::productValue()
197 << StringConstants::inputsVar() << StringConstants::outputsVar()
198 << StringConstants::inputVar() << StringConstants::outputVar()
199 << StringConstants::explicitlyDependsOnVar());
200 return decl;
201 }
202
priorityProperty()203 static PropertyDeclaration priorityProperty()
204 {
205 return {StringConstants::priorityProperty(), PropertyDeclaration::Integer};
206 }
207
addArtifactItem()208 void BuiltinDeclarations::addArtifactItem()
209 {
210 ItemDeclaration item(ItemType::Artifact);
211 PropertyDeclaration conditionDecl = conditionProperty();
212 conditionDecl.setDeprecationInfo(DeprecationInfo(Version(1, 4), Tr::tr("If you need "
213 "dynamic artifacts, use the Rule.outputArtifacts script instead of Artifact items.")));
214 item << conditionDecl;
215 PropertyDeclaration fileNameDecl(StringConstants::fileNameProperty(),
216 PropertyDeclaration::String);
217 fileNameDecl.setDeprecationInfo(DeprecationInfo(Version(1, 4),
218 Tr::tr("Please use 'filePath' instead.")));
219 item << fileNameDecl;
220 item << PropertyDeclaration(StringConstants::filePathProperty(), PropertyDeclaration::String);
221 item << PropertyDeclaration(StringConstants::fileTagsProperty(),
222 PropertyDeclaration::StringList);
223 item << PropertyDeclaration(StringConstants::alwaysUpdatedProperty(),
224 PropertyDeclaration::Boolean, StringConstants::trueValue());
225 insert(item);
226 }
227
addDependsItem()228 void BuiltinDeclarations::addDependsItem()
229 {
230 ItemDeclaration item(ItemType::Depends);
231 item << conditionProperty();
232 item << nameProperty();
233 item << PropertyDeclaration(StringConstants::submodulesProperty(),
234 PropertyDeclaration::StringList);
235 item << PropertyDeclaration(StringConstants::requiredProperty(), PropertyDeclaration::Boolean,
236 StringConstants::trueValue());
237 item << PropertyDeclaration(StringConstants::versionAtLeastProperty(),
238 PropertyDeclaration::String);
239 item << PropertyDeclaration(StringConstants::versionBelowProperty(),
240 PropertyDeclaration::String);
241 item << PropertyDeclaration(StringConstants::profilesProperty(),
242 PropertyDeclaration::StringList);
243 item << PropertyDeclaration(StringConstants::productTypesProperty(),
244 PropertyDeclaration::StringList);
245 item << PropertyDeclaration(StringConstants::limitToSubProjectProperty(),
246 PropertyDeclaration::Boolean, StringConstants::falseValue());
247 item << PropertyDeclaration(StringConstants::multiplexConfigurationIdsProperty(),
248 PropertyDeclaration::StringList, QString(),
249 PropertyDeclaration::ReadOnlyFlag);
250 item << PropertyDeclaration(StringConstants::enableFallbackProperty(),
251 PropertyDeclaration::Boolean, StringConstants::trueValue());
252 insert(item);
253 }
254
addExportItem()255 void BuiltinDeclarations::addExportItem()
256 {
257 ItemDeclaration item = moduleLikeItem(ItemType::Export);
258 item << PropertyDeclaration(StringConstants::prefixMappingProperty(),
259 PropertyDeclaration::Variant);
260 auto allowedChildTypes = item.allowedChildTypes();
261 allowedChildTypes.insert(ItemType::Parameters);
262 allowedChildTypes.insert(ItemType::Properties);
263 item.setAllowedChildTypes(allowedChildTypes);
264 insert(item);
265 }
266
addFileTaggerItem()267 void BuiltinDeclarations::addFileTaggerItem()
268 {
269 ItemDeclaration item(ItemType::FileTagger);
270 item << conditionProperty();
271 item << PropertyDeclaration(StringConstants::patternsProperty(),
272 PropertyDeclaration::StringList);
273 item << PropertyDeclaration(StringConstants::fileTagsProperty(),
274 PropertyDeclaration::StringList);
275 item << priorityProperty();
276 insert(item);
277 }
278
addGroupItem()279 void BuiltinDeclarations::addGroupItem()
280 {
281 ItemDeclaration item(ItemType::Group);
282 item.setAllowedChildTypes({ ItemType::Group });
283 item << conditionProperty();
284 item << PropertyDeclaration(StringConstants::nameProperty(), PropertyDeclaration::String,
285 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
286 item << PropertyDeclaration(StringConstants::filesProperty(), PropertyDeclaration::PathList,
287 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
288 item << PropertyDeclaration(StringConstants::fileTagsFilterProperty(),
289 PropertyDeclaration::StringList,
290 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
291 item << PropertyDeclaration(StringConstants::excludeFilesProperty(),
292 PropertyDeclaration::PathList,
293 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
294 item << PropertyDeclaration(StringConstants::fileTagsProperty(),
295 PropertyDeclaration::StringList, QString(),
296 PropertyDeclaration::PropertyNotAvailableInConfig);
297 item << PropertyDeclaration(StringConstants::prefixProperty(), PropertyDeclaration::String,
298 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
299 item << PropertyDeclaration(StringConstants::overrideTagsProperty(),
300 PropertyDeclaration::Boolean, StringConstants::trueValue(),
301 PropertyDeclaration::PropertyNotAvailableInConfig);
302 item << PropertyDeclaration(StringConstants::filesAreTargetsProperty(),
303 PropertyDeclaration::Boolean, StringConstants::falseValue(),
304 PropertyDeclaration::PropertyNotAvailableInConfig);
305 insert(item);
306 }
307
addJobLimitItem()308 void BuiltinDeclarations::addJobLimitItem()
309 {
310 ItemDeclaration item(ItemType::JobLimit);
311 item << conditionProperty();
312 item << PropertyDeclaration(StringConstants::jobPoolProperty(), PropertyDeclaration::String);
313 item << PropertyDeclaration(StringConstants::jobCountProperty(), PropertyDeclaration::Integer);
314 insert(item);
315 }
316
addModuleItem()317 void BuiltinDeclarations::addModuleItem()
318 {
319 ItemDeclaration item = moduleLikeItem(ItemType::Module);
320 item << priorityProperty();
321 insert(item);
322 }
323
addModuleProviderItem()324 void BuiltinDeclarations::addModuleProviderItem()
325 {
326 ItemDeclaration item(ItemType::ModuleProvider);
327 item << nameProperty()
328 << PropertyDeclaration(QStringLiteral("outputBaseDir"), PropertyDeclaration::String)
329 << PropertyDeclaration(QStringLiteral("relativeSearchPaths"),
330 PropertyDeclaration::StringList);
331 insert(item);
332 }
333
moduleLikeItem(ItemType type)334 ItemDeclaration BuiltinDeclarations::moduleLikeItem(ItemType type)
335 {
336 ItemDeclaration item(type);
337 item.setAllowedChildTypes(ItemDeclaration::TypeNames()
338 << ItemType::Group
339 << ItemType::Depends
340 << ItemType::FileTagger
341 << ItemType::JobLimit
342 << ItemType::Rule
343 << ItemType::Parameter
344 << ItemType::Probe
345 << ItemType::PropertyOptions
346 << ItemType::Scanner);
347 item << nameProperty();
348 item << conditionProperty();
349 PropertyDeclaration setupBuildEnvDecl(StringConstants::setupBuildEnvironmentProperty(),
350 PropertyDeclaration::Variant, QString(),
351 PropertyDeclaration::PropertyNotAvailableInConfig);
352 setupBuildEnvDecl.setFunctionArgumentNames(QStringList{StringConstants::projectVar(),
353 StringConstants::productVar()});
354 item << setupBuildEnvDecl;
355 PropertyDeclaration setupRunEnvDecl(StringConstants::setupRunEnvironmentProperty(),
356 PropertyDeclaration::Variant, QString(),
357 PropertyDeclaration::PropertyNotAvailableInConfig);
358 setupRunEnvDecl.setFunctionArgumentNames(QStringList{StringConstants::projectVar(),
359 StringConstants::productVar()});
360 item << setupRunEnvDecl;
361 item << PropertyDeclaration(StringConstants::validateProperty(),
362 PropertyDeclaration::Boolean, QString(),
363 PropertyDeclaration::PropertyNotAvailableInConfig);
364 item << PropertyDeclaration(StringConstants::additionalProductTypesProperty(),
365 PropertyDeclaration::StringList);
366 item << PropertyDeclaration(StringConstants::versionProperty(), PropertyDeclaration::String);
367 item << PropertyDeclaration(StringConstants::presentProperty(), PropertyDeclaration::Boolean,
368 StringConstants::trueValue());
369 return item;
370 }
371
addProbeItem()372 void BuiltinDeclarations::addProbeItem()
373 {
374 ItemDeclaration item(ItemType::Probe);
375 item << conditionProperty();
376 item << PropertyDeclaration(StringConstants::foundProperty(), PropertyDeclaration::Boolean,
377 StringConstants::falseValue());
378 item << PropertyDeclaration(StringConstants::configureProperty(), PropertyDeclaration::Variant,
379 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
380 insert(item);
381 }
382
addProductItem()383 void BuiltinDeclarations::addProductItem()
384 {
385 ItemDeclaration item(ItemType::Product);
386 item.setAllowedChildTypes(ItemDeclaration::TypeNames()
387 << ItemType::Depends
388 << ItemType::Group
389 << ItemType::FileTagger
390 << ItemType::JobLimit
391 << ItemType::Export
392 << ItemType::Probe
393 << ItemType::Profile
394 << ItemType::PropertyOptions
395 << ItemType::Rule);
396 item << conditionProperty();
397 item << PropertyDeclaration(StringConstants::typeProperty(), PropertyDeclaration::StringList,
398 StringConstants::emptyArrayValue());
399 item << nameProperty();
400 item << PropertyDeclaration(StringConstants::builtByDefaultProperty(),
401 PropertyDeclaration::Boolean, StringConstants::trueValue());
402 PropertyDeclaration profilesDecl(StringConstants::profilesProperty(),
403 PropertyDeclaration::StringList);
404 profilesDecl.setDeprecationInfo(DeprecationInfo(Version::fromString(QStringLiteral("1.9.0")),
405 Tr::tr("Use qbs.profiles instead.")));
406 item << profilesDecl;
407 item << PropertyDeclaration(StringConstants::targetNameProperty(), PropertyDeclaration::String,
408 QStringLiteral("new String(name)"
409 ".replace(/[/\\\\?%*:|\"<>]/g, '_').valueOf()"));
410 item << buildDirProperty();
411 item << PropertyDeclaration(StringConstants::destinationDirProperty(),
412 PropertyDeclaration::String,
413 StringConstants::buildDirectoryProperty());
414 item << PropertyDeclaration(StringConstants::consoleApplicationProperty(),
415 PropertyDeclaration::Boolean);
416 item << PropertyDeclaration(StringConstants::filesProperty(), PropertyDeclaration::PathList,
417 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
418 item << PropertyDeclaration(StringConstants::excludeFilesProperty(),
419 PropertyDeclaration::PathList,
420 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
421 item << PropertyDeclaration(StringConstants::qbsSearchPathsProperty(),
422 PropertyDeclaration::StringList);
423 item << PropertyDeclaration(StringConstants::versionProperty(), PropertyDeclaration::String);
424
425 item << PropertyDeclaration(StringConstants::multiplexByQbsPropertiesProperty(),
426 PropertyDeclaration::StringList, QStringLiteral("[\"profiles\"]"));
427 item << PropertyDeclaration(StringConstants::multiplexedTypeProperty(),
428 PropertyDeclaration::StringList);
429 item << PropertyDeclaration(StringConstants::aggregateProperty(), PropertyDeclaration::Boolean);
430 item << PropertyDeclaration(StringConstants::multiplexedProperty(),
431 PropertyDeclaration::Boolean,
432 QString(), PropertyDeclaration::ReadOnlyFlag);
433 item << PropertyDeclaration(StringConstants::multiplexConfigurationIdProperty(),
434 PropertyDeclaration::String, QString(),
435 PropertyDeclaration::ReadOnlyFlag);
436 item << PropertyDeclaration(StringConstants::qbsModuleProviders(),
437 PropertyDeclaration::StringList);
438 insert(item);
439 }
440
addProfileItem()441 void BuiltinDeclarations::addProfileItem()
442 {
443 ItemDeclaration item(ItemType::Profile);
444 item << conditionProperty();
445 item << nameProperty();
446 item << PropertyDeclaration(StringConstants::baseProfileProperty(),
447 PropertyDeclaration::String);
448 insert(item);
449 }
450
addProjectItem()451 void BuiltinDeclarations::addProjectItem()
452 {
453 ItemDeclaration item(ItemType::Project);
454 item.setAllowedChildTypes(ItemDeclaration::TypeNames()
455 << ItemType::Project
456 << ItemType::PropertyOptions
457 << ItemType::SubProject
458 << ItemType::Product
459 << ItemType::Profile
460 << ItemType::Probe
461 << ItemType::FileTagger
462 << ItemType::JobLimit
463 << ItemType::Rule);
464 item << nameProperty();
465 item << conditionProperty();
466 item << buildDirProperty();
467 item << PropertyDeclaration(StringConstants::minimumQbsVersionProperty(),
468 PropertyDeclaration::String);
469 item << PropertyDeclaration(StringConstants::sourceDirectoryProperty(),
470 PropertyDeclaration::Path);
471 item << PropertyDeclaration(StringConstants::profileProperty(), PropertyDeclaration::String);
472 item << PropertyDeclaration(StringConstants::referencesProperty(),
473 PropertyDeclaration::PathList,
474 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
475 item << PropertyDeclaration(StringConstants::qbsSearchPathsProperty(),
476 PropertyDeclaration::StringList,
477 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
478 item << PropertyDeclaration(StringConstants::qbsModuleProviders(),
479 PropertyDeclaration::StringList);
480 insert(item);
481 }
482
addPropertiesItem()483 void BuiltinDeclarations::addPropertiesItem()
484 {
485 ItemDeclaration item(ItemType::Properties);
486 item << conditionProperty();
487 insert(item);
488 }
489
addPropertyOptionsItem()490 void BuiltinDeclarations::addPropertyOptionsItem()
491 {
492 ItemDeclaration item(ItemType::PropertyOptions);
493 item << nameProperty();
494 item << PropertyDeclaration(StringConstants::allowedValuesProperty(),
495 PropertyDeclaration::Variant);
496 item << PropertyDeclaration(StringConstants::descriptionProperty(),
497 PropertyDeclaration::String);
498 item << PropertyDeclaration(StringConstants::removalVersionProperty(),
499 PropertyDeclaration::String);
500 insert(item);
501 }
502
addRuleItem()503 void BuiltinDeclarations::addRuleItem()
504 {
505 ItemDeclaration item(ItemType::Rule);
506 item.setAllowedChildTypes(ItemDeclaration::TypeNames()
507 << ItemType::Artifact);
508 item << conditionProperty();
509 item << alwaysRunProperty();
510 item << PropertyDeclaration(StringConstants::multiplexProperty(), PropertyDeclaration::Boolean,
511 StringConstants::falseValue());
512 item << PropertyDeclaration(StringConstants::requiresInputsProperty(),
513 PropertyDeclaration::Boolean);
514 item << nameProperty();
515 item << PropertyDeclaration(StringConstants::inputsProperty(), PropertyDeclaration::StringList);
516 item << PropertyDeclaration(StringConstants::outputFileTagsProperty(),
517 PropertyDeclaration::StringList);
518 PropertyDeclaration outputArtifactsDecl(StringConstants::outputArtifactsProperty(),
519 PropertyDeclaration::Variant, QString(),
520 PropertyDeclaration::PropertyNotAvailableInConfig);
521 outputArtifactsDecl.setFunctionArgumentNames(
522 QStringList()
523 << StringConstants::projectVar() << StringConstants::productVar()
524 << StringConstants::inputsVar() << StringConstants::inputVar());
525 item << outputArtifactsDecl;
526 PropertyDeclaration usingsDecl(QStringLiteral("usings"), PropertyDeclaration::StringList);
527 usingsDecl.setDeprecationInfo(DeprecationInfo(Version(1, 5),
528 Tr::tr("Use 'inputsFromDependencies' instead")));
529 item << usingsDecl;
530 item << PropertyDeclaration(StringConstants::inputsFromDependenciesProperty(),
531 PropertyDeclaration::StringList);
532 item << PropertyDeclaration(StringConstants::auxiliaryInputsProperty(),
533 PropertyDeclaration::StringList);
534 PropertyDeclaration excludedAuxInputs(StringConstants::excludedAuxiliaryInputsProperty(),
535 PropertyDeclaration::StringList);
536 excludedAuxInputs.setDeprecationInfo(DeprecationInfo(Version(1, 14),
537 Tr::tr("Use 'excludedInputs' instead")));
538 item << excludedAuxInputs;
539 item << PropertyDeclaration(StringConstants::excludedInputsProperty(),
540 PropertyDeclaration::StringList);
541 item << PropertyDeclaration(StringConstants::explicitlyDependsOnProperty(),
542 PropertyDeclaration::StringList);
543 item << PropertyDeclaration(StringConstants::explicitlyDependsOnFromDependenciesProperty(),
544 PropertyDeclaration::StringList);
545 item << prepareScriptProperty();
546 insert(item);
547 }
548
addSubprojectItem()549 void BuiltinDeclarations::addSubprojectItem()
550 {
551 ItemDeclaration item(ItemType::SubProject);
552 item.setAllowedChildTypes(ItemDeclaration::TypeNames()
553 << ItemType::Project // needed, because we're adding this internally
554 << ItemType::PropertiesInSubProject
555 << ItemType::PropertyOptions);
556 item << conditionProperty();
557 item << PropertyDeclaration(StringConstants::filePathProperty(), PropertyDeclaration::Path);
558 item << PropertyDeclaration(StringConstants::inheritPropertiesProperty(),
559 PropertyDeclaration::Boolean,
560 StringConstants::trueValue());
561 insert(item);
562 }
563
addTransformerItem()564 void BuiltinDeclarations::addTransformerItem()
565 {
566 ItemDeclaration item(ItemType::Transformer);
567 item.setDeprecationInfo(DeprecationInfo(Version(1, 7), Tr::tr("Use the 'Rule' item instead.")));
568 item.setAllowedChildTypes(ItemDeclaration::TypeNames()
569 << ItemType::Artifact);
570 item << conditionProperty();
571 item << alwaysRunProperty();
572 item << PropertyDeclaration(StringConstants::inputsProperty(), PropertyDeclaration::PathList);
573 item << prepareScriptProperty();
574 item << PropertyDeclaration(StringConstants::explicitlyDependsOnProperty(),
575 PropertyDeclaration::StringList);
576 insert(item);
577 }
578
addScannerItem()579 void BuiltinDeclarations::addScannerItem()
580 {
581 ItemDeclaration item(ItemType::Scanner);
582 item << conditionProperty();
583 item << PropertyDeclaration(StringConstants::inputsProperty(), PropertyDeclaration::StringList);
584 item << PropertyDeclaration(StringConstants::recursiveProperty(), PropertyDeclaration::Boolean,
585 StringConstants::falseValue());
586 PropertyDeclaration searchPaths(StringConstants::searchPathsProperty(),
587 PropertyDeclaration::StringList);
588 searchPaths.setFunctionArgumentNames(
589 QStringList()
590 << StringConstants::projectVar()
591 << StringConstants::productVar()
592 << StringConstants::inputVar());
593 item << searchPaths;
594 PropertyDeclaration scan(StringConstants::scanProperty(), PropertyDeclaration::Variant,
595 QString(), PropertyDeclaration::PropertyNotAvailableInConfig);
596 scan.setFunctionArgumentNames(
597 QStringList()
598 << StringConstants::projectVar()
599 << StringConstants::productVar()
600 << StringConstants::inputVar()
601 << StringConstants::filePathVar());
602 item << scan;
603 insert(item);
604 }
605
606 } // namespace Internal
607 } // namespace qbs
608