Bug 329744 Write migrator for moving to Toolkit-based profiles (Create a central build location in /suite). r/sr=Neil

git-svn-id: svn://10.0.0.236/trunk@201556 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bugzilla%standard8.demon.co.uk 2006-07-05 17:37:34 +00:00
parent 75771e1442
commit fe074ef38e
7 changed files with 245 additions and 75 deletions

View File

@ -927,6 +927,7 @@ suite/Makefile
suite/app/Makefile
suite/branding/Makefile
suite/browser/Makefile
suite/build/Makefile
suite/common/Makefile
suite/components/Makefile
suite/components/xulappinfo/Makefile

View File

@ -57,6 +57,7 @@ ifdef MOZ_XUL_APP
DIRS += \
browser \
profile \
build \
app \
$(NULL)
else

View File

@ -0,0 +1,91 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mark Banner <bugzilla@standard8.demon.co.uk>
#
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = suite
LIBRARY_NAME = suite
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsSuiteModule
MOZILLA_INTERNAL_API = 1
REQUIRES = \
xpcom \
string \
xulapp \
intl \
necko \
dom \
libreg \
pref \
rdf \
unicharutil \
windowwatcher \
appcomps \
$(NULL)
CPPSRCS = \
nsSuiteModule.cpp \
$(NULL)
EXTRA_DSO_LDOPTS = $(MOZ_COMPONENT_LIBS)
LOCAL_INCLUDES += \
-I$(topsrcdir)/suite/profile \
$(NULL)
SHARED_LIBRARY_LIBS = \
../profile/$(LIB_PREFIX)suiteprofile_s.$(LIB_SUFFIX) \
$(NULL)
# Link to gkgfx for GNOME shell service
ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2)
EXTRA_DSO_LIBS += gkgfx
endif
EXTRA_DSO_LDOPTS += \
$(LIBXUL_DIST)/../modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,57 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "nsSuiteDirectoryProvider.h"
/////////////////////////////////////////////////////////////////////////////
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSuiteDirectoryProvider)
/////////////////////////////////////////////////////////////////////////////
static const nsModuleComponentInfo components[] = {
{ "nsSuiteDirectoryProvider",
NS_SUITEDIRECTORYPROVIDER_CID,
NS_SUITEDIRECTORYPROVIDER_CONTRACTID,
nsSuiteDirectoryProviderConstructor,
nsSuiteDirectoryProvider::Register,
nsSuiteDirectoryProvider::Unregister }
};
NS_IMPL_NSGETMODULE(SuiteModule, components)

View File

@ -42,14 +42,8 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
# XXX This needs to be included when bug 329744 is implemented.
# DIRS = migration
MODULE = suiteprofile
LIBRARY_NAME = suiteprofile
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsSuiteProfileModule
LIBRARY_NAME = suiteprofile_s
MOZILLA_INTERNAL_API = 1
REQUIRES = \
@ -64,5 +58,8 @@ CPPSRCS = \
EXTRA_DSO_LDOPTS = $(MOZ_COMPONENT_LIBS)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB=1
include $(topsrcdir)/config/rules.mk

View File

@ -36,56 +36,11 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDirectoryService.h"
#include "nsIFile.h"
#include "nsISimpleEnumerator.h"
#include "nsSuiteDirectoryProvider.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsCategoryManagerUtils.h"
#include "nsCOMArray.h"
#include "nsIGenericFactory.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
class nsSuiteDirectoryProvider : public nsIDirectoryServiceProvider2
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
static NS_METHOD Register(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo);
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const nsModuleComponentInfo *aInfo);
private:
void EnsureProfileFile(const nsACString& aLeafName,
nsIFile* aParentDir, nsIFile* aTarget);
class AppendingEnumerator : public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
AppendingEnumerator(nsISimpleEnumerator* aBase,
const char* const aLeafName);
private:
void GetNext();
nsCOMPtr<nsISimpleEnumerator> mBase;
nsDependentCString mLeafName;
nsCOMPtr<nsIFile> mNext;
};
};
NS_IMPL_ISUPPORTS2(nsSuiteDirectoryProvider,
nsIDirectoryServiceProvider,
nsIDirectoryServiceProvider2)
@ -235,12 +190,6 @@ nsSuiteDirectoryProvider::AppendingEnumerator::AppendingEnumerator
GetNext();
}
static char const kContractID[] = "@mozilla.org/suite/directory-provider;1";
// {9aa21826-9d1d-433d-8c10-f313b26fa9dd}
#define NS_SUITEDIRECTORYPROVIDER_CID \
{ 0x9aa21826, 0x9d1d, 0x433d, { 0x8c, 0x10, 0xf3, 0x13, 0xb2, 0x6f, 0xa9, 0xdd } }
NS_METHOD
nsSuiteDirectoryProvider::Register(nsIComponentManager* aCompMgr,
nsIFile* aPath,
@ -256,7 +205,8 @@ nsSuiteDirectoryProvider::Register(nsIComponentManager* aCompMgr,
return catMan->AddCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
"suite-directory-provider",
kContractID, PR_TRUE, PR_TRUE, nsnull);
NS_SUITEDIRECTORYPROVIDER_CONTRACTID,
PR_TRUE, PR_TRUE, nsnull);
}
@ -274,18 +224,3 @@ nsSuiteDirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
return catMan->DeleteCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
"suite-directory-provider", PR_TRUE);
}
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSuiteDirectoryProvider)
static const nsModuleComponentInfo components[] = {
{
"nsSuiteDirectoryProvider",
NS_SUITEDIRECTORYPROVIDER_CID,
kContractID,
nsSuiteDirectoryProviderConstructor,
nsSuiteDirectoryProvider::Register,
nsSuiteDirectoryProvider::Unregister
}
};
NS_IMPL_NSGETMODULE(SuiteDirProvider, components)

View File

@ -0,0 +1,88 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla Firefox browser.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <benjamin@smedbergs.us>
*
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Banner <bugzilla@standard8.demon.co.uk>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDirectoryService.h"
#include "nsIFile.h"
#include "nsISimpleEnumerator.h"
#include "nsString.h"
struct nsModuleComponentInfo;
#define NS_SUITEDIRECTORYPROVIDER_CONTRACTID "@mozilla.org/suite/directory-provider;1"
// {9aa21826-9d1d-433d-8c10-f313b26fa9dd}
#define NS_SUITEDIRECTORYPROVIDER_CID \
{ 0x9aa21826, 0x9d1d, 0x433d, { 0x8c, 0x10, 0xf3, 0x13, 0xb2, 0x6f, 0xa9, 0xdd } }
class nsSuiteDirectoryProvider : public nsIDirectoryServiceProvider2
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
static NS_METHOD Register(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo);
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const nsModuleComponentInfo *aInfo);
private:
void EnsureProfileFile(const nsACString& aLeafName,
nsIFile* aParentDir, nsIFile* aTarget);
class AppendingEnumerator : public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
AppendingEnumerator(nsISimpleEnumerator* aBase,
const char* const aLeafName);
private:
void GetNext();
nsCOMPtr<nsISimpleEnumerator> mBase;
nsDependentCString mLeafName;
nsCOMPtr<nsIFile> mNext;
};
};