Add GYP build rule for Try Dart!

R=kasperl@google.com, kustermann@google.com

Review URL: https://codereview.chromium.org//133893008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31828 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ahe@google.com 2014-01-15 14:10:02 +00:00
parent ead87f47e9
commit 26e76d1be0
6 changed files with 150 additions and 9 deletions

View file

@ -184,5 +184,13 @@
'pkg/pkg.gyp:pkg_packages',
],
},
{
'target_name': 'try',
'type': 'none',
'dependencies': [
'create_sdk',
'site/try/build_try.gyp:try_site',
],
},
],
}

View file

@ -31,6 +31,8 @@ var handler;
RandomAccessFile output;
Uri outputUri;
Uri sdkRoot;
const bool outputJson =
const bool.fromEnvironment('outputJson', defaultValue: false);
main(List<String> arguments) {
handler = new FormattingDiagnosticHandler()
@ -77,7 +79,10 @@ jsonify(MirrorSystem mirrors) {
}
});
output.writeStringSync('''
if (outputJson) {
output.writeStringSync(JSON.encode(map));
} else {
output.writeStringSync('''
// Copyright (c) 2013, 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.
@ -88,7 +93,8 @@ jsonify(MirrorSystem mirrors) {
library dart.sdk_sources;
const Map<String, String> SDK_SOURCES = const <String, String>''');
output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$'));
output.writeStringSync(';\n');
output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$'));
output.writeStringSync(';\n');
}
output.closeSync();
}

View file

@ -5,11 +5,26 @@
# App Engine configuration, see:
# https://developers.google.com/appengine/docs/python/config/appconfig
# The version number should be something like rSVN_REVISION.
version: remember to edit app.yaml before deploying
# This version name is used to create a new host, for example,
# http://r31824.try-dart-lang.appspot.com/, which can be tested before going
# live at http://try.dartlang.org/. This is controlled from
# https://appengine.google.com/deployment?&app_id=s~try-dart-lang
application: try-dart-lang
version: 5-sdk1-0
runtime: python27
api_version: 1
threadsafe: yes
# Set "Cache-Control" and "Expires" HTTP headers to only cache for one second.
# We do this because we frequently push new changes and rely on AppCache for
# caching. Once files are installed in AppCache, the site launches
# immediately.
#
# Problem: PageSpeed Insights doesn't realize that we use AppCache and keeps
# nagging about caching.
# Solution: Ignore its advice about "Leverage browser caching".
default_expiration: 1s
handlers:
@ -34,12 +49,15 @@ handlers:
upload: (.*\.(html|js|png|css|dart|json))
secure: never
- url: /css/fonts/
static_dir: font
- url: /css/fonts/fontawesome-webfont.woff
static_files: fontawesome-webfont.woff
upload: fontawesome-webfont.woff
secure: never
error_handlers:
- file: static/not_found.html
- url: .*
static_files: not_found.html
upload: not_found.html
secure: never
libraries:
- name: webapp2

94
site/try/build_try.gyp Normal file
View file

@ -0,0 +1,94 @@
# 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
{
'targets': [
{
'target_name': 'try_site',
'type': 'none',
'dependencies': [
'../../runtime/dart-runtime.gyp:dart',
# Concern: there should really be a dependency on
# ../../dart.gyp:create_sdk, but this is reported as a cycle by GYP.
],
'actions': [
{
'action_name': 'sdk_json',
'message': 'Creating sdk.json',
'inputs': [
# Depending on this file ensures that the SDK is built before this
# action is executed.
'<(PRODUCT_DIR)/dart-sdk/README',
# This dependency is redundant for now, as this directory is
# implicitly part of the dependencies for dart-sdk/README.
'<!@(["python", "../../tools/list_files.py", "\\.dart$", '
'"../../sdk/lib/_internal/compiler/samples/jsonify"])',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/sdk.json',
],
'action': [
'<(PRODUCT_DIR)/dart-sdk/bin/'
'<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
'-Dlist_all_libraries=true',
'-DoutputJson=true',
'../../sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart',
'<(SHARED_INTERMEDIATE_DIR)/sdk.json',
],
},
{
'action_name': 'compile',
'message': 'Creating leap.dart.js',
'inputs': [
# Depending on this file ensures that the SDK is built before this
# action is executed.
'<(PRODUCT_DIR)/dart-sdk/README',
'leap.dart',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/leap.dart.js',
],
'action': [
'<(PRODUCT_DIR)/dart-sdk/bin/dart2js',
'-v',
'-Denable_ir=false',
'leap.dart',
'-o<(SHARED_INTERMEDIATE_DIR)/leap.dart.js',
],
},
],
'copies': [
{
# Destination directory.
'destination': '<(PRODUCT_DIR)/try_dartlang_org/',
# 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',
],
},
],
},
],
}

View file

@ -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 5-sdk1-0.3 <-- CHANGE THIS when you have a new version
# Version 7 <-- CHANGE THIS when you have a new version
CACHE:
index.html

15
site/try/not_found.html Normal file
View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<!--
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.
-->
<html lang="en">
<head>
<title>Missing Resource</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Missing Resource</h1>
</body>
</html>