Skip to content

Commit

Permalink
Merge pull request #11114 from meteor/full-rebuild-build-in-place
Browse files Browse the repository at this point in the history
  • Loading branch information
filipenevola committed Jul 9, 2020
2 parents d2998d6 + 97d5679 commit 94cd41f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
28 changes: 17 additions & 11 deletions tools/isobuild/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2844,20 +2844,18 @@ var writeTargetToPath = Profile(
previousBuilder = null,
buildMode,
minifyMode,
forceInPlaceBuild
}) {
var builder = new Builder({
outputPath: files.pathJoin(outputPath, 'programs', name),
previousBuilder,
// We do not force an in-place build for individual targets like
// .meteor/local/build/programs/web.browser.legacy, because they
// tend to be written atomically, and it's important on Windows to
// avoid overwriting files that might be open currently in the build
// or server process.
// Server builds do use an in-place build since the server is always stopped
// during the build.
// If client in-place builds were safer on Windows, they
// would be much quicker than from-scratch rebuilds.
forceInPlaceBuild: name === 'server',
// We do not force an in-place build for individual targets
// like .meteor/local/build/programs/web.browser.legacy, because they tend
// to be written atomically, and it's important on Windows to avoid
// overwriting files that might be open currently in the server
// process. There are some exceptions when we know the server process
// is not using the files, such as during a full build when it is stopped.
forceInPlaceBuild: forceInPlaceBuild,
});

var targetBuild = target.write(builder, {
Expand Down Expand Up @@ -2910,6 +2908,7 @@ var writeSiteArchive = Profile("bundler writeSiteArchive", function (
buildMode,
minifyMode,
sourceRoot,
forceInPlaceBuild,
}) {

const builders = {};
Expand Down Expand Up @@ -3004,7 +3003,8 @@ Find out more about Meteor at meteor.com.
releaseName,
previousBuilder: previousBuilders[name] || null,
buildMode,
minifyMode
minifyMode,
forceInPlaceBuild
});

builders[name] = targetBuilder;
Expand Down Expand Up @@ -3083,6 +3083,10 @@ Find out more about Meteor at meteor.com.
* - hasCachedBundle: true if we already have a cached bundle stored in
* /build. When true, we only build the new client targets in the bundle.
*
* - forceInPlaceBuild On Windows, in place builds are disabled by default
* since they are only safe when the output files from the previous build
* are not being used. This can be set to true when it is safe.
*
* Returns an object with keys:
* - errors: A buildmessage.MessageSet, or falsy if bundling succeeded.
* - serverWatchSet: Information about server files and paths that were
Expand Down Expand Up @@ -3117,6 +3121,7 @@ function bundle({
previousBuilders = Object.create(null),
hasCachedBundle,
allowDelayedClientBuilds = false,
forceInPlaceBuild,
}) {
buildOptions = buildOptions || {};

Expand Down Expand Up @@ -3271,6 +3276,7 @@ function bundle({
builtBy,
releaseName,
minifyMode,
forceInPlaceBuild,
};

function writeClientTarget(target) {
Expand Down
4 changes: 4 additions & 0 deletions tools/runners/run-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,10 @@ _.extend(AppRunner.prototype, {
// Permit delayed bundling of client architectures if the
// console is interactive.
allowDelayedClientBuilds: ! Console.isHeadless(),

// None of the targets are used during full rebuilds
// so we can safely build in place on Windows
forceInPlaceBuild: !cachedServerWatchSet
});
});

Expand Down

0 comments on commit 94cd41f

Please sign in to comment.