|
|
|
@ -18,8 +18,7 @@ target.all = function() {
@@ -18,8 +18,7 @@ target.all = function() {
|
|
|
|
|
echo('Please specify a target. Available targets:'); |
|
|
|
|
for (t in target) |
|
|
|
|
if (t !== 'all') echo(' ' + t); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
@ -43,16 +42,19 @@ target.web = function() {
@@ -43,16 +42,19 @@ target.web = function() {
|
|
|
|
|
|
|
|
|
|
cp(BUILD_TARGET, GH_PAGES_DIR + BUILD_TARGET); |
|
|
|
|
cp('-R', 'web/*', GH_PAGES_DIR + '/web'); |
|
|
|
|
cp(FIREFOX_BUILD_DIR+'/*.xpi', FIREFOX_BUILD_DIR+'/*.rdf', GH_PAGES_DIR+EXTENSION_SRC_DIR+'firefox/'); |
|
|
|
|
cp(FIREFOX_BUILD_DIR + '/*.xpi', FIREFOX_BUILD_DIR + '/*.rdf', |
|
|
|
|
GH_PAGES_DIR + EXTENSION_SRC_DIR + 'firefox/'); |
|
|
|
|
cp(GH_PAGES_DIR + '/web/index.html.template', GH_PAGES_DIR + '/index.html'); |
|
|
|
|
mv('-f', GH_PAGES_DIR+'/web/viewer-production.html', GH_PAGES_DIR+'/web/viewer.html'); |
|
|
|
|
mv('-f', GH_PAGES_DIR + '/web/viewer-production.html', |
|
|
|
|
GH_PAGES_DIR + '/web/viewer.html'); |
|
|
|
|
cd(GH_PAGES_DIR); |
|
|
|
|
exec('git add -A'); |
|
|
|
|
|
|
|
|
|
echo(); |
|
|
|
|
echo("Website built in " + GH_PAGES_DIR); |
|
|
|
|
echo("Don't forget to cd into "+GH_PAGES_DIR+" and issue 'git commit' to push changes."); |
|
|
|
|
} |
|
|
|
|
echo("Don't forget to cd into " + GH_PAGES_DIR + |
|
|
|
|
" and issue 'git commit' to push changes."); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make production
|
|
|
|
@ -61,7 +63,7 @@ target.web = function() {
@@ -61,7 +63,7 @@ target.web = function() {
|
|
|
|
|
target.production = function() { |
|
|
|
|
target.bundle(); |
|
|
|
|
target.viewer(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make bundle
|
|
|
|
@ -102,11 +104,13 @@ target.bundle = function() {
@@ -102,11 +104,13 @@ target.bundle = function() {
|
|
|
|
|
|
|
|
|
|
cd('src'); |
|
|
|
|
var bundle = cat(SRC_FILES), |
|
|
|
|
bundleVersion = exec('git log --format="%h" -n 1', {silent:true}).output.replace('\n', ''); |
|
|
|
|
bundleVersion = exec('git log --format="%h" -n 1', |
|
|
|
|
{silent: true}).output.replace('\n', ''); |
|
|
|
|
|
|
|
|
|
sed(/.*PDFJSSCRIPT_INCLUDE_ALL.*\n/, bundle, 'pdf.js').to(ROOT_DIR+BUILD_TARGET); |
|
|
|
|
sed(/.*PDFJSSCRIPT_INCLUDE_ALL.*\n/, bundle, 'pdf.js') |
|
|
|
|
.to(ROOT_DIR + BUILD_TARGET); |
|
|
|
|
sed('-i', 'PDFJSSCRIPT_BUNDLE_VER', bundleVersion, ROOT_DIR + BUILD_TARGET); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make viewer
|
|
|
|
@ -120,10 +124,12 @@ target.viewer = function() {
@@ -120,10 +124,12 @@ target.viewer = function() {
|
|
|
|
|
|
|
|
|
|
cd('web'); |
|
|
|
|
// Remove development lines
|
|
|
|
|
sed(/.*PDFJSSCRIPT_REMOVE_CORE.*\n/g, '', 'viewer.html').to('viewer-production.html'); |
|
|
|
|
sed(/.*PDFJSSCRIPT_REMOVE_CORE.*\n/g, '', 'viewer.html') |
|
|
|
|
.to('viewer-production.html'); |
|
|
|
|
// Introduce snippet
|
|
|
|
|
sed('-i', /.*PDFJSSCRIPT_INCLUDE_BUILD.*\n/g, cat('viewer-snippet.html'), 'viewer-production.html'); |
|
|
|
|
} |
|
|
|
|
sed('-i', /.*PDFJSSCRIPT_INCLUDE_BUILD.*\n/g, cat('viewer-snippet.html'), |
|
|
|
|
'viewer-production.html'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make pagesrepo
|
|
|
|
@ -143,7 +149,8 @@ target.pagesrepo = function() {
@@ -143,7 +149,8 @@ target.pagesrepo = function() {
|
|
|
|
|
echo(); |
|
|
|
|
echo('Cloning project repo...'); |
|
|
|
|
echo('(This operation can take a while, depending on network conditions)'); |
|
|
|
|
exec('git clone -b gh-pages --depth=1 '+REPO+' '+GH_PAGES_DIR, {silent:true}); |
|
|
|
|
exec('git clone -b gh-pages --depth=1 ' + REPO + ' ' + ßGH_PAGES_DIR, |
|
|
|
|
{silent: true}); |
|
|
|
|
echo('Done.'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -152,7 +159,7 @@ target.pagesrepo = function() {
@@ -152,7 +159,7 @@ target.pagesrepo = function() {
|
|
|
|
|
mkdir('-p', GH_PAGES_DIR + '/web/images'); |
|
|
|
|
mkdir('-p', GH_PAGES_DIR + BUILD_DIR); |
|
|
|
|
mkdir('-p', GH_PAGES_DIR + EXTENSION_SRC_DIR + '/firefox'); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
@ -180,7 +187,7 @@ target.extension = function() {
@@ -180,7 +187,7 @@ target.extension = function() {
|
|
|
|
|
target.production(); |
|
|
|
|
target.firefox(); |
|
|
|
|
target.chrome(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
target.buildnumber = function() { |
|
|
|
|
cd(ROOT_DIR); |
|
|
|
@ -188,11 +195,12 @@ target.buildnumber = function() {
@@ -188,11 +195,12 @@ target.buildnumber = function() {
|
|
|
|
|
echo('### Getting extension build number'); |
|
|
|
|
|
|
|
|
|
// Build number is the number of commits since base version
|
|
|
|
|
EXTENSION_BUILD_NUMBER = exec('git log --format=oneline '+EXTENSION_BASE_VERSION+'..', {silent:true}) |
|
|
|
|
EXTENSION_BUILD_NUMBER = exec('git log --format=oneline ' + |
|
|
|
|
EXTENSION_BASE_VERSION + '..', {silent: true}) |
|
|
|
|
.output.match(/\n/g).length; // get # of lines in git output
|
|
|
|
|
|
|
|
|
|
echo('Extension build number: ' + EXTENSION_BUILD_NUMBER); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make firefox
|
|
|
|
@ -267,7 +275,7 @@ target.firefox = function() {
@@ -267,7 +275,7 @@ target.firefox = function() {
|
|
|
|
|
exec('zip -r ' + FIREFOX_AMO_EXTENSION_NAME + ' ' + FIREFOX_EXTENSION_FILES.join(' ')); |
|
|
|
|
echo('AMO extension created: ' + FIREFOX_AMO_EXTENSION_NAME); |
|
|
|
|
cd(ROOT_DIR); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make chrome
|
|
|
|
@ -300,8 +308,9 @@ target.chrome = function() {
@@ -300,8 +308,9 @@ target.chrome = function() {
|
|
|
|
|
// Copy a standalone version of pdf.js inside the content directory
|
|
|
|
|
cp(BUILD_TARGET, CHROME_BUILD_CONTENT_DIR + BUILD_DIR); |
|
|
|
|
cp('-R', EXTENSION_WEB_FILES, CHROME_BUILD_CONTENT_DIR + '/web'); |
|
|
|
|
mv('-f', CHROME_BUILD_CONTENT_DIR+'/web/viewer-production.html', CHROME_BUILD_CONTENT_DIR+'/web/viewer.html'); |
|
|
|
|
} |
|
|
|
|
mv('-f', CHROME_BUILD_CONTENT_DIR + '/web/viewer-production.html', |
|
|
|
|
CHROME_BUILD_CONTENT_DIR + '/web/viewer.html'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
@ -315,7 +324,7 @@ target.chrome = function() {
@@ -315,7 +324,7 @@ target.chrome = function() {
|
|
|
|
|
target.test = function() { |
|
|
|
|
target.browsertest(); |
|
|
|
|
target.unittest(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make browsertest
|
|
|
|
@ -335,8 +344,9 @@ target.browsertest = function() {
@@ -335,8 +344,9 @@ target.browsertest = function() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cd('test'); |
|
|
|
|
exec(PYTHON_BIN+' test.py --reftest --browserManifestFile='+PDF_BROWSERS+' --manifestFile='+PDF_TEST, {async:true}); |
|
|
|
|
} |
|
|
|
|
exec(PYTHON_BIN + ' test.py --reftest --browserManifestFile=' + PDF_BROWSERS + |
|
|
|
|
' --manifestFile=' + PDF_TEST, {async: true}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make unittest
|
|
|
|
@ -348,9 +358,7 @@ target.unittest = function() {
@@ -348,9 +358,7 @@ target.unittest = function() {
|
|
|
|
|
|
|
|
|
|
cd('test/unit'); |
|
|
|
|
exec('make', {async: true}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
@ -368,7 +376,7 @@ target.server = function() {
@@ -368,7 +376,7 @@ target.server = function() {
|
|
|
|
|
|
|
|
|
|
cd('test'); |
|
|
|
|
exec(PYTHON_BIN + ' -u test.py --port=8888', {async: true}); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make lint
|
|
|
|
@ -387,7 +395,7 @@ target.lint = function() {
@@ -387,7 +395,7 @@ target.lint = function() {
|
|
|
|
|
extensions/chrome/*.js'; |
|
|
|
|
|
|
|
|
|
exec('gjslint --nojsdoc ' + LINT_FILES); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// make clean
|
|
|
|
@ -398,4 +406,4 @@ target.clean = function() {
@@ -398,4 +406,4 @@ target.clean = function() {
|
|
|
|
|
echo('### Cleaning up project builds'); |
|
|
|
|
|
|
|
|
|
rm('-rf', BUILD_DIR); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|