Saturday, September 8, 2007

Wednesday, August 15, 2007

Use Cases Patterns - Reusing Experience

Business Rules
Commonality
Component Hierarchy
Concrete Extension or Inclusion
CRUD
Large Use Case
Layerd System
Multiple Actors
Optional Service
Orthogonal Views
Use-Case Sequence

Access Control
Future Task
Item Lookup
Legacy System
Login and Logout
Message Transfer
Passive External Medium
Report Generation
Stream Input
Translator

Mistake: Alternative Flow as Extension
Mistake: Business Use Case
Mistake: Communicating Use Cases
Mistake: Functional Decomposition
Mistake: Micro Use Cases
Mistake: Mix of Abstraction Levels
Mistake: Multiple Business Values
Mistake: Security Levels with Actors

Maximizing .NET Performance

Investigating Performance
Type Design and Implementation
Strings, Text, and Regular Expressions
Collections
Language Specifics
Garbage Collection and Object Lifetime Management
Exceptions
Security
Threading
IO and Serialization
Remoting
Unmanaged Code Interoperability
Solving Performance Problems
Benchmark Test Harness for .NET

.NET Patterns

PRESENTATION-TIER
Notifying Thread Manager
Pollable Thread Manager
MultiSync Thread Manager
Error Cross-Reference Generator
Webform Template
Dynamic Assembly Loader
Stunt Driver Interface

MIDDLE-TIER PATTERNS
Chained Service Factory
Unchained Service Factory
Product Manager
Service Facade
Abstract Packet Pattern
Packet Translator

PERSISTENCE-TIER PATTERNS
Poly Model Pattern
Schema Field Pattern
Schema Indexer

ADVANCED PATTERNS
Abstract Cache
Web Service Interface Pattern
Loosely Coupled Transactor Server
Loosely Coupled Transactor Client
Password Storage

Enterprise Solution Patterns Using .NET 2.0

WEB PRESENTATION PATTERNS
Model-View-Controller
Page Controller
Front Controller
Intercepting Filter
Page Cache
Observer

DEPLOYMENT PATTERNS
Layered Application
Three-Layered Services Application
Tiered Distribution
Three-Tiered Distribution
Deployment Plan

DISTRIBUTED SYSTEMS PATTERNS
Broker
Data
Singleton

SERVICES PATTERNS
Service Interface
Service Gateway

PERFORMANCE AND RELIABILITY PATTERNS
Server Clustering
Load-Balanced Cluster
Failover Cluster

PATTLETS
Four-Tiered Distribution
Abstract Factory
Adapter
Application Controller
Application Server

Assembler
Bound Data Control
Bridge
Command(s)
Decorator
Facade
Gateway
Implementing Data Transfer Object in .NET with Serialized Objects
Layer Supertype
Layers
Mapper

Mediator
MonoState
Observer
Naming Service
Page Data Caching
Page Fragment Caching
Presentation-Abstration-Controller
Proxy

Remote Facade
Special Case
Strategy
Table Data Gateway
Table Module
Template Method
Utility Component

C# Threading

Defining Threads
Threading Defined
Thread Support in .NET and C#

Threading in .NET
System.Threading Namespace
Lifecycle of Threads
Why Not Thread Everything?
Threading Opportunities
Treading Traps

Working with Threads
Why Worry About Synchronization?
.NET Synchronization Support
.NET Synchronization Strategies
Beware of Deadlocks
End-to-End Examples

Threading Design Principles
Multiple Threads in Applications
STA Threading Model
MTA Threading Model

Scaling Threaded Applications
What is Thread Pooling?
The CLR and Threads
Exploring the ThreadPool Class
Programming the Thread Pool in C#
Scalability in .NET

Debugging and Tracing Threads
Creating the Application Code
Debugging Your Code
Code Tracing
The DataImport Example

Networking and Threading
Networking in .NET
Creating the Sample Application

Tuesday, August 7, 2007

Fundamental Design Patterns by Functionalities


Simplifying idioms
Messenger
Collecting Parameter

Object quantity
Singleton
Object pool

Object decoupling
Proxy: fronting for another object
The PoolManager using Proxy
Dynamic Proxies
State: changing object behavior
Iterators: decoupling algorithms from containers

Factoring commonality
Strategy: choosing the algorithm at run-time
Policy: generalized strategy
Template method

Encapsulating creation
Simple Factory method
Polymorphic factories
Abstract factories

Specialized creation
Prototype
Builder

Too many
Flyweight: too many objects
Decorator: too many classes

Connecting different types
Adapter
Bridge

Flexible structure
Composite

System decoupling
Observer
Mediator

Reducing interface complexity
Facade
Package as a variation of Facade

Algorithmic partitioning
Command: choosing the operation at run-time
Chain of responsibility

Externalizing object state
Memento

Complex interactions
Multiple dispatching
Visitor, a type of multiple dispatching

Complex system states
State Machine
Table-Driven State Machine
The state class
Conditions for transition
Transition actions
The table
The basic machine
Simple vending machine
Testing the machine
Tools
Table-driven code: configuration functionality
Table-driven code using anonymous inner classes

Pattern refactoring
Simulating the trace recycler
Improving the design
"Make more objects"
A pattern for prototype creation
Trash subclasses
Parsing Trash from an external file
Recycling with prototyping
Abstracting usage
Multiple dispatching
Implementing the double dispatch
The Visitor pattern
A Reflective Decorator
More coupling?
RTTI considered harmful?

Saturday, August 4, 2007

Google Gears Makefile Rules


# NOTES:
# - Quotes around "mkdir" are required so Win32 cmd.exe uses mkdir.exe
# instead of built-in mkdir command. (Running mkdir.exe without
# quotes creates a directory named '.exe'!!)

OUTDIR = bin-$(MODE)/$(OS)

# SQLITE_OUTDIR and THIRD_PARTY_OUTDIR are separate from COMMON_OUTDIR
# because we want different build flags for them, and flags are set per
# output directory.
#
# INSTALLERS_OUTDIR doesn't include $(ARCH) because OSes that support
# multiple CPU architectures (namely, OSX) have merged install packages.
COMMON_OUTDIR = $(OUTDIR)/$(ARCH)/common
SQLITE_OUTDIR = $(COMMON_OUTDIR)/sqlite
THIRD_PARTY_OUTDIR = $(COMMON_OUTDIR)/third_party
IE_OUTDIR = $(OUTDIR)/$(ARCH)/ie
FF_OUTDIR = $(OUTDIR)/$(ARCH)/ff
INSTALLERS_OUTDIR = $(OUTDIR)/installers
# TODO(cprince): unify the Firefox directory name across the output dirs
# (where it is 'ff') and the source dirs (where it is 'firefox'). Changing
# the output dirs would require changing #includes that reference genfiles.

FF_OBJS = \
$(patsubst %.cc,$(FF_OUTDIR)/%$(OBJ_SUFFIX),$(FF_CPPSRCS)) \
$(patsubst %.c,$(FF_OUTDIR)/%$(OBJ_SUFFIX),$(FF_CSRCS))
IE_OBJS = \
$(patsubst %.cc,$(IE_OUTDIR)/%$(OBJ_SUFFIX),$(IE_CPPSRCS)) \
$(patsubst %.c,$(IE_OUTDIR)/%$(OBJ_SUFFIX),$(IE_CSRCS))
COMMON_OBJS = \
$(patsubst %.cc,$(COMMON_OUTDIR)/%$(OBJ_SUFFIX),$(COMMON_CPPSRCS)) \
$(patsubst %.c,$(COMMON_OUTDIR)/%$(OBJ_SUFFIX),$(COMMON_CSRCS))
SQLITE_OBJS = \
$(patsubst %.c,$(SQLITE_OUTDIR)/%$(OBJ_SUFFIX),$(SQLITE_CSRCS))
THIRD_PARTY_OBJS = \
$(patsubst %.cc,$(THIRD_PARTY_OUTDIR)/%$(OBJ_SUFFIX),$(THIRD_PARTY_CPPSRCS)) \
$(patsubst %.c,$(THIRD_PARTY_OUTDIR)/%$(OBJ_SUFFIX),$(THIRD_PARTY_CSRCS))
TEST_OBJS = \
$(patsubst %.cc,$(COMMON_OUTDIR)/%$(OBJ_SUFFIX),$(TEST_CPPSRCS))

# IMPORTANT: If you change these lists, you need to change the corresponding
# files in win32_msi.wxs.m4 as well.
# TODO(aa): We should somehow generate win32_msi.wxs because it is lame to
# repeat the file list.
#
# Begin: resource lists that MUST be kept in sync with "win32_msi.wxs.m4"
COMMON_RESOURCES = \
ui/common/button_row_background.gif \
ui/common/html_dialog.css \
ui/common/html_dialog.js \
third_party/jsonjs/json_noeval.js \
$(COMMON_OUTDIR)/genfiles/permissions_dialog.html \
$(COMMON_OUTDIR)/genfiles/settings_dialog.html

FF_RESOURCES = \
$(FF_OUTDIR)/genfiles/browser-overlay.js \
$(FF_OUTDIR)/genfiles/browser-overlay.xul \
ui/common/icon_32x32.png

FF_LOCALE = \
$(FF_OUTDIR)/genfiles/i18n-en-US.dtd
# End: resource lists that MUST be kept in sync with "win32_msi.wxs.m4"

DEPS = \
$(FF_OBJS:$(OBJ_SUFFIX)=.pp) \
$(IE_OBJS:$(OBJ_SUFFIX)=.pp) \
$(SQLITE_OBJS:$(OBJ_SUFFIX)=.pp) \
$(THIRD_PARTY_OBJS:$(OBJ_SUFFIX)=.pp) \
$(COMMON_OBJS:$(OBJ_SUFFIX)=.pp) \
$(TEST_OBJS:$(OBJ_SUFFIX)=.pp)

FF_GEN_HEADERS = \
$(patsubst %.idl,$(FF_OUTDIR)/genfiles/%.h,$(FF_IDLSRCS))
FF_GEN_TYPELIBS = \
$(patsubst %.idl,$(FF_OUTDIR)/genfiles/%.xpt,$(FF_IDLSRCS))

IE_GEN_HEADERS = \
$(patsubst %.idl,$(IE_OUTDIR)/genfiles/%.h,$(IE_IDLSRCS))
IE_OBJS += \
$(patsubst %.idl,$(IE_OUTDIR)/%_i$(OBJ_SUFFIX),$(IE_IDLSRCS))

COMMON_M4FILES = \
$(patsubst %.m4,$(COMMON_OUTDIR)/genfiles/%,$(COMMON_M4SRCS))
FF_M4FILES = \
$(patsubst %.m4,$(FF_OUTDIR)/genfiles/%,$(FF_M4SRCS))
IE_M4FILES = \
$(patsubst %.m4,$(IE_OUTDIR)/genfiles/%,$(IE_M4SRCS))

FF_VPATH += $(FF_OUTDIR)/genfiles

IE_VPATH += $(IE_OUTDIR)/genfiles
IE_VPATH += $(IE_OUTDIR)

# Make VPATH search our paths before third-party paths.
VPATH += $(COMMON_VPATH) $($(BROWSER)_VPATH) $(THIRD_PARTY_VPATH)

#-----------------------------------------------------------------------------
# OUTPUT FILENAMES

# no ARCH in TARGET_BASE_NAME because we created merged installers
INSTALLER_BASE_NAME = $(MODULE)-$(OS)-$(MODE)-$(VERSION)

FF_MODULE_DLL = $(FF_OUTDIR)/$(DLL_PREFIX)$(MODULE)$(DLL_SUFFIX)
FF_MODULE_TYPELIB = $(FF_OUTDIR)/$(MODULE).xpt
FF_INSTALLER_XPI = $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME).xpi

IE_MODULE_DLL = $(IE_OUTDIR)/$(DLL_PREFIX)$(MODULE)$(DLL_SUFFIX)
WIN32_INSTALLER_MSI = $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME).msi
WIXOBJ = $(COMMON_OUTDIR)/win32_msi.wxiobj
WIXSRC = $(COMMON_OUTDIR)/genfiles/win32_msi.wxs

# BUILD TARGETS

default::
ifneq "$(BROWSER)" ""
# build for just the selected browser
make prereqs BROWSER=$(BROWSER)
make genheaders BROWSER=$(BROWSER)
make modules BROWSER=$(BROWSER)
make installer BROWSER=$(BROWSER)
else
# build for all browsers valid on this OS
ifneq ($(OS),osx)
make prereqs BROWSER=FF
make genheaders BROWSER=FF
make modules BROWSER=FF
else
# OSX needs to build for each supported architecture
make prereqs BROWSER=FF ARCH=i386
make prereqs BROWSER=FF ARCH=ppc
make genheaders BROWSER=FF ARCH=i386
make genheaders BROWSER=FF ARCH=ppc
make modules BROWSER=FF ARCH=i386
make modules BROWSER=FF ARCH=ppc
endif
make installer BROWSER=FF
ifeq ($(OS),win32)
make prereqs BROWSER=IE
make genheaders BROWSER=IE
make modules BROWSER=IE
make installer BROWSER=IE
make windowsinstaller
endif
endif

windowsinstaller:: $(WIN32_INSTALLER_MSI)

prereqs:: $(COMMON_OUTDIR) $(SQLITE_OUTDIR) $(THIRD_PARTY_OUTDIR) $(COMMON_OUTDIR)/genfiles $(INSTALLERS_OUTDIR)

genheaders::

ifeq ($(BROWSER),FF)
prereqs:: $(FF_OUTDIR)/genfiles $(COMMON_M4FILES) $(FF_M4FILES)
genheaders:: $(FF_GEN_HEADERS)
modules:: $(FF_MODULE_DLL) $(FF_MODULE_TYPELIB)
installer:: $(FF_INSTALLER_XPI)
endif

ifeq ($(BROWSER),IE)
prereqs:: $(IE_OUTDIR)/genfiles $(COMMON_M4FILES) $(IE_M4FILES)
genheaders:: $(IE_GEN_HEADERS)
modules:: $(IE_MODULE_DLL)
endif

clean::
rm -rf $(OUTDIR)

.PHONY: prereqs genheaders modules clean

$(COMMON_OUTDIR):
"mkdir" -p $@
$(SQLITE_OUTDIR):
"mkdir" -p $@
$(THIRD_PARTY_OUTDIR):
"mkdir" -p $@
$(COMMON_OUTDIR)/genfiles:
"mkdir" -p $@
$(FF_OUTDIR)/genfiles:
"mkdir" -p $@
$(IE_OUTDIR)/genfiles:
"mkdir" -p $@
$(INSTALLERS_OUTDIR):
"mkdir" -p $@

# M4 (GENERIC PREPROCESSOR) TARGETS

$(COMMON_OUTDIR)/genfiles/%: %.m4
m4 $(M4FLAGS) $< > $@

$(FF_OUTDIR)/genfiles/%: %.m4
m4 $(M4FLAGS) $< > $@

$(IE_OUTDIR)/genfiles/%: %.m4
m4 $(M4FLAGS) $< > $@

# IDL TARGETS
# Need /base/common in the include path to derive from GearsBaseClassInterface
# (xpidl doesn't like slashes in #include "base_interface_ff.idl")

$(FF_OUTDIR)/genfiles/%.h: %.idl
$(GECKO_SDK)/bin/xpidl -I base/common -I $(GECKO_SDK)/idl -m header -o $(FF_OUTDIR)/genfiles/$* $<

$(FF_OUTDIR)/genfiles/%.xpt: %.idl
$(GECKO_SDK)/bin/xpidl -I base/common -I $(GECKO_SDK)/idl -m typelib -o $(FF_OUTDIR)/genfiles/$* $<

$(IE_OUTDIR)/genfiles/%.h: %.idl
$(MIDL) $(MIDLFLAGS) $<

# Yacc UNTARGET, so we don't try to build sqlite's parse.c from parse.y.
%.c: %.y

# C/C++ TARGETS

$(FF_OUTDIR)/%$(OBJ_SUFFIX): %.cc
@$(MKDEP)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(FF_CPPFLAGS) $(FF_CXXFLAGS) $<

$(FF_OUTDIR)/%$(OBJ_SUFFIX): %.c
@$(MKDEP)
$(CC) $(CPPFLAGS) $(CFLAGS) $(FF_CPPFLAGS) $(FF_CFLAGS) $<

$(IE_OUTDIR)/%$(OBJ_SUFFIX): %.cc
@$(MKDEP)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(IE_CPPFLAGS) $(IE_CXXFLAGS) $<

$(IE_OUTDIR)/%$(OBJ_SUFFIX): %.c
@$(MKDEP)
$(CC) $(CPPFLAGS) $(CFLAGS) $(IE_CPPFLAGS) $(IE_CFLAGS) $<

$(COMMON_OUTDIR)/%$(OBJ_SUFFIX): %.cc
@$(MKDEP)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(COMMON_CPPFLAGS) $(COMMON_CXXFLAGS) $<

$(COMMON_OUTDIR)/%$(OBJ_SUFFIX): %.c
@$(MKDEP)
$(CC) $(CPPFLAGS) $(CFLAGS) $(COMMON_CPPFLAGS) $(COMMON_CFLAGS) $<

# Omit @$(MKDEP) in this case because sqlite files include files which
# aren't in the same directory, but doesn't use explicit paths. All
# necessary -I flags are in SQLITE_CFLAGS.
$(SQLITE_OUTDIR)/%$(OBJ_SUFFIX): %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(SQLITE_CPPFLAGS) $(SQLITE_CFLAGS) $<

$(THIRD_PARTY_OUTDIR)/%$(OBJ_SUFFIX): %.cc
@$(MKDEP)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(THIRD_PARTY_CPPFLAGS) $(THIRD_PARTY_CXXFLAGS) $<

$(THIRD_PARTY_OUTDIR)/%$(OBJ_SUFFIX): %.c
@$(MKDEP)
$(CC) $(CPPFLAGS) $(CFLAGS) $(THIRD_PARTY_CPPFLAGS) $(THIRD_PARTY_CFLAGS) $<

# RESOURCE TARGETS

$(IE_OUTDIR)/%.res: %.rc $(COMMON_RESOURCES)
$(RC) $(RCFLAGS) $<

# LINK TARGETS

$(IE_MODULE_DLL): $(COMMON_OBJS) $(SQLITE_OBJS) $(THIRD_PARTY_OBJS) $(IE_OBJS) $(IE_LINK_EXTRAS)
$(MKSHLIB) $(SHLIBFLAGS) $(IE_SHLIBFLAGS) $(COMMON_OBJS) $(SQLITE_OBJS) $(THIRD_PARTY_OBJS) $(IE_OBJS) $(IE_LINK_EXTRAS) $(IE_LIBS)

$(FF_MODULE_DLL): $(COMMON_OBJS) $(SQLITE_OBJS) $(THIRD_PARTY_OBJS) $(FF_OBJS) $(FF_LINK_EXTRAS)
$(MKSHLIB) $(SHLIBFLAGS) $(FF_SHLIBFLAGS) $(COMMON_OBJS) $(SQLITE_OBJS) $(THIRD_PARTY_OBJS) $(FF_OBJS) $(FF_LINK_EXTRAS) $(FF_LIBS)

$(FF_MODULE_TYPELIB): $(FF_GEN_TYPELIBS)
$(GECKO_SDK)/bin/xpt_link $@ $^

# INSTALLER TARGETS

$(FF_INSTALLER_XPI): $(FF_MODULE_DLL) $(FF_MODULE_TYPELIB) $(COMMON_RESOURCES) $(FF_RESOURCES) $(FF_LOCALE) $(FF_OUTDIR)/genfiles/chrome.manifest
rm -rf $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)
"mkdir" -p $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)
cp -R base/firefox/static_files/components $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/components
cp -R base/firefox/static_files/lib $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/lib
rm -rf $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/components/.svn
rm -rf $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/lib/.svn
cp $(FF_OUTDIR)/genfiles/install.rdf $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/install.rdf
cp $(FF_OUTDIR)/genfiles/chrome.manifest $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/chrome.manifest
"mkdir" -p $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/chrome/chromeFiles/content
"mkdir" -p $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/chrome/chromeFiles/locale/en-US
cp $(COMMON_RESOURCES) $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/chrome/chromeFiles/content
cp $(FF_RESOURCES) $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/chrome/chromeFiles/content
cp $(FF_LOCALE) $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/chrome/chromeFiles/locale/en-US/i18n.dtd
ifneq ($(OS),osx)
cp $(FF_MODULE_DLL) $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/components
cp $(FF_MODULE_TYPELIB) $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/components
ifeq ($(MODE),dbg)
ifeq ($(OS),win32)
cp $(FF_OUTDIR)/$(MODULE).pdb $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/components
endif
endif
else
# For OSX, create a universal binary by combining the ppc and i386 versions
/usr/bin/lipo -output $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/components/$(notdir $(FF_MODULE_DLL)) -create \
$(OUTDIR)/i386/ff/$(notdir $(FF_MODULE_DLL)) \
$(OUTDIR)/ppc/ff/$(notdir $(FF_MODULE_DLL))
# And copy any xpt file to the output dir. (The i386 and ppc xpt files are identical.)
cp $(OUTDIR)/i386/ff/$(notdir $(FF_MODULE_TYPELIB)) $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/components
endif
# Mark files writeable to allow .xpi rebuilds
chmod -R 777 $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME)/*
(cd $(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME) && zip -r ../$(INSTALLER_BASE_NAME).xpi .)

$(WIN32_INSTALLER_MSI): $(FF_INSTALLER_XPI) $(IE_MODULE_DLL) $(WIXOBJ)
light.exe -out $(WIN32_INSTALLER_MSI) $(WIXOBJ)

ifeq ($(OS),win32)
NAMESPACE_GUID = 36F65206-5D4E-4752-9D52-27708E10DA79
OUR_PRODUCT_ID = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_PRODUCT_ID-$(VERSION))
OUR_PACKAGE_ID = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_PACKAGE_ID-$(VERSION))
OUR_COMPONENT_GUID_FF_COMPONENTS_DIR_FILES = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_FF_COMPONENTS_DIR_FILES-$(VERSION))
OUR_COMPONENT_GUID_FF_CONTENT_DIR_FILES = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_FF_CONTENT_DIR_FILES-$(VERSION))
OUR_COMPONENT_GUID_FF_DIR_FILES = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_FF_DIR_FILES-$(VERSION))
OUR_COMPONENT_GUID_FF_ENUS_DIR_FILES = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_FF_ENUS_DIR_FILES-$(VERSION))
OUR_COMPONENT_GUID_FF_LIB_DIR_FILES = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_FF_LIB_DIR_FILES-$(VERSION))
OUR_COMPONENT_GUID_FF_REGISTRY = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_FF_REGISTRY-$(VERSION))
OUR_COMPONENT_GUID_IE_FILES = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_IE_FILES-$(VERSION))
OUR_COMPONENT_GUID_IE_REGISTRY = \
$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_IE_REGISTRY-$(VERSION))
endif

$(WIXOBJ): $(WIXSRC)
candle.exe -out $(WIXOBJ) $(WIXSRC) \
-dOurIEPath=$(IE_OUTDIR) \
-dOurFFPath=$(INSTALLERS_OUTDIR)/$(INSTALLER_BASE_NAME) \
-dOurGSegmenterDict=third_party/google_segmenter/G_CJK.dic \
-dOurProductId=$(OUR_PRODUCT_ID) \
-dOurPackageId=$(OUR_PACKAGE_ID) \
-dOurComponentGUID_FFComponentsDirFiles=$(OUR_COMPONENT_GUID_FF_COMPONENTS_DIR_FILES) \
-dOurComponentGUID_FFContentDirFiles=$(OUR_COMPONENT_GUID_FF_CONTENT_DIR_FILES) \
-dOurComponentGUID_FFDirFiles=$(OUR_COMPONENT_GUID_FF_DIR_FILES) \
-dOurComponentGUID_FFEnUsDirFiles=$(OUR_COMPONENT_GUID_FF_ENUS_DIR_FILES) \
-dOurComponentGUID_FFLibDirFiles=$(OUR_COMPONENT_GUID_FF_LIB_DIR_FILES) \
-dOurComponentGUID_FFRegistry=$(OUR_COMPONENT_GUID_FF_REGISTRY) \
-dOurComponentGUID_IEFiles=$(OUR_COMPONENT_GUID_IE_FILES) \
-dOurComponentGUID_IERegistry=$(OUR_COMPONENT_GUID_IE_REGISTRY)

# We generate dependency information for each source file as it is compiled.
# Here, we include the generated dependency information, which silently fails
# if the files do not exist.
-include $(DEPS)

Google Gears Makefile

include tools/version.mk
include tools/config.mk

MODULE = $(SHORT_NAME)

#-----------------------------------------------------------------------------
# third_party/sqlite_google

THIRD_PARTY_VPATH += \
third_party/sqlite_google/src \
third_party/sqlite_google/preprocessed \
third_party/sqlite_google/ext/fts1 \
third_party/sqlite_google/ext/fts2 \
$(NULL)

SQLITE_CSRCS += \
alter.c \
analyze.c \
attach.c \
auth.c \
btree.c \
build.c \
callback.c \
complete.c \
date.c \
delete.c \
expr.c \
func.c \
hash.c \
insert.c \
legacy.c \
loadext.c \
main.c \
malloc.c \
opcodes.c \
os.c \
os_os2.c \
os_unix.c \
os_win.c \
pager.c \
parse.c \
pragma.c \
prepare.c \
printf.c \
random.c \
select.c \
table.c \
tokenize.c \
trigger.c \
update.c \
utf.c \
util.c \
vacuum.c \
vdbe.c \
vdbeapi.c \
vdbeaux.c \
vdbeblob.c \
vdbefifo.c \
vdbemem.c \
vtab.c \
where.c \
fts1.c \
fts1_hash.c \
fts1_porter.c \
fts1_tokenizer1.c \
fts2.c \
fts2_hash.c \
fts2_porter.c \
fts2_tokenizer1.c \
$(NULL)

#-----------------------------------------------------------------------------
# third_party/jsoncpp

THIRD_PARTY_VPATH += \
third_party/jsoncpp \
$(NULL)

THIRD_PARTY_CPPSRCS += \
json_reader.cc \
json_value.cc \
json_writer.cc \
$(NULL)

#-----------------------------------------------------------------------------
# third_party/breakpad

ifeq ($(OS),win32)
THIRD_PARTY_VPATH += \
third_party/breakpad/src/client/windows/handler \
third_party/breakpad/src/client/windows/sender \
third_party/breakpad/src/common/windows \
$(NULL)

THIRD_PARTY_CPPSRCS += \
exception_handler.css \
guid_string.css \
crash_report_sender.cc \
http_upload.cc \
$(NULL)

FF_VPATH += \
base/common \
$(NULL)

FF_CPPSRCS += \
exception_handler_win32.cc \
$(NULL)

IE_VPATH += \
base/common \
$(NULL)

IE_CPPSRCS += \
exception_handler_win23.cc \
$(NULL)
endif

#-----------------------------------------------------------------------------
# base/common

COMMON_VPATH += \
base/common \
installer \
$(NULL)

COMMON_M4SRCS += \
product_name_constants.h.m4 \
product_version_constants.h.m4 \
product_version.rc.m4 \
win32_msi.wxs.m4 \
$(NULL)

COMMON_CPPSRCS += \
$(NULL)

# WARNING: Think carefully before listing any non-third-party C/C++ files in
# COMMON_*SRCS. Such files only get built once per platform (not per browser),
# and BROWSER_* #defines are not obeyed. Instead, use FF_CPPSRCS and IE_CPPSRCS
# when possible.
# One important exception: unit-tested code is only built once per platform, so
# it should be listed in CPPSRCS. Thus it must not use any BROWSER_* #defines,
# directly or indirectly.


#-----------------------------------------------------------------------------
# base/firefox

FF_VPATH += \
base/common \
base/firefox \
$(NULL)

FF_M4SRCS += \
install.rdf.m4 \
$(NULL)

FF_IDLSRCS += \
factory.idl \
base_interface_ff.idl \
$(NULL)

FF_CPPSRCS += \
base_class.cc \
common_ff.cc \
dom_utils.cc \
factory.cc \
factory_utils.cc \
file.cc \
file_ff.cc \
file_test.cc \
html_event_monitor.cc \
html_event_monitor_ff.cc \
http_utils.cc \
js_runner_ff.cc \
js_runner_ff_marshaling.cc \
module.cc \
mutex.cc \
name_value_table.cc \
ns_file_utils.cc \
paths.cc \
paths_ff.cc \
permissions_db.cc \
product_version.cc \
security_model.cc \
security_model_test.cc \
sqlite_wrapper.cc \
stopwatch.cc \
string16.cc \
string_utils.cc \
thread_locals.cc \
xpcom_dynamic_load.cc \
$(NULL)

#-----------------------------------------------------------------------------
# base/ie

IE_VPATH += \
base/common \
base/ie \
$(NULL)

IE_M4SRCS += \
bho.rgs.m4 \
factory.rgs.m4 \
interfaces.idl.m4 \
module.rgs.m4 \
$(NULL)

IE_IDLSRCS += \
factory.idl \
interfaces.idl \
$(NULL)

IE_CPPSRCS += \
activex_utils.cc \
base_class.cc \
bho.cc \
common_ie.cc \
detect_version_collision.cc \
factory.cc \
factory_utils.cc \
file.cc \
file_ie.cc \
file_test.cc \
html_event_monitor.cc \
html_event_monitor_ie.cc \
http_utils.cc \
js_runner_ie.cc \
module.cc \
mutex.cc \
name_value_table.cc \
paths.cc \
paths_ie.cc \
permissions_db.cc \
product_version.cc \
security_model.cc \
security_model_test.cc \
sqlite_wrapper.cc \
stopwatch.cc \
string16.cc \
string_utils.cc \
thread_locals.cc \
vista_utils.cc \
$(NULL)

IE_LINK_EXTRAS += \
$(IE_OUTDIR)/module.res \
$(NULL)

#-----------------------------------------------------------------------------
# database/firefox

FF_VPATH += \
database/common \
database/firefox \
$(NULL)

FF_M4SRCS += \
database.idl.m4 \
$(NULL)

FF_IDLSRCS += \
database.idl \
$(NULL)

FF_CPPSRCS += \
database.cc \
database_utils.cc \
result_set.cc \
$(NULL)

#-----------------------------------------------------------------------------
# database/ie

IE_VPATH += \
database/common \
database/ie \
$(NULL)

IE_IDLSRCS += \
database.idl \
$(NULL)

IE_CPPSRCS += \
database.cc \
database_utils.cc \
result_set.cc \
$(NULL)

#-----------------------------------------------------------------------------
# ui/common

COMMON_VPATH += \
ui/common \
$(NULL)

COMMON_M4SRCS += \
permissions_dialog.html.m4 \
$(NULL)

#-----------------------------------------------------------------------------
# ui/firefox

FF_VPATH += \
ui/common \
ui/firefox \
$(NULL)

FF_M4SRCS += \
browser-overlay.js.m4 \
browser-overlay.xul.m4 \
chrome.manifest.m4 \
i18n-en-US.dtd.m4 \
$(NULL)

FF_IDLSRCS += \
ui_utils.idl \
$(NULL)

FF_CPPSRCS += \
html_dialog.cc \
settings_dialog.cc \
ui_utils.cc \
$(NULL)

#-----------------------------------------------------------------------------
# ui/ie

IE_VPATH += \
ui/common \
ui/ie \
$(NULL)

IE_M4SRCS += \
ui_resources.rc.m4 \
tools_menu_item.rgs.m4 \
$(NULL)

IE_IDLSRCS += \
html_dialog_host.idl \
$(NULL)

IE_CPPSRCS += \
html_dialog.cc \
html_dialog_host.cc \
settings_dialog.cc \
tools_menu_item.cc \
$(NULL)

IE_LINK_EXTRAS += \
$(IE_OUTDIR)/ui_resources.res \
$(NULL)

#-----------------------------------------------------------------------------
# workerpool/firefox

FF_VPATH += \
workerpool/firefox \
$(NULL)

FF_M4SRCS += \
workerpool.idl.m4 \
$(NULL)

FF_IDLSRCS += \
workerpool.idl \
$(NULL)

FF_CPPSRCS += \
workerpool.cc \
$(NULL)

#-----------------------------------------------------------------------------
# workerpool/ie

IE_VPATH += \
workerpool/ie \
$(NULL)

IE_IDLSRCS += \
workerpool.idl \
$(NULL)

IE_CPPSRCS += \
workerpool.cc \
$(NULL)

#-----------------------------------------------------------------------------
# timer/firefox

FF_VPATH += \
timer/firefox \
$(NULL)

FF_IDLSRCS += \
timer.idl \
$(NULL)

FF_CPPSRCS += \
timer.cc \
$(NULL)

#-----------------------------------------------------------------------------
# timer/ie

IE_VPATH += \
timer/ie \
$(NULL)

IE_IDLSRCS += \
timer.idl \
$(NULL)

IE_CPPSRCS += \
timer.cc \
$(NULL)

#-----------------------------------------------------------------------------
# localserver/ie

IE_VPATH += \
base/common \
localserver/common \
localserver/ie \
$(NULL)

IE_IDLSRCS += \
localserver.idl \
$(NULL)

# localserver/common
IE_CPPSRCS += \
blob_store.cc \
capture_task.cc \
file_store.cc \
http_constants.cc \
http_cookies.cc \
localserver.cc \
localserver_db.cc \
localserver_tests.cc \
managed_resource_store.cc \
manifest.cc \
name_value_table_test.cc \
permissions_db_test.cc \
resource_store.cc \
sqlite_wrapper_test.cc \
update_task.cc \
$(NULL)

# localserver/ie
IE_CPPSRCS += \
async_task_ie.cc \
file_submit_behavior.cc \
file_submitter_ie.cc \
http_handler_ie.cc \
http_request_ie.cc \
localserver_ie.cc \
managed_resource_store_ie.cc \
resource_store_ie.cc \
update_task_ie.cc \
urlmon_utils.cc \
$(NULL)

#-----------------------------------------------------------------------------
# localserver/ff

FF_VPATH += \
base/common \
localserver/common \
localserver/firefox \
$(NULL)

FF_M4SRCS += \
localserver.idl.m4 \
$(NULL)

FF_IDLSRCS += \
localserver.idl \
$(NULL)

# localserver/common
FF_CPPSRCS += \
blob_store.cc \
capture_task.cc \
file_store.cc \
http_constants.cc \
http_cookies.cc \
localserver.cc \
localserver_db.cc \
localserver_tests.cc \
managed_resource_store.cc \
manifest.cc \
name_value_table_test.cc \
permissions_db_test.cc \
resource_store.cc \
sqlite_wrapper_test.cc \
update_task.cc \
$(NULL)

# localserver/firefox
FF_CPPSRCS += \
async_task_ff.cc \
cache_intercept.cc \
file_submitter_ff.cc \
http_request_ff.cc \
localserver_ff.cc \
managed_resource_store_ff.cc \
resource_store_ff.cc \
update_task_ff.cc \
$(NULL)

include tools/rules.mk

Google Gears Code Structure

  • Makefile
  • base/
  • database/
  • installer/
  • localserver/
  • sdk/
  • test/
  • third_party/
  • timer/
  • tools/
  • ui/
  • workerpool/

Thursday, May 24, 2007