mirror of
https://github.com/google/blockly.git
synced 2026-01-14 12:27:10 +01:00
feat(tests): Write Closure Compiler output directly to dist/
Since they are already UMD-wrapped, have Closure Compiler write output chunks directly to RELEASE_DIR, i.e. dist/.
This commit is contained in:
@@ -25,7 +25,7 @@ var closureDeps = require('google-closure-deps');
|
||||
var argv = require('yargs').argv;
|
||||
var rimraf = require('rimraf');
|
||||
|
||||
var {BUILD_DIR, DEPS_FILE, TEST_DEPS_FILE, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config');
|
||||
var {BUILD_DIR, DEPS_FILE, RELEASE_DIR, TEST_DEPS_FILE, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config');
|
||||
var {getPackageJson} = require('./helper_tasks');
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -668,7 +668,7 @@ function buildCompiled() {
|
||||
.pipe(compile(options))
|
||||
.pipe(gulp.rename({suffix: COMPILED_SUFFIX}))
|
||||
.pipe(gulp.sourcemaps.write('.'))
|
||||
.pipe(gulp.dest(BUILD_DIR));
|
||||
.pipe(gulp.dest(RELEASE_DIR));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -705,17 +705,17 @@ function buildAdvancedCompilationTest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This task copies built files from BUILD_DIR back to the repository
|
||||
* so they can be committed to git.
|
||||
* This task copies built files from BUILD_DIR and RELEASE_DIR back to
|
||||
* the repository so they can be committed to git.
|
||||
*
|
||||
* Prerequisite: buildCompiled, buildLangfiles.
|
||||
*/
|
||||
function checkinBuilt() {
|
||||
return gulp.src([
|
||||
`${BUILD_DIR}/*_compressed.js`,
|
||||
`${BUILD_DIR}/*_compressed.js.map`,
|
||||
`${BUILD_DIR}/msg/js/*.js`,
|
||||
], {base: BUILD_DIR}).pipe(gulp.dest('.'));
|
||||
`${RELEASE_DIR}/*_compressed.js`,
|
||||
`${RELEASE_DIR}/*_compressed.js.map`,
|
||||
// `${BUILD_DIR}/msg/js/*.js`, // Temporarily disabled (base mismatch).
|
||||
], {base: RELEASE_DIR}).pipe(gulp.dest('.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,15 +54,6 @@ function packageCommonJS(namespace, dependencies) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* This task copies the compressed files and their source maps into
|
||||
* the release directory.
|
||||
*/
|
||||
function packageCompressed() {
|
||||
return gulp.src('*_compressed.js?(.map)', {cwd: BUILD_DIR})
|
||||
.pipe(gulp.dest(RELEASE_DIR));
|
||||
};
|
||||
|
||||
/**
|
||||
* This task wraps scripts/package/blockly.js into a UMD module.
|
||||
* @example import 'blockly/blockly';
|
||||
@@ -300,10 +291,10 @@ function packageLocales() {
|
||||
*/
|
||||
function packageUMDBundle() {
|
||||
var srcs = [
|
||||
`${BUILD_DIR}/blockly_compressed.js`,
|
||||
`${BUILD_DIR}/msg/js/en.js`,
|
||||
`${BUILD_DIR}/blocks_compressed.js`,
|
||||
`${BUILD_DIR}/javascript_compressed.js`,
|
||||
`${RELEASE_DIR}/blockly_compressed.js`,
|
||||
`${RELEASE_DIR}/msg/en.js`,
|
||||
`${RELEASE_DIR}/blocks_compressed.js`,
|
||||
`${RELEASE_DIR}/javascript_compressed.js`,
|
||||
];
|
||||
return gulp.src(srcs)
|
||||
.pipe(gulp.concat('blockly.min.js'))
|
||||
@@ -384,7 +375,6 @@ const package = gulp.series(
|
||||
build.build,
|
||||
gulp.parallel(
|
||||
packageIndex,
|
||||
packageCompressed,
|
||||
packageBrowser,
|
||||
packageNode,
|
||||
packageCore,
|
||||
@@ -396,9 +386,8 @@ const package = gulp.series(
|
||||
packageLua,
|
||||
packageDart,
|
||||
packagePHP,
|
||||
packageLocales,
|
||||
packageMedia,
|
||||
packageUMDBundle,
|
||||
gulp.series(packageLocales, packageUMDBundle),
|
||||
packageJSON,
|
||||
packageReadme,
|
||||
packageDTS)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# (TODO(#5007): Should fetch this from scripts/gulpfiles/config.js
|
||||
# instead of hardcoding it here.
|
||||
readonly BUILD_DIR='build'
|
||||
readonly RELEASE_DIR='dist'
|
||||
|
||||
# These values should be updated with each release. (Note that the
|
||||
# historic values are tab-delimited.)
|
||||
@@ -101,8 +101,8 @@ trap fail ERR
|
||||
# GZip them for additional size comparisons (keep originals, force
|
||||
# overwite previously-gzipped copies).
|
||||
echo "Zipping the compressed files"
|
||||
gzip -kf "${BUILD_DIR}/blockly_compressed.js"
|
||||
gzip -kf "${BUILD_DIR}/blocks_compressed.js"
|
||||
gzip -kf "${RELEASE_DIR}/blockly_compressed.js"
|
||||
gzip -kf "${RELEASE_DIR}/blocks_compressed.js"
|
||||
|
||||
# Check the sizes of the files
|
||||
|
||||
@@ -126,9 +126,9 @@ compare_size() {
|
||||
fi
|
||||
}
|
||||
|
||||
compare_size "${BUILD_DIR}/blockly_compressed.js" $BLOCKLY_SIZE_EXPECTED
|
||||
compare_size "${BUILD_DIR}/blocks_compressed.js" $BLOCKS_SIZE_EXPECTED
|
||||
compare_size "${BUILD_DIR}/blockly_compressed.js.gz" $BLOCKLY_GZ_SIZE_EXPECTED
|
||||
compare_size "${BUILD_DIR}/blocks_compressed.js.gz" $BLOCKS_GZ_SIZE_EXPECTED
|
||||
compare_size "${RELEASE_DIR}/blockly_compressed.js" $BLOCKLY_SIZE_EXPECTED
|
||||
compare_size "${RELEASE_DIR}/blocks_compressed.js" $BLOCKS_SIZE_EXPECTED
|
||||
compare_size "${RELEASE_DIR}/blockly_compressed.js.gz" $BLOCKLY_GZ_SIZE_EXPECTED
|
||||
compare_size "${RELEASE_DIR}/blocks_compressed.js.gz" $BLOCKS_GZ_SIZE_EXPECTED
|
||||
|
||||
exit $has_failed
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
#
|
||||
# (TODO(#5007): Should fetch this from scripts/gulpfiles/config.js
|
||||
# instead of hardcoding it here.
|
||||
readonly BUILD_DIR='build'
|
||||
readonly RELEASE_DIR='dist'
|
||||
|
||||
gzip -k "${BUILD_DIR}/blockly_compressed.js"
|
||||
gzip -k "${BUILD_DIR}/blocks_compressed.js"
|
||||
gzip -k "${RELEASE_DIR}/blockly_compressed.js"
|
||||
gzip -k "${RELEASE_DIR}/blocks_compressed.js"
|
||||
|
||||
blockly_size=$(wc -c < "${BUILD_DIR}/blockly_compressed.js")
|
||||
blocks_size=$(wc -c < "${BUILD_DIR}/blocks_compressed.js")
|
||||
blockly_gz_size=$(wc -c < "${BUILD_DIR}/blockly_compressed.js.gz")
|
||||
blocks_gz_size=$(wc -c < "${BUILD_DIR}/blocks_compressed.js.gz")
|
||||
blockly_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js")
|
||||
blocks_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js")
|
||||
blockly_gz_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js.gz")
|
||||
blocks_gz_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js.gz")
|
||||
quarters=(1 1 1 2 2 2 3 3 3 4 4 4)
|
||||
month=$(date +%-m)
|
||||
quarter=$(echo Q${quarters[$month - 1]} $(date +%Y))
|
||||
|
||||
Reference in New Issue
Block a user