If you want to use unversioned frameworks, you should read the
copy_framework_unversioned script, which explains what it does, why we
use it, and how to get the best results from it. Whether or not you
want to use unversioned frameworks is your own decision, but the
comments will at least help you make an informed decision, and explain
why I made the decision to go unversioned.
In this case, if you’re linking Chromium Framework directly against
Sparkle, you’ll need to adjust Sparkle’s “install name” before you
link Chromium Framework. You can handle this by changing the setting
of LD_DYLIB_INSTALL_NAME as instructed by the comments in
copy_framework_unversioned. If you’re building Sparkle using a
GYP-generated .xcodeproj, you’d put LD_DYLIB_INSTALL_NAME inside an
xcode_settings section. You can find an example of this in
chrome_dll.gypi, within the chrome_dll target. If you’re using
Sparkle’s own .xcodeproj, you can set LD_DYLIB_INSTALL_NAME in the
framework target’s Build tab within its settings window. If you’re
using a prebuilt copy of Sparkle, you can run install_name_tool
manually to set LD_DYLIB_INSTALL_NAME properly before you link
Chromium Framework against it.
> What if I use versioned framework copy - can I still use the scripts
> preparing delta updates .dmg for an .app bundle?
Whether or not the framework is versioned won’t have any impact on
your ability to use our scripts to handle delta updates. However, if
you’re not using Keystone, I’m not sure how useful our existing delta
update support will be for you. Our support for this depends on being
able to run a script at update time, and I don’t know if Sparkle or
other update systems can be made to work that way. For that matter,
even non-delta updates of Chrome are updated by script, much more than
just a simple copy. A lot of the details of our on-disk layout were
influenced by the updater design. This may not be helpful, or may even
prove troublesome, for updaters that behave differently behind the
scenes than Keystone as used by Chrome.
If you haven’t seen this already, here’s some background reading that
explains how our update scheme works, how we’ve laid things out on
disk to make everything operate smoothly, answers a lot of other “why”
questions, and will probably save you some time.
http://an.enduringcolumn.com/2011/04/keeping-up.html
Some additional background material: while not all of Keystone’s
source is available publicly, much of it is, at
http://update-engine.googlecode.com/ .
to use automatic updates or manual ones. It is showing up properly inNow I managed to create a user preference, allowing to chose whether
chrome://settings screen and now I want the changes of that property
to be observed and an action must be launched when it changes. I've
added a line to the bottom of Browser::RegisterUserPrefs()
prefs->RegisterBooleanPref(prefs::kAutomaticUpdatesEnabled, true);
As I see there's
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
in subtle::PrefMemberBase.
How do I properly use it to monitor property changes?
As I understand, after keystone_install.sh has done its work, theContents/Resources/Info.plist in main bundle directory contains newly
installed version. Can I just get the on-disk version in Info.plist
here? If so, is there a built-in API to do this?
Take a look at what keystone_glue::CurrentlyInstalledVersion() in
chrome/browser/cocoa/keystone_glue.mm does. It’s just this:
KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue];
NSString* version = [keystoneGlue currentlyInstalledVersion];
return base::SysNSStringToUTF16(version);
and all -[KeystoneGlue currentlyInstalledVersion] does is:
NSString* appInfoPlistPath = [self appInfoPlistPath];
NSDictionary* infoPlist =
[NSDictionary dictionaryWithContentsOfFile:appInfoPlistPath];
return [infoPlist objectForKey:@"CFBundleShortVersionString"];
-[KeystoneGlue appInfoPlistPath] is:
// NSBundle ought to have a way to access this path directly, but it
// doesn't.
return [[appPath_ stringByAppendingPathComponent:@"Contents"]
stringByAppendingPathComponent:@"Info.plist"];
appPath_ is [[NSBundle mainBundle] bundlePath].
The deal here is that the installed version is determined by looking
at the Info.plist’s CFBundleShortVersionString. In order to avoid
getting a cached CFBundleShortVersionString that probably corresponds
to the running app, this code needs to actually consult the Info.plist
file on disk. As you point out, the version contained in that file
will reflect that an update has been applied. That’s why this code
uses +[NSDictionary dictionaryWithContentsOfFile:] instead of
-[NSBundle infoDictionary], -[NSBundle objectForInfoDictionaryKey:],
or any other NSBundle method.
I would stay away from the FileVersionInfo interface here. Chrome code
generally uses it to get the running framework’s version (via
FileVersionInfo::CreateFileVersionInfoForCurrentModule()) and it is
implemented using -[NSBundle objectForInfoDictionaryKey:].
platform_util.h sounds fine to me, but since I’m not sure what your
plans for upstreaming your changes are or even if upstreaming would be
appropriate, my opinion shouldn’t be terribly important.