Skip to content

Commit

Permalink
move some stuff for reusability between modularized tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinmombay committed Oct 27, 2015
1 parent 2f452d5 commit 843f763
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 13 deletions.
19 changes: 19 additions & 0 deletions build-system/internal-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Used to e.g. references the ads binary from the runtime to get
// version lock.
exports.VERSION = new Date().getTime();
31 changes: 31 additions & 0 deletions build-system/tasks/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var del = require('del');
var gulp = require('gulp-help')(require('gulp'));


/**
* Clean up the build artifacts
*
* @param {function} done callback
*/
function clean(done) {
del(['dist', 'dist.3p', 'build', 'examples.build'], done);
}


gulp.task('clean', 'Removes build output', clean);
1 change: 1 addition & 0 deletions build-system/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

require('./clean');
require('./lint');
require('./make-golden');
require('./presubmit-checks');
Expand Down
14 changes: 1 addition & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var babel = require('babelify');
var browserify = require('browserify');
var buffer = require('vinyl-buffer');
var cssnano = require('cssnano');
var del = require('del');
var file = require('gulp-file');
var fs = require('fs-extra');
var gulp = require('gulp-help')(require('gulp'));
Expand All @@ -34,6 +33,7 @@ var uglify = require('gulp-uglify');
var util = require('gulp-util');
var watchify = require('watchify');
var wrap = require('gulp-wrap');
var internalRuntimeVersion = require('./build-system/internal-version').VERSION;
require('./build-system/tasks');

// NOTE: see https://github.com/ai/browserslist#queries for `browsers` list
Expand All @@ -54,9 +54,6 @@ cssnano = cssnano({
zindex: false
});

// Used to e.g. references the ads binary from the runtime to get
// version lock.
var internalRuntimeVersion = new Date().getTime();

/**
* Build all the AMP extensions
Expand Down Expand Up @@ -85,14 +82,6 @@ function buildExtensions(options) {
buildExtension('amp-youtube', '0.1', false, options);
}

/**
* Clean up the build artifacts
*
* @param {function} done callback
*/
function clean(done) {
del(['dist', 'dist.3p', 'build', 'examples.build'], done);
}

/**
* Compile the polyfills script and drop it in the build folder
Expand Down Expand Up @@ -452,7 +441,6 @@ function compileJs(srcDir, srcFilename, destDir, options) {
* Gulp tasks
*/
gulp.task('build', 'Builds the AMP library', build);
gulp.task('clean', 'Removes build output', clean);
gulp.task('css', 'Recompile css to build directory', compileCss);
gulp.task('default', 'Same as "watch"', ['watch']);
gulp.task('dist', 'Build production binaries', dist);
Expand Down

0 comments on commit 843f763

Please sign in to comment.