Repository navigation
Add support for containerURLs through publisher cache folders - #2384
Conversation
|
|
||
| #include <COMIncludes.h> | ||
| #import <windows.storage.h> | ||
| #import <wrl\client.h> |
There was a problem hiding this comment.
standardize on /
| ComPtr<IStorageItem> storageItem; | ||
| RETURN_NULL_IF_FAILED(folder.As(&storageItem)); | ||
|
|
||
| HSTRING folderPath; |
There was a problem hiding this comment.
You probably want a HStringReference here; i think get_Path will return a +1 HSTRING, and you'll leak it.
There was a problem hiding this comment.
Ah, spent too much time with CF, got used to Get = 0
There was a problem hiding this comment.
You actually want a Wrappers::HString https://msdn.microsoft.com/en-us/library/hh771141.aspx
HStringReference is for a reference to an existing string resource to avoid copies.
In reply to: 109047974 [](ancestors = 109047974)
|
|
||
| PBXFileReference* m_productReferencePtr; | ||
| BuildRuleList m_buildRulePtrs; | ||
| XCConfigurationList* m_nativeBuildConfigurationListPtr; |
There was a problem hiding this comment.
XCConfigurationList* [](start = 3, length = 21)
this is fine as a raw ptr? do we not own the config list here?
There was a problem hiding this comment.
We do not, it is just a pointer to an object owned by the pbxDoc. Ideally it would be a shared_ptr but that's a lot more fixing than I want to do for this change set.
| extension += | ||
| " </PublisherCacheFolders>\n" | ||
| " </Extension>\n"; | ||
| ret.emplace_back(extension); |
There was a problem hiding this comment.
extension [](start = 25, length = 9)
should you std move extension here?
| pDict = boost::any_cast<Plist::dictionary_type>(&pAny); | ||
| } catch (const std::exception& e) { | ||
| SBLog::error() << e.what() << std::endl; | ||
| pDict = nullptr; |
There was a problem hiding this comment.
pDict = nullptr; [](start = 12, length = 20)
move this up to the declaration?
|
|
|
|
||
| using namespace Microsoft::WRL; | ||
| using namespace ABI::Windows::Storage; | ||
|
|
There was a problem hiding this comment.
we can get rid of the #ifdef linux code here.
| // Dispose of any resources that can be recreated. | ||
| } | ||
|
|
||
| - (void)readFile { |
There was a problem hiding this comment.
want to add a negative test here trying to read folder2?
| " </PublisherCacheFolders>\n" | ||
| " </Extension>\n"; | ||
| ret.emplace_back(extension); | ||
| } |
There was a problem hiding this comment.
Use pugixml for this. See VSTemplateProject.cpp.
| </Application> | ||
| </Applications> | ||
|
|
||
| $extensions$ |
There was a problem hiding this comment.
$extensions$ [](start = 2, length = 12)
Use in combination with pugixml instead
| String ret = ""; | ||
| buildSettings.getValue("CODE_SIGN_ENTITLEMENTS", ret); | ||
| return ret; | ||
| } |
There was a problem hiding this comment.
SBResourcesBuildPhase.cpp does this simpler. See SBResourcesBuildPhase::writeVCProjectFiles:
String plistPath = bs.second->getValue("INFOPLIST_FILE");
|
🕐 |
| extensionsOutput += " </Extensions>"; | ||
| m_params["$extensions$"] = extensionsOutput; | ||
| } | ||
| } |
There was a problem hiding this comment.
You don't seem to be using this function anymore. Revert changes in VSTemplateParameters.cpp/h
| Plist::dictionary_type* pDict = nullptr; | ||
| boost::any pAny; | ||
| try { | ||
| Plist::readPlist(entitlementsPath.c_str(), pAny); |
There was a problem hiding this comment.
Plist::readPlist(entitlementsPath.c_str(), pAny); [](start = 8, length = 49)
Needs to be relative to xcodeproj or something, not relative to the current dir.
| static void insertUrlSchemes(const String& file, const StringSet& schemes) { | ||
| // | ||
| // Inject registered URL schemes into the AppX manifest file, in this format: | ||
| static std::vector<String> getCacheFolders(const String& entitlementsPath) { |
There was a problem hiding this comment.
getCacheFolders [](start = 27, length = 15)
return this by ref vs making a copy.
There was a problem hiding this comment.
The compiler should elide this copy #ByDesign
4e67dfc to
bd5dd9c
Compare
| SBLog::error() << e.what() << std::endl; | ||
| } | ||
|
|
||
| if (pDict) { |
There was a problem hiding this comment.
nit: a comment here would be nice
|
|
||
| #include <iostream> | ||
| #include <iterator> | ||
| #include <memory> |
There was a problem hiding this comment.
Remove unused include
| #include "PBXBuildRule.h" | ||
| #include "PBXObjectIdConvert.h" | ||
| #include "VariableCollection.h" | ||
| #include "XCBuildConfiguration.h" |
There was a problem hiding this comment.
Remove unused includes
| void queryBuildConfigurations(); | ||
| void selectBuildConfigurations(const StringSet* configNames); | ||
| void getMatchingFiles(fileMatchFunc matchFunc, ConstFileList& ret) const; | ||
| std::vector<std::string> SBProject::getPublisherCacheFolderNames() const; |
There was a problem hiding this comment.
Remove. This is never defined/used.
The reference platform has a concept of an application-group entitlement which allows apps made by the same publisher to share folders and semaphores. The shared folders can be accessed through
-[NSFileManager containerURLForSecurityApplicationGroupIdentifier:]which will return an NSURL pointing to the shared folder with the given name if one exists.These folders are declared in an entitlements file separate from the main .pbxproj and info.plist where other settings are stored, and is pointed at by the value with key CODE_SIGN_ENTITLEMENTS in the PBXNativeTarget's Build Configurations.
Here, the shared folders are implemented using Windows' Publisher Cache Folders, which also allow files to be shared in designated folders between apps of the same publisher, but with the caveat that users can clear the data at any time so it should not be used as the sole storage for key data.
VSImporter has been modified to check if CODE_SIGN_ENTITLEMENTS exists, and if it does, read the file and look for com.apple.security.application-groups, which will contain an array of folder names which are to be shared. The reference platform specifies the format which folders must be named, but Publisher Cache Folders does not have such a restriction for names so any valid folder names will be taken and used.
-[NSFileManager containerURLForSecurityApplicationGroupIdentifier:]is implemented by checking if a Publisher Cache Folder of the given name, and if it does returning an NSURL to it.Fixes #2295
Fixes #2307