diff --git a/pkgs/dartpad_ui/lib/samples.g.dart b/pkgs/dartpad_ui/lib/samples.g.dart index 2ba7d1fe2..72effebf0 100644 --- a/pkgs/dartpad_ui/lib/samples.g.dart +++ b/pkgs/dartpad_ui/lib/samples.g.dart @@ -1,6 +1,6 @@ -// Copyright 2023 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. +// Copyright (c) 2023, 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. // This file has been automatically generated - please do not edit it manually. @@ -68,10 +68,6 @@ const _fibonacci = Sample( name: 'Fibonacci', id: 'fibonacci', source: r''' -// Copyright 2015 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. - void main() { const i = 20; @@ -91,10 +87,6 @@ const _helloWorld = Sample( name: 'Hello world', id: 'hello-world', source: r''' -// Copyright 2015 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. - void main() { for (var i = 0; i < 10; i++) { print('hello ${i + 1}'); @@ -153,10 +145,6 @@ const _flameGame = Sample( name: 'Flame game', id: 'flame-game', source: r''' -// Copyright 2024 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. - /// A simplified brick-breaker game, /// built using the Flame game engine for Flutter. /// @@ -490,10 +478,6 @@ const _googleSdk = Sample( name: 'Google AI SDK', id: 'google-ai-sdk', source: r''' -// Copyright 2024 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. - import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:google_generative_ai/google_generative_ai.dart'; @@ -838,10 +822,6 @@ const _counter = Sample( name: 'Counter', id: 'counter', source: r''' -// Copyright 2019 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. - import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); @@ -920,10 +900,6 @@ const _sunflower = Sample( name: 'Sunflower', id: 'sunflower', source: r''' -// Copyright 2019 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. - import 'dart:math' as math; import 'package:flutter/material.dart'; diff --git a/pkgs/samples/lib/default_dart.dart b/pkgs/samples/lib/default_dart.dart index f9b01a21d..105fb48f5 100644 --- a/pkgs/samples/lib/default_dart.dart +++ b/pkgs/samples/lib/default_dart.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2024, 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. + void main() { for (var i = 0; i < 10; i++) { print('hello ${i + 1}'); diff --git a/pkgs/samples/lib/default_flutter.dart b/pkgs/samples/lib/default_flutter.dart index 155affed6..277190914 100644 --- a/pkgs/samples/lib/default_flutter.dart +++ b/pkgs/samples/lib/default_flutter.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2024, 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 'package:flutter/material.dart'; void main() { diff --git a/pkgs/samples/tool/samples.dart b/pkgs/samples/tool/samples.dart index 30c433a5b..5e2940100 100644 --- a/pkgs/samples/tool/samples.dart +++ b/pkgs/samples/tool/samples.dart @@ -1,6 +1,6 @@ -// Copyright 2023 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. +// Copyright (c) 2023, 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 'dart:convert'; import 'dart:io'; @@ -146,9 +146,9 @@ ${samples.map((s) => s.toTableRow()).join('\n')} String _generateSourceContent() { final buf = StringBuffer(''' -// Copyright 2023 the Dart project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file. +// Copyright (c) 2023, 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. // This file has been automatically generated - please do not edit it manually. @@ -243,7 +243,10 @@ class Sample implements Comparable { return '_$gen'; } - String get source => File(path).readAsStringSync(); + String get _rawSource => File(path).readAsStringSync(); + + String get source => + _rawSource.replaceFirst(_copyrightCommentPattern, '').trim(); String get sourceDef { return ''' @@ -253,7 +256,7 @@ const $sourceId = Sample( name: '$name', id: '$id', source: r\'\'\' -${source.trimRight()} +$source \'\'\', ); '''; @@ -276,4 +279,7 @@ ${source.trimRight()} static String _idFromName(String name) => name.trim().toLowerCase().replaceAll(' ', '-'); + + static final RegExp _copyrightCommentPattern = + RegExp(r'^\/\/ Copyright.*LICENSE file.', multiLine: true, dotAll: true); }