mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 17:35:46 +00:00
Remove old samples.
Change-Id: I07773e6d9095c17f6ad4ed223d456838ddf122b5 Reviewed-on: https://dart-review.googlesource.com/64700 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Devon Carew <devoncarew@google.com>
This commit is contained in:
parent
e8ecb3bc08
commit
fcde5ca4c4
|
@ -1,30 +0,0 @@
|
|||
// Copyright (c) 2012, 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.
|
||||
|
||||
library test_build_dart;
|
||||
|
||||
import "dart:io";
|
||||
|
||||
/**
|
||||
* In order to generate test.foobar, make an edit to test.foo.
|
||||
*/
|
||||
void main() {
|
||||
printContents("test.foo");
|
||||
print("");
|
||||
printContents("test.foobar");
|
||||
}
|
||||
|
||||
void printContents(String file) {
|
||||
print("the contents of ${file} are:");
|
||||
|
||||
var f = new File(file);
|
||||
|
||||
if (f.existsSync()) {
|
||||
String contents = new File(file).readAsStringSync();
|
||||
|
||||
print("[${contents}]");
|
||||
} else {
|
||||
print("[]");
|
||||
}
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
// Copyright (c) 2012, 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.
|
||||
|
||||
library build_dart;
|
||||
|
||||
import "dart:io";
|
||||
import "package:args/args.dart";
|
||||
|
||||
bool cleanBuild;
|
||||
bool fullBuild;
|
||||
bool useMachineInterface;
|
||||
|
||||
List<String> changedFiles;
|
||||
List<String> removedFiles;
|
||||
|
||||
/**
|
||||
* If the file is named 'build.dart' and is placed in the root directory of a
|
||||
* project or in a directory containing a pubspec.yaml file, then the Editor
|
||||
* will automatically invoke that file whenever a file in that project changes.
|
||||
* See the source code of [processArgs] for information about the legal command
|
||||
* line options.
|
||||
*/
|
||||
void main(List<String> arguments) {
|
||||
processArgs(arguments);
|
||||
|
||||
if (cleanBuild) {
|
||||
handleCleanCommand();
|
||||
} else if (fullBuild) {
|
||||
handleFullBuild();
|
||||
} else {
|
||||
handleChangedFiles(changedFiles);
|
||||
handleRemovedFiles(removedFiles);
|
||||
}
|
||||
|
||||
// Return a non-zero code to indicate a build failure.
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle --changed, --removed, --clean, --full, and --help command-line args.
|
||||
*/
|
||||
void processArgs(List<String> arguments) {
|
||||
var parser = new ArgParser();
|
||||
parser.addOption("changed",
|
||||
help: "the file has changed since the last build", allowMultiple: true);
|
||||
parser.addOption("removed",
|
||||
help: "the file was removed since the last build", allowMultiple: true);
|
||||
parser.addFlag("clean", negatable: false, help: "remove any build artifacts");
|
||||
parser.addFlag("full", negatable: false, help: "perform a full build");
|
||||
parser.addFlag("machine",
|
||||
negatable: false, help: "produce warnings in a machine parseable format");
|
||||
parser.addFlag("help", negatable: false, help: "display this help and exit");
|
||||
|
||||
var args = parser.parse(arguments);
|
||||
|
||||
if (args["help"]) {
|
||||
print(parser.getUsage());
|
||||
exit(0);
|
||||
}
|
||||
|
||||
changedFiles = args["changed"];
|
||||
removedFiles = args["removed"];
|
||||
|
||||
useMachineInterface = args["machine"];
|
||||
|
||||
cleanBuild = args["clean"];
|
||||
fullBuild = args["full"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all generated files.
|
||||
*/
|
||||
void handleCleanCommand() {
|
||||
Directory current = Directory.current;
|
||||
current.list(recursive: true).listen((FileSystemEntity entity) {
|
||||
if (entity is File) _maybeClean(entity);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively scan the current directory looking for .foo files to process.
|
||||
*/
|
||||
void handleFullBuild() {
|
||||
var files = <String>[];
|
||||
|
||||
Directory.current.list(recursive: true).listen((entity) {
|
||||
if (entity is File) {
|
||||
files.add((entity as File).resolveSymbolicLinksSync());
|
||||
}
|
||||
}, onDone: () => handleChangedFiles(files));
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the given list of changed files.
|
||||
*/
|
||||
void handleChangedFiles(List<String> files) {
|
||||
files.forEach(_processFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the given list of removed files.
|
||||
*/
|
||||
void handleRemovedFiles(List<String> files) {}
|
||||
|
||||
/**
|
||||
* Convert a .foo file to a .foobar file.
|
||||
*/
|
||||
void _processFile(String arg) {
|
||||
if (arg.endsWith(".foo")) {
|
||||
print("processing: ${arg}");
|
||||
|
||||
File file = new File(arg);
|
||||
|
||||
String contents = file.readAsStringSync();
|
||||
|
||||
File outFile = new File("${arg}bar");
|
||||
|
||||
IOSink out = outFile.openWrite();
|
||||
out.writeln("// processed from ${file.path}:");
|
||||
if (contents != null) {
|
||||
out.write(contents);
|
||||
}
|
||||
out.close();
|
||||
|
||||
_findErrors(arg);
|
||||
|
||||
print("wrote: ${outFile.path}");
|
||||
}
|
||||
}
|
||||
|
||||
void _findErrors(String arg) {
|
||||
File file = new File(arg);
|
||||
|
||||
List lines = file.readAsLinesSync();
|
||||
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
if (lines[i].contains("woot") && !lines[i].startsWith("//")) {
|
||||
if (useMachineInterface) {
|
||||
// Ideally, we should emit the charStart and charEnd params as well.
|
||||
print('[{"method":"error","params":{"file":"$arg","line":${i+1},'
|
||||
'"message":"woot not supported"}}]');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If this file is a generated file (based on the extension), delete it.
|
||||
*/
|
||||
void _maybeClean(File file) {
|
||||
if (file.path.endsWith(".foobar")) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
name: buildhook2
|
||||
description: A demo of the buildhook build.dart script.
|
||||
dependencies:
|
||||
args: ">=0.9.0 <0.10.0"
|
||||
environment:
|
||||
sdk: ">=0.8.10+6 <2.0.0"
|
|
@ -1,4 +0,0 @@
|
|||
I'm from foo.
|
||||
I'm from foo.
|
||||
I'm from woot.
|
||||
//I'm from woot.
|
|
@ -1,14 +0,0 @@
|
|||
// 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.
|
||||
|
||||
library build_dart_test;
|
||||
|
||||
import '../build.dart' as build_dart;
|
||||
import '../bin/test.dart' as test2;
|
||||
|
||||
/**
|
||||
* This test exists to ensure that the build_dart sample compiles without
|
||||
* errors.
|
||||
*/
|
||||
void main() {}
|
|
@ -1,34 +0,0 @@
|
|||
// Copyright (c) 2012, 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.
|
||||
|
||||
library build_dart_simple;
|
||||
|
||||
import "dart:io";
|
||||
|
||||
/**
|
||||
* This minimal build script copies the contents of .foo files to .foobar files.
|
||||
* In order to be invoked automatically by the Editor, this script must be named
|
||||
* 'build.dart' and placed in the root of a project.
|
||||
*/
|
||||
void main(List<String> arguments) {
|
||||
for (String arg in arguments) {
|
||||
if (arg.startsWith("--changed=")) {
|
||||
String file = arg.substring("--changed=".length);
|
||||
|
||||
if (file.endsWith(".foo")) {
|
||||
_processFile(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _processFile(String file) {
|
||||
String contents = new File(file).readAsStringSync();
|
||||
|
||||
if (contents != null) {
|
||||
IOSink out = new File("${file}bar").openWrite();
|
||||
out.write("// processed from ${file}:\n${contents}");
|
||||
out.close();
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright (c) 2012, 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.
|
||||
|
||||
library test_build_dart_simple;
|
||||
|
||||
import "dart:io";
|
||||
|
||||
/**
|
||||
* In order to generate test.foobar, make an edit to test.foo.
|
||||
*/
|
||||
void main() {
|
||||
printContents("test.foo");
|
||||
print("");
|
||||
printContents("test.foobar");
|
||||
}
|
||||
|
||||
void printContents(String file) {
|
||||
print("the contents of ${file} are:");
|
||||
|
||||
var f = new File(file);
|
||||
|
||||
if (f.existsSync()) {
|
||||
String contents = new File(file).readAsStringSync();
|
||||
|
||||
print("[${contents}]");
|
||||
} else {
|
||||
print("[]");
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
I'm from foo.
|
|
@ -1,14 +0,0 @@
|
|||
// 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.
|
||||
|
||||
library build_dart_simple_test;
|
||||
|
||||
import '../build.dart' as build_dart_simple;
|
||||
import '../test.dart' as test1;
|
||||
|
||||
/**
|
||||
* This test exists to ensure that the build_dart_simple sample compiles
|
||||
* without errors.
|
||||
*/
|
||||
void main() {}
|
|
@ -11,9 +11,6 @@ sample_extension/test/sample_extension_app_snapshot_test: SkipByDesign # This te
|
|||
[ $compiler == app_jit ]
|
||||
sample_extension/test/sample_extension_app_snapshot_test: RuntimeError
|
||||
|
||||
[ $compiler == dart2analyzer ]
|
||||
build_dart: Skip
|
||||
|
||||
[ $compiler == precompiler ]
|
||||
sample_extension/test/*: Skip # These tests attempt to spawn another script using the precompiled runtime.
|
||||
|
||||
|
@ -36,8 +33,6 @@ sample_extension/test/sample_extension_test: RuntimeError
|
|||
|
||||
# Skip tests that use dart:io
|
||||
[ $runtime == d8 || $browser ]
|
||||
build_dart/*: Skip
|
||||
build_dart_simple/*: Skip
|
||||
sample_extension/*: Skip
|
||||
|
||||
[ $hot_reload || $hot_reload_rollback ]
|
||||
|
|
Loading…
Reference in a new issue