Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
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
86 changes: 82 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,88 @@ task :concat => :init do
end


desc 'Minify source files into angular.min.js'
task :minify_angular => [:init] do
min_path = path_to('angular.min.js')

angular_prefix = %x(cat src/angular.prefix)
angular_suffix = %x(cat src/angular.suffix)

%x(java \
#{java32flags()} \
-jar lib/closure-compiler/compiler.jar \
--compilation_level SIMPLE_OPTIMIZATIONS \
--language_in ECMASCRIPT5_STRICT \
--warning_level VERBOSE \
--externs lib/externs/json.js \
--jscomp_off nonStandardJsDocs \
--jscomp_error ambiguousFunctionDecl \
--jscomp_error checkRegExp \
--jscomp_error checkTypes \
--jscomp_error checkVars \
--jscomp_error const \
--jscomp_error constantProperty \
--jscomp_error deprecated \
--jscomp_error duplicateMessage \
--jscomp_error es5Strict \
--jscomp_error externsValidation \
--jscomp_error globalThis \
--jscomp_error internetExplorerChecks \
--jscomp_error invalidCasts \
--jscomp_error misplacedTypeAnnotation \
--jscomp_error missingProperties \
--jscomp_error suspiciousCode \
--jscomp_error strictModuleDepCheck \
--jscomp_error typeInvalidation \
--jscomp_error undefinedNames \
--jscomp_error undefinedVars \
--jscomp_error unknownDefines \
--jscomp_error uselessCode \
--jscomp_error visibility \
--output_wrapper '#{angular_prefix} %output% #{angular_suffix}' \
--js #{files['angularSrc'].flatten.join(" \\\n --js ")} \
--js_output_file #{min_path})

rewrite_file(min_path) do |content|
content.gsub!('"NG_VERSION_FULL"', NG_VERSION.full).
gsub!('"NG_VERSION_MAJOR"', NG_VERSION.major).
gsub!('"NG_VERSION_MINOR"', NG_VERSION.minor).
gsub!('"NG_VERSION_DOT"', NG_VERSION.dot).
gsub!('"NG_VERSION_CODENAME"', NG_VERSION.codename).
gsub!(/\s*['"]use strict['"];?\s*/, ''). # remove all file-specific strict mode flags
sub!(/\(function\([^)]*\)\s*\{/, "\\0\n'use strict';") # add single strict mode flag
end
end


desc 'Double-minify angular.min.js into angular.min.js'
task :minify_angular2 => [:minify_angular] do
# We double minify to rename free floating fns in angular closure, this will go away
# when we switch to namespaces

input_path = path_to('angular.min.js')
output_path = path_to('angular.min2.js')


# TODO(i): remove rather than suppress bogus warnings
%x(java \
#{java32flags()} \
-jar lib/closure-compiler/compiler.jar \
--compilation_level SIMPLE_OPTIMIZATIONS \
--language_in ECMASCRIPT5_STRICT \
--externs lib/externs/json.js \
--jscomp_off suspiciousCode \
--warning_level QUIET \
--js #{input_path} \
--js_output_file #{output_path})

FileUtils.cp output_path, input_path
end


desc 'Minify JavaScript'
task :minify => [:init, :concat, :concat_scenario] do
[ 'angular.js',
'angular-cookies.js',
task :minify => [:init, :concat, :concat_scenario, :minify_angular] do
[ 'angular-cookies.js',
'angular-loader.js',
'angular-resource.js',
'angular-sanitize.js',
Expand Down Expand Up @@ -265,7 +343,7 @@ def gen_css(cssFile, minify = false)
css.gsub! /'/, "\\\\'"
css.gsub! /\n/, "\\n"

return %Q{angular.element(document).find('head').append('<style type="text/css">#{css}</style>');}
return %Q{window.angular.element(document).find('head').append('<style type="text/css">#{css}</style>');}
end


Expand Down
15 changes: 10 additions & 5 deletions angularFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ angularFiles = {
'src/ng/directive/ngView.js',
'src/ng/directive/script.js',
'src/ng/directive/select.js',
'src/ng/directive/style.js'
'src/ng/directive/style.js',

'src/angular-bootstrap.js'
],

'angularSrcModules': [
Expand Down Expand Up @@ -127,7 +129,8 @@ angularFiles = {
'jstdExclude': [
'test/jquery_alias.js',
'src/angular-bootstrap.js',
'src/ngScenario/angular-bootstrap.js'
'src/angular-dev.js',
'src/ngScenario/angular-dev.js'
],

'jstdScenario': [
Expand Down Expand Up @@ -168,8 +171,9 @@ angularFiles = {
],

'jstdPerfExclude': [
'src/ng/angular-bootstrap.js',
'src/ngScenario/angular-bootstrap.js'
'src/angular-bootstrap.js',
'src/angular-dev.js',
'src/ngScenario/angular-dev.js'
],

'jstdJquery': [
Expand All @@ -190,7 +194,8 @@ angularFiles = {

'jstdJqueryExclude': [
'src/angular-bootstrap.js',
'src/ngScenario/angular-bootstrap.js',
'src/angular-dev.js',
'src/ngScenario/angular-dev.js',
'test/jquery_remove.js'
]
};
Expand Down
7 changes: 5 additions & 2 deletions check-size.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

rake minify
#TODO(i): UNCOMMENT
#rake minify
gzip -c < build/angular.min.js > build/angular.min.js.gzip
ls -l build/angular.min.*
gzip -c < build/angular.mmin.js > build/angular.mmin.js.gzip
gzip -c < build/angular.mmin2.js > build/angular.mmin2.js.gzip
ls -l build/angular.m*
2 changes: 1 addition & 1 deletion example/personalLog/personalLog.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
setupModuleLoader(window);
</script>
<script src="personalLog.js"></script>
<script src="../../src/angular-bootstrap.js"></script>
<script src="../../src/angular-dev.js"></script>
<script src="../../src/ngCookies/cookies.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion example/personalLog/personalLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ app.controller('LogCtrl', ['$cookieStore', '$scope', function LogCtrl($cookieSto

/**
* Persistently removes a log from logs.
* @param {object} log The log to remove.
* @param {Object} log The log to remove.
*/
$scope.rmLog = function(log) {
for ( var i = 0; i < logs.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion example/personalLog/scenario/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Personal Log Scenario Runner</title>
<meta http-equiv="expires" content="0">
<script type="text/javascript" src="../../../src/scenario/angular-bootstrap.js" ng:autotest></script>
<script type="text/javascript" src="../../../src/scenario/angular-dev.js" ng:autotest></script>
<script type="text/javascript" src="personalLogScenario.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion example/temp.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
};
});
</script>
<script src="../src/angular-bootstrap.js"></script>
<script src="../src/angular-dev.js"></script>
</head>
<body>
<p>
Expand Down
2 changes: 1 addition & 1 deletion example/tweeter/tweeter_addressbook.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="../../css/angular.css">
<script type="text/javascript" src="../../lib/underscore/underscore.js"></script>
<script type="text/javascript" src="../../lib/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../src/angular-bootstrap.js"></script>
<script type="text/javascript" src="../../src/angular-dev.js"></script>
<script type="text/javascript" src="tweeterclient.js"></script>
</head>
<body ng:class="status" ng:init="mute={}" ng:watch="$anchor.user: tweets = fetchTweets($anchor.user)">
Expand Down
2 changes: 1 addition & 1 deletion example/tweeter/tweeter_demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="../../css/angular.css">
<script type="text/javascript" src="../../lib/underscore/underscore.js"></script>
<script type="text/javascript" src="../../lib/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../src/angular-bootstrap.js"></script>
<script type="text/javascript" src="../../src/angular-dev.js"></script>
<script type="text/javascript" src="tweeterclient.js"></script>
</head>
<body ng:class="status" Xng:init="tweets = fetchTweets()">
Expand Down
36 changes: 25 additions & 11 deletions lib/closure-compiler/README
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ the parse tree data structures were extracted and modified
significantly for use by Google's JavaScript compiler.

Local Modifications: The packages have been renamespaced. All code not
relavant to parsing has been removed. A JSDoc parser and static typing
relevant to parsing has been removed. A JsDoc parser and static typing
system have been added.


-----
Code in:
lib/libtrunk_rhino_parser_jarjared.jar
lib/rhino

Rhino
URL: http://www.mozilla.org/rhino
Expand All @@ -161,9 +161,8 @@ License: Netscape Public License and MPL / GPL dual license

Description: Mozilla Rhino is an implementation of JavaScript for the JVM.

Local Modifications: None. We've used JarJar to renamespace the code
post-compilation. See:
http://code.google.com/p/jarjar/
Local Modifications: Minor changes to parsing JSDoc that usually get pushed
up-stream to Rhino trunk.


-----
Expand All @@ -172,7 +171,7 @@ lib/args4j.jar

Args4j
URL: https://args4j.dev.java.net/
Version: 2.0.12
Version: 2.0.16
License: MIT

Description:
Expand All @@ -188,7 +187,7 @@ lib/guava.jar

Guava Libraries
URL: http://code.google.com/p/guava-libraries/
Version: r08
Version: 13.0.1
License: Apache License 2.0

Description: Google's core Java libraries.
Expand All @@ -210,13 +209,28 @@ Description: Annotations for software defect detection.
Local Modifications: None.


-----
Code in:
lib/jarjar.jar

Jar Jar Links
URL: http://jarjar.googlecode.com/
Version: 1.1
License: Apache License 2.0

Description:
A utility for repackaging Java libraries.

Local Modifications: None.


----
Code in:
lib/junit.jar

JUnit
URL: http://sourceforge.net/projects/junit/
Version: 4.8.2
Version: 4.10
License: Common Public License 1.0

Description: A framework for writing and running automated tests in Java.
Expand All @@ -230,7 +244,7 @@ lib/protobuf-java.jar

Protocol Buffers
URL: http://code.google.com/p/protobuf/
Version: 2.3.0
Version: 2.4.1
License: New BSD License

Description: Supporting libraries for protocol buffers,
Expand Down Expand Up @@ -267,9 +281,9 @@ Local Modifications: None

---
Code in:
tools/maven-ant-tasks-2.1.1.jar
tools/maven-ant-tasks-2.1.3.jar
URL: http://maven.apache.org
Version 2.1.1
Version 2.1.3
License: Apache License 2.0
Description:
Maven Ant tasks are used to manage dependencies and to install/deploy to
Expand Down
Binary file modified lib/closure-compiler/compiler.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion lib/closure-compiler/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
20110615
20130207
r4796bc81
45 changes: 45 additions & 0 deletions lib/externs/json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2009 Google Inc.
*
* 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.
*/

/**
* @fileoverview Definitions for the JSON specification.
* @see http://www.json.org/json2.js.
* @externs
*/

// This cannot go into the COMMON externs because it conflicts with the pure
// JavaScript implementations of the API.

var JSON = {};

/**
* @param {string} jsonStr The string to parse.
* @param {(function(string, *) : *)=} opt_reviver
* @return {*} The JSON object.
* @throws {Error}
* @nosideeffects
*/
JSON.parse = function(jsonStr, opt_reviver) {};

/**
* @param {*} jsonObj Input object.
* @param {(Array.<string>|(function(string, *) : *)|null)=} opt_replacer
* @param {(number|string)=} opt_space
* @return {string} JSON string which represents jsonObj.
* @throws {Error}
* @nosideeffects
*/
JSON.stringify = function(jsonObj, opt_replacer, opt_space) {};
Loading