Skip to content

Commit

Permalink
Merge branch 'glenn/win-build-script' into glenn/gyp
Browse files Browse the repository at this point in the history
  • Loading branch information
gruehle committed Dec 13, 2012
2 parents c9ac87e + 748b404 commit f3a50b7
Show file tree
Hide file tree
Showing 17 changed files with 760 additions and 563 deletions.
2 changes: 1 addition & 1 deletion Brackets.vcxproj

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion appshell.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

{
'variables': {
'appname': 'Brackets',
'chromium_code': 1,
'conditions': [
[ 'OS=="mac"', {
Expand All @@ -14,6 +13,8 @@
]
},
'includes': [
# Bring in the configuration vars
'appshell_config.gypi',
# Bring in the source file lists for appshell.
'appshell_paths.gypi',
],
Expand Down
1,054 changes: 539 additions & 515 deletions appshell.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions appshell/appshell_extensions_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ int32 ReadDir(ExtensionString path, CefRefPtr<CefListValue>& directoryContents)
NSString* pathStr = [NSString stringWithUTF8String:path.c_str()];
NSError* error = nil;

if ([pathStr length] == 0) {
return ERR_INVALID_PARAMS;
}

NSArray* contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:pathStr error:&error];

if (contents != nil)
Expand Down
45 changes: 5 additions & 40 deletions appshell/cefclient.rc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

#define OS_WIN
#include "config.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

Expand All @@ -23,44 +26,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// VersionInfo
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,18,0,0
/* PRODUCTVERSION 1,0,0,0 */
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "brackets.io\0"
VALUE "FileDescription", "\0"
VALUE "FileVersion", "Sprint 18\0"
VALUE "ProductName", "Brackets\0"
VALUE "ProductVersion", "\0"
VALUE "LegalCopyright", "(c) 2012 Adobe Systems, Inc.\0"
END
END

BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */

VALUE "Translation", 0x409, 1252
VALUE "Translation", 0x40C, 1252
END
END

/////////////////////////////////////////////////////////////////////////////
//
// Binary
Expand All @@ -75,7 +40,7 @@ IDS_APPSHELL_EXTENSIONS BINARY "appshell_extensions.js"

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_CEFCLIENT ICON "res\brackets.ico"
IDI_CEFCLIENT ICON "res\\appshell.ico"

/////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -178,7 +143,7 @@ END

STRINGTABLE
BEGIN
IDS_APP_TITLE "Brackets"
IDS_APP_TITLE WINDOW_TITLE
IDC_CEFCLIENT "CEFCLIENT"
END

Expand Down
2 changes: 1 addition & 1 deletion appshell/mac/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>brackets.icns</string>
<string>appshell.icns</string>
<key>CFBundleIdentifier</key>
<string>io.brackets.appshell</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
File renamed without changes.
File renamed without changes.
68 changes: 68 additions & 0 deletions appshell/version.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

#define OS_WIN
#include "config.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// VersionInfo
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,18,0,0
/* PRODUCTVERSION 1,0,0,0 */
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "brackets.io\0"
VALUE "FileDescription", "\0"
VALUE "FileVersion", "Sprint 18\0"
VALUE "ProductName", APP_NAME "\0"
VALUE "ProductVersion", "\0"
VALUE "LegalCopyright", "(c) 2012 Adobe Systems, Inc.\0"
END
END

BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */

VALUE "Translation", 0x409, 1252
VALUE "Translation", 0x40C, 1252
END
END

#endif // !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

5 changes: 5 additions & 0 deletions appshell_config.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
'variables': {
'appname': "Brackets"
}
}
5 changes: 3 additions & 2 deletions appshell_paths.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@
'appshell_sources_win': [
'appshell/appshell_extensions_win.cpp',
'appshell/cefclient.rc',
'appshell/version.rc',
'appshell/cefclient_win.cpp',
'appshell/client_app_win.cpp',
'appshell/client_handler_win.cpp',
'appshell/resource.h',
'appshell/res/brackets.ico',
'appshell/res/appshell.ico',
'appshell/resource_util_win.cpp',
],
'appshell_sources_mac': [
Expand Down Expand Up @@ -138,7 +139,7 @@
'appshell/util.h',
],
'appshell_bundle_resources_mac': [
'appshell/mac/brackets.icns',
'appshell/mac/appshell.icns',
'appshell/mac/English.lproj/InfoPlist.strings',
'appshell/mac/English.lproj/MainMenu.xib',
'appshell/mac/French.lproj/InfoPlist.strings',
Expand Down
3 changes: 3 additions & 0 deletions installer/win/setBuildNumber.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# NOTE: THIS SCRIPT WILL BE GOING AWAY SOON. IT HAS BEEN SUPERSEDED BY
# /scripts/build.sh
#
# Injects the build number, branch, and SHA into the staged package.json file.
#
# INSTRUCTIONS FOR RUNNING
Expand Down
6 changes: 3 additions & 3 deletions installer/win/stageForInstaller.bat
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ del shell_excludes.tmp
echo Copying brackets source from %BRACKETS_SRC%\src ...

echo .git > www_excludes.tmp
xcopy %BRACKETS_SRC%\src staging\www /s /i /exclude:www_excludes.tmp
xcopy "%BRACKETS_SRC%\src" staging\www /s /i /exclude:www_excludes.tmp
del www_excludes.tmp


:: Copy BRACKETS_SRC\samples to staging\samples
echo Copying sample content from %BRACKETS_SRC%\samples ...

xcopy %BRACKETS_SRC%\samples staging\samples /s /i
xcopy "%BRACKETS_SRC%\samples" staging\samples /s /i



echo.
echo Done staging Brackets for Windows! (Ready to run setBuildNumber.sh and then build the installer)
echo Done staging Brackets for Windows! (Ready to build the installer)

GOTO END

Expand Down
109 changes: 109 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# SETUP - MAC
# - Install xcode
# - Install xcode command line tools
# - Install DropDMG, including the dropdmg command line tool
# SETUP - WIN
# - Install Visual Studio 2010 (Express is fine)
# SETUP - COMMON
# - Setup source directories as specified in README.md
# (copy CEF binary, run scripts/make_symlinks.sh, etc.)
# - Set BRACKETS_SRC environment variable, pointing to the
# brackets source code (without trailing '/')
# - Optionally, set BRACKETS_APP_NAME environment variable with the
# name of the application. (This should match the app name built
# by the gyp project, and need not match the final installed build name.)
# - Optionally, set BRACKETS_SHELL_BRANCH and BRACKETS_BRANCH
# to the branches you want to build.

# Make sure BRACKETS_SRC environment variable is set
if [ "$BRACKETS_SRC" = "" ]; then
echo "The BRACKETS_SRC environment variable must be set to the location of the Brackets source folder. Aborting."
exit
fi

# Default the app name to "Brackets", but override with $BRACKETS_APP_NAME if set
if [ "$BRACKETS_APP_NAME" = "" ]; then
export BRACKETS_APP_NAME="Brackets"
fi

# Default the branches to "master"
# You can set either branch name to "NO_FETCH" to skip the fetching for that repo
if [ "$BRACKETS_SHELL_BRANCH" = "" ]; then
export BRACKETS_SHELL_BRANCH="master"
fi
if [ "$BRACKETS_BRANCH" = "" ]; then
export BRACKETS_BRANCH="master"
fi

# Pull the latest code
curDir=`pwd`
cd "$BRACKETS_SRC"
if [ "$BRACKETS_BRANCH" != "NO_FETCH" ]; then
git checkout "$BRACKETS_BRANCH"
git pull origin "$BRACKETS_BRANCH"
git submodule update --init --recursive
else
echo "Skipping fetch for brackets repo"
fi
build_num=`git log --oneline | wc -l | tr -d ' '`
brackets_sha=`git log | head -1 | sed -e 's/commit \([0-9a-f]*$\)/\1/'`
cd $curDir
if [ "$BRACKETS_SHELL_BRANCH" != "NO_FETCH" ]; then
git checkout "$BRACKETS_SHELL_BRANCH"
git pull origin "$BRACKETS_SHELL_BRANCH"
else
echo "Skipping fetch for brackets-shell repo"
fi

os=${OSTYPE//[0-9.]/}

if [ "$os" = "darwin" ]; then # Building on mac
# Clean and build the xcode project
xcodebuild -project appshell.xcodeproj -config Release clean
xcodebuild -project appshell.xcodeproj -config Release build

# Package www files
scripts/package_www_files.sh

# Remove existing staging dir
if [ -d installer/mac/staging ]; then
rm -rf installer/mac/staging
fi

mkdir installer/mac/staging

# Copy to installer staging folder
cp -R "xcodebuild/Release/${BRACKETS_APP_NAME}.app" installer/mac/staging/
packageLocation="installer/mac/staging/${BRACKETS_APP_NAME}.app/Contents/www"

elif [ "$os" = "msys" ]; then # Building on Windows

# Clean and build the Visual Studio project
cmd /k "scripts\build_projects.bat"

# Stage files for installer
cmd /k "scripts\stage_for_installer.bat"

packageLocation="installer/win/staging/www"

else
echo "Unknown platform \"$os\". I don't know how to build this."
exit;
fi


# Set the build number, branch and sha on the staged build
cat "$packageLocation/package.json" \
| sed "s:\(\"version\"[^\"]*\"[0-9.]*-\)\([0-9*]\)\(\"\):\1$build_num\3:" \
| sed "s:\(\"branch\"[^\"]*\"\)\([^\"]*\)\(\"\):\1$BRACKETS_BRANCH\3:" \
| sed "s:\(\"SHA\"[^\"]*\"\)\([^\"]*\)\(\"\):\1$brackets_sha\3:" \
> tmp_package_json.txt
mv tmp_package_json.txt "$packageLocation/package.json"

# Build the installer
if [ "$os" = "darwin" ]; then # Build mac installer
cd installer/mac
./buildInstaller.sh

# TODO: Build windows installer
fi
3 changes: 3 additions & 0 deletions scripts/build_mac.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# IMPORTANT: THIS FILE WILL BE GOING AWAY SOON! USE scripts/build.sh INSTEAD!
# YOU HAVE BEEN WARNED!

# SETUP
# - Install xcode
# - Install xcode command line tools
Expand Down
7 changes: 7 additions & 0 deletions scripts/build_projects.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:: Batch file that sets up Visual Studio command line tools and builds appshell.sln
:: This file should *not* be called directly. It is called by the build.sh script.

call "%VS100COMNTOOLS%/vsvars32.bat"
msbuild.exe appshell.sln /t:Clean /p:Platform=Win32 /p:Configuration=Release
msbuild.exe appshell.sln /t:Build /p:Platform=Win32 /p:Configuration=Release
exit
7 changes: 7 additions & 0 deletions scripts/stage_for_installer.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:: Batch file that simply calls installer/win/stageForInstaller.
:: This file is used by build.sh

cd installer/win
call stageForInstaller.bat
cd ../..
exit

0 comments on commit f3a50b7

Please sign in to comment.