bool ProductType:: parse(Context *context, plist::Dictionary const *dict, std::unordered_set<std::string> *seen, bool check) { if (!Specification::parse(context, dict, seen, false)) return false; auto unpack = plist::Keys::Unpack("ProductType", dict, seen); auto DTN = unpack.cast <plist::String> ("DefaultTargetName"); auto DBP = unpack.cast <plist::Dictionary> ("DefaultBuildProperties"); auto V = unpack.cast <plist::Dictionary> ("Validation"); auto INP = unpack.cast <plist::String> ("IconNamePrefix"); auto PTs = unpack.cast <plist::Array> ("PackageTypes"); auto HIP = unpack.coerce <plist::Boolean> ("HasInfoPlist"); auto HIPS = unpack.coerce <plist::Boolean> ("HasInfoPlistStrings"); auto IW = unpack.coerce <plist::Boolean> ("IsWrapper"); auto IJ = unpack.coerce <plist::Boolean> ("IsJava"); auto SZL = unpack.coerce <plist::Boolean> ("SupportsZeroLink"); auto APSS = unpack.coerce <plist::Boolean> ("AlwaysPerformSeparateStrip"); auto WSTE = unpack.coerce <plist::Boolean> ("WantsSimpleTargetEditing"); auto AWCR = unpack.coerce <plist::Boolean> ("AddWatchCompanionRequirement"); auto ROP = unpack.coerce <plist::Boolean> ("RunsOnProxy"); auto DSA = unpack.coerce <plist::Boolean> ("DisableSchemeAutocreation"); auto VEB = unpack.coerce <plist::Boolean> ("ValidateEmbeddedBinaries"); auto SODR = unpack.coerce <plist::Boolean> ("SupportsOnDemandResources"); auto CEAL = unpack.coerce <plist::Boolean> ("CanEmbedAddressSanitizerLibraries"); auto RSEF = unpack.coerce <plist::String> ("RunpathSearchPathForEmbeddedFrameworks"); auto IE = unpack.coerce <plist::Boolean> ("IsEmbeddable"); auto BPIWE = unpack.coerce <plist::Array> ("BuildPhaseInjectionsWhenEmbedding"); auto RBPD = unpack.coerce <plist::String> ("RequiredBuiltProductsDir"); if (!unpack.complete(check)) { fprintf(stderr, "%s", unpack.errorText().c_str()); } if (DTN != nullptr) { _defaultTargetName = DTN->value(); } if (DBP != nullptr) { std::vector<Setting> settings; for (size_t n = 0; n < DBP->count(); n++) { auto DBPK = DBP->key(n); auto DBPV = DBP->value <plist::String> (DBPK); if (DBPV != nullptr) { Setting setting = Setting::Parse(DBPK, DBPV->value()); settings.push_back(setting); } } _defaultBuildProperties = Level(settings); } if (V != nullptr) { _validation = Validation(); _validation->parse(V); } if (INP != nullptr) { _iconNamePrefix = INP->value(); } if (PTs != nullptr) { _packageTypes = std::vector<std::string>(); for (size_t n = 0; n < PTs->count(); n++) { if (auto PT = PTs->value <plist::String> (n)) { _packageTypes->push_back(PT->value()); } } } if (HIP != nullptr) { _hasInfoPlist = HIP->value(); } if (HIPS != nullptr) { _hasInfoPlistStrings = HIPS->value(); } if (IW != nullptr) { _isWrapper = IW->value(); } if (IJ != nullptr) { _isJava = IJ->value(); } if (SZL != nullptr) { _supportsZeroLink = SZL->value(); } if (APSS != nullptr) { _alwaysPerformSeparateStrip = APSS->value(); } if (WSTE != nullptr) { _wantsSimpleTargetEditing = WSTE->value(); } if (AWCR != nullptr) { _addWatchCompanionRequirement = AWCR->value(); } if (ROP != nullptr) { _runsOnProxy = ROP->value(); } if (DSA != nullptr) { _disableSchemeAutocreation = DSA->value(); } if (VEB != nullptr) { _validateEmbeddedBinaries = VEB->value(); } if (SODR != nullptr) { _supportsOnDemandResources = SODR->value(); } if (CEAL != nullptr) { _canEmbedAddressSanitizerLibraries = CEAL->value(); } if (RSEF != nullptr) { _runpathSearchPathForEmbeddedFrameworks = RSEF->value(); } if (IE != nullptr) { _isEmbeddable = IE->value(); } if (BPIWE != nullptr) { _buildPhaseInjectionsWhenEmbedding = std::vector<BuildPhaseInjection>(); for (size_t n = 0; n < BPIWE->count(); n++) { auto BPI = BPIWE->value <plist::Dictionary> (n); if (BPI != nullptr) { BuildPhaseInjection injection; if (injection.parse(BPI)) { _buildPhaseInjectionsWhenEmbedding->push_back(injection); } } } } if (RBPD != nullptr) { _requiredBuiltProductsDir = RBPD->value(); } return true; }
bool FileType:: parse(Context *context, plist::Dictionary const *dict, std::unordered_set<std::string> *seen, bool check) { if (!Specification::parse(context, dict, seen, false)) return false; auto unpack = plist::Keys::Unpack("FileType", dict, seen); auto MTs = unpack.cast <plist::Array> ("MIMETypes"); auto U = unpack.cast <plist::String> ("UTI"); auto Es = unpack.cast <plist::Array> ("Extensions"); auto TCs = unpack.cast <plist::Array> ("TypeCodes"); auto FPs = unpack.cast <plist::Array> ("FilenamePatterns"); auto MWs = unpack.cast <plist::Array> ("MagicWord"); auto L = unpack.cast <plist::String> ("Language"); auto CL = unpack.cast <plist::String> ("ComputerLanguage"); auto GDN = unpack.cast <plist::String> ("GccDialectName"); auto Ps = unpack.cast <plist::Array> ("Prefix"); auto P = unpack.cast <plist::String> ("Permissions"); auto BPIWE = unpack.cast <plist::Array> ("BuildPhaseInjectionsWhenEmbedding"); auto ATBR = unpack.coerce <plist::Boolean> ("AppliesToBuildRules"); auto ITF = unpack.coerce <plist::Boolean> ("IsTextFile"); auto IBPF = unpack.coerce <plist::Boolean> ("IsBuildPropertiesFile"); auto ISC = unpack.coerce <plist::Boolean> ("IsSourceCode"); auto ISSC = unpack.coerce <plist::Boolean> ("IsSwiftSourceCode"); auto IP = unpack.coerce <plist::Boolean> ("IsPreprocessed"); auto IT = unpack.coerce <plist::Boolean> ("IsTransparent"); auto ID = unpack.coerce <plist::Boolean> ("IsDocumentation"); auto IEM = unpack.coerce <plist::Boolean> ("IsEmbeddable"); auto IE = unpack.coerce <plist::Boolean> ("IsExecutable"); auto IEWG = unpack.coerce <plist::Boolean> ("IsExecutableWithGUI"); auto IA = unpack.coerce <plist::Boolean> ("IsApplication"); auto IB = unpack.coerce <plist::Boolean> ("IsBundle"); auto IL = unpack.coerce <plist::Boolean> ("IsLibrary"); auto IDL = unpack.coerce <plist::Boolean> ("IsDynamicLibrary"); auto ISL = unpack.coerce <plist::Boolean> ("IsStaticLibrary"); auto IF = unpack.coerce <plist::Boolean> ("IsFolder"); auto IWF = unpack.coerce <plist::Boolean> ("IsWrapperFolder"); auto ISFI = unpack.coerce <plist::Boolean> ("IsScannedForIncludes"); auto IFW = unpack.coerce <plist::Boolean> ("IsFrameworkWrapper"); auto ISFW = unpack.coerce <plist::Boolean> ("IsStaticFrameworkWrapper"); auto IPW = unpack.coerce <plist::Boolean> ("IsProjectWrapper"); auto ITW = unpack.coerce <plist::Boolean> ("IsTargetWrapper"); auto EPNs = unpack.cast <plist::Array> ("ExtraPropertyNames"); auto CPs = unpack.cast <plist::Dictionary> ("ComponentParts"); auto III = unpack.coerce <plist::Boolean> ("IncludeInIndex"); auto CSIII = unpack.coerce <plist::Boolean> ("CanSetIncludeInIndex"); auto RHT = unpack.coerce <plist::Boolean> ("RequiresHardTabs"); auto CNC = unpack.coerce <plist::Boolean> ("ContainsNativeCode"); auto PDS = unpack.cast <plist::String> ("PlistStructureDefinition"); auto CCDGI = unpack.coerce <plist::Boolean> ("ChangesCauseDependencyGraphInvalidation"); auto FABP = unpack.cast <plist::String> ("FallbackAutoroutingBuildPhase"); auto CSOC = unpack.coerce <plist::Boolean> ("CodeSignOnCopy"); auto RHOC = unpack.coerce <plist::Boolean> ("RemoveHeadersOnCopy"); auto VOC = unpack.coerce <plist::Boolean> ("ValidateOnCopy"); if (!unpack.complete(check)) { fprintf(stderr, "%s", unpack.errorText().c_str()); } if (U != nullptr) { _uti = U->value(); } if (Es != nullptr) { _extensions = std::vector<std::string>(); for (size_t n = 0; n < Es->count(); n++) { auto E = Es->value <plist::String> (n); if (E != nullptr) { _extensions->push_back(E->value()); } } } if (MTs != nullptr) { _mimeTypes = std::vector<std::string>(); for (size_t n = 0; n < MTs->count(); n++) { auto MT = MTs->value <plist::String> (n); if (MT != nullptr) { _mimeTypes->push_back(MT->value()); } } } if (TCs != nullptr) { _typeCodes = std::vector<std::string>(); for (size_t n = 0; n < TCs->count(); n++) { auto TC = TCs->value <plist::String> (n); if (TC != nullptr) { _typeCodes->push_back(TC->value()); } } } if (FPs != nullptr) { _filenamePatterns = std::vector<std::string>(); for (size_t n = 0; n < FPs->count(); n++) { auto FP = FPs->value <plist::String> (n); if (FP != nullptr) { _filenamePatterns->push_back(FP->value()); } } } if (MWs != nullptr) { _magicWords = std::vector<std::vector<uint8_t>>(); for (size_t n = 0; n < MWs->count(); n++) { if (auto MW = MWs->value <plist::String> (n)) { std::vector<uint8_t> MWV = std::vector<uint8_t>(MW->value().begin(), MW->value().end()); _magicWords->push_back(MWV); } else if (auto MW = MWs->value <plist::Data> (n)) { _magicWords->push_back(MW->value()); } } } if (L != nullptr) { _language = L->value(); } if (CL != nullptr) { _computerLanguage = CL->value(); } if (GDN != nullptr) { _gccDialectName = GDN->value(); } if (Ps != nullptr) { _prefix = std::vector<std::string>(); for (size_t n = 0; n < Ps->count(); n++) { auto P = Ps->value <plist::String> (n); if (P != nullptr) { _prefix->push_back(P->value()); } } } if (P != nullptr) { _permissions = P->value(); } if (BPIWE != nullptr) { _buildPhaseInjectionsWhenEmbedding = std::vector<BuildPhaseInjection>(); for (size_t n = 0; n < BPIWE->count(); n++) { auto BPI = BPIWE->value <plist::Dictionary> (n); if (BPI != nullptr) { BuildPhaseInjection injection; if (injection.parse(BPI)) { _buildPhaseInjectionsWhenEmbedding->push_back(injection); } } } } if (ATBR != nullptr) { _appliesToBuildRules = ATBR->value(); } if (IT != nullptr) { _isTransparent = IT->value(); } if (ID != nullptr) { _isDocumentation = ID->value(); } if (IBPF != nullptr) { _isBuildPropertiesFile = IBPF->value(); } if (ISC != nullptr) { _isSourceCode = ISC->value(); } if (ISSC != nullptr) { _isSwiftSourceCode = ISSC->value(); } if (IP != nullptr) { _isPreprocessed = IP->value(); } if (IT != nullptr) { _isTransparent = IT->value(); } if (IEM != nullptr) { _isEmbeddable = IEM->value(); } if (IE != nullptr) { _isExecutable = IE->value(); } if (IEWG != nullptr) { _isExecutableWithGUI = IEWG->value(); } if (IA != nullptr) { _isApplication = IA->value(); } if (IB != nullptr) { _isBundle = IB->value(); } if (IL != nullptr) { _isLibrary = IL->value(); } if (IDL != nullptr) { _isDynamicLibrary = IDL->value(); } if (ISL != nullptr) { _isStaticLibrary = ISL->value(); } if (IF != nullptr) { _isFolder = IF->value(); } if (IWF != nullptr) { _isWrappedFolder = IWF->value(); } if (IFW != nullptr) { _isFrameworkWrapper = IFW->value(); } if (ISFW != nullptr) { _isStaticFrameworkWrapper = ISFW->value(); } if (IPW != nullptr) { _isProjectWrapper = IPW->value(); } if (ITW != nullptr) { _isTargetWrapper = ITW->value(); } if (EPNs != nullptr) { _extraPropertyNames = std::vector<std::string>(); for (size_t n = 0; n < EPNs->count(); n++) { auto EPN = EPNs->value <plist::String> (n); if (EPN != nullptr) { _extraPropertyNames->push_back(EPN->value()); } } } if (CPs != nullptr) { _componentParts = std::vector<ComponentPart>(); for (size_t n = 0; n < CPs->count(); n++) { auto K = CPs->key(n); auto CP = CPs->value <plist::Array> (n); if (CP != nullptr) { ComponentPart cp; if (cp.parse(K, CP)) { _componentParts->push_back(cp); } } } } if (ISFI != nullptr) { _isScannedForIncludes = ISFI->value(); } if (III != nullptr) { _includeInIndex = III->value(); } if (CSIII != nullptr) { _canSetIncludeInIndex = CSIII->value(); } if (RHT != nullptr) { _requiresHardTabs = RHT->value(); } if (CNC != nullptr) { _containsNativeCode = CNC->value(); } if (PDS != nullptr) { _plistStructureDefinition = PDS->value(); } if (CCDGI != nullptr) { _changesCauseDependencyGraphInvalidation = CCDGI->value(); } if (FABP != nullptr) { _fallbackAutoroutingBuildPhase = FABP->value(); } if (CSOC != nullptr) { _codeSignOnCopy = CSOC->value(); } if (RHOC != nullptr) { _removeHeadersOnCopy = RHOC->value(); } if (VOC != nullptr) { _validateOnCopy = VOC->value(); } return true; }