Use config file.
This commit is contained in:
parent
1ceac04351
commit
c73d091e9c
41
make.js
41
make.js
@ -25,9 +25,14 @@ var builder = require('./external/builder/builder.js');
|
|||||||
var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
|
var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
|
||||||
var wintersmith = require('wintersmith');
|
var wintersmith = require('wintersmith');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
var BETA_VERSION = '0.8.1114'; // Current version in Firefox Nightly.
|
var CONFIG_FILE = 'pdfjs.config';
|
||||||
var STABLE_VERSION = '0.8.1181'; // Current version in Firefox Aurora.
|
var config = JSON.parse(fs.readFileSync(CONFIG_FILE));
|
||||||
|
|
||||||
|
// Defined by buildnumber target.
|
||||||
|
var BUILD_NUMBER,
|
||||||
|
VERSION;
|
||||||
|
|
||||||
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
||||||
BUILD_DIR = 'build/',
|
BUILD_DIR = 'build/',
|
||||||
@ -168,9 +173,9 @@ target.web = function() {
|
|||||||
if (error) {
|
if (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
sed('-i', /STABLE_VERSION/g, STABLE_VERSION,
|
sed('-i', /STABLE_VERSION/g, config.stableVersion,
|
||||||
GH_PAGES_DIR + '/getting_started/index.html');
|
GH_PAGES_DIR + '/getting_started/index.html');
|
||||||
sed('-i', /BETA_VERSION/g, BETA_VERSION,
|
sed('-i', /BETA_VERSION/g, config.betaVersion,
|
||||||
GH_PAGES_DIR + '/getting_started/index.html');
|
GH_PAGES_DIR + '/getting_started/index.html');
|
||||||
echo('Done building with wintersmith.');
|
echo('Done building with wintersmith.');
|
||||||
|
|
||||||
@ -188,8 +193,11 @@ target.web = function() {
|
|||||||
|
|
||||||
target.dist = function() {
|
target.dist = function() {
|
||||||
target.generic();
|
target.generic();
|
||||||
|
config.stableVersion = config.betaVersion;
|
||||||
|
config.betaVersion = VERSION;
|
||||||
|
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
||||||
cd(GENERIC_DIR);
|
cd(GENERIC_DIR);
|
||||||
var distFilename = 'pdfjs-' + EXTENSION_VERSION + '-dist.zip';
|
var distFilename = 'pdfjs-' + VERSION + '-dist.zip';
|
||||||
exec('zip -r ' + ROOT_DIR + BUILD_DIR + distFilename + ' *');
|
exec('zip -r ' + ROOT_DIR + BUILD_DIR + distFilename + ' *');
|
||||||
echo('Built distrobution file: ' + distFilename);
|
echo('Built distrobution file: ' + distFilename);
|
||||||
cd(ROOT_DIR);
|
cd(ROOT_DIR);
|
||||||
@ -309,7 +317,7 @@ target.bundle = function(args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var bundle = cat(SRC_FILES),
|
var bundle = cat(SRC_FILES),
|
||||||
bundleVersion = EXTENSION_VERSION,
|
bundleVersion = VERSION,
|
||||||
bundleBuild = exec('git log --format="%h" -n 1',
|
bundleBuild = exec('git log --format="%h" -n 1',
|
||||||
{silent: true}).output.replace('\n', '');
|
{silent: true}).output.replace('\n', '');
|
||||||
|
|
||||||
@ -537,11 +545,6 @@ target.minified = function() {
|
|||||||
// Extension stuff
|
// Extension stuff
|
||||||
//
|
//
|
||||||
|
|
||||||
var EXTENSION_BASE_VERSION = '0ac55ac879d1c0eea9c0d155d5bbd9b11560f631',
|
|
||||||
EXTENSION_VERSION_PREFIX = '0.8.',
|
|
||||||
EXTENSION_BUILD_NUMBER,
|
|
||||||
EXTENSION_VERSION;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// make extension
|
// make extension
|
||||||
//
|
//
|
||||||
@ -561,13 +564,13 @@ target.buildnumber = function() {
|
|||||||
echo('### Getting extension build number');
|
echo('### Getting extension build number');
|
||||||
|
|
||||||
var lines = exec('git log --format=oneline ' +
|
var lines = exec('git log --format=oneline ' +
|
||||||
EXTENSION_BASE_VERSION + '..', {silent: true}).output;
|
config.baseVersion + '..', {silent: true}).output;
|
||||||
// Build number is the number of commits since base version
|
// Build number is the number of commits since base version
|
||||||
EXTENSION_BUILD_NUMBER = lines ? lines.match(/\n/g).length : 0;
|
BUILD_NUMBER = lines ? lines.match(/\n/g).length : 0;
|
||||||
|
|
||||||
echo('Extension build number: ' + EXTENSION_BUILD_NUMBER);
|
echo('Extension build number: ' + BUILD_NUMBER);
|
||||||
|
|
||||||
EXTENSION_VERSION = EXTENSION_VERSION_PREFIX + EXTENSION_BUILD_NUMBER;
|
VERSION = config.versionPrefix + BUILD_NUMBER;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -662,9 +665,9 @@ target.firefox = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Update the build version number
|
// Update the build version number
|
||||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
|
sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
|
||||||
FIREFOX_BUILD_DIR + '/install.rdf');
|
FIREFOX_BUILD_DIR + '/install.rdf');
|
||||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
|
sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
|
||||||
FIREFOX_BUILD_DIR + '/update.rdf');
|
FIREFOX_BUILD_DIR + '/update.rdf');
|
||||||
|
|
||||||
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID,
|
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID,
|
||||||
@ -795,7 +798,7 @@ target.mozcentral = function() {
|
|||||||
cp(DEFAULT_LOCALE_FILES, MOZCENTRAL_L10N_DIR);
|
cp(DEFAULT_LOCALE_FILES, MOZCENTRAL_L10N_DIR);
|
||||||
|
|
||||||
// Update the build version number
|
// Update the build version number
|
||||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
|
sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
|
||||||
MOZCENTRAL_EXTENSION_DIR + 'README.mozilla');
|
MOZCENTRAL_EXTENSION_DIR + 'README.mozilla');
|
||||||
|
|
||||||
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID,
|
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID,
|
||||||
@ -895,7 +898,7 @@ target.chromium = function() {
|
|||||||
cleanupJSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.js');
|
cleanupJSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.js');
|
||||||
|
|
||||||
// Update the build version number
|
// Update the build version number
|
||||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
|
sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
|
||||||
CHROME_BUILD_DIR + '/manifest.json');
|
CHROME_BUILD_DIR + '/manifest.json');
|
||||||
|
|
||||||
// Allow PDF.js resources to be loaded by adding the files to
|
// Allow PDF.js resources to be loaded by adding the files to
|
||||||
|
6
pdfjs.config
Normal file
6
pdfjs.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"betaVersion": "0.8.1114",
|
||||||
|
"stableVersion": "0.8.1181",
|
||||||
|
"baseVersion": "0ac55ac879d1c0eea9c0d155d5bbd9b11560f631",
|
||||||
|
"versionPrefix": "0.8."
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user