diff --git a/site/try/add_time_stamp.py b/site/try/add_time_stamp.py new file mode 100644 index 00000000000..adc0612beeb --- /dev/null +++ b/site/try/add_time_stamp.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +import datetime +import sys + +def Main(): + (_, input_file_name, output_file_name) = sys.argv + if not input_file_name or not output_file_name: + raise Exception('Missing argument') + + timestamp = str(datetime.datetime.now()) + + with open(input_file_name, 'r') as input_file: + with open(output_file_name, 'w') as output_file: + output_file.write(input_file.read().replace('@@TIMESTAMP@@', timestamp)) + + +if __name__ == '__main__': + sys.exit(Main()) diff --git a/site/try/build_try.gyp b/site/try/build_try.gyp index 09fec198720..c966ce1f754 100644 --- a/site/try/build_try.gyp +++ b/site/try/build_try.gyp @@ -12,6 +12,24 @@ # Concern: there should really be a dependency on # ../../dart.gyp:create_sdk, but this is reported as a cycle by GYP. ], + 'variables': { + 'try_dart_static_files': [ + 'index.html', + 'dartlang-style.css', + 'iframe.html', + 'iframe.js', + 'dart-icon.png', + 'dart-iphone5.png', + + '../../third_party/font-awesome/font-awesome-4.0.3/' + 'fonts/fontawesome-webfont.woff', + + '../../sdk/lib/_internal/dartdoc/static/favicon.ico', + + '<(SHARED_INTERMEDIATE_DIR)/leap.dart.js', + '<(SHARED_INTERMEDIATE_DIR)/sdk.json', + ], + }, 'actions': [ { 'action_name': 'sdk_json', @@ -62,6 +80,26 @@ '-o<(SHARED_INTERMEDIATE_DIR)/leap.dart.js', ], }, + { + 'action_name': 'nossl_appcache', + 'message': 'Creating nossl.appcache', + 'inputs': [ + 'add_time_stamp.py', + 'nossl.appcache', + '<@(try_dart_static_files)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/nossl.appcache', + ], + # Try Dart! uses AppCache. Cached files are only validated when the + # manifest changes (not its timestamp, but its actual contents). + 'action': [ + 'python', + 'add_time_stamp.py', + 'nossl.appcache', + '<(SHARED_INTERMEDIATE_DIR)/nossl.appcache', + ], + }, ], 'copies': [ { @@ -70,22 +108,8 @@ # List of files to be copied (creates implicit build dependencies). 'files': [ 'app.yaml', - - 'nossl.appcache', - 'index.html', - 'dartlang-style.css', - 'iframe.html', - 'iframe.js', - 'dart-icon.png', - 'dart-iphone5.png', - - '../../third_party/font-awesome/font-awesome-4.0.3/' - 'fonts/fontawesome-webfont.woff', - - '../../sdk/lib/_internal/dartdoc/static/favicon.ico', - - '<(SHARED_INTERMEDIATE_DIR)/leap.dart.js', - '<(SHARED_INTERMEDIATE_DIR)/sdk.json', + '<@(try_dart_static_files)', + '<(SHARED_INTERMEDIATE_DIR)/nossl.appcache', ], }, ], diff --git a/site/try/nossl.appcache b/site/try/nossl.appcache index d7de0a87917..d5218a3bf41 100644 --- a/site/try/nossl.appcache +++ b/site/try/nossl.appcache @@ -3,7 +3,7 @@ CACHE MANIFEST # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. -# Version 7.1 <-- CHANGE THIS when you have a new version +# @@TIMESTAMP@@ CACHE: index.html