Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various smaller clean-up in gulpfile.js #11869

Merged
merged 2 commits into from
May 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,7 @@ function replaceJSRootName(amdName, jsName) {
);
}

function createBundle(defines) {
console.log();
console.log("### Bundling files into pdf.js");

function createMainBundle(defines) {
var mainAMDName = "pdfjs-dist/build/pdf";
var mainOutputName = "pdf.js";

Expand All @@ -309,12 +306,14 @@ function createBundle(defines) {
libraryTarget: "umd",
umdNamedDefine: true,
});
var mainOutput = gulp
return gulp
.src("./src/pdf.js")
.pipe(webpack2Stream(mainFileConfig))
.pipe(replaceWebpackRequire())
.pipe(replaceJSRootName(mainAMDName, "pdfjsLib"));
}

function createWorkerBundle(defines) {
var workerAMDName = "pdfjs-dist/build/pdf.worker";
var workerOutputName = "pdf.worker.js";

Expand All @@ -324,13 +323,11 @@ function createBundle(defines) {
libraryTarget: "umd",
umdNamedDefine: true,
});

var workerOutput = gulp
return gulp
.src("./src/pdf.worker.js")
.pipe(webpack2Stream(workerFileConfig))
.pipe(replaceWebpackRequire())
.pipe(replaceJSRootName(workerAMDName, "pdfjsWorker"));
return merge([mainOutput, workerOutput]);
}

function createWebBundle(defines) {
Expand Down Expand Up @@ -677,13 +674,6 @@ gulp.task("cmaps", function (done) {
done();
});

gulp.task(
"bundle",
gulp.series("buildnumber", function () {
return createBundle(DEFINES).pipe(gulp.dest(BUILD_DIR));
})
);

function preprocessCSS(source, mode, defines, cleanup) {
var outName = getTempFile("~preprocess", ".css");
builder.preprocessCSS(mode, source, outName);
Expand Down Expand Up @@ -713,7 +703,8 @@ function buildGeneric(defines, dir) {
rimraf.sync(dir);

return merge([
createBundle(defines).pipe(gulp.dest(dir + "build")),
createMainBundle(defines).pipe(gulp.dest(dir + "build")),
createWorkerBundle(defines).pipe(gulp.dest(dir + "build")),
createWebBundle(defines).pipe(gulp.dest(dir + "web")),
gulp.src(COMMON_WEB_FILES, { base: "web/" }).pipe(gulp.dest(dir + "web")),
gulp.src("LICENSE").pipe(gulp.dest(dir)),
Expand Down Expand Up @@ -847,7 +838,8 @@ gulp.task(
rimraf.sync(MINIFIED_DIR);

return merge([
createBundle(defines).pipe(gulp.dest(MINIFIED_DIR + "build")),
createMainBundle(defines).pipe(gulp.dest(MINIFIED_DIR + "build")),
createWorkerBundle(defines).pipe(gulp.dest(MINIFIED_DIR + "build")),
createWebBundle(defines).pipe(gulp.dest(MINIFIED_DIR + "web")),
createImageDecodersBundle(
builder.merge(defines, { IMAGE_DECODERS: true })
Expand Down Expand Up @@ -1007,7 +999,12 @@ gulp.task(
];

return merge([
createBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + "build")),
createMainBundle(defines).pipe(
gulp.dest(MOZCENTRAL_CONTENT_DIR + "build")
),
createWorkerBundle(defines).pipe(
gulp.dest(MOZCENTRAL_CONTENT_DIR + "build")
),
createWebBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + "web")),
gulp
.src(MOZCENTRAL_COMMON_WEB_FILES, { base: "web/" })
Expand Down Expand Up @@ -1062,7 +1059,12 @@ gulp.task(
var version = getVersionJSON().version;

return merge([
createBundle(defines).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + "build")),
createMainBundle(defines).pipe(
gulp.dest(CHROME_BUILD_CONTENT_DIR + "build")
),
createWorkerBundle(defines).pipe(
gulp.dest(CHROME_BUILD_CONTENT_DIR + "build")
),
createWebBundle(defines).pipe(
gulp.dest(CHROME_BUILD_CONTENT_DIR + "web")
),
Expand Down