Permalink
Browse files

Add a bunch of missing license blocks and fix some lint warnings in v…

…arious support files and scripts.

RELNOTES: n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203042979
  • Loading branch information...
shicks committed Jul 3, 2018
1 parent b3be3e5 commit b42650981f212bedcc67809e237a62b6d6cbc4c3
@@ -1,5 +1,24 @@
// Copyright 2018 The Closure Library 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 sauceBrowsers = require('./sauce_browsers.json');

/**
* Returns a versioned name for the given capability object.
* @param {!Object} browserCap
* @return {string}
*/
function getBrowserName(browserCap) {
var name = browserCap.browserName == 'internet explorer' ?
'ie' :
@@ -8,6 +27,11 @@ function getBrowserName(browserCap) {
return name + version;
}

/**
* Returns the travis job name for the given capability object.
* @param {!Object} browserCap
* @return {string}
*/
function getJobName(browserCap) {
var browserName = getBrowserName(browserCap);

@@ -17,16 +41,20 @@ function getJobName(browserCap) {
process.env.TRAVIS_BRANCH;
}

/**
* Adds 'name', 'build', and 'tunnel-identifier' properties to all elements,
* based on runtime information from the environment.
* @param {!Array<!Object>} browsers
* @return {!Array<!Object>} The original array, whose objects are augmented.
*/
function getBrowserCapabilities(browsers) {
var caps = [];
for (var i = 0; i < browsers.length; i++) {
var b = browsers[i];
b['tunnel-identifier'] = process.env.TRAVIS_JOB_NUMBER;
b['build'] = process.env.TRAVIS_BUILD_NUMBER;
b['name'] = getJobName(b);
caps.push(b);
}
return caps;
return browsers;
}

module.exports = getBrowserCapabilities(sauceBrowsers);
@@ -1,3 +1,17 @@
// Copyright 2018 The Closure Library 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.

// See https://github.com/angular/protractor/blob/master/docs/referenceConf.js
// for full protractor config reference.
var browserCapabilities = require('./browser_capabilities');
@@ -1,3 +1,17 @@
// Copyright 2018 The Closure Library 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.

// TODO(joeltine): Remove promise module when stable node version supports it
// natively.
var Promise = require('promise');
@@ -36,7 +50,9 @@ describe('Run all Closure unit tests', function() {
return tests;
};

beforeAll(function() { allTests = removeIgnoredTests(allTests); });
beforeAll(function() {
allTests = removeIgnoredTests(allTests);
});

beforeEach(function() {
// Ignores synchronization with angular loading. Since we don't use angular,
@@ -53,18 +69,19 @@ describe('Run all Closure unit tests', function() {
// executeScript runs the passed method in the "window" context of
// the current test. JSUnit exposes hooks into the test's status through
// the "G_testRunner" global object.
browser.executeScript(function() {
if (window['G_testRunner'] &&
window['G_testRunner']['isFinished']()) {
var status = {};
status['isFinished'] = true;
status['isSuccess'] = window['G_testRunner']['isSuccess']();
status['report'] = window['G_testRunner']['getReport']();
return status;
} else {
return {'isFinished': false};
}
})
browser
.executeScript(function() {
if (window['G_testRunner'] &&
window['G_testRunner']['isFinished']()) {
var status = {};
status['isFinished'] = true;
status['isSuccess'] = window['G_testRunner']['isSuccess']();
status['report'] = window['G_testRunner']['getReport']();
return status;
} else {
return {'isFinished': false};
}
})
.then(
function(status) {
if (status && status.isFinished) {
@@ -84,7 +101,9 @@ describe('Run all Closure unit tests', function() {
}
}
},
function(err) { reject(err); });
function(err) {
reject(err);
});
};

return new Promise(function(resolve, reject) {
@@ -100,7 +119,9 @@ describe('Run all Closure unit tests', function() {
var runNextTest = function(testPath) {
return browser.navigate()
.to(TEST_SERVER + '/' + testPath)
.then(function() { return waitForTestSuiteCompletion(testPath); })
.then(function() {
return waitForTestSuiteCompletion(testPath);
})
.then(function(status) {
if (!status.isSuccess) {
failureReports.push(status.report);
@@ -113,7 +134,9 @@ describe('Run all Closure unit tests', function() {
// Chains the next test to the completion of the previous through its
// promise.
var chainNextTest = function(promise, test) {
return promise.then(function() { runNextTest(test); });
return promise.then(function() {
runNextTest(test);
});
};

var testPromise = null;
@@ -1,5 +1,19 @@
#!/bin/bash
#
# Copyright 2018 The Closure Library 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.
#
# Script to determine if .js files in Pull Request are properly formatted.
# Exits with non 0 exit code if formatting is needed.

@@ -1,5 +1,19 @@
#!/bin/bash
#
# Copyright 2018 The Closure Library 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.
#
# Compiles pertinent Closure library files.

# TODO(joeltine): Make strictMissingRequire an error when
@@ -31,4 +45,4 @@ java -Xmx1G -jar ../closure-compiler-1.0-SNAPSHOT.jar \
--js='!**generate_closure_unit_tests.js' \
--js='!./doc/**.js' \
--js='!**debug_loader_integration_tests/testdata/**' \
--js_output_file=$(mktemp);
--js_output_file="$(mktemp)"
@@ -1,3 +1,6 @@
<!-- Documentation licensed under CC BY 4.0 -->
<!-- License available at https://creativecommons.org/licenses/by/4.0/ -->

# Closure Generated API Docs

This is the generated documentation for the Closure Library
@@ -1,4 +1,18 @@
#!/bin/bash
#
# Copyright 2018 The Closure Library 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.

# Rebuild gh-pages branch.

@@ -1,3 +1,17 @@
:: Copyright 2018 The Closure Library 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.

:: Disable "Stop running this script?" alert dialog.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Styles" ^
/v "MaxScriptStatements" /t REG_DWORD /d 0xffffffff /f
@@ -1,5 +1,19 @@
#!/bin/bash
#
# Copyright 2018 The Closure Library 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.
#
# Script to install all necessary dependencies for running Closure tests,
# linting, formatting and compiling.

@@ -23,15 +37,15 @@ fetch () {
curl -o - "$dir/" |
sed -n 's+.*<a href="\('"$dir/$name"'-[-.0-9]*\.jar\)".*+\1+p' |
head -n 1)
[ -n $url ]
[ -n "$url" ]
wget -O "$jar" "$url"
}

# Install clang-format.
wget --quiet $CLANG_URL
tar xf $CLANG_TAR
mv $CLANG_BUILD clang
rm -f $CLANG_TAR
wget --quiet "$CLANG_URL"
tar xf "$CLANG_TAR"
mv "$CLANG_BUILD" clang
rm -f "$CLANG_TAR"

# Install closure compiler and linter.
fetch closure-compiler
@@ -1,11 +1,25 @@
#!/bin/bash
#
# Copyright 2018 The Closure Library 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.
#
# Script to run the Compiler's Linter on only the modified or added files in the
# current branch. Should be run from the base git directory with the PR branch
# checked out.

CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
CHANGED_FILES=$(git diff --name-only --diff-filter=AM master..$CURRENT_BRANCH |
CHANGED_FILES=$(git diff --name-only --diff-filter=AM master.."$CURRENT_BRANCH" |
grep -E "\.js$" |
grep -v -E "test\.js$" |
grep -v -f scripts/ci/lint_ignore.txt)
@@ -1,4 +1,18 @@
#!/bin/bash
#
# Copyright 2018 The Closure Library 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.

# Deploy the gh-pages branch, adapted from
# https://github.com/google/dagger/blob/master/util/generate-latest-docs.sh
@@ -1,4 +1,18 @@
#!/bin/bash
#
# Copyright 2018 The Closure Library 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.

set -x

Oops, something went wrong.

0 comments on commit b426509

Please sign in to comment.