text
stringlengths
6
13.6M
id
stringlengths
13
176
metadata
dict
__index_level_0__
int64
0
1.69k
name: gen_web_keyboard_keymap description: Generates keyboard layouts for Web from external sources. environment: sdk: '>=3.2.0-0 <4.0.0' dependencies: args: any http: any path: any meta: any dependency_overrides: args: path: ../../../third_party/dart/third_party/pkg/args async: path: ../../../third_party/dart/third_party/pkg/async collection: path: ../../../third_party/dart/third_party/pkg/collection http: path: ../../../third_party/dart/third_party/pkg/http/pkgs/http http_parser: path: ../../../third_party/dart/third_party/pkg/http_parser meta: path: ../../../third_party/dart/pkg/meta path: path: ../../../third_party/dart/third_party/pkg/path source_span: path: ../../../third_party/dart/third_party/pkg/source_span string_scanner: path: ../../../third_party/dart/third_party/pkg/string_scanner term_glyph: path: ../../../third_party/dart/third_party/pkg/term_glyph typed_data: path: ../../../third_party/dart/third_party/pkg/typed_data web: path: ../../../third_party/dart/third_party/pkg/web
engine/tools/gen_web_locale_keymap/pubspec.yaml/0
{ "file_path": "engine/tools/gen_web_locale_keymap/pubspec.yaml", "repo_id": "engine", "token_count": 448 }
471
#!/bin/sh # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. YELLOW='' RED='' NC='' BOLD='' echo "${BOLD}${RED}Warning:${NC} ${BOLD}Pre-push checks are not enabled!${NC}" echo "${YELLOW}${BOLD}Note:${NC} ${BOLD}Please run 'gclient sync -D' to enable pre-push checks on Windows${NC}"
engine/tools/githooks/windows/pre-push/0
{ "file_path": "engine/tools/githooks/windows/pre-push", "repo_id": "engine", "token_count": 154 }
472
// Copyright 2013 The Flutter 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:io' as io; import 'package:meta/meta.dart'; import 'package:path/path.dart' as p; import 'package:source_span/source_span.dart'; /// Represents a C++ header file, i.e. a file on disk that ends in `.h`. @immutable final class HeaderFile { /// Creates a new header file from the given [path]. const HeaderFile.from( this.path, { required this.guard, required this.pragmaOnce, }); /// Parses the given [path] as a header file. /// /// Throws an [ArgumentError] if the file does not exist. factory HeaderFile.parse(String path) { final io.File file = io.File(path); if (!file.existsSync()) { throw ArgumentError.value(path, 'path', 'File does not exist.'); } final String contents = file.readAsStringSync(); final SourceFile sourceFile = SourceFile.fromString(contents, url: p.toUri(path)); return HeaderFile.from( path, guard: _parseGuard(sourceFile), pragmaOnce: _parsePragmaOnce(sourceFile), ); } static ({ int start, int end, String line, }) _getLine(SourceFile sourceFile, int index) { final int start = sourceFile.getOffset(index); int end = index == sourceFile.lines - 1 ? sourceFile.length : sourceFile.getOffset(index + 1) - 1; String line = sourceFile.getText(start, end); // On Windows, it's common for files to have CRLF line endings, and for // developers to use git's `core.autocrlf` setting to convert them to LF // line endings. // // However, our scripts expect LF line endings, so we need to remove the // CR characters from the line endings when computing the line so that // properly formatted files are not considered malformed. if (line.isNotEmpty && sourceFile.getText(end - 1, end) == '\r') { end--; line = line.substring(0, line.length - 1); } return ( start: start, end: end, line: line, ); } /// Parses the header guard of the given [sourceFile]. static HeaderGuardSpans? _parseGuard(SourceFile sourceFile) { SourceSpan? ifndefSpan; SourceSpan? defineSpan; SourceSpan? endifSpan; // Iterate over the lines in the file. for (int i = 0; i < sourceFile.lines; i++) { final (:int start, :int end, :String line) = _getLine(sourceFile, i); // Check if the line is a header guard directive. if (line.startsWith('#ifndef')) { ifndefSpan = sourceFile.span(start, end); } else if (line.startsWith('#define')) { // If we find a define preceding an ifndef, it is not a header guard. if (ifndefSpan == null) { continue; } defineSpan = sourceFile.span(start, end); break; } } // If we found no header guard, return null. if (ifndefSpan == null) { return null; } // Now iterate backwards to find the (last) #endif directive. for (int i = sourceFile.lines - 1; i > 0; i--) { final (:int start, :int end, :String line) = _getLine(sourceFile, i); // Check if the line is a header guard directive. if (line.startsWith('#endif')) { endifSpan = sourceFile.span(start, end); break; } } return HeaderGuardSpans( ifndefSpan: ifndefSpan, defineSpan: defineSpan, endifSpan: endifSpan, ); } /// Parses the `#pragma once` directive of the given [sourceFile]. static SourceSpan? _parsePragmaOnce(SourceFile sourceFile) { // Iterate over the lines in the file. for (int i = 0; i < sourceFile.lines; i++) { final (:int start, :int end, :String line) = _getLine(sourceFile, i); // Check if the line is a header guard directive. if (line.startsWith('#pragma once')) { return sourceFile.span(start, end); } } return null; } /// Path to the file on disk. final String path; /// The header guard span, if any. /// /// This is `null` if the file does not have a header guard. final HeaderGuardSpans? guard; /// The `#pragma once` directive, if any. /// /// This is `null` if the file does not have a `#pragma once` directive. final SourceSpan? pragmaOnce; static final RegExp _nonAlphaNumeric = RegExp(r'[^a-zA-Z0-9]'); /// Returns the expected header guard for this file, relative to [engineRoot]. /// /// For example, if the file is `foo/bar/baz.h`, this will return `FLUTTER_FOO_BAR_BAZ_H_`. String computeExpectedName({required String engineRoot}) { final String relativePath = p.relative(path, from: engineRoot); final String underscoredRelativePath = p.withoutExtension(relativePath).replaceAll(_nonAlphaNumeric, '_'); return 'FLUTTER_${underscoredRelativePath.toUpperCase()}_H_'; } /// Updates the file at [path] to have the expected header guard. /// /// Returns `true` if the file was modified, `false` otherwise. bool fix({required String engineRoot}) { final String expectedGuard = computeExpectedName(engineRoot: engineRoot); // Check if the file already has a valid header guard. if (guard != null) { if (guard!.ifndefValue == expectedGuard && guard!.defineValue == expectedGuard && guard!.endifValue == expectedGuard) { return false; } } // Get the contents of the file. final String oldContents = io.File(path).readAsStringSync(); // If we're using pragma once, replace it with an ifndef/define, and // append an endif and a newline at the end of the file. if (pragmaOnce != null) { // Append the endif and newline. String newContents = '$oldContents\n#endif // $expectedGuard\n'; // Replace the span with the ifndef/define. newContents = newContents.replaceRange( pragmaOnce!.start.offset, pragmaOnce!.end.offset, '#ifndef $expectedGuard\n' '#define $expectedGuard' ); // Write the new contents to the file. io.File(path).writeAsStringSync(newContents); return true; } // If we're not using pragma once, replace the header guard with the // expected header guard. if (guard != null) { // Replace endif: String newContents = oldContents.replaceRange( guard!.endifSpan!.start.offset, guard!.endifSpan!.end.offset, '#endif // $expectedGuard' ); // Replace define: newContents = newContents.replaceRange( guard!.defineSpan!.start.offset, guard!.defineSpan!.end.offset, '#define $expectedGuard' ); // Replace ifndef: newContents = newContents.replaceRange( guard!.ifndefSpan!.start.offset, guard!.ifndefSpan!.end.offset, '#ifndef $expectedGuard' ); // Write the new contents to the file. io.File(path).writeAsStringSync('$newContents\n'); return true; } // If we're missing a guard entirely, add one. The rules are: // 1. Add a newline, #endif at the end of the file. // 2. Add a newline, #ifndef, #define after the first non-comment line. String newContents = oldContents; newContents += '\n#endif // $expectedGuard\n'; newContents = newContents.replaceFirst( RegExp(r'^(?!//)', multiLine: true), '\n#ifndef $expectedGuard\n' '#define $expectedGuard\n' ); // Write the new contents to the file. io.File(path).writeAsStringSync(newContents); return true; } @override bool operator ==(Object other) { return other is HeaderFile && path == other.path && guard == other.guard && pragmaOnce == other.pragmaOnce; } @override int get hashCode => Object.hash(path, guard, pragmaOnce); @override String toString() { return 'HeaderFile(\n' ' path: $path\n' ' guard: $guard\n' ' pragmaOnce: $pragmaOnce\n' ')'; } } /// Source elements that are part of a header guard. @immutable final class HeaderGuardSpans { /// Collects the source spans of the header guard directives. const HeaderGuardSpans({ required this.ifndefSpan, required this.defineSpan, required this.endifSpan, }); /// Location of the `#ifndef` directive. final SourceSpan? ifndefSpan; /// Location of the `#define` directive. final SourceSpan? defineSpan; /// Location of the `#endif` directive. final SourceSpan? endifSpan; @override bool operator ==(Object other) { return other is HeaderGuardSpans && ifndefSpan == other.ifndefSpan && defineSpan == other.defineSpan && endifSpan == other.endifSpan; } @override int get hashCode => Object.hash(ifndefSpan, defineSpan, endifSpan); @override String toString() { return 'HeaderGuardSpans(\n' ' #ifndef: $ifndefSpan\n' ' #define: $defineSpan\n' ' #endif: $endifSpan\n' ')'; } /// Returns the value of the `#ifndef` directive. /// /// For example, `#ifndef FOO_H_`, this will return `FOO_H_`. /// /// If the span is not a valid `#ifndef` directive, `null` is returned. String? get ifndefValue { final String? value = ifndefSpan?.text; if (value == null) { return null; } if (!value.startsWith('#ifndef ')) { return null; } return value.substring('#ifndef '.length); } /// Returns the value of the `#define` directive. /// /// For example, `#define FOO_H_`, this will return `FOO_H_`. /// /// If the span is not a valid `#define` directive, `null` is returned. String? get defineValue { final String? value = defineSpan?.text; if (value == null) { return null; } if (!value.startsWith('#define ')) { return null; } return value.substring('#define '.length); } /// Returns the value of the `#endif` directive. /// /// For example, `#endif // FOO_H_`, this will return `FOO_H_`. /// /// If the span is not a valid `#endif` directive, `null` is returned. String? get endifValue { final String? value = endifSpan?.text; if (value == null) { return null; } if (!value.startsWith('#endif // ')) { return null; } return value.substring('#endif // '.length); } }
engine/tools/header_guard_check/lib/src/header_file.dart/0
{ "file_path": "engine/tools/header_guard_check/lib/src/header_file.dart", "repo_id": "engine", "token_count": 3940 }
473
Copyright (C) The Internet Society (2002). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
engine/tools/licenses/data/ietf/0
{ "file_path": "engine/tools/licenses/data/ietf", "repo_id": "engine", "token_count": 309 }
474
// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // ignore_for_file: use_raw_strings, prefer_interpolation_to_compose_strings import 'dart:core' hide RegExp; import 'regexp_debug.dart'; // COMMON PATTERNS // _findLicenseBlocks in licenses.dart cares about the two captures here // it also handles the first line being slightly different ("/*" vs " *" for example) const String kIndent = r'^((?:[-;@#<!.\\"/* ]*(?:REM[-;@#<!.\\"/* ]*)?[-;@#<!.\"/*]+)?)( *)'; final RegExp stripDecorations = RegExp( r'^((?:(?:[-;@#<!.\\"/* ]*(?:REM[-;@#<!.\\"/* ]*)?[-;@#<!.\"/*]+)?) *)(.*?)[ */]*$', multiLine: true, caseSensitive: false ); // _reformat patterns (see also irrelevantText below) final RegExp leadingDecorations = RegExp(r'^(?://|#|;|@|REM\b|/?\*|--| )'); final RegExp fullDecorations = RegExp(r'^ *[-=]{2,}$'); final RegExp trailingColon = RegExp(r':(?: |\*|/|\n|=|-)*$', expectNoMatch: true); final RegExp newlinePattern = RegExp(r'\r\n?'); final RegExp nonSpace = RegExp('[^ ]'); // Used to check if something that we expect to contain a copyright does contain a copyright. Should be very easy to match. final RegExp anySlightSignOfCopyrights = RegExp(r'©|copyright|\(c\)', caseSensitive: false); // Used to check if something that we don't expect to contain a copyright does contain a copyright. Should be harder to match. // The copyrightMentionOkPattern below is used to further exclude files that do match this. final RegExp copyrightMentionPattern = RegExp(r'©|copyright [0-9]|\(c\) [0-9]|copyright \(c\)', caseSensitive: false); // Used to check if something that we don't expect to contain a license does contain a license. final RegExp licenseMentionPattern = RegExp(r'Permission is hereby granted|warrant[iy]|derivative works|redistribution|copyleft', caseSensitive: false, expectNoMatch: true); // Used to allow-list files that match copyrightMentionPattern due to false positives. // Files that match this will not be caught if they add new otherwise unmatched licenses! final RegExp copyrightMentionOkPattern = RegExp( // if a (multiline) block matches this, we ignore it even if it matches copyrightMentionPattern/licenseMentionPattern r'(?:These are covered by the following copyright:' r'|\$YEAR' // clearly part of a template string r'|LICENSE BLOCK' // MPL license block header/footer r'|2117.+COPYRIGHT' // probably U+2117 mention... r'|// The copyright below was added in 2009, but I see no record' r'|This ICU code derived from:' r'|the contents of which are also included in zip.h' // seen in minizip's unzip.c, but the upshot of the crazy license situation there is that we don't have to do anything r'|" inflate 1\.2\.1\d Copyright 1995-2022 Mark Adler ";' r'|" deflate 1\.2\.1\d Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";' r'|const char zip_copyright\[\] =" zip 1\.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";' r'|#define JCOPYRIGHT_SHORT "Copyright \(C\) 1991-2016 The libjpeg-turbo Project and many others"' r"|r'[^']*©[^']*'" // e.g. flutter/third_party/web_locale_keymap/lib/web_locale_keymap/key_mappings.g.dart // the following are all bits from ICU source files // (you'd think ICU would be more consistent with its copyrights given how much // source code there is in ICU just for generating copyrights) r'|VALUE "LegalCopyright"' r'|const char inflate_copyright\[\] =\n *" inflate 1\.2\.11 Copyright 1995-2017 Mark Adler ";' // found in some freetype files r'|" Copyright \(C\) 2016 and later: Unicode, Inc\. and others\. License & terms of use: http://www\.unicode\.org/copyright\.html "' r'|"\* / \\\\& ⁊ # % † ‡ ‧ ° © ® ™]"' r'|" \* Copyright \(C\) International Business Machines\n"' r'|fprintf\(out, "// Copyright \(C\) 2016 and later: Unicode, Inc\. and others\.\\n"\);' r'|fprintf\(out, "// License & terms of use: http://www\.unicode\.org/copyright\.html\\n\\n"\);' r'|fprintf\(out, "/\*\* Copyright \(C\) 2007-2016, International Business Machines Corporation and Others\. All Rights Reserved\. \*\*/\\n\\n"\);' r'|\\\(C\\\) ↔ ©;' r'|" \* Copyright \(C\) International Business Machines\\n"' r'|"%s Copyright \(C\) %d and later: Unicode, Inc\. and others\.\\n"' r'|"%s License & terms of use: http://www\.unicode\.org/copyright\.html\\n",' r'|"%s Copyright \(C\) 1999-2016, International Business Machines\\n"' r'|"%s Corporation and others\. All Rights Reserved\.\\n",' r'|\\mainpage' // q.v. third_party/vulkan_memory_allocator/include/vk_mem_alloc.h r'|" \* Copyright 2017 Google Inc\.\\n"' r')', caseSensitive: false, multiLine: true); // Used to extact the "authors" pattern for copyrights that use that (like Flutter's). final RegExp authorPattern = RegExp(r'Copyright .+(The .+ Authors)\. +All rights reserved\.', caseSensitive: false); // Lines that are found at the top of license files but aren't strictly part of the license. final RegExp licenseHeaders = RegExp( r'.+ Library\n|' // e.g. "xxHash Library" r'.*(BSD|MIT|SGI).* (?:License|LICENSE)(?: [A-Z])?(?: \(.+\))?:? *\n|' // e.g. "BSD 3-Clause License", "The MIT License (MIT):", "SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)"; NOT "Apache License" (that _is_ part of the license) r'All MurmurHash source files are placed in the public domain\.\n|' r'The license below applies to all other code in SMHasher:\n|' r'amalgamate.py - Amalgamate C source and header files\n|' r'\n', ); // copyright blocks start with the first line matching this // (used by _findLicenseBlocks) final List<RegExp> copyrightStatementLeadingPatterns = <RegExp>[ RegExp(r'^ *(?:Portions(?: created by the Initial Developer)?(?: are)? )?Copyright.+$', caseSensitive: false), RegExp(r'^.*(?:All )?rights? reserved\.$', caseSensitive: false), RegExp(r'^.*© [0-9]{4} .+$'), ]; // patterns used by _splitLicense to extend the copyright block final RegExp halfCopyrightPattern = RegExp(r'^(?: *(?:Copyright(?: \(c\))? [-0-9, ]+(?: by)?|Written [0-9]+)[ */]*)$', caseSensitive: false); final RegExp trailingComma = RegExp(r',[ */]*$'); // copyright blocks end with the last line that matches this, rest is considered license // (used by _splitLicense) final List<RegExp> copyrightStatementPatterns = <RegExp>[ ...copyrightStatementLeadingPatterns, RegExp(r'^(?:Google )?Author\(?s?\)?: .+', caseSensitive: false), RegExp(r'^Written by .+', caseSensitive: false), RegExp(r'^Originally written by .+', caseSensitive: false), RegExp(r"^based on (?:code in )?['`][^'`]+['`]$", caseSensitive: false), RegExp(r'^Based on .+, written by .+, [0-9]+\.$', caseSensitive: false), RegExp(r'^(?:Based on the )?x86 SIMD extension for IJG JPEG library(?: - version [0-9.]+|,)?$'), RegExp(r'^Derived from [a-z._/]+$'), RegExp(r'^ *This is part of .+, a .+ library\.$'), RegExp(r'^(?:Modification )?[Dd]eveloped [-0-9]+ by .+\.$', caseSensitive: false), RegExp(r'^Modified .+[:.]$', caseSensitive: false), RegExp(r'^(?:[^ ]+ )?Modifications:$', caseSensitive: false), RegExp(r'^ *Modifications for', caseSensitive: false), RegExp(r'^ *Modifications of', caseSensitive: false), RegExp(r'^Modifications Copyright \(C\) .+', caseSensitive: false), RegExp(r'^\(Royal Institute of Technology, Stockholm, Sweden\)\.$'), RegExp(r'^FT_Raccess_Get_HeaderInfo\(\) and raccess_guess_darwin_hfsplus\(\) are$'), RegExp(r'^derived from ftobjs\.c\.$'), // RegExp(r'^ *Condition of use and distribution are the same than zlib :$'), RegExp(r'^Unicode and the Unicode Logo are registered trademarks of Unicode, Inc\. in the U.S. and other countries\.$'), RegExp(r'^$'), ]; // patterns that indicate we're running into another license final List<RegExp> licenseFragments = <RegExp>[ RegExp(r'SUCH DAMAGE\.'), RegExp(r'found in the LICENSE file'), RegExp(r'This notice may not be removed'), RegExp(r'SPDX-License-Identifier'), RegExp(r'terms of use'), RegExp(r'implied warranty'), RegExp(r'^ *For more info read ([^ ]+)$'), ]; const String _linebreak = r' *(?:(?:\*/ *|[*#])?(?:\n\1 *(?:\*/ *)?)*\n\1\2 *)?'; const String _linebreakLoose = r' *(?:(?:\*/ *|[*#])?\r?\n(?:-|;|#|<|!|/|\*| |REM)*)*'; // LICENSE RECOGNIZERS final RegExp lrLLVM = RegExp(r'--- LLVM Exceptions to the Apache 2\.0 License ----$', multiLine: true); final RegExp lrApache = RegExp(r'^(?: |\n)*Apache License\b'); final RegExp lrMPL = RegExp(r'^(?: |\n)*Mozilla Public License Version 2\.0\n'); final RegExp lrGPL = RegExp(r'^(?: |\n)*GNU GENERAL PUBLIC LICENSE\n'); final RegExp lrAPSL = RegExp(r'^APPLE PUBLIC SOURCE LICENSE Version 2\.0 +- +August 6, 2003', expectNoMatch: true); final RegExp lrMIT = RegExp(r'Permission(?: |\n)+is(?: |\n)+hereby(?: |\n)+granted,(?: |\n)+free(?: |\n)+of(?: |\n)+charge,(?: |\n)+to(?: |\n)+any(?: |\n)+person(?: |\n)+obtaining(?: |\n)+a(?: |\n)+copy(?: |\n)+of(?: |\n)+this(?: |\n)+software(?: |\n)+and(?: |\n)+associated(?: |\n)+documentation(?: |\n)+files(?: |\n)+\(the(?: |\n)+"Software"\),(?: |\n)+to(?: |\n)+deal(?: |\n)+in(?: |\n)+the(?: |\n)+Software(?: |\n)+without(?: |\n)+restriction,(?: |\n)+including(?: |\n)+without(?: |\n)+limitation(?: |\n)+the(?: |\n)+rights(?: |\n)+to(?: |\n)+use,(?: |\n)+copy,(?: |\n)+modify,(?: |\n)+merge,(?: |\n)+publish,(?: |\n)+distribute,(?: |\n)+sublicense,(?: |\n)+and/or(?: |\n)+sell(?: |\n)+copies(?: |\n)+of(?: |\n)+the(?: |\n)+Software,(?: |\n)+and(?: |\n)+to(?: |\n)+permit(?: |\n)+persons(?: |\n)+to(?: |\n)+whom(?: |\n)+the(?: |\n)+Software(?: |\n)+is(?: |\n)+furnished(?: |\n)+to(?: |\n)+do(?: |\n)+so,(?: |\n)+subject(?: |\n)+to(?: |\n)+the(?: |\n)+following(?: |\n)+conditions:'); final RegExp lrOpenSSL = RegExp(r'OpenSSL.+dual license', expectNoMatch: true); final RegExp lrBSD = RegExp(r'Redistribution(?: |\n)+and(?: |\n)+use(?: |\n)+in(?: |\n)+source(?: |\n)+and(?: |\n)+binary(?: |\n)+forms(?:(?: |\n)+of(?: |\n)+the(?: |\n)+software(?: |\n)+as(?: |\n)+well(?: |\n)+as(?: |\n)+documentation)?,(?: |\n)+with(?: |\n)+or(?: |\n)+without(?: |\n)+modification,(?: |\n)+are(?: |\n)+permitted(?: |\n)+provided(?: |\n)+that(?: |\n)+the(?: |\n)+following(?: |\n)+conditions(?: |\n)+are(?: |\n)+met:'); final RegExp lrPNG = RegExp(r'This code is released under the libpng license\.|PNG Reference Library License'); final RegExp lrBison = RegExp(r'This special exception was added by the Free Software Foundation in *\n *version 2.2 of Bison.'); // Matching this exactly is important since it's likely there will be similar // licenses with more requirements. final RegExp lrZlib = RegExp( r"This software is provided 'as-is', without any express or implied\n" r'warranty\. +In no event will the authors be held liable for any damages\n' r'arising from the use of this software\.\n' r'\n' r'Permission is granted to anyone to use this software for any purpose,\n' r'including commercial applications, and to alter it and redistribute it\n' r'freely, subject to the following restrictions:\n' r'\n' r'1\. The origin of this software must not be misrepresented; you must not\n' r' claim that you wrote the original software\. If you use this software\n' r' in a product, an acknowledgment in the product documentation would(?: be)?\n' r' (?:be )?appreciated but is not required\.\n' r'2\. Altered source versions must be plainly marked as such, and must not(?: be)?\n' r' (?: be)?misrepresented as being the original software\.\n' r'3\. This notice may not be removed or altered from any source(?: |\n )distribution\.' r'$' // no more terms! ); // ASCII ART PATTERNS // If these images are found in a file, they are stripped before we look for license patterns. final List<List<String>> asciiArtImages = <String>[ r''' ___ _ |_ _|_ __ (_) __ _ | || '_ \ | |/ _` | | || | | || | (_| | |___|_| |_|/ |\__,_| |__/''', ].map((String image) => image.split('\n')).toList(); // FORWARD REFERENCE class ForwardReferencePattern { ForwardReferencePattern({ required this.firstPrefixIndex, required this.indentPrefixIndex, required this.pattern, required this.targetPattern }); final int firstPrefixIndex; final int indentPrefixIndex; final RegExp pattern; final RegExp targetPattern; } final List<ForwardReferencePattern> csForwardReferenceLicenses = <ForwardReferencePattern>[ // used with _tryForwardReferencePattern // OpenSSL ForwardReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, pattern: RegExp( kIndent + r'(?:' + ( r'Portions of the attached software \("Contribution"\) are developed by .+ and are contributed to the OpenSSL project\.' .replaceAll(' ', _linebreak) ) + r'|' + ( r'The .+ included herein is developed by .+, and is contributed to the OpenSSL project\.' .replaceAll(' ', _linebreak) ) + r'|' r'(?:\1? *\n)+' r')*' r'\1\2 *' + ( r'The .+ is licensed pursuant to the OpenSSL open source license provided (?:below|above)\.' .replaceAll(' ', _linebreak) ), multiLine: true, caseSensitive: false, ), targetPattern: RegExp('Redistribution and use in source and binary forms(?:.|\n)+OpenSSL') ), ForwardReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, pattern: RegExp(kIndent + r'This code is released under the libpng license\. \(See LICENSE, below\.\)', multiLine: true), targetPattern: RegExp('PNG Reference Library License'), ), ]; // REFERENCES TO OTHER FILES class LicenseFileReferencePattern { LicenseFileReferencePattern({ required this.firstPrefixIndex, required this.indentPrefixIndex, this.copyrightIndex, this.authorIndex, required this.fileIndex, required this.pattern, this.needsCopyright = true }); final int firstPrefixIndex; final int indentPrefixIndex; final int? copyrightIndex; final int? authorIndex; final int fileIndex; final bool needsCopyright; final RegExp pattern; @override String toString() { return '$pattern ($firstPrefixIndex $indentPrefixIndex c=$copyrightIndex (needs? $needsCopyright) a=$authorIndex, f=$fileIndex'; } } final List<LicenseFileReferencePattern> csReferencesByFilename = <LicenseFileReferencePattern>[ // used with _tryReferenceByFilename // libpng files LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r'This code is released under the libpng license. For conditions of distribution and use, see the disclaimer and license in (png.h)\b'.replaceAll(' ', _linebreak), multiLine: true, caseSensitive: false ), ), // zlib files LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r'(?:detect_data_type\(\) function provided freely by Cosmin Truta, 2006 )?' r'For conditions of distribution and use, see copyright notice in (zlib.h|jsimdext.inc)\b'.replaceAll(' ', _linebreak), multiLine: true, ), ), // typical of much Google-written code LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r'Use of this source(?: code)? is governed by a BS?D-style license that can be found in the '.replaceAll(' ', _linebreak) + r'([^ ]+) file\b(?! or at)', multiLine: true, caseSensitive: false, ) ), // Chromium's zlib extensions. LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, copyrightIndex: 3, authorIndex: 4, fileIndex: 5, pattern: RegExp( kIndent + // The " \* " is needed to ensure that both copyright lines start with // the comment decoration in the captured match, otherwise it won't be // stripped from the second line when generating output. r'((?: \* Copyright \(C\) 2017 ARM, Inc.\n)?' r'Copyright .+(The .+ Authors)(?:\. +All rights reserved\.)?)\n' r'Use of this source code is governed by a BSD-style license that can be\n' r'found in the Chromium source repository ([^ ]+) file.'.replaceAll(r'\n', _linebreakLoose), multiLine: true, caseSensitive: false, ) ), // Mojo code LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, copyrightIndex: 3, authorIndex: 4, fileIndex: 5, pattern: RegExp( kIndent + r'(Copyright .+(the .+ authors)\. +All rights reserved.) +' + r'Use of this source(?: code)? is governed by a BS?D-style license that can be found in the '.replaceAll(' ', _linebreak) + r'([^ ]+) file\b(?! or at)', multiLine: true, caseSensitive: false, ) ), // ANGLE .json files LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, copyrightIndex: 3, authorIndex: 4, fileIndex: 5, pattern: RegExp( kIndent + r'(Copyright .+(The .+ Authors)\. +All rights reserved.)", *\n' r'^\1\2Use of this source code is governed by a BSD-style license that can be", *\n' r'^\1\2found in the ([^ ]+) file.",', multiLine: true, caseSensitive: false, ) ), // typical of Dart-derived files LicenseFileReferencePattern( firstPrefixIndex: 2, indentPrefixIndex: 3, copyrightIndex: 1, authorIndex: 4, fileIndex: 5, pattern: RegExp( r'(' + kIndent + r'Copyright .+(the .+ authors)\[?\. ' r'Please see the AUTHORS file for details. All rights (?:re|solve)served\.) ' r'Use of this source(?: code)? is governed by a BS?D-style license ' r'that can be found in the '.replaceAll(' ', _linebreakLoose) + r'([^ ]+) file\b(?! or at)', multiLine: true, caseSensitive: false, ) ), // Seen in libjpeg-turbo LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r"(?:This file is part of the Independent JPEG Group's software.)? " r'(?:It was modified by The libjpeg-turbo Project to include only code (?:and information)? relevant to libjpeg-turbo\.)? ' r'For conditions of distribution and use, see the accompanying ' r'(README.ijg)'.replaceAll(' ', _linebreakLoose), multiLine: true, caseSensitive: false, ), ), // Seen in FreeType software LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r'This file (?:is part of the FreeType project, and )?may only be used,? ' r'modified,? and distributed under the terms of the FreeType project ' r'license, (LICENSE\.TXT). By continuing to use, modify, or distribute this ' r'file you indicate that you have read the license and understand and ' r'accept it fully\.'.replaceAll(' ', _linebreak), multiLine: true, caseSensitive: false, ) ), // Seen in FreeType cff software from Adobe LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r'This software, and all works of authorship, whether in source or ' r'object code form as indicated by the copyright notice\(s\) included ' r'herein \(collectively, the "Work"\) is made available, and may only be ' r'used, modified, and distributed under the FreeType Project License, ' r'(LICENSE\.TXT)\. Additionally, subject to the terms and conditions of the ' r'FreeType Project License, each contributor to the Work hereby grants ' r'to any individual or legal entity exercising permissions granted by ' r'the FreeType Project License and this section \(hereafter, "You" or ' r'"Your"\) a perpetual, worldwide, non-exclusive, no-charge, ' r'royalty-free, irrevocable \(except as stated in this section\) patent ' r'license to make, have made, use, offer to sell, sell, import, and ' r'otherwise transfer the Work, where such license applies only to those ' r'patent claims licensable by such contributor that are necessarily ' r'infringed by their contribution\(s\) alone or by combination of their ' r'contribution\(s\) with the Work to which such contribution\(s\) was ' r'submitted\. If You institute patent litigation against any entity ' r'\(including a cross-claim or counterclaim in a lawsuit\) alleging that ' r'the Work or a contribution incorporated within the Work constitutes ' r'direct or contributory patent infringement, then any patent licenses ' r'granted to You under this License for that Work shall terminate as of ' r'the date such litigation is filed\. ' r'By using, modifying, or distributing the Work you indicate that you ' r'have read and understood the terms and conditions of the ' r'FreeType Project License as well as those provided in this section, ' r'and you accept them fully\.'.replaceAll(' ', _linebreak), multiLine: true, ) ), // BoringSSL LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r'Licensed under the OpenSSL license \(the "License"\)\. You may not use ' r'this file except in compliance with the License\. You can obtain a copy ' r'in the file (LICENSE) in the source distribution or at ' r'https://www\.openssl\.org/source/license\.html' .replaceAll(' ', _linebreak), multiLine: true, ) ), // Seen in Microsoft files LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r'Licensed under the MIT License\. ' r'See (License\.txt) in the project root for license information\.' .replaceAll(' ', _linebreak), multiLine: true, caseSensitive: false, ) ), // Seen in React Native files LicenseFileReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, fileIndex: 3, pattern: RegExp( kIndent + r'This source code is licensed under the MIT license found in the ' r'(LICENSE) file in the root directory of this source tree.' .replaceAll(' ', _linebreak), multiLine: true, ) ), ]; // INDIRECT REFERENCES TO OTHER FILES final List<RegExp> csReferencesByType = <RegExp>[ // used with _tryReferenceByType // groups 1 and 2 are the prefix, group 3 is the license type RegExp( kIndent + r'Written by Andy Polyakov <appro@openssl\.org> for the OpenSSL ' r'project\. The module is, however, dual licensed under (OpenSSL) and ' r'CRYPTOGAMS licenses depending on where you obtain it\. For further ' r'details see http://www\.openssl\.org/~appro/cryptogams/\. ' r'Permission to use under GPL terms is granted\.'.replaceAll(' ', _linebreak), multiLine: true, ), // MPL // fallback_root_certificates RegExp( r'/\* This Source Code Form is subject to the terms of the Mozilla Public *\n' r'^( \*)( )License, v\. 2\.0\. +If a copy of the MPL was not distributed with this *\n' r'^\1\2file, You can obtain one at (http://mozilla\.org/MPL/2\.0/)\.', multiLine: true, ), // JSON (MIT) RegExp( kIndent + r'The code is distributed under the (MIT) license, Copyright (.+)\.$', multiLine: true, ), // BoringSSL RegExp( kIndent + r'Rights for redistribution and usage in source and binary forms are ' r'granted according to the (OpenSSL) license\. Warranty of any kind is ' r'disclaimed\.' .replaceAll(' ', _linebreak), multiLine: true, ), RegExp( kIndent + ( r'The portions of the attached software \("Contribution"\) is developed by ' r'Nokia Corporation and is licensed pursuant to the (OpenSSL) open source ' r'license\. ' r'\n ' r'The Contribution, originally written by Mika Kousa and Pasi Eronen of ' r'Nokia Corporation, consists of the "PSK" \(Pre-Shared Key\) ciphersuites ' r'support \(see RFC 4279\) to OpenSSL\. ' r'\n ' r'No patent licenses or other rights except those expressly stated in ' r'the OpenSSL open source license shall be deemed granted or received ' r'expressly, by implication, estoppel, or otherwise\. ' r'\n ' r'No assurances are provided by Nokia that the Contribution does not ' r'infringe the patent or other intellectual property rights of any third ' r'party or that the license provides you with all the necessary rights ' r'to make use of the Contribution\. ' r'\n ' r'THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND\. IN ' r'ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA ' r'SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY ' r'OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR ' r'OTHERWISE\.' .replaceAll(' ', _linebreak) ), multiLine: true, ), // TODO(ianh): Confirm this is the right way to handle this. RegExp( kIndent + r'.+ support in OpenSSL originally developed by ' r'SUN MICROSYSTEMS, INC\., and contributed to the (OpenSSL) project\.' .replaceAll(' ', _linebreak), multiLine: true, ), RegExp( kIndent + r'This software is made available under the terms of the (ICU) License -- ICU 1\.8\.1 and later\.' .replaceAll(' ', _linebreak), multiLine: true, ), ]; class LicenseReferencePattern { LicenseReferencePattern({ this.firstPrefixIndex = 1, this.indentPrefixIndex = 2, this.licenseIndex = 3, this.checkLocalFirst = true, this.spdx = false, // indicates whether this is a reference via the SPDX syntax rather than a statement in English required this.pattern, }); final int? firstPrefixIndex; final int? indentPrefixIndex; final int? licenseIndex; final bool checkLocalFirst; final bool spdx; final RegExp? pattern; } final List<LicenseReferencePattern> csReferencesByIdentifyingReference = <LicenseReferencePattern>[ // used with _tryReferenceByIdentifyingReference LicenseReferencePattern( pattern: RegExp( kIndent + r'For terms of use, see ([^ \n]+)', multiLine: true, ) ), LicenseReferencePattern( pattern: RegExp( kIndent + r'License & terms of use: ([^ \n]+)', multiLine: true, ) ), LicenseReferencePattern( pattern: RegExp( kIndent + r'For more info read (MiniZip_info.txt)', multiLine: true, ) ), // SPDX LicenseReferencePattern( checkLocalFirst: false, spdx: true, // indicates that this is a reference via the SPDX syntax rather than a statement in English pattern: RegExp( kIndent + r'SPDX-License-Identifier: (.+)', multiLine: true, ) ), // Apache reference. // Seen in Android code. // TODO(ianh): For this license we only need to include the text once, not once per copyright // TODO(ianh): For this license we must also include all the NOTICE text (see section 4d) LicenseReferencePattern( checkLocalFirst: false, pattern: RegExp( kIndent + r'Licensed under the Apache License, Version 2\.0 \(the "License"\); *\n' r'^\1\2you may not use this file except in compliance with the License\. *\n' r'^(?:\1\2Copyright \(c\) 2015-2017 Valve Corporation\n)?' // https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/4930 r'^\1\2You may obtain a copy of the License at *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2 *(https?://www\.apache\.org/licenses/LICENSE-2\.0) *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2 *Unless required by applicable law or agreed to in writing, software *\n' r'^\1\2 *distributed under the License is distributed on an "AS IS" BASIS, *\n' r'^\1\2 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\. *\n' r'^\1\2 *See the License for the specific language governing permissions and *\n' r'^\1\2 *limitations under the License\.', multiLine: true, caseSensitive: false, ) ), // MIT // LicenseReferencePattern( // checkLocalFirst: false, // pattern: RegExp( // kIndent + // ( // r'Use of this source code is governed by a MIT-style ' // r'license that can be found in the LICENSE file or at ' // r'(https://opensource.org/licenses/MIT)' // .replaceAll(' ', _linebreak) // ), // multiLine: true, // caseSensitive: false, // ) // ), // MIT // the crazy s/./->/ thing is someone being over-eager with search-and-replace in rapidjson LicenseReferencePattern( checkLocalFirst: false, pattern: RegExp( kIndent + r'Licensed under the MIT License \(the "License"\); you may not use this file except *\n' r'^\1\2in compliance with the License(?:\.|->) You may obtain a copy of the License at *\n' r'^\1\n' r'^\1\2(http://opensource(?:\.|->)org/licenses/MIT) *\n' r'^\1\n' r'^\1\2Unless required by applicable law or agreed to in writing, software distributed *\n' r'^\1\2under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR *\n' r'^\1\2CONDITIONS OF ANY KIND, either express or implied(?:\.|->) See the License for the *\n' r'^\1\2specific language governing permissions and limitations under the License(?:\.|->)', multiLine: true, caseSensitive: false, ) ), // Observatory (polymer) LicenseReferencePattern( checkLocalFirst: false, pattern: RegExp( kIndent + r'This code may only be used under the BSD style license found at (http://polymer.github.io/LICENSE.txt)$', multiLine: true, caseSensitive: false, ) ), // LLVM (Apache License v2.0 with LLVM Exceptions) LicenseReferencePattern( checkLocalFirst: false, pattern: RegExp( kIndent + ( r'Part of the LLVM Project, under the Apache License v2\.0 with LLVM Exceptions\. ' r'See (https://llvm\.org/LICENSE\.txt) for license information\.' .replaceAll(' ', _linebreak) ), multiLine: true, ) ), // Seen in RFC-derived files in ICU LicenseReferencePattern( checkLocalFirst: false, pattern: RegExp( kIndent + r'This file was generated from RFC 3454 \((http://www.ietf.org/rfc/rfc3454.txt)\) ' r'Copyright \(C\) The Internet Society \(2002\)\. All Rights Reserved\.' .replaceAll(' ', _linebreak), multiLine: true, ), ), ]; // INLINE LICENSES final List<RegExp> csTemplateLicenses = <RegExp>[ // used with _tryInline, with needsCopyright: true (will only match if preceded by a copyright notice) // should have two groups, prefixes 1 and 2 // BoringSSL RegExp( kIndent + r'Redistribution and use in source and binary forms, with or without *\n' r'^\1\2modification, are permitted provided that the following conditions *\n' r'^\1\2are met: *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2(?:[-*1-9.)/ ]+)Redistributions of source code must retain the above copyright *\n' r'^\1\2 *notice, this list of conditions and the following disclaimer\. *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2(?:[-*1-9.)/ ]+)Redistributions in binary form must reproduce the above copyright *\n' r'^\1\2 *notice, this list of conditions and the following disclaimer in *\n' r'^\1\2 *the documentation and/or other materials provided with the *\n' r'^\1\2 *distribution\. *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2(?:[-*1-9.)/ ]+)All advertising materials mentioning features or use of this *\n' r'^\1\2 *software must display the following acknowledgment: *\n' r'^\1\2 *"This product includes software developed by the OpenSSL Project *\n' r'^\1\2 *for use in the OpenSSL Toolkit\. \(http://www\.OpenSSL\.org/\)" *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2(?:[-*1-9.)/ ]+)The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to *\n' r'^\1\2 *endorse or promote products derived from this software without *\n' r'^\1\2 *prior written permission\. +For written permission, please contact *\n' r'^\1\2 *[^@ ]+@OpenSSL\.org\. *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2(?:[-*1-9.)/ ]+)Products derived from this software may not be called "OpenSSL" *\n' r'^\1\2 *nor may "OpenSSL" appear in their names without prior written *\n' r'^\1\2 *permission of the OpenSSL Project\. *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2(?:[-*1-9.)/ ]+)Redistributions of any form whatsoever must retain the following *\n' r'^\1\2 *acknowledgment: *\n' r'^\1\2 *"This product includes software developed by the OpenSSL Project *\n' r'^\1\2 *for use in the OpenSSL Toolkit \(http://www\.OpenSSL\.org/\)" *\n' r'^(?:(?:\1\2? *)? *\n)*' r"^\1\2THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY *\n" r'^\1\2EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *\n' r'^\1\2IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR *\n' r'^\1\2PURPOSE ARE DISCLAIMED\. +IN NO EVENT SHALL THE OpenSSL PROJECT OR *\n' r'^\1\2ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *\n' r'^\1\2SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \(INCLUDING, BUT *\n' r'^\1\2NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *\n' r'^\1\2LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION\) *\n' r'^\1\2HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, *\n' r'^\1\2STRICT LIABILITY, OR TORT \(INCLUDING NEGLIGENCE OR OTHERWISE\) *\n' r'^\1\2ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED *\n' r'^\1\2OF THE POSSIBILITY OF SUCH DAMAGE\.', multiLine: true, caseSensitive: false, ), RegExp( kIndent + r'(?:This package is an SSL implementation written *\n' r'^\1\2by Eric Young \(eay@cryptsoft\.com\)\. *\n' r'^\1\2The implementation was written so as to conform with Netscapes SSL\. *\n' r'^(?:(?:\1\2?g? *)? *\n)*' r'^\1\2This library is free for commercial and non-commercial use as long as *\n' r'^\1\2the following conditions are aheared to\. +The following conditions *\n' r'^\1\2apply to all code found in this distribution, be it the RC4, RSA, *\n' r'^\1\2lhash, DES, etc\., code; not just the SSL code\. +The SSL documentation *\n' r'^\1\2included with this distribution is covered by the same copyright terms *\n' r'^\1\2except that the holder is Tim Hudson \(tjh@cryptsoft\.com\)\. *\n' r'^(?:(?:\1\2?g? *)? *\n)*' r"^\1\2Copyright remains Eric Young's, and as such any Copyright notices in *\n" r'^\1\2the code are not to be removed\. *\n' r'^\1\2If this package is used in a product, Eric Young should be given attribution *\n' r'^\1\2as the author of the parts of the library used\. *\n' r'^\1\2This can be in the form of a textual message at program startup or *\n' r'^\1\2in documentation \(online or textual\) provided with the package\. *\n' r'^(?:(?:\1\2?g? *)? *\n)*' r'^\1\2)?Redistribution and use in source and binary forms, with or without *\n' r'^\1\2modification, are permitted provided that the following conditions *\n' r'^\1\2are met: *\n' r'^\1\2(?:[-*1-9.)/ ]+)Redistributions of source code must retain the copyright *\n' r'^\1\2 *notice, this list of conditions and the following disclaimer\. *\n' r'^\1\2(?:[-*1-9.)/ ]+)Redistributions in binary form must reproduce the above copyright *\n' r'^\1\2 *notice, this list of conditions and the following disclaimer in the *\n' r'^\1\2 *documentation and/or other materials provided with the distribution\. *\n' r'^\1\2(?:[-*1-9.)/ ]+)All advertising materials mentioning features or use of this software *\n' r'^\1\2 *must display the following acknowledgement: *\n' r'^\1\2 *"This product includes cryptographic software written by *\n' r'^\1\2 *Eric Young \(eay@cryptsoft\.com\)" *\n' r"^\1\2 *The word 'cryptographic' can be left out if the rouines from the library *\n" // TODO(ianh): File a bug on the number of analyzer errors you get if you replace the " characters on this line with ' r'^\1\2 *being used are not cryptographic related :-\)\. *\n' r'^\1\2(?:[-*1-9.)/ ]+)If you include any Windows specific code \(or a derivative thereof\) fromg? *\n' r'^\1\2 *the apps directory \(application code\) you must include an acknowledgement: *\n' r'^\1\2 *"This product includes software written by Tim Hudson \(tjh@cryptsoft\.com\)" *\n' r'^(?:(?:\1\2?g? *)? *\n)*' r"^\1\2THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND *\n" r'^\1\2ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *\n' r'^\1\2IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *\n' r'^\1\2ARE DISCLAIMED\. +IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE *\n' r'^\1\2FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *\n' r'^\1\2DAMAGES \(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *\n' r'^\1\2OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION\) *\n' r'^\1\2HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *\n' r'^\1\2LIABILITY, OR TORT \(INCLUDING NEGLIGENCE OR OTHERWISE\) ARISING IN ANY WAY *\n' r'^\1\2OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *\n' r'^\1\2SUCH DAMAGE\. *\n' r'^(?:(?:\1\2?g? *)? *\n)*' r'^\1\2The licence and distribution terms for any publically available version or *\n' r'^\1\2derivative of this code cannot be changed\. +i\.e\. +this code cannot simply be *\n' r'^\1\2copied and put under another distribution licence *\n' r'^\1\2\[including the GNU Public Licence\.\]', multiLine: true, caseSensitive: false, ), // BSD-DERIVED LICENSES RegExp( kIndent + // Some files in ANGLE prefix the license with a description of the license. r'(?:BSD 2-Clause License \(https?://www.opensource.org/licenses/bsd-license.php\))?' + _linebreak + ( 'Redistribution and use in source and binary forms, with or without ' 'modification, are permitted provided that the following conditions are met:' .replaceAll(' ', _linebreak) ) + // the conditions: r'(?:' + // indented blank lines _linebreak + // truly blank lines r'|\n+' + // ad clause - ucb r'|(?:[-*1-9.)/ ]*)' + ( 'All advertising materials mentioning features or use of this software ' 'must display the following acknowledgement: This product includes software ' 'developed by the University of California, Berkeley and its contributors\\.' .replaceAll(' ', _linebreak) ) + // ad clause - netbsd r'|(?:[-*1-9.)/ ]*)' + ( 'All advertising materials mentioning features or use of this software ' 'must display the following acknowledgement: This product includes software ' 'developed by the NetBSD Foundation, Inc\\. and its contributors\\.' .replaceAll(' ', _linebreak) ) + // ack clause r'|(?:[-*1-9.)/ ]*)' + ( r'The origin of this software must not be misrepresented; you must not claim ' r'that you wrote the original software\. If you use this software in a product, ' r'an acknowledgment in the product documentation would be appreciated but is ' r'not required\.' .replaceAll(' ', _linebreak) ) + r'|(?:[-*1-9.)/ ]*)' + ( r'Altered source versions must be plainly marked as such, and must not be ' r'misrepresented as being the original software\.' .replaceAll(' ', _linebreak) ) + // no ad clauses r'|(?:[-*1-9.)/ ]*)' + ( 'Neither my name, .+, nor the names of any other contributors to the code ' 'use may not be used to endorse or promote products derived from this ' 'software without specific prior written permission\\.' .replaceAll(' ', _linebreak) ) + r'|(?:[-*1-9.)/ ]*)' + ( 'The name of the author may not be used to endorse or promote products ' 'derived from this software without specific prior written permission\\.?' .replaceAll(' ', _linebreak) ) + r'|(?:[-*1-9.)/ ]*)' + ( 'Neither the name of .+ nor the names of its contributors may be used ' 'to endorse or promote products derived from this software without ' 'specific prior written permission\\.' .replaceAll(' ', _linebreak) ) + // notice clauses r'|(?:[-*1-9.)/ ]*)' + ( 'Redistributions of source code must retain the above copyright notice, ' 'this list of conditions and the following disclaimer\\.' .replaceAll(' ', _linebreak) ) + r'|(?:[-*1-9.)/ ]*)' + ( 'Redistributions in binary form must reproduce the above copyright notice, ' 'this list of conditions and the following disclaimer in the documentation ' 'and/or other materials provided with the distribution\\.' .replaceAll(' ', _linebreak) ) + r'|(?:[-*1-9.)/ ]*)' + ( 'Redistributions in binary form must reproduce the above copyright notice, ' 'this list of conditions and the following disclaimer\\.' .replaceAll(' ', _linebreak) ) + // end of conditions r')*' + // disclaimers ( 'THIS SOFTWARE IS PROVIDED (?:BY .+(?: .+)? )?["“`]+AS IS["”\']+,? AND ANY EXPRESS OR IMPLIED ' 'WARRANTIES,(?::tabnew)? INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ' 'MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED\\. IN NO EVENT ' 'SHALL .+(?: .+)? BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ' 'CONSEQUENTIAL DAMAGES \\(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ' 'OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION\\) HOWEVER CAUSED ' 'AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \\(INCLUDING ' 'NEGLIGENCE OR OTHERWISE\\) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ' 'ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\\.' .replaceAll(' ', _linebreak) ), multiLine: true, caseSensitive: false, ), // MIT-DERIVED LICENSES // Seen in Mesa, among others. RegExp( kIndent + ( r'(?:' // this bit is optional r'Licensed under the MIT license:\n' // seen in expat r'\1\2? *\n' // blank line r'\1\2' // this is the prefix for the next block (handled by kIndent if this optional bit is skipped) r')?' // end of optional bit ) + ( r'Permission is hereby granted, free of charge, to any person obtaining ' r'a copy of this software and(?: /or)? associated documentation files \(the "(?:Software|Materials) "\), ' r'to deal in the (?:Software|Materials) without restriction, including without limitation ' r'the rights to use, copy, modify, merge, publish, distribute, sub license, ' r'and/or sell copies of the (?:Software|Materials), and to permit persons to whom the ' r'(?:Software|Materials) (?:is|are) furnished to do so, subject to the following conditions:' .replaceAll(' ', _linebreak) ) + r'(?:' + ( r'(?:(?:\1\2?(?: *| -*))? *\n)*' // A version with "// -------" between sections was seen in ffx_spd, hence the -*. + r'|' r'\1\2 ' r'The above copyright notice and this permission notice' r'(?: \(including the next paragraph\))? ' r'shall be included in all copies or substantial portions ' r'of the (?:Software|Materials)\.' r'|' r'\1\2 ' r'The above copyright notice including the dates of first publication and either this ' r'permission notice or a reference to .+ shall be ' r'included in all copies or substantial portions of the Software.' r'|' r'\1\2 ' r'In addition, the following condition applies:' r'|' r'\1\2 ' r'All redistributions must retain an intact copy of this copyright notice and disclaimer\.' r'|' r'\1\2 ' r'MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS ' r'STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND ' r'HEADER INFORMATION ARE LOCATED AT https://www\.khronos\.org/registry/' r'|' r'\1\2 ' r'THE (?:SOFTWARE|MATERIALS) (?:IS|ARE) PROVIDED "AS -? IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ' r'OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ' r'FITNESS FOR A PARTICULAR PURPOSE AND NON-?INFRINGEMENT\. IN NO EVENT SHALL ' r'.+(?: .+)? BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER ' r'IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,(?: )?OUT OF OR IN ' r'CONNECTION WITH THE (?:SOFTWARE|MATERIALS) OR THE USE OR OTHER DEALINGS IN THE (?:SOFTWARE|MATERIALS)\.' r'|' r'\1\2 ' r'THE (?:SOFTWARE|MATERIALS) (?:IS|ARE) PROVIDED "AS -? IS" AND WITHOUT WARRANTY OF ANY KIND, ' r'EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY ' r'OR FITNESS FOR A PARTICULAR PURPOSE\.' r'|' r'\1\2 ' r'IN NO EVENT SHALL .+ BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL ' r'DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ' r'WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING ' r'OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE\.' r'|' r'\1\2 ' r'Except as contained in this notice, the name of .+ shall not ' r'be used in advertising or otherwise to promote the sale, use or other dealings in ' r'this Software without prior written authorization from .+\.' .replaceAll(' ', _linebreak) ) + r')*', multiLine: true, caseSensitive: false, ), RegExp( kIndent + r'Boost Software License - Version 1\.0 - August 17th, 2003\n' + r'\n' + ( r'\1\2Permission is hereby granted, free of charge, to any person or ' r'organization obtaining a copy of the software and accompanying ' r'documentation covered by this license \(the "Software"\) to use, ' r'reproduce, display, distribute, execute, and transmit the Software, and ' r'to prepare derivative works of the Software, and to permit third-parties ' r'to whom the Software is furnished to do so, all subject to the following:\n' .replaceAll(' ', _linebreak) ) + r'\n' + ( r'\1\2The copyright notices in the Software and this entire statement, ' r'including the above license grant, this restriction and the following ' r'disclaimer, must be included in all copies of the Software, in whole or ' r'in part, and all derivative works of the Software, unless such copies or ' r'derivative works are solely in the form of machine-executable object ' r'code generated by a source language processor\.\n' .replaceAll(' ', _linebreak) ) + r'\n' + ( r'\1\2THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ' r'EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ' r'MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND ' r'NON-INFRINGEMENT\. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE ' r'DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, ' r'WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ' r'CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ' r'SOFTWARE\.' .replaceAll(' ', _linebreak) ), multiLine: true, caseSensitive: false, ), // BISON LICENSE // Seen in some ANGLE source. The usage falls under the "special exception" clause. RegExp( kIndent + r'This program is free software: you can redistribute it and/or modify\n' r'^(?:\1\2)?it under the terms of the GNU General Public License as published by\n' r'^(?:\1\2)?the Free Software Foundation, either version 3 of the License, or\n' r'^(?:\1\2)?\(at your option\) any later version.\n' r'^(?:\1\2)?\n*' r'^(?:\1\2)?This program is distributed in the hope that it will be useful,\n' r'^(?:\1\2)?but WITHOUT ANY WARRANTY; without even the implied warranty of\n' r'^(?:\1\2)?MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n' r'^(?:\1\2)?GNU General Public License for more details.\n' r'^(?:\1\2)?\n*' r'^(?:\1\2)?You should have received a copy of the GNU General Public License\n' r'^(?:\1\2)?along with this program. If not, see <https?://www.gnu.org/licenses/>. \*/\n' r'^(?:\1\2)?\n*' + kIndent + r'As a special exception, you may create a larger work that contains\n' r'^(?:\1\2)?part or all of the Bison parser skeleton and distribute that work\n' r"^(?:\1\2)?under terms of your choice, so long as that work isn't itself a\n" r'^(?:\1\2)?parser generator using the skeleton or a modified version thereof\n' r'^(?:\1\2)?as a parser skeleton. Alternatively, if you modify or redistribute\n' r'^(?:\1\2)?the parser skeleton itself, you may \(at your option\) remove this\n' r'^(?:\1\2)?special exception, which will cause the skeleton and the resulting\n' r'^(?:\1\2)?Bison output files to be licensed under the GNU General Public\n' r'^(?:\1\2)?License without this special exception.\n' r'^(?:\1\2)?\n*' r'^(?:\1\2)?This special exception was added by the Free Software Foundation in\n' r'^(?:\1\2)?version 2.2 of Bison. \*/\n', multiLine: true, caseSensitive: false, ), // NVIDIA license found in glslang RegExp( kIndent + r'NVIDIA Corporation\("NVIDIA"\) supplies this software to you in\n' r'\1\2consideration of your agreement to the following terms, and your use,\n' r'\1\2installation, modification or redistribution of this NVIDIA software\n' r'\1\2constitutes acceptance of these terms\. If you do not agree with these\n' r'\1\2terms, please do not use, install, modify or redistribute this NVIDIA\n' r'\1\2software\.\n' r'\1(?:\2)?\n' r'\1\2In consideration of your agreement to abide by the following terms, and\n' r'\1\2subject to these terms, NVIDIA grants you a personal, non-exclusive\n' r"\1\2license, under NVIDIA's copyrights in this original NVIDIA software \(the\n" r'\1\2"NVIDIA Software"\), to use, reproduce, modify and redistribute the\n' r'\1\2NVIDIA Software, with or without modifications, in source and/or binary\n' r'\1\2forms; provided that if you redistribute the NVIDIA Software, you must\n' r'\1\2retain the copyright notice of NVIDIA, this notice and the following\n' r'\1\2text and disclaimers in all such redistributions of the NVIDIA Software\.\n' r'\1\2Neither the name, trademarks, service marks nor logos of NVIDIA\n' r'\1\2Corporation may be used to endorse or promote products derived from the\n' r'\1\2NVIDIA Software without specific prior written permission from NVIDIA\.\n' r'\1\2Except as expressly stated in this notice, no other rights or licenses\n' r'\1\2express or implied, are granted by NVIDIA herein, including but not\n' r'\1\2limited to any patent rights that may be infringed by your derivative\n' r'\1\2works or by other works in which the NVIDIA Software may be\n' r'\1\2incorporated\. No hardware is licensed hereunder\.\n' r'\1(?:\2)?\n' r'\1\2THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\n' r'\1\2WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\n' r'\1\2INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\n' r'\1\2NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\n' r'\1\2ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\n' r'\1\2PRODUCTS\.\n' r'\1(?:\2)?\n' r'\1\2IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\n' r'\1\2INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES \(INCLUDING, BUT NOT LIMITED\n' r'\1\2TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n' r'\1\2USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION\) OR ARISING IN ANY WAY\n' r'\1\2OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\n' r'\1\2NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\n' r'\1\2TORT \(INCLUDING NEGLIGENCE\), STRICT LIABILITY OR OTHERWISE, EVEN IF\n' r'\1\2NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\.\n', multiLine: true, ), // OTHER BRIEF LICENSES // Seen in the NDK RegExp( kIndent + r'Permission to use, copy, modify, and/or distribute this software for any *\n' r'^\1\2purpose with or without fee is hereby granted, provided that the above *\n' r'^\1\2copyright notice and this permission notice appear in all copies\. *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2THE SOFTWARE IS PROVIDED "AS IS" AND .+ DISCLAIMS ALL WARRANTIES(?: WITH)? *\n' r'^\1\2(?:WITH )?REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF(?: MERCHANTABILITY)? *\n' r'^\1\2(?:MERCHANTABILITY )?AND FITNESS\. +IN NO EVENT SHALL .+ BE LIABLE FOR(?: ANY(?: SPECIAL, DIRECT,)?)? *\n' r'^\1\2(?:(?:ANY )?SPECIAL, DIRECT, )?INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES(?: WHATSOEVER RESULTING FROM)? *\n' r'^\1\2(?:WHATSOEVER RESULTING FROM )?LOSS OF USE, DATA OR PROFITS, WHETHER IN AN(?: ACTION(?: OF CONTRACT, NEGLIGENCE)?)? *\n' r'^\1\2(?:(?:ACTION )?OF CONTRACT, NEGLIGENCE )?OR OTHER TORTIOUS ACTION, ARISING OUT OF(?: OR IN(?: CONNECTION WITH THE USE OR)?)? *\n' r'^\1\2(?:(?:OR IN )?CONNECTION WITH THE USE OR )?PERFORMANCE OF THIS SOFTWARE\.', multiLine: true, ), // harfbuzz RegExp( kIndent + r'Permission is hereby granted, without written agreement and without *\n' r'^\1\2license or royalty fees, to use, copy, modify, and distribute this *\n' r'^\1\2software and its documentation for any purpose, provided that the *\n' r'^\1\2above copyright notice and the following two paragraphs appear in *\n' r'^\1\2all copies of this software\. *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR *\n' r'^\1\2DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES *\n' r'^\1\2ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN *\n' r'^\1\2IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH *\n' r'^\1\2DAMAGE\. *\n' r'^(?:(?:\1\2? *)? *\n)*' r'^\1\2THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, *\n' r'^\1\2BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND *\n' r'^\1\2FITNESS FOR A PARTICULAR PURPOSE\. +THE SOFTWARE PROVIDED HEREUNDER IS *\n' r'^\1\2ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO *\n' r'^\1\2PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS\. *\n', multiLine: true, ), // freetype2. RegExp( kIndent + ( r'Permission to use, copy, modify, distribute, and sell this software and its ' r'documentation for any purpose is hereby granted without fee, provided that ' r'the above copyright notice appear in all copies and that both that ' r'copyright notice and this permission notice appear in supporting ' r'documentation\. ' r'The above copyright notice and this permission notice shall be included in ' r'all copies or substantial portions of the Software\. ' r'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ' r'IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ' r'FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\. IN NO EVENT SHALL THE ' r'OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN ' r'AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ' r'CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE\. ' r'Except as contained in this notice, the name of The Open Group shall not be ' r'used in advertising or otherwise to promote the sale, use or other dealings ' r'in this Software without prior written authorization from The Open Group\. ' .replaceAll(' ', _linebreak) ), multiLine: true, ), // libjpeg-turbo RegExp( kIndent + ( r'Permission to use, copy, modify, and distribute this software and its ' r'documentation for any purpose and without fee is hereby granted, provided ' r'that the above copyright notice appear in all copies and that both that ' r'copyright notice and this permission notice appear in supporting ' r'documentation\. This software is provided "as is" without express or ' r'implied warranty\.' .replaceAll(' ', _linebreak) ), multiLine: true, ), ]; // LICENSES WE JUST DISPLAY VERBATIM final List<RegExp> csNoticeLicenses = <RegExp>[ // used with _tryInline, with needsCopyright: false // should have two groups, prefixes 1 and 2 RegExp( kIndent + r'COPYRIGHT NOTICE, DISCLAIMER, and LICENSE\n' r'(?:\1.*\n)+?' r'(?=\1\2END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE\.)', multiLine: true, ), // ideally this would be template-expanded against the referenced license, but // there's two licenses in the file in question and it's not exactly obvious // how to programmatically select the right one... for now just including the // text verbatim should be enough. RegExp( kIndent + r'Portions of the attached software \("Contribution"\) are developed by ' r'SUN MICROSYSTEMS, INC\., and are contributed to the OpenSSL project\. ' r'\n ' r'The Contribution is licensed pursuant to the Eric Young open source ' r'license provided above\.' .replaceAll(' ', _linebreak), multiLine: true, ), // ideally this would be template-expanded against the referenced license, but // there's two licenses in the file in question and it's not exactly obvious // how to programmatically select the right one... for now just including the // text verbatim should be enough. RegExp( kIndent + r'Portions of the attached software \("Contribution"\) are developed by ' r'SUN MICROSYSTEMS, INC\., and are contributed to the OpenSSL project\. ' r'\n ' r'The Contribution is licensed pursuant to the OpenSSL open source ' r'license provided above\.' .replaceAll(' ', _linebreak), multiLine: true, ), // Freetype RegExp( kIndent + ( r'This software was written by Alexander Peslyak in 2001\. No copyright is ' r'claimed, and the software is hereby placed in the public domain\. In case ' r'this attempt to disclaim copyright and place the software in the public ' r'domain is deemed null and void, then the software is Copyright \(c\) 2001 ' r'Alexander Peslyak and it is hereby released to the general public under the ' r'following terms: Redistribution and use in source and binary forms, with or ' r"without modification, are permitted\. There\'s ABSOLUTELY NO WARRANTY, " r'express or implied\.(?: \(This is a heavily cut-down "BSD license"\.\))?' .replaceAll(' ', _linebreak) ), multiLine: true, ), // Ahem font non-copyright RegExp( r'(//)( )License for the Ahem font embedded below is from:\n' r'\1\2https://www\.w3\.org/Style/CSS/Test/Fonts/Ahem/COPYING\n' r'\1\n' r'\1\2The Ahem font in this directory belongs to the public domain\. In\n' r'\1\2jurisdictions that do not recognize public domain ownership of these\n' r'\1\2files, the following Creative Commons Zero declaration applies:\n' r'\1\n' r'\1\2<http://labs\.creativecommons\.org/licenses/zero-waive/1\.0/us/legalcode>\n' r'\1\n' r'\1\2which is quoted below:\n' r'\1\n' r'\1\2 The person who has associated a work with this document \(the "Work"\)\n' r'\1\2 affirms that he or she \(the "Affirmer"\) is the/an author or owner of\n' r'\1\2 the Work\. The Work may be any work of authorship, including a\n' r'\1\2 database\.\n' r'\1\n' r'\1\2 The Affirmer hereby fully, permanently and irrevocably waives and\n' r'\1\2 relinquishes all of her or his copyright and related or neighboring\n' r'\1\2 legal rights in the Work available under any federal or state law,\n' r'\1\2 treaty or contract, including but not limited to moral rights,\n' r'\1\2 publicity and privacy rights, rights protecting against unfair\n' r'\1\2 competition and any rights protecting the extraction, dissemination\n' r'\1\2 and reuse of data, whether such rights are present or future, vested\n' r'\1\2 or contingent \(the "Waiver"\)\. The Affirmer makes the Waiver for the\n' r"\1\2 benefit of the public at large and to the detriment of the Affirmer's\n" r'\1\2 heirs or successors\.\n' r'\1\n' r'\1\2 The Affirmer understands and intends that the Waiver has the effect\n' r"\1\2 of eliminating and entirely removing from the Affirmer's control all\n" r'\1\2 the copyright and related or neighboring legal rights previously held\n' r'\1\2 by the Affirmer in the Work, to that extent making the Work freely\n' r'\1\2 available to the public for any and all uses and purposes without\n' r'\1\2 restriction of any kind, including commercial use and uses in media\n' r'\1\2 and formats or by methods that have not yet been invented or\n' r'\1\2 conceived\. Should the Waiver for any reason be judged legally\n' r'\1\2 ineffective in any jurisdiction, the Affirmer hereby grants a free,\n' r'\1\2 full, permanent, irrevocable, nonexclusive and worldwide license for\n' r'\1\2 all her or his copyright and related or neighboring legal rights in\n' r'\1\2 the Work\.', multiLine: true, ), RegExp( r'()()punycode\.c 0\.4\.0 \(2001-Nov-17-Sat\)\n' r'\1\2http://www\.cs\.berkeley\.edu/~amc/idn/\n' r'\1\2Adam M\. Costello\n' r'\1\2http://www\.nicemice\.net/amc/\n' r'\1\2\n' r'\1\2Disclaimer and license\n' r'\1\2\n' r'\1\2 Regarding this entire document or any portion of it \(including\n' r'\1\2 the pseudocode and C code\), the author makes no guarantees and\n' r'\1\2 is not responsible for any damage resulting from its use\. The\n' r'\1\2 author grants irrevocable permission to anyone to use, modify,\n' r'\1\2 and distribute it in any way that does not diminish the rights\n' r'\1\2 of anyone else to use, modify, and distribute it, provided that\n' r'\1\2 redistributed derivative works do not contain misleading author or\n' r'\1\2 version information\. Derivative works need not be licensed under\n' r'\1\2 similar terms\.\n', multiLine: true, ), RegExp( kIndent + r'This file is provided as-is by Unicode, Inc\. \(The Unicode Consortium\)\. ' r'No claims are made as to fitness for any particular purpose\. No ' r'warranties of any kind are expressed or implied\. The recipient ' r'agrees to determine applicability of information provided\. If this ' r'file has been provided on optical media by Unicode, Inc\., the sole ' r'remedy for any claim will be exchange of defective media within 90 ' r'days of receipt\.\n' r'\1\n' r'\1\2Unicode, Inc\. hereby grants the right to freely use the information ' r'supplied in this file in the creation of products supporting the ' r'Unicode Standard, and to make copies of this file in any form for ' r'internal or external distribution as long as this notice remains ' r'attached\. ' .replaceAll(' ', _linebreak), multiLine: true, ), RegExp( kIndent + r'We are also required to state that "The Graphics Interchange Format\(c\) ' r'is the Copyright property of CompuServe Incorporated. GIF\(sm\) is a ' r'Service Mark property of CompuServe Incorporated."' .replaceAll(' ', _linebreak), multiLine: true, ), // ZLIB-LIKE LICENSES // Seen in libjpeg-turbo (with a copyright), zlib.h RegExp( kIndent + ( r" This software is provided 'as-is', without any express or implied " r'warranty\. In no event will the authors be held liable for any damages ' r'arising from the use of this software\.' .replaceAll(' ', _linebreak) ) + ( r' Permission is granted to anyone to use this software for any purpose, ' r'including commercial applications, and to alter it and redistribute it ' r'freely, subject to the following restrictions:' .replaceAll(' ', _linebreak) ) + r'(?:' + _linebreak + r'(?:' + r'|\n+' + r'|(?:[-*1-9.)/ ]*)' + ( r'The origin of this software must not be misrepresented; you must not ' r'claim that you wrote the original software\. If you use this software ' r'in a product, an acknowledgment in the product documentation would be ' r'appreciated but is not required\.' .replaceAll(' ', _linebreak) ) + r'|(?:[-*1-9.)/ ]*)' + ( r'Altered source versions must be plainly marked as such, and must not be ' r'misrepresented as being the original software\. ' .replaceAll(' ', _linebreak) ) + r'|(?:[-*1-9.)/ ]*)' + ( r"If you meet \(any of\) the author\(s\), you're encouraged to buy them a beer, " r'a drink or whatever is suited to the situation, given that you like the ' r'software\. ' .replaceAll(' ', _linebreak) ) + r'|(?:[-*1-9.)/ ]*)' + ( r'This notice may not be removed or altered from any source distribution\.' .replaceAll(' ', _linebreak) ) + r'))+', multiLine: true, caseSensitive: false, ), ]; final List<RegExp> csStrayCopyrights = <RegExp>[ // a file in BoringSSL RegExp( kIndent + r'DTLS code by Eric Rescorla <ekr@rtfm\.com> ' r'\n ' r'Copyright \(C\) 2006, Network Resonance, Inc\. ' r'Copyright \(C\) 2011, RTFM, Inc\.' .replaceAll(' ', _linebreak), multiLine: true, ), // thaidict.txt has a weird indenting thing going on RegExp( r'^ *# *Copyright \(c\) [-0-9]+ International Business Machines Corporation,\n' r' *# *Apple Inc\., and others\. All Rights Reserved\.', multiLine: true, ), // Found in a lot of ICU files RegExp( kIndent + r'Copyright \([Cc]\) [-, 0-9{}]+ ' + '(?:Google, )?International Business Machines ' r'Corporation(?:(?:, Google,?)? and others)?\. All [Rr]ights [Rr]eserved\.' .replaceAll(' ', _linebreak), multiLine: true, ), // Found in ICU files RegExp( kIndent + r'Copyright \([Cc]\) [-0-9,]+ IBM(?: Corp(?:oration)?)?(?:, Inc\.)?(?: and [Oo]thers)?\.(?: All rights reserved\.)?', multiLine: true, ), // Found in ICU files RegExp( kIndent + r'Copyright \(C\) [0-9]+ and later: Unicode, Inc\. and others\.', multiLine: true, ), // Found in ICU files RegExp( kIndent + r'Copyright \(c\) [-0-9 ]+ Unicode, Inc\. All Rights reserved\.', multiLine: true, ), // Found in ICU files RegExp( kIndent + r'Copyright \(C\) [-,0-9]+ ,? Yahoo! Inc\.', multiLine: true, ), // Found in some ICU files RegExp( kIndent + r'Copyright [0-9]+ and onwards Google Inc.', multiLine: true, ), // Found in some ICU files RegExp( kIndent + r'Copyright [0-9]+ Google Inc. All Rights Reserved.', multiLine: true, ), // Found in some ICU files RegExp( kIndent + r'Copyright \(C\) [-0-9]+, Apple Inc\.(?:; Unicode, Inc\.;)? and others\. All Rights Reserved\.', multiLine: true, ), // rapidjson RegExp( kIndent + r'The above software in this distribution may have been modified by THL A29 Limited ' r'\("Tencent Modifications"\)\. All Tencent Modifications are Copyright \(C\) 2015 THL A29 Limited\.' .replaceAll(' ', _linebreak), multiLine: true, ), // minizip RegExp( kIndent + r'Copyright \(C\) [-0-9]+ Gilles Vollant', multiLine: true, ), // Skia RegExp( kIndent + r'Copyright [-0-9]+ Google LLC\.', multiLine: true, ), // flutter/third_party/inja/third_party/include/hayai/hayai_clock.hpp // Advice was to just ignore these copyright notices given the LICENSE.md file // in the same directory. RegExp( kIndent + r'Copyright \(C\) 2011 Nick Bruun <nick@bruun\.co>\n' r'\1\2Copyright \(C\) 2013 Vlad Lazarenko <vlad@lazarenko\.me>\n' r'\1\2Copyright \(C\) 2014 Nicolas Pauss <nicolas\.pauss@gmail\.com>', multiLine: true, ), ];
engine/tools/licenses/lib/patterns.dart/0
{ "file_path": "engine/tools/licenses/lib/patterns.dart", "repo_id": "engine", "token_count": 26168 }
475
// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /// This is a library for parsing the Engine CI configurations that live under /// flutter/ci/builders. They describe how CI builds, tests, archives, and /// uploads the engine to cloud storage. The documentation and spec for the /// format is at: /// /// https://github.com/flutter/engine/blob/main/ci/builders/README.md /// /// The code in this library is *not* used by CI to run these configurations. /// Rather, that code executes these configs on CI is part of the "engine_v2" /// recipes at: /// /// https://cs.opensource.google/flutter/recipes/+/main:recipes/engine_v2 /// /// This library exposes two main classes, [BuildConfigLoader], which reads and /// loads all build configurations under a directory, and [BuildConfig], which /// is the Dart representation of a single build configuration. library; export 'src/build_config.dart'; export 'src/build_config_loader.dart'; export 'src/build_config_runner.dart';
engine/tools/pkg/engine_build_configs/lib/engine_build_configs.dart/0
{ "file_path": "engine/tools/pkg/engine_build_configs/lib/engine_build_configs.dart", "repo_id": "engine", "token_count": 300 }
476
// Copyright 2013 The Flutter 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:io' as io show Directory, File, stdout; import 'package:path/path.dart' as path; import 'package:process/process.dart'; import 'package:process_runner/process_runner.dart'; /// Utility methods for working with a git repository. final class GitRepo { /// The git repository rooted at `root`. GitRepo.fromRoot(this.root, { this.verbose = false, StringSink? logSink, ProcessManager processManager = const LocalProcessManager(), }) : _processManager = processManager, logSink = logSink ?? io.stdout; /// Whether to produce verbose log output. /// /// If true, output of git commands will be printed to [logSink]. final bool verbose; /// Where to send verbose log output. /// /// Defaults to [io.stdout]. final StringSink logSink; /// The root of the git repo. final io.Directory root; /// The delegate to use for running processes. final ProcessManager _processManager; /// Returns a list of all non-deleted files which differ from the nearest /// merge-base with `main`. If it can't find a fork point, uses the default /// merge-base. /// /// This is only computed once and cached. Subsequent invocations of the /// getter will return the same result. late final Future<List<io.File>> changedFiles = _changedFiles(); /// Returns the SHA of the current HEAD commit. Future<String> headSha({bool short = false}) async { final ProcessRunnerResult result = await ProcessRunner( defaultWorkingDirectory: root, processManager: _processManager, ).runProcess( <String>['git', 'rev-parse', if (short) '--short' ,'HEAD'], ); return result.stdout.trim(); } Future<List<io.File>> _changedFiles() async { final ProcessRunner processRunner = ProcessRunner( defaultWorkingDirectory: root, processManager: _processManager, ); await _fetch(processRunner); // Find the merge base between the current branch and the branch that was // checked out at the time of the last fetch. The merge base is the common // ancestor of the two branches, and the output is the hash of the merge // base. ProcessRunnerResult mergeBaseResult = await processRunner.runProcess( <String>['git', 'merge-base', '--fork-point', 'FETCH_HEAD', 'HEAD'], failOk: true, ); if (mergeBaseResult.exitCode != 0) { if (verbose) { logSink.writeln('git merge-base --fork-point failed, using default merge-base'); logSink.writeln('Output:\n${mergeBaseResult.stdout}'); } mergeBaseResult = await processRunner.runProcess(<String>[ 'git', 'merge-base', 'FETCH_HEAD', 'HEAD', ]); } final String mergeBase = mergeBaseResult.stdout.trim(); final ProcessRunnerResult masterResult = await processRunner.runProcess(<String>[ 'git', 'diff', '--name-only', '--diff-filter=ACMRT', mergeBase, ]); return _gitOutputToList(masterResult); } /// Returns a list of non-deleted files which differ between the HEAD /// commit and its parent. /// /// This is only computed once and cached. Subsequent invocations of the /// getter will return the same result. late final Future<List<io.File>> changedFilesAtHead = _changedFilesAtHead(); Future<List<io.File>> _changedFilesAtHead() async { final ProcessRunner processRunner = ProcessRunner( defaultWorkingDirectory: root, processManager: _processManager, ); await _fetch(processRunner); final ProcessRunnerResult diffTreeResult = await processRunner.runProcess( <String>[ 'git', 'diff-tree', '--no-commit-id', '--name-only', '--diff-filter=ACMRT', // Added, copied, modified, renamed, or type-changed. '-r', 'HEAD', ], ); return _gitOutputToList(diffTreeResult); } Future<void> _fetch(ProcessRunner processRunner) async { final ProcessRunnerResult fetchResult = await processRunner.runProcess( <String>['git', 'fetch', 'upstream', 'main'], failOk: true, ); if (fetchResult.exitCode != 0) { if (verbose) { logSink.writeln('git fetch upstream main failed, using origin main'); logSink.writeln('Output:\n${fetchResult.stdout}'); } await processRunner.runProcess(<String>[ 'git', 'fetch', 'origin', 'main', ]); } } List<io.File> _gitOutputToList(ProcessRunnerResult result) { final String diffOutput = result.stdout.trim(); if (verbose) { logSink.writeln('git diff output:\n$diffOutput'); } final Set<String> resultMap = <String>{}; resultMap.addAll(diffOutput.split('\n').where( (String str) => str.isNotEmpty, )); return resultMap.map<io.File>( (String filePath) => io.File(path.join(root.path, filePath)), ).toList(); } }
engine/tools/pkg/git_repo_tools/lib/git_repo_tools.dart/0
{ "file_path": "engine/tools/pkg/git_repo_tools/lib/git_repo_tools.dart", "repo_id": "engine", "token_count": 1807 }
477
// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_VULKAN_PROCS_VULKAN_HANDLE_H_ #define FLUTTER_VULKAN_PROCS_VULKAN_HANDLE_H_ #include <functional> #include "flutter/fml/logging.h" #include "flutter/fml/macros.h" #include "flutter/vulkan/procs/vulkan_interface.h" namespace vulkan { template <class T> class VulkanHandle { public: using Handle = T; using Disposer = std::function<void(Handle)>; VulkanHandle() : handle_(VK_NULL_HANDLE) {} explicit VulkanHandle(Handle handle, const Disposer& disposer = nullptr) : handle_(handle), disposer_(disposer) {} VulkanHandle(VulkanHandle&& other) : handle_(other.handle_), disposer_(std::move(other.disposer_)) { other.handle_ = VK_NULL_HANDLE; other.disposer_ = nullptr; } ~VulkanHandle() { DisposeIfNecessary(); } VulkanHandle& operator=(VulkanHandle&& other) { if (handle_ != other.handle_) { DisposeIfNecessary(); } handle_ = other.handle_; disposer_ = other.disposer_; other.handle_ = VK_NULL_HANDLE; other.disposer_ = nullptr; return *this; } explicit operator bool() const { return handle_ != VK_NULL_HANDLE; } // NOLINTNEXTLINE(google-explicit-constructor) operator Handle() const { return handle_; } /// Relinquish responsibility of collecting the underlying handle when this /// object is collected. It is the responsibility of the caller to ensure that /// the lifetime of the handle extends past the lifetime of this object. void ReleaseOwnership() { disposer_ = nullptr; } void Reset() { DisposeIfNecessary(); } private: Handle handle_; Disposer disposer_; void DisposeIfNecessary() { if (handle_ == VK_NULL_HANDLE) { return; } if (disposer_) { disposer_(handle_); } handle_ = VK_NULL_HANDLE; disposer_ = nullptr; } FML_DISALLOW_COPY_AND_ASSIGN(VulkanHandle); }; } // namespace vulkan #endif // FLUTTER_VULKAN_PROCS_VULKAN_HANDLE_H_
engine/vulkan/procs/vulkan_handle.h/0
{ "file_path": "engine/vulkan/procs/vulkan_handle.h", "repo_id": "engine", "token_count": 773 }
478
// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "vulkan_image.h" #include "flutter/vulkan/procs/vulkan_proc_table.h" #include "vulkan_command_buffer.h" namespace vulkan { VulkanImage::VulkanImage(VulkanHandle<VkImage> image) : handle_(std::move(image)), layout_(VK_IMAGE_LAYOUT_UNDEFINED), access_flags_(0), valid_(false) { if (!handle_) { return; } valid_ = true; } VulkanImage::~VulkanImage() = default; bool VulkanImage::IsValid() const { return valid_; } bool VulkanImage::InsertImageMemoryBarrier( const VulkanCommandBuffer& command_buffer, VkPipelineStageFlagBits src_pipline_bits, VkPipelineStageFlagBits dest_pipline_bits, VkAccessFlags dest_access_flags, VkImageLayout dest_layout) { const VkImageMemoryBarrier image_memory_barrier = { .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .pNext = nullptr, .srcAccessMask = access_flags_, .dstAccessMask = dest_access_flags, .oldLayout = layout_, .newLayout = dest_layout, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = handle_, .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, }; bool success = command_buffer.InsertPipelineBarrier( src_pipline_bits, // src_stage_flags dest_pipline_bits, // dest_stage_flags 0, // dependency_flags 0, // memory_barrier_count nullptr, // memory_barriers 0, // buffer_memory_barrier_count nullptr, // buffer_memory_barriers 1, // image_memory_barrier_count &image_memory_barrier // image_memory_barriers ); if (success) { access_flags_ = dest_access_flags; layout_ = dest_layout; } return success; } } // namespace vulkan
engine/vulkan/vulkan_image.cc/0
{ "file_path": "engine/vulkan/vulkan_image.cc", "repo_id": "engine", "token_count": 885 }
479
// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_VULKAN_VULKAN_UTILITIES_H_ #define FLUTTER_VULKAN_VULKAN_UTILITIES_H_ #include <string> #include <vector> #include "flutter/fml/macros.h" #include "flutter/vulkan/procs/vulkan_handle.h" #include "flutter/vulkan/procs/vulkan_proc_table.h" namespace vulkan { bool ValidationLayerInfoMessagesEnabled(); bool ValidationErrorsFatal(); std::vector<std::string> InstanceLayersToEnable(const VulkanProcTable& vk, bool enable_validation_layers); std::vector<std::string> DeviceLayersToEnable( const VulkanProcTable& vk, const VulkanHandle<VkPhysicalDevice>& physical_device, bool enable_validation_layers); } // namespace vulkan #endif // FLUTTER_VULKAN_VULKAN_UTILITIES_H_
engine/vulkan/vulkan_utilities.h/0
{ "file_path": "engine/vulkan/vulkan_utilities.h", "repo_id": "engine", "token_count": 364 }
480
// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // ignore_for_file: avoid_dynamic_calls @JS() library test.host; import 'dart:async'; import 'dart:convert'; import 'dart:js_interop'; import 'package:stack_trace/stack_trace.dart'; import 'package:stream_channel/stream_channel.dart'; // ignore: implementation_imports import 'package:ui/src/engine/dom.dart'; /// A class defined in content shell, used to control its behavior. @JS() @staticInterop class _TestRunner {} extension _TestRunnerExtension on _TestRunner { external JSVoid waitUntilDone(); } /// Returns the current content shell runner, or `null` if none exists. @JS() external _TestRunner? get testRunner; // ignore: library_private_types_in_public_api /// A class that exposes the test API to JS. /// /// These are exposed so that tools like IDEs can interact with them via remote /// debugging. @JS() @anonymous @staticInterop class _JSApi { external factory _JSApi({JSFunction resume, JSFunction restartCurrent}); } extension _JSApiExtension on _JSApi { /// Causes the test runner to resume running, as though the user had clicked /// the "play" button. // ignore: unused_element external JSFunction get resume; /// Causes the test runner to restart the current test once it finishes /// running. // ignore: unused_element external JSFunction get restartCurrent; } /// Sets the top-level `dartTest` object so that it's visible to JS. @JS('dartTest') external set _jsApi(_JSApi api); /// The iframes created for each loaded test suite, indexed by the suite id. final Map<int, DomHTMLIFrameElement> _iframes = <int, DomHTMLIFrameElement>{}; /// Subscriptions created for each loaded test suite, indexed by the suite id. final Map<int, List<DomSubscription>> _domSubscriptions = <int, List<DomSubscription>>{}; final Map<int, List<StreamSubscription<dynamic>>> _streamSubscriptions =<int, List<StreamSubscription<dynamic>>>{}; /// The URL for the current page. final Uri _currentUrl = Uri.parse(domWindow.location.href); /// Code that runs in the browser and loads test suites at the server's behest. /// /// One instance of this runs for each browser. When the server tells it to load /// a test, it starts an iframe pointing at that test's code; from then on, it /// just relays messages between the two. /// /// The browser uses two layers of [MultiChannel]s when communicating with the /// server: /// /// server /// │ /// (WebSocket) /// │ /// ┏━ host.html ━━━━━━━━┿━━━━━━━━━━━━━━━━━┓ /// ┃ │ ┃ /// ┃ ┌──────┬───MultiChannel─────┐ ┃ /// ┃ │ │ │ │ │ ┃ /// ┃ host suite suite suite suite ┃ /// ┃ │ │ │ │ ┃ /// ┗━━━━━━━━━━━┿━━━━━━┿━━━━━━┿━━━━━━┿━━━━━┛ /// │ │ │ │ /// │ ... ... ... /// │ /// (MessageChannel) /// │ /// ┏━ suite.html (in iframe) ┿━━━━━━━━━━━━━━━━━━━━━━━━━━┓ /// ┃ │ ┃ /// ┃ ┌──────────MultiChannel┬─────────┐ ┃ /// ┃ │ │ │ │ │ ┃ /// ┃ IframeListener test test test running test ┃ /// ┃ ┃ /// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ /// /// The host (this code) has a [MultiChannel] that splits the WebSocket /// connection with the server. One connection is used for the host itself to /// receive messages like "load a suite at this URL", and the rest are /// connected to each test suite's iframe via a [MessageChannel]. /// /// Each iframe then has its own [MultiChannel] which takes its /// [MessageChannel] connection and splits it again. One connection is used for /// the [IframeListener], which sends messages like "here are all the tests in /// this suite". The rest are used for each test, receiving messages like /// "start running". A new connection is also created whenever a test begins /// running to send status messages about its progress. /// /// It's of particular note that the suite's [MultiChannel] connection uses the /// host's purely as a transport layer; neither is aware that the other is also /// using [MultiChannel]. This is necessary, since the host doesn't share memory /// with the suites and thus can't share its [MultiChannel] with them, but it /// does mean that the server needs to be sure to nest its [MultiChannel]s at /// the same place the client does. void main() { // This tells content_shell not to close immediately after the page has // rendered. testRunner?.waitUntilDone(); if (_currentUrl.queryParameters['debug'] == 'true') { domDocument.body!.classList.add('debug'); } runZonedGuarded( () { final MultiChannel<dynamic> serverChannel = _connectToServer(); serverChannel.stream.listen((dynamic message) { if (message['command'] == 'loadSuite') { final int channelId = message['channel'] as int; final String url = message['url'] as String; final int messageId = message['id'] as int; final VirtualChannel<dynamic> suiteChannel = serverChannel.virtualChannel(channelId); final StreamChannel<dynamic> iframeChannel = _connectToIframe(url, messageId); suiteChannel.pipe(iframeChannel); } else if (message['command'] == 'displayPause') { domDocument.body!.classList.add('paused'); } else if (message['command'] == 'resume') { domDocument.body!.classList.remove('paused'); } else { assert(message['command'] == 'closeSuite'); _iframes.remove(message['id'])!.remove(); for (final DomSubscription subscription in _domSubscriptions.remove(message['id'])!) { subscription.cancel(); } for (final StreamSubscription<dynamic> subscription in _streamSubscriptions.remove(message['id'])!) { subscription.cancel(); } } }); // Send periodic pings to the test runner so it can know when the browser is // paused for debugging. Timer.periodic(const Duration(seconds: 1), (_) => serverChannel.sink.add(<String, String>{'command': 'ping'})); _jsApi = _JSApi(resume: () { if (!domDocument.body!.classList.contains('paused')) { return; } domDocument.body!.classList.remove('paused'); serverChannel.sink.add(<String, String>{'command': 'resume'}); }.toJS, restartCurrent: () { serverChannel.sink.add(<String, String>{'command': 'restart'}); }.toJS); }, (dynamic error, StackTrace stackTrace) { print('$error\n${Trace.from(stackTrace).terse}'); // ignore: avoid_print }, ); } /// Creates a [MultiChannel] connection to the server, using a [WebSocket] as /// the underlying protocol. MultiChannel<dynamic> _connectToServer() { // The `managerUrl` query parameter contains the WebSocket URL of the remote // [BrowserManager] with which this communicates. final DomWebSocket webSocket = createDomWebSocket(_currentUrl.queryParameters['managerUrl']!); final StreamChannelController<dynamic> controller = StreamChannelController<dynamic>(sync: true); webSocket.addEventListener('message', createDomEventListener((DomEvent message) { final String data = (message as DomMessageEvent).data as String; controller.local.sink.add(jsonDecode(data)); })); controller.local.stream .listen((dynamic message) => webSocket.send(jsonEncode(message))); return MultiChannel<dynamic>(controller.foreign); } /// Creates an iframe with `src` [url] and establishes a connection to it using /// a [MessageChannel]. /// /// [id] identifies the suite loaded in this iframe. StreamChannel<dynamic> _connectToIframe(String url, int id) { final DomHTMLIFrameElement iframe = createDomHTMLIFrameElement(); _iframes[id] = iframe; iframe ..src = url ..width = '1000' ..height = '1000'; domDocument.body!.appendChild(iframe); final StreamChannelController<dynamic> controller = StreamChannelController<dynamic>(sync: true); final List<DomSubscription> domSubscriptions = <DomSubscription>[]; final List<StreamSubscription<dynamic>> streamSubscriptions = <StreamSubscription<dynamic>>[]; _domSubscriptions[id] = domSubscriptions; _streamSubscriptions[id] = streamSubscriptions; domSubscriptions.add(DomSubscription(domWindow, 'message', (DomEvent event) { final DomMessageEvent message = event as DomMessageEvent; // A message on the Window can theoretically come from any website. It's // very unlikely that a malicious site would care about hacking someone's // unit tests, let alone be able to find the test server while it's // running, but it's good practice to check the origin anyway. if (message.origin != domWindow.location.origin) { return; } if (message.source.location?.href != iframe.src) { return; } message.stopPropagation(); if (message.data == 'port') { final DomMessagePort port = message.ports.first; domSubscriptions.add( DomSubscription(port, 'message',(DomEvent event) { controller.local.sink.add((event as DomMessageEvent).data); })); port.start(); streamSubscriptions.add(controller.local.stream.listen(port.postMessage)); } else if (message.data['ready'] == true) { // This message indicates that the iframe is actively listening for // events, so the message channel's second port can now be transferred. final DomMessageChannel channel = createDomMessageChannel(); channel.port1.start(); channel.port2.start(); iframe.contentWindow.postMessage( 'port', domWindow.location.origin, <DomMessagePort>[channel.port2]); domSubscriptions .add(DomSubscription(channel.port1, 'message', (DomEvent message) { controller.local.sink.add((message as DomMessageEvent).data['data']); })); streamSubscriptions .add(controller.local.stream.listen(channel.port1.postMessage)); } else if (message.data['exception'] == true) { // This message from `dart.js` indicates that an exception occurred // loading the test. controller.local.sink.add(message.data['data']); } })); return controller.foreign; }
engine/web_sdk/web_engine_tester/lib/static/host.dart/0
{ "file_path": "engine/web_sdk/web_engine_tester/lib/static/host.dart", "repo_id": "engine", "token_count": 4187 }
481
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="libraries-with-intellij-classes"> <option name="intellijApiContainingLibraries"> <list> <LibraryCoordinatesState> <option name="artifactId" value="ideaIU" /> <option name="groupId" value="com.jetbrains.intellij.idea" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="ideaIU" /> <option name="groupId" value="com.jetbrains" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="ideaIC" /> <option name="groupId" value="com.jetbrains.intellij.idea" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="ideaIC" /> <option name="groupId" value="com.jetbrains" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="pycharmPY" /> <option name="groupId" value="com.jetbrains.intellij.pycharm" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="pycharmPY" /> <option name="groupId" value="com.jetbrains" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="pycharmPC" /> <option name="groupId" value="com.jetbrains.intellij.pycharm" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="pycharmPC" /> <option name="groupId" value="com.jetbrains" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="clion" /> <option name="groupId" value="com.jetbrains.intellij.clion" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="clion" /> <option name="groupId" value="com.jetbrains" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="riderRD" /> <option name="groupId" value="com.jetbrains.intellij.rider" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="riderRD" /> <option name="groupId" value="com.jetbrains" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="goland" /> <option name="groupId" value="com.jetbrains.intellij.goland" /> </LibraryCoordinatesState> <LibraryCoordinatesState> <option name="artifactId" value="goland" /> <option name="groupId" value="com.jetbrains" /> </LibraryCoordinatesState> </list> </option> </component> </project>
flutter-intellij/.idea/libraries-with-intellij-classes.xml/0
{ "file_path": "flutter-intellij/.idea/libraries-with-intellij-classes.xml", "repo_id": "flutter-intellij", "token_count": 1275 }
482
# Code of conduct When contributing code to the `flutter-intellij` project, please observe Flutter's [code of conduct](https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md).
flutter-intellij/CODE_OF_CONDUCT.md/0
{ "file_path": "flutter-intellij/CODE_OF_CONDUCT.md", "repo_id": "flutter-intellij", "token_count": 61 }
483
/* * Copyright 2016 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter; import com.intellij.AbstractBundle; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.PropertyKey; import java.lang.ref.Reference; import java.lang.ref.SoftReference; import java.util.ResourceBundle; public class FlutterBundle { private static Reference<ResourceBundle> ourBundle; @NonNls private static final String BUNDLE = "io.flutter.FlutterBundle"; public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) { return AbstractBundle.message(getBundle(), key, params); } private FlutterBundle() { } private static ResourceBundle getBundle() { ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle); if (bundle == null) { bundle = ResourceBundle.getBundle(BUNDLE); ourBundle = new SoftReference<>(bundle); } return bundle; } }
flutter-intellij/flutter-idea/src/io/flutter/FlutterBundle.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/FlutterBundle.java", "repo_id": "flutter-intellij", "token_count": 365 }
484
/* * Copyright 2016 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.actions; import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import io.flutter.run.daemon.FlutterApp; import org.jetbrains.annotations.NotNull; import javax.swing.*; abstract public class FlutterAppAction extends DumbAwareAction { private static final Logger LOG = Logger.getInstance(FlutterAppAction.class); @NotNull private final FlutterApp myApp; @NotNull private final Computable<Boolean> myIsApplicable; @NotNull private final String myActionId; private final FlutterApp.FlutterAppListener myListener = new FlutterApp.FlutterAppListener() { @Override public void stateChanged(FlutterApp.State newState) { getTemplatePresentation().setEnabled(myApp.isStarted() && myIsApplicable.compute()); } }; private boolean myIsListening = false; public FlutterAppAction(@NotNull FlutterApp app, @NotNull String text, @NotNull String description, @NotNull Icon icon, @NotNull Computable<Boolean> isApplicable, @NotNull String actionId) { super(text, description, icon); myApp = app; myIsApplicable = isApplicable; myActionId = actionId; updateActionRegistration(app.isConnected()); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.BGT; } private void updateActionRegistration(boolean isConnected) { final Project project = getApp().getProject(); if (!isConnected) { // Unregister ourselves if we're the current action. if (ProjectActions.getAction(project, myActionId) == this) { ProjectActions.unregisterAction(project, myActionId); } } else { if (ProjectActions.getAction(project, myActionId) != this) { ProjectActions.registerAction(project, myActionId, this); } } } @Override public void update(@NotNull final AnActionEvent e) { updateActionRegistration(myApp.isConnected()); final boolean isConnected = myIsApplicable.compute(); final boolean supportsReload = myApp.getMode().supportsReload(); e.getPresentation().setEnabled(myApp.isStarted() && isConnected && supportsReload); if (isConnected) { if (!myIsListening) { getApp().addStateListener(myListener); myIsListening = true; } } else { if (myIsListening) { getApp().removeStateListener(myListener); myIsListening = false; } } } @NotNull public FlutterApp getApp() { return myApp; } }
flutter-intellij/flutter-idea/src/io/flutter/actions/FlutterAppAction.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/actions/FlutterAppAction.java", "repo_id": "flutter-intellij", "token_count": 1113 }
485
/* * Copyright 2021 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.actions; import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.process.ColoredProcessHandler; import com.intellij.execution.process.ProcessAdapter; import com.intellij.execution.process.ProcessEvent; import com.intellij.execution.process.ProcessOutputTypes; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectUtil; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.vfs.VirtualFile; import io.flutter.FlutterMessages; import io.flutter.sdk.FlutterSdk; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static io.flutter.actions.OpenInXcodeAction.findProjectFile; public class OpenInAppCodeAction extends AnAction { private static boolean IS_INITIALIZED = false; private static boolean IS_APPCODE_INSTALLED = false; static { initialize(); } private static void initialize() { if (SystemInfo.isMac) { try { // AppCode is installed if this shell command produces any output: // mdfind "kMDItemContentType == 'com.apple.application-bundle'" | grep AppCode.app final GeneralCommandLine cmd = new GeneralCommandLine().withExePath("/bin/bash") .withParameters("-c", "mdfind \"kMDItemContentType == 'com.apple.application-bundle'\" | grep AppCode.app"); final ColoredProcessHandler handler = new ColoredProcessHandler(cmd); handler.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { if (outputType == ProcessOutputTypes.STDOUT) { IS_APPCODE_INSTALLED = true; } } }); handler.startNotify(); } catch (ExecutionException ex) { // ignored } } IS_INITIALIZED = true; } @Override public void update(@NotNull AnActionEvent event) { // Enable in global menu; action group controls context menu visibility. if (!SystemInfo.isMac || !(IS_INITIALIZED && IS_APPCODE_INSTALLED)) { event.getPresentation().setVisible(false); } else { final Presentation presentation = event.getPresentation(); final boolean enabled = findProjectFile(event) != null; presentation.setEnabledAndVisible(enabled); } } @Override public void actionPerformed(@NotNull AnActionEvent event) { final VirtualFile projectFile = findProjectFile(event); if (projectFile != null) { openFile(projectFile); } else { @Nullable final Project project = event.getProject(); FlutterMessages.showError("Error Opening AppCode", "Project not found.", project); } } private static void openFile(@NotNull VirtualFile file) { final Project project = ProjectUtil.guessProjectForFile(file); final FlutterSdk sdk = project != null ? FlutterSdk.getFlutterSdk(project) : null; if (sdk == null) { FlutterSdkAction.showMissingSdkDialog(project); return; } openInAppCode(project, file.getParent().getPath()); } private static void openInAppCode(@Nullable Project project, @NotNull String path) { try { final GeneralCommandLine cmd = new GeneralCommandLine().withExePath("open").withParameters("-a", "AppCode.app", path); final ColoredProcessHandler handler = new ColoredProcessHandler(cmd); handler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull final ProcessEvent event) { if (event.getExitCode() != 0) { FlutterMessages.showError("Error Opening", path, project); } } }); handler.startNotify(); } catch (ExecutionException ex) { FlutterMessages.showError( "Error Opening", "Exception: " + ex.getMessage(), project); } } }
flutter-intellij/flutter-idea/src/io/flutter/actions/OpenInAppCodeAction.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/actions/OpenInAppCodeAction.java", "repo_id": "flutter-intellij", "token_count": 1547 }
486
/* * Copyright 2016 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.analytics; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.util.SystemInfo; import com.intellij.util.concurrency.QueueProcessor; import com.jetbrains.lang.dart.sdk.DartSdk; import io.flutter.bazel.WorkspaceCache; import io.flutter.sdk.FlutterSdk; import io.flutter.sdk.FlutterSdkVersion; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.awt.*; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Locale; import java.util.Map; /** * Lightweight Google Analytics integration. */ public class Analytics { public static final String GROUP_DISPLAY_ID = "Flutter Usage Statistics"; public static final String TIMING_COMPLETE = "timing_complete"; private static final String analyticsUrl = "https://www.google-analytics.com/collect"; private static final String applicationName = "Flutter IntelliJ Plugin"; private static final String trackingId = "UA-67589403-7"; private static final int maxExceptionLength = 512; @NotNull private final String clientId; @NotNull private final String pluginVersion; @NotNull private final String platformName; @NotNull private final String platformVersion; @NotNull private Transport transport = new HttpTransport(); @NotNull private ThrottlingBucket bucket = new ThrottlingBucket(20); private boolean myCanSend = false; public Analytics(@NotNull String clientId, @NotNull String pluginVersion, @NotNull String platformName, @NotNull String platformVersion) { this.clientId = clientId; this.pluginVersion = pluginVersion; this.platformName = platformName; this.platformVersion = platformVersion; } public void disableThrottling(@NotNull Runnable func) { ThrottlingBucket original = bucket; try { bucket = new ThrottlingBucket.NonTrhottlingBucket(0); func.run(); } finally { bucket = original; } } @NotNull public String getClientId() { return clientId; } public boolean canSend() { return myCanSend; } public void setCanSend(boolean value) { this.myCanSend = value; } /** * Public for testing. */ public void setTransport(@NotNull Transport transport) { this.transport = transport; } public void sendScreenView(@NotNull String viewName) { final Map<String, String> args = new HashMap<>(); args.put("cd", viewName); sendPayload("screenview", args, null); } public void sendEvent(@NotNull String category, @NotNull String action) { sendEvent(category, action, null); } public void sendEvent(@NotNull String category, @NotNull String action, @Nullable FlutterSdk flutterSdk) { final Map<String, String> args = new HashMap<>(); args.put("ec", category); args.put("ea", action); sendPayload("event", args, flutterSdk); } public void sendEventWithSdk(@NotNull String category, @NotNull String action, @NotNull String sdkVersion) { final Map<String, String> args = new HashMap<>(); args.put("ec", category); args.put("ea", action); sendPayload("event", args, null, sdkVersion); } public void sendEventMetric(@NotNull String category, @NotNull String action, int value) { sendEventMetric(category, action, value, null); } public void sendEventMetric(@NotNull String category, @NotNull String action, int value, @Nullable FlutterSdk flutterSdk) { final Map<String, String> args = new HashMap<>(); args.put("ec", category); args.put("ea", action); args.put("ev", Integer.toString(value)); sendPayload("event", args, flutterSdk); } public void sendEvent(@NotNull String category, @NotNull String action, @NotNull String label, @NotNull String value) { final Map<String, String> args = new HashMap<>(); args.put("ec", category); args.put("ea", action); if (!label.isEmpty()) { args.put("el", label); } args.put("ev", value); sendPayload("event", args, null); } public void sendTiming(@NotNull String category, @NotNull String variable, long timeMillis) { sendEvent(category, TIMING_COMPLETE, variable, Long.toString(timeMillis)); } public void sendExpectedException(@NotNull String location, @NotNull Throwable throwable) { sendEvent("expected-exception", location + ":" + throwable.getClass().getName()); } public void sendException(@NotNull String throwableText, boolean isFatal) { String description = throwableText; description = description.replaceAll("com.intellij.openapi.", "c.i.o."); description = description.replaceAll("com.intellij.", "c.i."); if (description.length() > maxExceptionLength) { description = description.substring(0, maxExceptionLength); } final Map<String, String> args = new HashMap<>(); args.put("exd", description); if (isFatal) { args.put("'exf'", "1"); } sendPayload("exception", args, null); } private void sendPayload(@NotNull String hitType, @NotNull Map<String, String> args, @Nullable FlutterSdk flutterSdk) { sendPayload(hitType, args, flutterSdk, null); } private void sendPayload(@NotNull String hitType, @NotNull Map<String, String> args, @Nullable FlutterSdk flutterSdk, @Nullable String sdkVersion) { if (!canSend()) { return; } if (!bucket.removeDrop()) { return; } args.put("v", "1"); // protocol version args.put("ds", "app"); // specify an 'app' data source args.put("an", applicationName); args.put("av", pluginVersion); args.put("aiid", platformName); // Record the platform name as the application installer ID args.put("cd1", platformVersion); // Record the Open API version as a custom dimension // If the Flutter SDK is provided, send the SDK version in a custom dimension. if (flutterSdk != null) { final FlutterSdkVersion flutterVersion = flutterSdk.getVersion(); if (flutterVersion.getVersionText() != null) { args.put("cd2", flutterVersion.getVersionText()); } } else if (sdkVersion != null) { args.put("cd2", sdkVersion); } // Record whether this client uses bazel. if (anyProjectUsesBazel()) { args.put("cd3", "bazel"); } args.put("tid", trackingId); args.put("cid", clientId); args.put("t", hitType); try { final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); args.put("sr", screenSize.width + "x" + screenSize.height); } catch (HeadlessException he) { // ignore this - allow the tests to run when the IDE is headless } final String language = System.getProperty("user.language"); if (language != null) { args.put("ul", language); } transport.send(analyticsUrl, args); } /** * Return true if any open project is a Dart project and uses Bazel. */ private boolean anyProjectUsesBazel() { if (ApplicationManager.getApplication() == null) { return false; // In unit testing. } ProjectManager mgr = ProjectManager.getInstance(); if (mgr == null) { return false; // In unit testing. } for (Project project : mgr.getOpenProjects()) { if (project.isDisposed()) { continue; } if (DartSdk.getDartSdk(project) != null && WorkspaceCache.getInstance(project).isBazel()) { return true; } } return false; } public interface Transport { void send(@NotNull String url, @NotNull Map<String, String> values); } private static class HttpTransport implements Transport { private final QueueProcessor<Runnable> sendingQueue = QueueProcessor.createRunnableQueueProcessor(); @Nullable private static String createUserAgent() { final String locale = Locale.getDefault().toString(); if (SystemInfo.isWindows) { return "Mozilla/5.0 (Windows; Windows; Windows; " + locale + ")"; } else if (SystemInfo.isMac) { return "Mozilla/5.0 (Macintosh; Intel Mac OS X; Macintosh; " + locale + ")"; } else if (SystemInfo.isLinux) { return "Mozilla/5.0 (Linux; Linux; Linux; " + locale + ")"; } return null; } @Override public void send(@NotNull String url, @NotNull Map<String, String> values) { sendingQueue.add(() -> { try { final byte[] postDataBytes = createPostData(values); final HttpURLConnection conn = (HttpURLConnection)new URL(url).openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length)); final String userAgent = createUserAgent(); if (userAgent != null) { conn.setRequestProperty("User-Agent", userAgent); } conn.setDoOutput(true); conn.getOutputStream().write(postDataBytes); final InputStream in = conn.getInputStream(); //noinspection ResultOfMethodCallIgnored in.read(); in.close(); } catch (IOException ignore) { } }); } byte[] createPostData(@NotNull Map<String, String> values) throws UnsupportedEncodingException { final StringBuilder postData = new StringBuilder(); for (Map.Entry<String, String> param : values.entrySet()) { if (!postData.isEmpty()) { postData.append('&'); } postData.append(URLEncoder.encode(param.getKey(), StandardCharsets.UTF_8)); postData.append('='); postData.append(URLEncoder.encode(param.getValue(), StandardCharsets.UTF_8)); } return postData.toString().getBytes(StandardCharsets.UTF_8); } } // This class is intended to be used during debugging. Replacing the reference to // HttpTransport with NonTransport stops sending any data to Google Analytics, // and instead logs the number of bytes that would have been sent (minus HTTP header bytes). private static class NonTransport extends HttpTransport { private static final Logger LOG = Logger.getInstance(Analytics.class); @Override public void send(@NotNull String url, @NotNull Map<String, String> values) { try { final byte[] postDataBytes = createPostData(values); //noinspection ConstantConditions LOG.info("Sending " + postDataBytes.length + " bytes " + new String(postDataBytes)); } catch (UnsupportedEncodingException ignore) { } } } }
flutter-intellij/flutter-idea/src/io/flutter/analytics/Analytics.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/analytics/Analytics.java", "repo_id": "flutter-intellij", "token_count": 3971 }
487
/* * Copyright 2021 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.console; import com.intellij.execution.ConsoleFolding; import com.intellij.openapi.project.Project; import io.flutter.settings.FlutterSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; public class FlutterConsoleExceptionFolding extends ConsoleFolding { private static final String EXCEPTION_PREFIX = "======="; private boolean foldLines = false; private boolean foldingInProgress = false; @Override public boolean shouldFoldLine(@NotNull Project project, @NotNull String line) { final FlutterSettings settings = FlutterSettings.getInstance(); if (line.startsWith(EXCEPTION_PREFIX) && settings.isShowStructuredErrors() && !settings.isIncludeAllStackTraces()) { foldingInProgress = true; foldLines = !foldLines; return true; } return foldLines; } @Override public boolean shouldBeAttachedToThePreviousLine() { return false; } @Nullable @Override public String getPlaceholderText(@NotNull Project project, @NotNull List<String> lines) { if (foldingInProgress) { foldingInProgress = false; return lines.isEmpty() ? null : lines.get(0); // Newlines are removed, so we can only show one line. } return null; } }
flutter-intellij/flutter-idea/src/io/flutter/console/FlutterConsoleExceptionFolding.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/console/FlutterConsoleExceptionFolding.java", "repo_id": "flutter-intellij", "token_count": 465 }
488
/* * Copyright 2019 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.editor; import com.google.common.collect.HashMultimap; import com.google.common.collect.SetMultimap; import com.intellij.openapi.Disposable; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Set; public class EditorEventServiceBase<L> implements Disposable { protected interface InvokeListener<L> { void run(L listener); } private final SetMultimap<EditorEx, L> listeners = HashMultimap.create(); private final Project project; public EditorEventServiceBase(Project project) { this.project = project; Disposer.register(project, this); } protected void invokeAll(InvokeListener<L> invoke, Editor editor) { if (!(editor instanceof EditorEx)) { return; } final ArrayList<EditorEx> disposedEditors = new ArrayList<>(); for (EditorEx e : listeners.keySet()) { if (e.isDisposed()) { disposedEditors.add(e); } } for (EditorEx e : disposedEditors) { listeners.removeAll(e); } final EditorEx editorEx = (EditorEx)editor; final Set<L> matches = listeners.get(editorEx); if (matches == null || matches.isEmpty()) return; for (L listener : matches) { try { invoke.run(listener); } catch (Exception e) { // XXX log. } } } public void addListener(@NotNull EditorEx editor, @NotNull L listener, Disposable parent) { synchronized (listeners) { listeners.put(editor, listener); Disposer.register(parent, () -> removeListener(editor, listener)); } } private void removeListener(@NotNull EditorEx editor, @NotNull L listener) { synchronized (listeners) { listeners.remove(editor, listener); } } EditorEx getIfValidForProject(Editor editor) { if (editor.getProject() != project) return null; if (editor.isDisposed() || project.isDisposed()) return null; if (!(editor instanceof EditorEx)) return null; return (EditorEx)editor; } @Override public void dispose() { listeners.clear(); } }
flutter-intellij/flutter-idea/src/io/flutter/editor/EditorEventServiceBase.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/editor/EditorEventServiceBase.java", "repo_id": "flutter-intellij", "token_count": 839 }
489
/* * Copyright 2018 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.editor; import com.intellij.AppTopics; import com.intellij.application.options.CodeStyle; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.util.PsiErrorElementUtil; import com.intellij.util.messages.MessageBus; import com.intellij.util.messages.MessageBusConnection; import com.jetbrains.lang.dart.DartLanguage; import com.jetbrains.lang.dart.analyzer.DartAnalysisServerService; import com.jetbrains.lang.dart.assists.AssistUtils; import io.flutter.FlutterUtils; import io.flutter.dart.DartPlugin; import io.flutter.settings.FlutterSettings; import org.dartlang.analysis.server.protocol.SourceEdit; import org.dartlang.analysis.server.protocol.SourceFileEdit; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; /** * A manager class to run actions on save (formatting, organize imports, ...). */ public class FlutterSaveActionsManager { private static final Logger LOG = Logger.getInstance(FlutterSaveActionsManager.class); /** * Initialize the save actions manager for the given project. */ public static void init(@NotNull Project project) { // Call getInstance() will init FlutterSaveActionsManager for the given project by calling the private constructor below. getInstance(project); } @Nullable public static FlutterSaveActionsManager getInstance(@NotNull Project project) { return project.getService(FlutterSaveActionsManager.class); } private final @NotNull Project myProject; private FlutterSaveActionsManager(@NotNull Project project) { this.myProject = project; final MessageBus bus = project.getMessageBus(); final MessageBusConnection connection = bus.connect(); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeDocumentSaving(@NotNull Document document) { // Don't try and format read only docs. if (!document.isWritable()) { return; } handleBeforeDocumentSaving(document); } }); } private void handleBeforeDocumentSaving(@NotNull Document document) { final FlutterSettings settings = FlutterSettings.getInstance(); if (!settings.isFormatCodeOnSave()) { return; } if (!myProject.isInitialized() || myProject.isDisposed()) { return; } final VirtualFile file = FileDocumentManager.getInstance().getFile(document); if (file == null) { return; } if (!FlutterUtils.isDartFile(file)) { return; } final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document); if (psiFile == null || !psiFile.isValid()) { return; } final Module module = ModuleUtil.findModuleForFile(file, myProject); if (module == null) { return; } if (!DartPlugin.isDartSdkEnabled(module)) { return; } // check for errors if (PsiErrorElementUtil.hasErrors(myProject, psiFile.getVirtualFile())) { return; } if (DartAnalysisServerService.getInstance(myProject).serverReadyForRequest()) { if (settings.isOrganizeImportsOnSave()) { performOrganizeThenFormat(document, file, psiFile); } else { performFormat(document, file, false, psiFile); } } } private void performOrganizeThenFormat(@NotNull Document document, @NotNull VirtualFile file, @NotNull PsiFile psiFile) { final String filePath = file.getPath(); final SourceFileEdit fileEdit = DartAnalysisServerService.getInstance(myProject).edit_organizeDirectives(filePath); if (fileEdit != null) { ApplicationManager.getApplication().invokeLater(() -> { if (myProject.isDisposed()) { return; } new WriteCommandAction.Simple(myProject) { @Override protected void run() { if (myProject.isDisposed()) { return; } AssistUtils.applySourceEdits(myProject, file, document, fileEdit.getEdits(), Collections.emptySet()); // Committing a document here is required in order to guarantee that DartPostFormatProcessor.processText() is called afterwards. PsiDocumentManager.getInstance(myProject).commitDocument(document); // Run this in an invoke later so that we don't exeucte the initial part of performFormat in a write action. //noinspection CodeBlock2Expr ApplicationManager.getApplication().invokeLater(() -> { performFormat(document, file, true, psiFile); }); } }.execute(); }); } } private void performFormat(@NotNull Document document, @NotNull VirtualFile file, boolean reSave, @NotNull PsiFile psiFile) { final int lineLength = getRightMargin(psiFile); final DartAnalysisServerService das = DartAnalysisServerService.getInstance(myProject); das.updateFilesContent(); final DartAnalysisServerService.FormatResult formatResult = das.edit_format(file, 0, 0, lineLength); if (formatResult == null) { if (reSave) { FileDocumentManager.getInstance().saveDocument(document); } return; } ApplicationManager.getApplication().invokeLater(() -> { if (myProject.isDisposed()) { return; } new WriteCommandAction.Simple(myProject) { @Override protected void run() { if (myProject.isDisposed()) { return; } boolean didFormat = false; final List<SourceEdit> edits = formatResult.getEdits(); if (edits != null && edits.size() == 1) { final String replacement = StringUtil.convertLineSeparators(edits.get(0).getReplacement()); document.replaceString(0, document.getTextLength(), replacement); PsiDocumentManager.getInstance(myProject).commitDocument(document); didFormat = true; } // Don't perform the save in a write action - it could invoke EDT work. if (reSave || didFormat) { //noinspection CodeBlock2Expr ApplicationManager.getApplication().invokeLater(() -> { FileDocumentManager.getInstance().saveDocument(document); }); } } }.execute(); }); } private static int getRightMargin(@NotNull PsiFile psiFile) { return CodeStyle.getLanguageSettings(psiFile, DartLanguage.INSTANCE).RIGHT_MARGIN; } }
flutter-intellij/flutter-idea/src/io/flutter/editor/FlutterSaveActionsManager.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/editor/FlutterSaveActionsManager.java", "repo_id": "flutter-intellij", "token_count": 2635 }
490
/* * Copyright 2019 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.editor; import com.intellij.application.options.editor.EditorOptionsListener; import com.intellij.codeHighlighting.Pass; import com.intellij.codeHighlighting.TextEditorHighlightingPass; import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory; import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.event.CaretEvent; import com.intellij.openapi.editor.event.CaretListener; import com.intellij.openapi.editor.event.EditorEventMulticaster; import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.util.ui.EdtInvocationManager; import com.jetbrains.lang.dart.analyzer.DartAnalysisServerService; import io.flutter.FlutterUtils; import io.flutter.dart.FlutterDartAnalysisServer; import io.flutter.inspector.InspectorGroupManagerService; import io.flutter.inspector.InspectorService; import io.flutter.settings.FlutterSettings; import org.dartlang.analysis.server.protocol.FlutterOutline; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Objects; /** * Factory that drives all rendering of widget indents. * <p> * Warning: it is unsafe to register the WidgetIndentsHighlightingPassFactory * without using WidgetIndentsHighlightingPassFactoryRegistrar as recent * versions of IntelliJ will unpredictably clear out all existing highlighting * pass factories and then rerun all registrars. */ public class WidgetIndentsHighlightingPassFactory implements TextEditorHighlightingPassFactory, Disposable, DumbAware { // This is a debugging flag to track down bugs that are hard to spot if // analysis server updates are occuring at their normal rate. If there are // bugs, With this flag on you should be able to spot flickering or invalid // widget indent guide lines after editing code containing guides. private static final boolean SIMULATE_SLOW_ANALYSIS_UPDATES = false; @NotNull private final Project project; private final FlutterSettings.Listener settingsListener; private final ActiveEditorsOutlineService.Listener outlineListener; protected InspectorService inspectorService; // Current configuration settings used to display Widget Indent Guides cached from the FlutterSettings class. private boolean isShowBuildMethodGuides; // Current configuration setting used to display regular indent guides cached from EditorSettingsExternalizable. private boolean isIndentGuidesShown; @Nullable public static WidgetIndentsHighlightingPassFactory getInstance(Project project) { return project.getService(WidgetIndentsHighlightingPassFactory.class); } public WidgetIndentsHighlightingPassFactory(@NotNull Project project) { this.project = project; // TODO(jacobr): I'm not clear which Disposable it is best to tie the // lifecycle of this object. The FlutterDartAnalysisServer is chosen at // random as a Disposable with generally the right lifecycle. IntelliJ // returns a lint warning if you tie the lifecycle to the Project. this.settingsListener = this::onSettingsChanged; this.outlineListener = this::updateEditor; syncSettings(FlutterSettings.getInstance()); FlutterSettings.getInstance().addListener(settingsListener); isIndentGuidesShown = EditorSettingsExternalizable.getInstance().isIndentGuidesShown(); ApplicationManager.getApplication().getMessageBus().connect(this).subscribe( EditorOptionsListener.APPEARANCE_CONFIGURABLE_TOPIC, () -> { final boolean newValue = EditorSettingsExternalizable.getInstance().isIndentGuidesShown(); if (isIndentGuidesShown != newValue) { isIndentGuidesShown = newValue; updateAllEditors(); } }); final EditorEventMulticaster eventMulticaster = EditorFactory.getInstance().getEventMulticaster(); eventMulticaster.addCaretListener(new CaretListener() { @Override public void caretPositionChanged(@NotNull CaretEvent event) { final Editor editor = event.getEditor(); if (editor.getProject() != project) return; if (editor.isDisposed() || project.isDisposed()) return; if (!(editor instanceof EditorEx)) return; final EditorEx editorEx = (EditorEx)editor; WidgetIndentsHighlightingPass.onCaretPositionChanged(editorEx, event.getCaret()); } }, this); getEditorOutlineService().addListener(outlineListener); } @NotNull private FlutterDartAnalysisServer getAnalysisService() { return FlutterDartAnalysisServer.getInstance(project); } @NotNull private InspectorGroupManagerService getInspectorGroupManagerService() { return InspectorGroupManagerService.getInstance(project); } @NotNull private EditorMouseEventService getEditorEventService() { return EditorMouseEventService.getInstance(project); } @NotNull private EditorPositionService getEditorPositionService() { return EditorPositionService.getInstance(project); } @NotNull private ActiveEditorsOutlineService getEditorOutlineService() { return ActiveEditorsOutlineService.getInstance(project); } /** * Updates all editors if the settings have changed. * <p> * This is useful for adding the guides in after they were turned on from the settings menu. */ private void syncSettings(FlutterSettings settings) { if (isShowBuildMethodGuides != settings.isShowBuildMethodGuides()) { isShowBuildMethodGuides = settings.isShowBuildMethodGuides(); updateAllEditors(); } } /** * Updates the indent guides in the editor for the file at {@param path}. */ private void updateEditor(@NotNull final String path, @Nullable FlutterOutline outline) { ApplicationManager.getApplication().invokeLater(() -> { if (project.isDisposed()) { return; } for (EditorEx editor : getEditorOutlineService().getActiveDartEditors()) { final String filePath = editor.getVirtualFile().getCanonicalPath(); if (!editor.isDisposed() && Objects.equals(filePath, path)) { runWidgetIndentsPass(editor, outline); } } }); } // Updates all editors instead of just a specific editor. private void updateAllEditors() { ApplicationManager.getApplication().invokeLater(() -> { // Find visible editors for the path. If the file is not actually // being displayed on screen, there is no need to go through the // work of updating the outline. if (project.isDisposed()) { return; } for (EditorEx editor : getEditorOutlineService().getActiveDartEditors()) { if (!editor.isDisposed()) { runWidgetIndentsPass(editor, getEditorOutlineService().getOutline(editor.getVirtualFile().getCanonicalPath())); } } }); } @Nullable @Override public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull Editor e) { // Surprisingly, the highlighting pass returned by this method isn't the // highlighting pass to display the indent guides. It is the highlighting // pass that display regular indent guides for Dart files that filters out // indent guides that intersect with the widget indent guides. because // the widget indent guides are powered by the Dart Analyzer, computing the // widget indent guides themselves must be done asynchronously driven by // analysis server updates not IntelliJ's default assumptions about how a // text highlighting pass should work. See runWidgetIndentsPass for the // logic that handles the actual widget indent guide pass. if (file.getVirtualFile() == null) return null; if (!FlutterUtils.isDartFile(file.getVirtualFile())) { return null; } if (!isShowBuildMethodGuides) { ApplicationManager.getApplication().invokeLater(() -> { // Reset the editor back to its default indent guide setting as build // method guides are disabled and the file is a dart file. e.getSettings().setIndentGuidesShown(isIndentGuidesShown); // Cleanup custom filtered build method guides that may be left around // from when our custom filtered build method guides were previously // shown. This cleanup is very cheap if it has already been performed // so there is no harm in performing it more than once. FilteredIndentsHighlightingPass.cleanupHighlighters(e); }); return null; } // If we are showing build method guides we can never show the regular // IntelliJ indent guides for a file because they will overlap with the // widget indent guides in distracting ways. if (EdtInvocationManager.getInstance().isEventDispatchThread()) { e.getSettings().setIndentGuidesShown(false); } else { ApplicationManager.getApplication().invokeLater(() -> { if (!e.isDisposed()) { e.getSettings().setIndentGuidesShown(false); } }); } // If regular indent guides should be shown we need to show the filtered // indents guides which look like the regular indent guides except that // guides that intersect with the widget guides are filtered out. final TextEditorHighlightingPass highlightingPass; if (isIndentGuidesShown) { highlightingPass = new FilteredIndentsHighlightingPass(project, e, file); } else { highlightingPass = null; // The filtered pass might have been shown before in which case we need to clean it up. // Cleanup custom filtered build method guides that may be left around // from when our custom filtered build method guides were previously // shown. This cleanup is very cheap if it has already been performed // so there is no harm in performing it more than once. FilteredIndentsHighlightingPass.cleanupHighlighters(e); } if (!(e instanceof EditorEx)) return highlightingPass; final EditorEx editor = (EditorEx)e; final VirtualFile virtualFile = editor.getVirtualFile(); if (!FlutterUtils.couldContainWidgets(virtualFile)) { return highlightingPass; } final FlutterOutline outline = getEditorOutlineService().getOutline(virtualFile.getCanonicalPath()); if (outline != null) { ApplicationManager.getApplication().invokeLater(() -> runWidgetIndentsPass(editor, outline)); } return highlightingPass; } void runWidgetIndentsPass(EditorEx editor, FlutterOutline outline) { if (editor.isDisposed() || project.isDisposed()) { // The editor might have been disposed before we got a new FlutterOutline. // It is safe to ignore it as it isn't relevant. return; } if (!isShowBuildMethodGuides || outline == null) { // If build method guides are disabled or there is no outline to use in this pass, // then do nothing. WidgetIndentsHighlightingPass.cleanupHighlighters(editor); return; } final VirtualFile file = editor.getVirtualFile(); if (!FlutterUtils.couldContainWidgets(file)) { return; } // If the editor and the outline have different lengths then // the outline is out of date and cannot safely be displayed. final DocumentEx document = editor.getDocument(); final int documentLength = document.getTextLength(); final int outlineLength = outline.getLength(); // TODO(jacobr): determine why we sometimes have to check against both the // raw outlineLength and the converted outline length for things to work // correctly on windows. if (documentLength != outlineLength && documentLength != DartAnalysisServerService.getInstance(project).getConvertedOffset(file, outlineLength)) { // Outline is out of date. That is ok. Ignore it for now. // An up to date outline will probably arrive shortly. Showing an // outline from data inconsistent with the current // content will show annoying flicker. It is better to // instead return; } // We only need to convert offsets when the document and outline disagree // on the document length. final boolean convertOffsets = documentLength != outlineLength; WidgetIndentsHighlightingPass.run( project, editor, outline, getAnalysisService(), getInspectorGroupManagerService(), getEditorEventService(), getEditorPositionService(), convertOffsets ); } @Override public void dispose() { FlutterSettings.getInstance().removeListener(settingsListener); getEditorOutlineService().removeListener(outlineListener); } void onSettingsChanged() { if (project.isDisposed()) { return; } final FlutterSettings settings = FlutterSettings.getInstance(); // Skip if none of the settings that impact Widget Idents were changed. if (isShowBuildMethodGuides == settings.isShowBuildMethodGuides()) { // Change doesn't matter for us. return; } syncSettings(settings); } public void registerHighlightingPassFactory(@NotNull TextEditorHighlightingPassRegistrar registrar) { registrar .registerTextEditorHighlightingPass(this, TextEditorHighlightingPassRegistrar.Anchor.AFTER, Pass.UPDATE_FOLDING, false, false); } }
flutter-intellij/flutter-idea/src/io/flutter/editor/WidgetIndentsHighlightingPassFactory.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/editor/WidgetIndentsHighlightingPassFactory.java", "repo_id": "flutter-intellij", "token_count": 4271 }
491
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.inspector; import com.google.gson.JsonObject; import com.intellij.openapi.Disposable; import com.intellij.openapi.diagnostic.Logger; import com.intellij.util.Alarm; import com.intellij.xdebugger.XSourcePosition; import io.flutter.utils.StreamSubscription; import io.flutter.vmService.DartVmServiceDebugProcess; import io.flutter.vmService.VMServiceManager; import org.dartlang.vm.service.VmService; import org.dartlang.vm.service.consumer.EvaluateConsumer; import org.dartlang.vm.service.consumer.GetIsolateConsumer; import org.dartlang.vm.service.consumer.GetObjectConsumer; import org.dartlang.vm.service.consumer.ServiceExtensionConsumer; import org.dartlang.vm.service.element.*; import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.Set; import java.util.concurrent.*; import java.util.function.Supplier; /** * Invoke methods from a specified Dart library using the observatory protocol. */ public class EvalOnDartLibrary implements Disposable { private static final Logger LOG = Logger.getInstance(EvalOnDartLibrary.class); private final StreamSubscription<IsolateRef> subscription; private final ScheduledThreadPoolExecutor delayer; private String isolateId; private final VmService vmService; @SuppressWarnings("FieldCanBeLocal") private final VMServiceManager vmServiceManager; private final Set<String> libraryNames; CompletableFuture<LibraryRef> libraryRef; private final Alarm myRequestsScheduler; static final int DEFAULT_REQUEST_TIMEOUT_SECONDS = 10; /** * For robustness we ensure at most one pending request is issued at a time. */ private CompletableFuture<?> allPendingRequestsDone; private final Object pendingRequestLock = new Object(); /** * Public so that other related classes such as InspectorService can ensure their * requests are in a consistent order with requests which eliminates otherwise * surprising timing bugs such as if a request to dispose an * InspectorService.ObjectGroup was issued after a request to read properties * from an object in a group but the request to dispose the object group * occurred first. * <p> * The design is we have at most 1 pending request at a time. This sacrifices * some throughput with the advantage of predictable semantics and the benefit * that we are able to skip large numbers of requests if they happen to be * from groups of objects that should no longer be kept alive. * <p> * The optional ObjectGroup specified by isAlive, indicates whether the * request is still relevant or should be cancelled. This is an optimization * for the Inspector to avoid overloading the service with stale requests if * the user is quickly navigating through the UI generating lots of stale * requests to view specific details subtrees. */ public <T> CompletableFuture<T> addRequest(InspectorService.ObjectGroup isAlive, String requestName, Supplier<CompletableFuture<T>> request) { if (isAlive != null && isAlive.isDisposed()) { return CompletableFuture.completedFuture(null); } if (myRequestsScheduler.isDisposed()) { return CompletableFuture.completedFuture(null); } // Future that completes when the request has finished. final CompletableFuture<T> response = new CompletableFuture<>(); // This is an optimization to avoid sending stale requests across the wire. final Runnable wrappedRequest = () -> { if (isAlive != null && isAlive.isDisposed()) { response.complete(null); return; } try { // No need to timeout until the request has actually started. timeoutAfter(response, DEFAULT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS, requestName); } catch (CompletionException ex) { response.completeExceptionally(ex); } final CompletableFuture<T> future = request.get(); future.whenCompleteAsync((v, t) -> { if (t != null) { response.completeExceptionally(t); } else { response.complete(v); } }); }; synchronized (pendingRequestLock) { if (allPendingRequestsDone == null || allPendingRequestsDone.isDone()) { allPendingRequestsDone = response; myRequestsScheduler.addRequest(wrappedRequest, 0); } else { final CompletableFuture<?> previousDone = allPendingRequestsDone; allPendingRequestsDone = response; // Actually schedule this request only after the previous request completes. previousDone.whenCompleteAsync((v, error) -> { if (myRequestsScheduler.isDisposed()) { response.complete(null); } else { myRequestsScheduler.addRequest(wrappedRequest, 0); } }); } } return response; } public EvalOnDartLibrary(Set<String> libraryNames, VmService vmService, VMServiceManager vmServiceManager) { this.libraryNames = libraryNames; this.vmService = vmService; this.vmServiceManager = vmServiceManager; this.myRequestsScheduler = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, this); libraryRef = new CompletableFuture<>(); subscription = vmServiceManager.getCurrentFlutterIsolate((isolate) -> { if (libraryRef.isDone()) { libraryRef = new CompletableFuture<>(); } if (isolate != null) { initialize(isolate.getId()); } }, true); delayer = new ScheduledThreadPoolExecutor(1); } public String getIsolateId() { return isolateId; } CompletableFuture<LibraryRef> getLibraryRef() { return libraryRef; } public void dispose() { subscription.dispose(); // TODO(jacobr): complete all pending futures as cancelled? } public CompletableFuture<JsonObject> invokeServiceMethod(String method, JsonObject params) { final CompletableFuture<JsonObject> ret = new CompletableFuture<>(); timeoutAfter(ret, DEFAULT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS, "service method " + method); vmService.callServiceExtension(isolateId, method, params, new ServiceExtensionConsumer() { @Override public void onError(RPCError error) { ret.completeExceptionally(new RuntimeException(error.getMessage())); } @Override public void received(JsonObject object) { ret.complete(object); } }); return ret; } // TODO(jacobr): remove this method after we switch to Java9+ which supports this method directly on CompletableFuture. private void timeoutAfter(CompletableFuture<?> future, long timeout, TimeUnit unit, String operationName) { // Create the timeout exception now, so we can capture the stack trace of the caller. final TimeoutException timeoutException = new TimeoutException(operationName); delayer.schedule(() -> future.completeExceptionally(timeoutException), timeout, unit); } public CompletableFuture<InstanceRef> eval(String expression, Map<String, String> scope, InspectorService.ObjectGroup isAlive) { return addRequest(isAlive, "evaluate", () -> { final CompletableFuture<InstanceRef> future = new CompletableFuture<>(); libraryRef.thenAcceptAsync((LibraryRef ref) -> vmService.evaluate( getIsolateId(), ref.getId(), expression, scope, true, new EvaluateConsumer() { @Override public void onError(RPCError error) { future.completeExceptionally( new EvalException(expression, Integer.toString(error.getCode()), error.getMessage())); } @Override public void received(ErrorRef response) { future.completeExceptionally( new EvalException(expression, response.getKind().name(), response.getMessage())); } @Override public void received(InstanceRef response) { future.complete(response); } @Override public void received(Sentinel response) { future.completeExceptionally( new EvalException(expression, "Sentinel", response.getValueAsString())); } } )); return future; }); } @SuppressWarnings("unchecked") public <T extends Obj> CompletableFuture<T> getObjectHelper(ObjRef instance, InspectorService.ObjectGroup isAlive) { return addRequest(isAlive, "getObject", () -> { final CompletableFuture<T> future = new CompletableFuture<>(); vmService.getObject( getIsolateId(), instance.getId(), new GetObjectConsumer() { @Override public void onError(RPCError error) { future.completeExceptionally(new RuntimeException("RPCError calling getObject: " + error.toString())); } @Override public void received(Obj response) { future.complete((T)response); } @Override public void received(Sentinel response) { future.completeExceptionally(new RuntimeException("Sentinel calling getObject: " + response.toString())); } } ); return future; }); } @NotNull public CompletableFuture<XSourcePosition> getSourcePosition(DartVmServiceDebugProcess debugProcess, ScriptRef script, int tokenPos, InspectorService.ObjectGroup isAlive) { return addRequest(isAlive, "getSourcePosition", () -> CompletableFuture.completedFuture(debugProcess.getSourcePosition(isolateId, script, tokenPos))); } public CompletableFuture<Instance> getInstance(InstanceRef instance, InspectorService.ObjectGroup isAlive) { return getObjectHelper(instance, isAlive); } public CompletableFuture<Library> getLibrary(LibraryRef instance, InspectorService.ObjectGroup isAlive) { return getObjectHelper(instance, isAlive); } public CompletableFuture<ClassObj> getClass(ClassRef instance, InspectorService.ObjectGroup isAlive) { return getObjectHelper(instance, isAlive); } public CompletableFuture<Func> getFunc(FuncRef instance, InspectorService.ObjectGroup isAlive) { return getObjectHelper(instance, isAlive); } public CompletableFuture<Instance> getInstance(CompletableFuture<InstanceRef> instanceFuture, InspectorService.ObjectGroup isAlive) { return instanceFuture.thenComposeAsync((instance) -> getInstance(instance, isAlive)); } private JsonObject convertMapToJsonObject(Map<String, String> map) { final JsonObject obj = new JsonObject(); for (String key : map.keySet()) { obj.addProperty(key, map.get(key)); } return obj; } private void initialize(String isolateId) { this.isolateId = isolateId; vmService.getIsolate(isolateId, new GetIsolateConsumer() { @Override public void received(Isolate response) { for (LibraryRef library : response.getLibraries()) { if (libraryNames.contains(library.getUri())) { libraryRef.complete(library); return; } } libraryRef.completeExceptionally(new RuntimeException("No library matching " + libraryNames + " found.")); } @Override public void onError(RPCError error) { libraryRef.completeExceptionally(new RuntimeException("RPCError calling getIsolate:" + error.toString())); } @Override public void received(Sentinel response) { libraryRef.completeExceptionally(new RuntimeException("Sentinel calling getIsolate:" + response.toString())); } }); } }
flutter-intellij/flutter-idea/src/io/flutter/inspector/EvalOnDartLibrary.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/inspector/EvalOnDartLibrary.java", "repo_id": "flutter-intellij", "token_count": 4292 }
492
/* * Copyright 2018 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.inspector; import com.intellij.openapi.Disposable; import com.intellij.ui.components.JBScrollBar; import gnu.trove.THashSet; import io.flutter.utils.animation.Curve; import io.flutter.utils.animation.Curves; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.List; import java.util.Set; import static java.lang.Math.abs; import static java.lang.Math.max; /** * This class provides animated scrolling of tree views. * <p> * If autoHorizontalScroll is true, the tree automatically scrolls horizontally * to keep as many rows as possible in view any time the tree scrolls vertically. * <p> * All scrolling operations are animated to improve usability. */ public class TreeScrollAnimator implements Disposable { private final InspectorTree tree; private final JScrollPane scrollPane; private final Timer timer; private final Timer scrollIdleTimer; private Set<TreePath> targets; private long animationStartTime; private final LockableScrollbar[] scrollbars = { new LockableScrollbar(JScrollBar.HORIZONTAL), new LockableScrollbar(JScrollBar.VERTICAL) }; /** * Last time the user initiated a scroll using a scrollbar. */ private long lastScrollTime; /** * To avoid bad interactions when autoHorizontalScroll is true, we only * allow one scrollbar to be active at a time. * <p> * Allowed values: * * JScrollBar.NO_ORIENTATION neither scrollback currently active. The next * active scroll directionwins. * * JScrollBar.VERTICAL the vertical scrollbaris active and the horizontal * scrollbar is locked. * * JScrollBar.HORIZONTAL the horizontal scrollbaris active and the vertical * scrollbar is locked. * * JScrollBar.ABORT both scrollbar are locked. */ private int activeScrollbar = JScrollBar.NO_ORIENTATION; /** * Duration of current animation. */ double animationDuration; /** * Minumum amount to attempt to keep the left side of the tree indented by. */ static final double TARGET_LEFT_INDENT = 25.0; /** * Min delay before changes from switching horizontally to vertically and * vice versa are allowed. This is to avoid accidental undesirable mouse * wheel based scrolls. */ static final int MS_DELAY_BEFORE_CHANGING_SCROLL_AXIS = 150; static final int DEFAULT_ANIMATION_DURATION = 150; /** * Animation duration if we are only changing the X axis and not the Y axis. */ static final int DEFAULT_ANIMATE_X_DURATION = 80; private Point animationStart; private Point animationEnd; private Curve animationCurve; private boolean scrollTriggeredAnimator = false; /** * Last observed scroll position of the scrollPane. */ private Point scrollPosition; private boolean autoHorizontalScroll; /** * Scrollbar that can be locked to prevent accidental user scrolls triggered * by the touchpad. * <p> * The purpose of this class is to improve behavior handling mouse wheel * scroll triggered by a trackpad where it can be easy to accidentally * trigger both horizontal and vertical scroll. This class can be used to * help avoid spurious scroll in that case. Unfortunately, the UI is redrawn * for one frame before we would have a chance to reset the scroll position * so we have to solve locking scroll this way instead of by resetting * spurious scrolls after we get an onScroll event. * Using JScrollPane.setHorizontalScrollBarPolicy cannot achieve the desired * effect because toggling that option on and off results in Swing scrolling * the UI to try to be clever about which UI is in view. */ private static class LockableScrollbar extends JBScrollBar { boolean allowScroll; LockableScrollbar(int orientation) { super(orientation); allowScroll = true; } void setAllowScroll(boolean value) { allowScroll = value; } @Override public boolean isVisible() { return allowScroll && super.isVisible(); } } public TreeScrollAnimator(InspectorTree tree, JScrollPane scrollPane) { this.tree = tree; this.scrollPane = scrollPane; // Our target of 60fps is perhaps a bit ambitious given the rendering // pipeline used by IntelliJ. timer = new Timer(1000 / 60, this::onFrame); scrollIdleTimer = new Timer(MS_DELAY_BEFORE_CHANGING_SCROLL_AXIS, this::onScrollIdle); scrollPane.setHorizontalScrollBar(scrollbars[JScrollBar.HORIZONTAL]); scrollPane.setVerticalScrollBar(scrollbars[JScrollBar.VERTICAL]); // TODO(jacobr): is this useful? scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setAutoscrolls(false); tree.setScrollsOnExpand(false); scrollPane.getVerticalScrollBar().getModel().addChangeListener(this::verticalScrollChanged); scrollPane.getHorizontalScrollBar().getModel().addChangeListener(this::horizontalScrollChanged); scrollPosition = scrollPane.getViewport().getViewPosition(); computeScrollPosition(); } public void setAutoHorizontalScroll(boolean autoHorizontalScroll) { this.autoHorizontalScroll = autoHorizontalScroll; if (autoHorizontalScroll) { applyAutoHorizontalScroll(); } else if (!timer.isRunning()) { setActiveScrollbar(JScrollBar.NO_ORIENTATION); } } private void computeScrollPosition() { scrollPosition = new Point(scrollbars[JScrollBar.HORIZONTAL].getModel().getValue(), scrollbars[JScrollBar.VERTICAL].getModel().getValue()); } private void handleScrollChanged() { final Point last = scrollPosition; computeScrollPosition(); if (!autoHorizontalScroll) { return; } final int dx = scrollPosition.x - last.x; final int dy = scrollPosition.y - last.y; if (dx == 0 && dy == 0) { return; } if (scrollTriggeredAnimator || timer.isRunning()) { return; } final int orientation = abs(dy) >= abs(dx) ? JScrollBar.VERTICAL : JScrollBar.HORIZONTAL; if (activeScrollbar != JScrollBar.NO_ORIENTATION && activeScrollbar != orientation) { // This should only occur if vertical and horizontal scrolling was initiated at the same time. return; } lastScrollTime = System.currentTimeMillis(); setActiveScrollbar(orientation); scrollIdleTimer.restart(); } private void setActiveScrollbar(int orientation) { if (activeScrollbar != orientation) { activeScrollbar = orientation; if (orientation == JScrollBar.ABORT) { for (int axis = 0; axis <= 1; ++axis) { scrollbars[axis].setAllowScroll(false); } } else { for (int axis = 0; axis <= 1; ++axis) { final int otherAxis = 1 - axis; scrollbars[axis].setAllowScroll(orientation != otherAxis); } } } } private void horizontalScrollChanged(ChangeEvent e) { handleScrollChanged(); } private void verticalScrollChanged(ChangeEvent e) { handleScrollChanged(); if (targets != null || scrollTriggeredAnimator) { return; } if (autoHorizontalScroll) { applyAutoHorizontalScroll(); } } private void applyAutoHorizontalScroll() { animateToX(calculateTargetX(scrollPosition, null)); } private int calculateTargetX(Point candidate, TreePath selectionPath) { final int rowStart = tree.getClosestRowForLocation(candidate.x, candidate.y); final int rowEnd = tree.getClosestRowForLocation(candidate.x, candidate.y + scrollPane.getHeight() - 1); Rectangle union = null; int selectedRow = -1; if (selectionPath != null) { selectedRow = tree.getRowForPath(selectionPath); } else { final int[] rows = tree.getSelectionRows(); selectedRow = rows != null && rows.length > 0 ? rows[0] : selectedRow; } Rectangle selectedBounds = null; for (int i = rowStart; i <= rowEnd; ++i) { final Rectangle bounds = tree.getRowBounds(i); if (i == selectedRow) { selectedBounds = bounds; } union = union == null ? bounds : union.union(bounds); } if (union == null) { // No rows in view. return 0; } int targetX = Math.max(union.x - (int)TARGET_LEFT_INDENT, 0); if (selectedBounds != null) { // Using the actual selection width which depends on the contents of the nodes // results in jumpy and distracting UI so we use a fake selection width // instead so scrolling behavior is more stable. final int selectionWidth = Math.min(scrollPane.getViewport().getWidth() / 2, 100); final Interval xAxis = clampInterval( new Interval(selectedBounds.x, selectionWidth), new Interval(targetX, selectedBounds.x + selectionWidth - targetX), scrollPane.getViewport().getWidth()); targetX = xAxis.start; } return targetX; } private void animateToX(int x) { targets = null; computeScrollPosition(); animationStart = scrollPosition; setActiveScrollbar(JScrollBar.VERTICAL); animationEnd = new Point(x, animationStart.y); final long currentTime = System.currentTimeMillis(); if (!timer.isRunning()) { animationCurve = Curves.LINEAR; animationDuration = DEFAULT_ANIMATE_X_DURATION; } else { // We have the same target but that target's position has changed. // Adjust the animation duration to account for the time we have left // ensuring the animation proceeds for at least half the default animation // duration. animationDuration = Math.max(DEFAULT_ANIMATE_X_DURATION / 2.0, animationDuration - (currentTime - animationStartTime)); // Ideally we would manage the velocity keeping it consistent // with the existing velocity at the animationStart of the animation // but this is good enough. We use EASE_OUT assuming the // animation was already at a moderate speed when the // destination position was updated. animationCurve = Curves.LINEAR; } animationStartTime = currentTime; if (!timer.isRunning()) { timer.start(); } } public static class Interval { Interval(int start, int length) { this.start = start; this.length = length; } final int start; final int length; @Override public String toString() { return "Interval(" + start + ", " + length + ")"; } @Override public boolean equals(Object o) { if (!(o instanceof Interval)) { return false; } final Interval interval = (Interval)o; return interval.start == start && interval.length == length; } } /** * Determines the best interval that does not exceed clampLength * and includes the required interval and as much content from * the ideal interval as possible. The clamped interval is expanded * proportionally in both directions to reach the size of the ideal * interval. * <p> * The required interval must be inside the ideal interval. */ static Interval clampInterval(Interval required, Interval ideal, int clampLength) { if (required.start < ideal.start || required.start + required.length > ideal.start + ideal.length || required.length < 0 || ideal.length < 0 || clampLength < 0) { // The required bounds must not be outside the ideal bounds. throw new IllegalArgumentException(); } if (ideal.length <= clampLength) { return ideal; } final double extraSpace = clampLength - required.length; if (extraSpace <= 0) { // Required bounds don't even fully fit. Ensure we include the start // coordinate in the required bounds. return new Interval(required.start, clampLength); } // Primary bounds fit. Expand the bounds proportionally both before and after the primaryBounds; final double desiredSpace = ideal.length - required.length; return new Interval(Curves.LINEAR.interpolate(required.start, ideal.start, extraSpace / desiredSpace), clampLength); } public void animateTo(Rectangle rect) { final int firstRow = tree.getClosestRowForLocation(rect.x, rect.y); final int lastRow = tree.getClosestRowForLocation(rect.x, rect.y + rect.height); final List<TreePath> targets = new ArrayList<>(); final int[] selectionRows = tree.getSelectionRows(); final int selectedRow = selectionRows != null && selectionRows.length > 0 ? selectionRows[0] : -1; if (selectedRow > firstRow && selectedRow <= lastRow) { // Add the selected row first so it is the priority to include targets.add(tree.getPathForRow(selectedRow)); } for (int row = firstRow; row <= lastRow; ++row) { if (row != selectedRow) { targets.add(tree.getPathForRow(row)); } } animateTo(targets); } public void animateTo(List<TreePath> targets) { if (targets == null || targets.isEmpty()) { return; } Rectangle bounds = tree.getPathBounds(targets.get(0)); if (bounds == null) { // The target is the child of a collapsed node. return; } final Rectangle primaryBounds = bounds; boolean newTarget = true; if (this.targets != null) { for (TreePath target : targets) { if (this.targets.contains(target)) { newTarget = false; break; } } } animationStart = scrollPane.getViewport().getViewPosition(); // Grow bound up to half the width of the window to the left so that // connections to ancestors are still visible. Otherwise, the window could // get scrolled so that ancestors are all hidden with the new target placed // on the left side of the window. final double minX = max(0.0, bounds.getMinX() - Math.min(scrollPane.getWidth() * 0.5, TARGET_LEFT_INDENT)); final double maxX = bounds.getMaxX(); final double y = bounds.getMinY(); final double height = bounds.getHeight(); bounds.setRect(minX, y, maxX - minX, height); // Add secondary targets to the bounding rectangle. for (int i = 1; i < targets.size(); i++) { final Rectangle secoundaryBounds = tree.getPathBounds(targets.get(i)); if (secoundaryBounds != null) { bounds = bounds.union(secoundaryBounds); } } // We need to clarify that we care most about keeping the top left corner // of the primary bounds in view by clamping if our bounds are larger than the viewport. final Interval xAxis = clampInterval( new Interval(primaryBounds.x, primaryBounds.width), new Interval(bounds.x, bounds.width), scrollPane.getViewport().getWidth()); final Interval yAxis = clampInterval( new Interval(primaryBounds.y, primaryBounds.height), new Interval(bounds.y, bounds.height), scrollPane.getViewport().getHeight()); bounds.setBounds(xAxis.start, yAxis.start, xAxis.length, yAxis.length); scrollTriggeredAnimator = true; if (timer.isRunning()) { // Compute where to scroll to show the target bounds from the location // the currend animation ends at. scrollPane.getViewport().setViewPosition(animationEnd); } tree.immediateScrollRectToVisible(bounds); animationEnd = scrollPane.getViewport().getViewPosition(); if (autoHorizontalScroll) { // Post process the position so we are 100% consistent with the algorithm // used for automatic horizontal scroll. int targetX = calculateTargetX(animationEnd, targets.get(0)); animationEnd = new Point(targetX, animationEnd.y); } scrollPane.getViewport().setViewPosition(animationStart); scrollTriggeredAnimator = false; if (animationStart.y == animationEnd.y && animationStart.x == animationEnd.x) { // No animation required. return; } this.targets = new THashSet<>(targets); final long currentTime = System.currentTimeMillis(); if (newTarget) { animationCurve = Curves.EASE_IN_OUT; animationDuration = DEFAULT_ANIMATION_DURATION; } else { // We have the same target but that target's position has changed. // Adjust the animation duration to account for the time we have left // ensuring the animation proceeds for at least half the default animation // duration. animationDuration = Math.max(DEFAULT_ANIMATION_DURATION / 2.0, animationDuration - (currentTime - animationStartTime)); // Ideally we would manage the velocity keeping it consistent // with the existing velocity at the animationStart of the animation // but this is good enough. We use EASE_OUT assuming the // animation was already at a moderate speed when the // destination position was updated. animationCurve = Curves.EASE_OUT; } animationStartTime = currentTime; setActiveScrollbar(JScrollBar.ABORT); if (!timer.isRunning()) { timer.start(); } } private void setScrollPosition(int x, int y) { scrollPosition = new Point(x, y); scrollTriggeredAnimator = true; scrollPane.getViewport().setViewPosition(scrollPosition); scrollTriggeredAnimator = false; } private void onFrame(ActionEvent e) { final long now = System.currentTimeMillis(); final long delta = now - animationStartTime; final double fraction = Math.min((double)delta / animationDuration, 1.0); final boolean animateX = animationStart.x != animationEnd.x; final boolean animateY = animationStart.y != animationEnd.y; final Point current = scrollPane.getViewport().getViewPosition(); final int x = animateX ? animationCurve.interpolate(animationStart.x, animationEnd.x, fraction) : current.x; final int y = animateY ? animationCurve.interpolate(animationStart.y, animationEnd.y, fraction) : current.y; setScrollPosition(x, y); if (fraction >= 1.0) { targets = null; setActiveScrollbar(JScrollBar.NO_ORIENTATION); timer.stop(); } } private void onScrollIdle(ActionEvent e) { if (activeScrollbar != JScrollBar.ABORT && !timer.isRunning()) { setActiveScrollbar(JScrollBar.NO_ORIENTATION); } } @Override public void dispose() { if (timer.isRunning()) { timer.stop(); } if (scrollIdleTimer.isRunning()) { scrollIdleTimer.stop(); } } }
flutter-intellij/flutter-idea/src/io/flutter/inspector/TreeScrollAnimator.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/inspector/TreeScrollAnimator.java", "repo_id": "flutter-intellij", "token_count": 6317 }
493
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.module.settings; import com.intellij.ide.util.projectWizard.SettingsStep; import com.intellij.openapi.ui.DialogPanel; import com.intellij.ui.DocumentAdapter; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import io.flutter.FlutterBundle; import io.flutter.FlutterUtils; import io.flutter.module.FlutterProjectType; import io.flutter.sdk.FlutterCreateAdditionalSettings; import io.flutter.sdk.FlutterSdk; import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.border.AbstractBorder; import javax.swing.event.DocumentEvent; import java.awt.*; import java.awt.event.ItemEvent; import java.util.function.Supplier; public class FlutterCreateAdditionalSettingsFields { private final FlutterCreateAdditionalSettings settings; private final JTextField orgField; private final JTextField descriptionField; private final RadiosForm androidLanguageRadios; private final RadiosForm iosLanguageRadios; private final ProjectType projectTypeForm; private final PlatformsForm platformsForm; private final FlutterCreateParams createParams; private SettingsHelpForm helpForm; @SuppressWarnings("FieldCanBeLocal") private DialogPanel panel; public FlutterCreateAdditionalSettingsFields(FlutterCreateAdditionalSettings additionalSettings, Supplier<? extends FlutterSdk> getSdk) { settings = additionalSettings; projectTypeForm = new ProjectType(getSdk); projectTypeForm.addListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { FlutterProjectType type = projectTypeForm.getType(); settings.setType(type); changeVisibility(type); } }); orgField = new JTextField(); orgField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { settings.setOrg(orgField.getText()); } }); orgField.setText(FlutterBundle.message("flutter.module.create.settings.org.default_text")); orgField.setToolTipText(FlutterBundle.message("flutter.module.create.settings.org.tip")); descriptionField = new JTextField(); descriptionField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { settings.setDescription(descriptionField.getText()); } }); descriptionField.setToolTipText(FlutterBundle.message("flutter.module.create.settings.description.tip")); descriptionField.setText(FlutterBundle.message("flutter.module.create.settings.description.default_text")); androidLanguageRadios = new RadiosForm(FlutterBundle.message("flutter.module.create.settings.radios.android.java"), FlutterBundle.message("flutter.module.create.settings.radios.android.kotlin")); androidLanguageRadios.addItemListener( e -> { final boolean isJavaSelected = e.getStateChange() == ItemEvent.SELECTED; settings.setKotlin(!isJavaSelected); } ); androidLanguageRadios.setToolTipText(FlutterBundle.message("flutter.module.create.settings.radios.android.tip")); iosLanguageRadios = new RadiosForm(FlutterBundle.message("flutter.module.create.settings.radios.ios.object_c"), FlutterBundle.message("flutter.module.create.settings.radios.ios.swift")); androidLanguageRadios.addItemListener( e -> { final boolean isObjcSelected = e.getStateChange() == ItemEvent.SELECTED; settings.setSwift(!isObjcSelected); } ); iosLanguageRadios.setToolTipText(FlutterBundle.message("flutter.module.create.settings.radios.ios.tip")); platformsForm = new PlatformsForm(); createParams = new FlutterCreateParams(); } private void changeVisibility(FlutterProjectType projectType) { boolean areLanguageFeaturesVisible = projectType != FlutterProjectType.PACKAGE && projectType != FlutterProjectType.MODULE; if (helpForm != null) { // Only in Android Studio. helpForm.adjustContrast(projectType); } orgField.setEnabled(projectType != FlutterProjectType.PACKAGE); UIUtil.setEnabled(androidLanguageRadios.getComponent(), areLanguageFeaturesVisible, true, true); UIUtil.setEnabled(iosLanguageRadios.getComponent(), areLanguageFeaturesVisible, true, true); UIUtil.setEnabled(platformsForm.getComponent(), areLanguageFeaturesVisible, true, true); } private void changeSettingsItemVisibility(JComponent component, boolean areLanguageFeaturesVisible) { // Note: This requires implementation knowledge of SettingsStep.addSettingsField(), which could change. if (component.getParent() == null) { return; } Component[] components = component.getParent().getComponents(); int index; for (index = 0; index < components.length; index++) { if (components[index] == component) { break; } } Component label = components[index - 1]; component.setVisible(areLanguageFeaturesVisible); label.setVisible(areLanguageFeaturesVisible); } public void addSettingsFields(@NotNull SettingsStep settingsStep) { settingsStep.addSettingsField(FlutterBundle.message("flutter.module.create.settings.description.label"), descriptionField); settingsStep.addSettingsField(FlutterBundle.message("flutter.module.create.settings.type.label"), projectTypeForm.getComponent()); settingsStep.addSettingsField(FlutterBundle.message("flutter.module.create.settings.radios.org.label"), orgField); addBorder(androidLanguageRadios.getComponent(), false); settingsStep.addSettingsField(FlutterBundle.message("flutter.module.create.settings.radios.android.label"), androidLanguageRadios.getComponent()); addBorder(iosLanguageRadios.getComponent(), false); settingsStep.addSettingsField(FlutterBundle.message("flutter.module.create.settings.radios.ios.label"), iosLanguageRadios.getComponent()); panel = platformsForm.panel(settings); addBorder(panel, true); settingsStep.addSettingsField(FlutterBundle.message("flutter.module.create.settings.platforms.label"), panel); if (!FlutterUtils.isAndroidStudio()) { // In IntelliJ the help form appears on the second page of the wizard, along with the project type selection drop-down. settingsStep.addSettingsComponent(new SettingsHelpForm().getComponent()); } settingsStep.addSettingsComponent(createParams.setInitialValues().getComponent()); } private void addBorder(JComponent c, boolean left) { // #addSettingsField() moves the second item up by 5. // We also add a bit to the left of the panel to make the check box line up with the radio button. c.setBorder(new AbstractBorder() { public Insets getBorderInsets(Component c, Insets insets) { return JBUI.insets(5, left ? 3 : 0, 0, 0); } }); } public void updateProjectType(FlutterProjectType projectType) { // TODO(messick) Remove this method and its caller, which is in the flutter-studio module. } public FlutterCreateAdditionalSettings getAdditionalSettings() { return new FlutterCreateAdditionalSettings.Builder() .setDescription(!descriptionField.getText().trim().isEmpty() ? descriptionField.getText().trim() : null) .setType(projectTypeForm.getType()) // Packages are pure Dart code, no iOS or Android modules. .setKotlin(androidLanguageRadios.isRadio2Selected() ? true : null) .setOrg(!orgField.getText().trim().isEmpty() ? orgField.getText().trim() : null) .setSwift(iosLanguageRadios.isRadio2Selected() ? true : null) .setOffline(createParams.isOfflineSelected()) .setPlatformAndroid(shouldIncludePlatforms() ? settings.getPlatformAndroid() : null) .setPlatformIos(shouldIncludePlatforms() ? settings.getPlatformIos() : null) .setPlatformLinux(shouldIncludePlatforms() ? settings.getPlatformLinux() : null) .setPlatformMacos(shouldIncludePlatforms() ? settings.getPlatformMacos() : null) .setPlatformWeb(shouldIncludePlatforms() && projectTypeForm.getType() != FlutterProjectType.PLUGIN_FFI ? settings.getPlatformWeb() : null) .setPlatformWindows(shouldIncludePlatforms() ? settings.getPlatformWindows() : null) .build(); } public boolean shouldIncludePlatforms() { switch (projectTypeForm.getType()) { case APP: // fall through case SKELETON: case PLUGIN: case PLUGIN_FFI: case EMPTY_PROJECT: return true; default: return false; } } public FlutterCreateAdditionalSettings getSettings() { return settings; } // This is used in Android Studio to emphasize the help text for the selected project type. // The help form appears on the first page of the wizard. public void linkHelpForm(SettingsHelpForm form) { helpForm = form; } public void updateProjectTypes() { projectTypeForm.updateProjectTypes(); } }
flutter-intellij/flutter-idea/src/io/flutter/module/settings/FlutterCreateAdditionalSettingsFields.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/module/settings/FlutterCreateAdditionalSettingsFields.java", "repo_id": "flutter-intellij", "token_count": 3168 }
494
/* * Copyright 2018 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.perf; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; import com.intellij.openapi.util.TextRange; import java.util.Arrays; import java.util.Collection; /** * Performance stats for a single source file. * <p> * Typically the TextRange objects correspond to widget constructor locations. * A single constructor location may have multiple SummaryStats objects one for * each kind of stats (Widget repaints, rebuilds, etc). */ class FilePerfInfo { private final Multimap<TextRange, SummaryStats> stats = LinkedListMultimap.create(); long maxTimestamp = -1; private final int[] totalForMetric = new int[PerfMetric.values().length]; public void clear() { stats.clear(); maxTimestamp = -1; Arrays.fill(totalForMetric, 0); } public Iterable<TextRange> getLocations() { return stats.keySet(); } public Iterable<SummaryStats> getStats() { return stats.values(); } public boolean hasLocation(TextRange range) { return stats.containsKey(range); } public int getTotalValue(PerfMetric metric) { return totalForMetric[metric.ordinal()]; } public int getValue(TextRange range, PerfMetric metric) { final Collection<SummaryStats> entries = stats.get(range); if (entries == null) { return 0; } int count = 0; for (SummaryStats entry : entries) { count += entry.getValue(metric); } return count; } Iterable<SummaryStats> getRangeStats(TextRange range) { return stats.get(range); } public long getMaxTimestamp() { return maxTimestamp; } public void add(TextRange range, SummaryStats entry) { stats.put(range, entry); for (PerfMetric metric : PerfMetric.values()) { totalForMetric[metric.ordinal()] += entry.getValue(metric); } } public void markAppIdle() { for (PerfMetric metric : PerfMetric.values()) { if (metric.timeIntervalMetric) { totalForMetric[metric.ordinal()] = 0; } } for (SummaryStats stats : stats.values()) { stats.markAppIdle(); } } public int getCurrentValue(TextRange range) { return getValue(range, PerfMetric.peakRecent); } }
flutter-intellij/flutter-idea/src/io/flutter/perf/FilePerfInfo.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/perf/FilePerfInfo.java", "repo_id": "flutter-intellij", "token_count": 814 }
495
/* * Copyright 2018 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.perf; import com.google.gson.JsonObject; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.text.StringUtil; import io.flutter.inspector.DiagnosticsNode; import io.flutter.inspector.InspectorService; import io.flutter.run.daemon.FlutterApp; import io.flutter.utils.StreamSubscription; import io.flutter.utils.VmServiceListenerAdapter; import io.flutter.vmService.VMServiceManager; import org.dartlang.vm.service.VmService; import org.dartlang.vm.service.VmServiceListener; import org.dartlang.vm.service.element.Event; import org.dartlang.vm.service.element.IsolateRef; import org.jetbrains.annotations.NotNull; import java.util.concurrent.CompletableFuture; public class VmServiceWidgetPerfProvider implements WidgetPerfProvider { @NotNull final FlutterApp.FlutterAppListener appListener; @NotNull final FlutterApp app; private VmServiceListener vmServiceListener; private WidgetPerfListener target; private boolean started; private boolean isStarted; private boolean isDisposed = false; private boolean connected; private StreamSubscription<IsolateRef> isolateRefStreamSubscription; private CompletableFuture<InspectorService> inspectorService; VmServiceWidgetPerfProvider(@NotNull FlutterApp app) { this.app = app; // start listening for frames, reload and restart events appListener = new FlutterApp.FlutterAppListener() { @Override public void stateChanged(FlutterApp.State newState) { if (!started && app.isStarted()) { started = true; requestRepaint(When.now); } } @Override public void notifyAppReloaded() { requestRepaint(When.now); } @Override public void notifyAppRestarted() { requestRepaint(When.now); } @Override public void notifyFrameRendered() { requestRepaint(When.soon); } public void notifyVmServiceAvailable(VmService vmService) { setupConnection(vmService); } }; app.addStateListener(appListener); if (app.getVmService() != null) { setupConnection(app.getVmService()); } started = app.isStarted(); } public boolean isStarted() { return started; } public void setTarget(WidgetPerfListener widgetPerfListener) { this.target = widgetPerfListener; } private void requestRepaint(When now) { if (target != null) { target.requestRepaint(now); } } private void onWidgetPerfEvent(PerfReportKind kind, JsonObject json) { if (target != null) { target.onWidgetPerfEvent(kind, json); } } private void onNavigation() { if (target != null) { target.onNavigation(); } } @Override public void dispose() { app.removeStateListener(appListener); if (isolateRefStreamSubscription != null) { isolateRefStreamSubscription.dispose(); } isDisposed = true; connected = false; if (vmServiceListener != null && app.getVmService() != null) { app.getVmService().removeVmServiceListener(vmServiceListener); } } private void setupConnection(@NotNull VmService vmService) { if (isDisposed || connected) { return; } final VMServiceManager vmServiceManager = app.getVMServiceManager(); assert vmServiceManager != null; connected = true; isolateRefStreamSubscription = vmServiceManager.getCurrentFlutterIsolate( (isolateRef) -> requestRepaint(When.soon), false); vmService.addVmServiceListener(new VmServiceListenerAdapter() { @Override public void received(String streamId, Event event) { onVmServiceReceived(streamId, event); } @Override public void connectionClosed() { } }); inspectorService = InspectorService.create(app, app.getFlutterDebugProcess(), app.getVmService()); inspectorService.whenCompleteAsync((service, throwable) -> Disposer.register(this, service)); requestRepaint(When.soon); } private IsolateRef getCurrentIsolateRef() { assert app.getVMServiceManager() != null; return app.getVMServiceManager().getCurrentFlutterIsolateRaw(); } public boolean isConnected() { return connected; } @Override public boolean shouldDisplayPerfStats(FileEditor editor) { return !app.isReloading() && app.isLatestVersionRunning(editor.getFile()) && !editor.isModified(); } @Override public CompletableFuture<DiagnosticsNode> getWidgetTree() { return inspectorService .thenComposeAsync((inspectorService) -> inspectorService.createObjectGroup("widget_perf").getSummaryTreeWithoutIds()); } private void onVmServiceReceived(String streamId, Event event) { // TODO(jacobr): centrailize checks for Flutter.Frame // They are now in VMServiceManager, InspectorService, and here. if (StringUtil.equals(streamId, VmService.EXTENSION_STREAM_ID)) { final String kind = event.getExtensionKind(); if (kind == null) { return; } switch (kind) { case "Flutter.Frame": final JsonObject extensionData = event.getExtensionData().getJson(); requestRepaint(When.soon); break; case "Flutter.RebuiltWidgets": onWidgetPerfEvent(PerfReportKind.rebuild, event.getExtensionData().getJson()); break; case "Flutter.RepaintedWidgets": onWidgetPerfEvent(PerfReportKind.repaint, event.getExtensionData().getJson()); break; case "Flutter.Navigation": onNavigation(); break; } } } }
flutter-intellij/flutter-idea/src/io/flutter/perf/VmServiceWidgetPerfProvider.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/perf/VmServiceWidgetPerfProvider.java", "repo_id": "flutter-intellij", "token_count": 2089 }
496
/* * Copyright 2019 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.preview; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.CustomComponentAction; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.SimpleToolWindowPanel; import com.intellij.ui.components.JBLabel; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import io.flutter.dart.FlutterDartAnalysisServer; import io.flutter.editor.EditorPositionService; import io.flutter.editor.PreviewViewController; import io.flutter.editor.WidgetEditingContext; import io.flutter.editor.WidgetViewModelData; import io.flutter.inspector.InspectorGroupManagerService; import io.flutter.inspector.InspectorService; import org.dartlang.analysis.server.protocol.FlutterOutline; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.util.List; import java.util.Set; /** * Class that manages displaying the DeviceMirror. */ public class PreviewArea { public static int BORDER_WIDTH = 0; private final DefaultActionGroup toolbarGroup = new DefaultActionGroup(); private final ActionToolbar windowToolbar; private final SimpleToolWindowPanel window; private final JLayeredPane layeredPanel = new JLayeredPane(); private final JPanel deviceMirrorPanel; private final PreviewViewController preview; private final WidgetEditingContext context; private final Set<FlutterOutline> outlinesWithWidgets; private final InspectorGroupManagerService.Client inspectorClient; public PreviewArea(Project project, Set<FlutterOutline> outlinesWithWidgets, Disposable parent) { this.outlinesWithWidgets = outlinesWithWidgets; context = new WidgetEditingContext( project, FlutterDartAnalysisServer.getInstance(project), InspectorGroupManagerService.getInstance(project), EditorPositionService.getInstance(project) ); inspectorClient = new InspectorGroupManagerService.Client(parent); context.inspectorGroupManagerService.addListener(inspectorClient, parent); preview = new PreviewViewController(new WidgetViewModelData(context), false, layeredPanel, parent); deviceMirrorPanel = new PreviewViewModelPanel(preview); windowToolbar = ActionManager.getInstance().createActionToolbar("PreviewArea", toolbarGroup, true); toolbarGroup.add(new TitleAction("Device Mirror")); window = new SimpleToolWindowPanel(true, true); window.setToolbar(windowToolbar.getComponent()); deviceMirrorPanel.setLayout(new BorderLayout()); // TODO(jacobr): reafactor to remove the layeredPanel as we aren't getting any benefit from it. window.setContent(layeredPanel); layeredPanel.add(deviceMirrorPanel, Integer.valueOf(0)); // Layers should cover the whole root panel. layeredPanel.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { final Dimension renderSize = getRenderSize(); preview.setScreenshotBounds(new Rectangle(0, 0, renderSize.width, renderSize.height)); } }); } /** * Return the Swing component of the area. */ public JComponent getComponent() { return window; } // TODO(jacobr): switch the previewArea to listen on the event stream of // selected outlines and editors instead like the PropertyEditPanel // already does. public void select(@NotNull List<FlutterOutline> outlines, Editor editor) { if (editor.isDisposed()) return; final InspectorService.ObjectGroup group = getObjectGroup(); if (group != null && !outlines.isEmpty()) { final FlutterOutline outline = findWidgetToHighlight(outlines.get(0)); if (outline == null) return; final InspectorService.Location location = InspectorService.Location.outlineToLocation(editor, outline); if (location == null) return; group.setSelection(location, false, true); } } /** * Find the first descendant of the outline that is a widget as long as there * is only one path down the tree that leeds to a widget. */ private FlutterOutline findWidgetToHighlight(FlutterOutline outline) { if (outline == null || outline.getClassName() != null) return outline; if (!outlinesWithWidgets.contains(outline)) return null; FlutterOutline candidate = null; for (FlutterOutline child : outline.getChildren()) { if (outlinesWithWidgets.contains(child)) { if (candidate != null) { // It is ambiguous which candidate to show so don't show anything. // TODO(jacobr): consider showing multiple locations instead if the // inspector on device protocol is enhanced to support that. return null; } candidate = findWidgetToHighlight(child); } } return candidate; } public Dimension getRenderSize() { final int width = layeredPanel.getWidth(); final int height = layeredPanel.getHeight(); for (Component child : layeredPanel.getComponents()) { child.setBounds(0, 0, width, height); } final int renderWidth = width - 2 * BORDER_WIDTH; final int renderHeight = height - 2 * BORDER_WIDTH; return new Dimension(renderWidth, renderHeight); } InspectorService.ObjectGroup getObjectGroup() { return inspectorClient.getCurrentObjectGroup(); } } class TitleAction extends AnAction implements CustomComponentAction { TitleAction(String text) { super(text); } @Override public void actionPerformed(@NotNull AnActionEvent event) { } @NotNull @Override public JComponent createCustomComponent(@NotNull Presentation presentation) { final JPanel panel = new JPanel(new BorderLayout()); // Add left border to make the title look similar to the tool window title. panel.setBorder(BorderFactory.createEmptyBorder(0, JBUI.scale(3), 0, 0)); final String text = getTemplatePresentation().getText(); panel.add(new JBLabel(text != null ? text : "", UIUtil.ComponentStyle.SMALL)); return panel; } }
flutter-intellij/flutter-idea/src/io/flutter/preview/PreviewArea.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/preview/PreviewArea.java", "repo_id": "flutter-intellij", "token_count": 1977 }
497
<?xml version="1.0" encoding="UTF-8"?> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="io.flutter.run.FlutterConfigurationEditorForm"> <grid id="27dc6" binding="myMainPanel" default-binding="true" layout-manager="GridLayoutManager" row-count="11" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <margin top="0" left="0" bottom="0" right="0"/> <constraints> <xy x="20" y="20" width="698" height="320"/> </constraints> <properties/> <border type="none"/> <children> <vspacer id="3f5de"> <constraints> <grid row="10" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> </constraints> </vspacer> <component id="55076" class="javax.swing.JLabel" binding="myDartFileLabel"> <constraints> <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <inheritsPopupMenu value="true"/> <labelFor value="17e7a"/> <text value="Dart &amp;entrypoint:"/> <toolTipText value="The main Dart entrypoint script."/> </properties> </component> <component id="efe47" class="javax.swing.JLabel"> <constraints> <grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <labelFor value="14837"/> <text value="Build flavor:"/> <toolTipText value="The build flavor. This is either a gradle product flavor or an Xcode custom scheme."/> </properties> </component> <component id="14837" class="javax.swing.JTextField" binding="myBuildFlavorField"> <constraints> <grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <preferred-size width="150" height="-1"/> </grid> </constraints> <properties/> </component> <component id="45360" class="javax.swing.JLabel"> <constraints> <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <enabled value="false"/> <text value="The entry-point for the application (e.g. lib/main.dart)."/> </properties> </component> <component id="4882d" class="com.intellij.ui.components.fields.ExpandableTextField" binding="myAdditionalArgumentsField"> <constraints> <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> </constraints> <properties> <margin top="2" left="6" bottom="2" right="29"/> <text value=""/> </properties> </component> <component id="7656f" class="javax.swing.JLabel"> <constraints> <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <labelFor value="4882d"/> <text value="Additional run &amp;args:"/> <toolTipText value="Additional command-line arguments to pass into 'flutter run'."/> </properties> </component> <component id="5f9bb" class="javax.swing.JLabel"> <constraints> <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <enabled value="false"/> <text value="Additional arguments to 'flutter run'."/> </properties> </component> <component id="c681d" class="com.intellij.ui.components.fields.ExpandableTextField" binding="myAttachArgsField"> <constraints> <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> </constraints> <properties> <margin top="2" left="6" bottom="2" right="29"/> </properties> </component> <component id="42996" class="javax.swing.JLabel"> <constraints> <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <labelFor value="4882d"/> <text value="Additional a&amp;ttach args:"/> <toolTipText value="Additional command-line arguments to pass into 'flutter attach'."/> </properties> </component> <component id="2171a" class="javax.swing.JLabel"> <constraints> <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <enabled value="false"/> <text value="Additional arguments to 'flutter attach'."/> </properties> </component> <component id="17e7a" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myFileField"> <constraints> <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> </constraints> <properties> <focusable value="true"/> </properties> </component> <component id="8aeaf" class="javax.swing.JLabel" binding="myEnvvarLabel"> <constraints> <grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <text value="Environment variables:"/> </properties> </component> <component id="cdacc" class="com.intellij.execution.configuration.EnvironmentVariablesTextFieldWithBrowseButton" binding="myEnvironmentVariables"> <constraints> <grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> </constraints> <properties/> </component> <component id="952f4" class="javax.swing.JLabel"> <constraints> <grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <enabled value="false"/> <text value="Additional environment variables."/> </properties> </component> <component id="9a5c8" class="javax.swing.JLabel"> <constraints> <grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <enabled value="false"/> <text value="An optional build flavor; either a Gradle product flavor or an Xcode custom scheme."/> </properties> </component> </children> </grid> </form>
flutter-intellij/flutter-idea/src/io/flutter/run/FlutterConfigurationEditorForm.form/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/run/FlutterConfigurationEditorForm.form", "repo_id": "flutter-intellij", "token_count": 3311 }
498
# Debugger Architecture Overview ## `io.flutter.run` * `LaunchState` - launches a Flutter app in "machine" mode so that it [sends and receives JSON messages](https://github.com/flutter/flutter/wiki/The-flutter-daemon-mode). * `LaunchState.Runner` - abstract class for a way of running a Flutter app (either using a Flutter SDK or Bazel). * `SdkRunConfig` - holds user-editable settings when using a Flutter SDK (not Bazel). Creates the form to edit them and the LaunchState to run them. * `FlutterDebugProcess` - subclass of `DartVmServiceDebugProcessZ` that handles Flutter hot reloading. * `FlutterRunConfigurationProducer` - creates `SdkRunConfig` based on context (e.g., active file). * `FlutterRunConfigurationType` - singleton that determines if Flutter run configurations are appropriate for a given project and creates template `SdkRunConfig`s. * `SdkRunner` - starts flutter app without debugging, when using a Flutter SDK. * `SdkFields` - User-editable fields for starting a Flutter app (non-Bazel). * `FlutterConfigurationEditorForm` - form for editing fields in SdkFields. ## `io.flutter.run.daemon` * `FlutterApp` - represents a running Flutter app. * `FlutterAppListener` - callback for daemon lifecycle events. * `DaemonApi` - defines protocol for sending JSON messages to running Flutter app's process. * `DaemonEvent` - event received from running Flutter app's process. * `DaemonEvent.Listener` - base class for receiving events from Flutter app's process. * `DeviceService` - a project level singleton. It manages the device poller and holds the list of devices. * `FlutterDevice` - snapshot of a connected Flutter device's configuration, based on last poll. ## `io.flutter.run.bazel` * `FlutterBazelRunConfigurationType` - creates Bazel run configurations * `BazelRunConfig` - a run configuration for user-editable fields for Bazel targets * `BazelFields` - holds user-editable fields. * `FlutterBazelConfigurationEditorForm` - editor for BazelFields * `BazelRunner` - runs a BazelRunConfig by delegating to LaunchState.
flutter-intellij/flutter-idea/src/io/flutter/run/README.md/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/run/README.md", "repo_id": "flutter-intellij", "token_count": 585 }
499
/* * Copyright 2018 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.run.bazelTest; import com.intellij.execution.ExecutionException; import com.intellij.execution.Executor; import com.intellij.execution.configurations.CommandLineState; import com.intellij.execution.configurations.RuntimeConfigurationError; import com.intellij.execution.filters.UrlFilter; import com.intellij.execution.process.ProcessHandler; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; import com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView; import com.intellij.execution.ui.ConsoleView; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.jetbrains.lang.dart.ide.runner.DartConsoleFilter; import com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter; import com.jetbrains.lang.dart.util.DartUrlResolver; import io.flutter.bazel.Workspace; import io.flutter.bazel.WorkspaceCache; import io.flutter.run.common.ConsoleProps; import io.flutter.run.common.RunMode; import io.flutter.run.daemon.DaemonConsoleView; import io.flutter.utils.FlutterModuleUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * The Bazel version of the {@link io.flutter.run.test.TestLaunchState}. */ @SuppressWarnings("JavadocReference") public class BazelTestLaunchState extends CommandLineState { @NotNull private final BazelTestConfig config; @NotNull private final BazelTestFields fields; @NotNull private final VirtualFile testFile; protected BazelTestLaunchState(ExecutionEnvironment env, @NotNull BazelTestConfig config, @Nullable VirtualFile testFile) { super(env); this.config = config; this.fields = config.getFields(); if (testFile == null) { final Workspace workspace = WorkspaceCache.getInstance(env.getProject()).get(); assert (workspace != null); testFile = workspace.getRoot(); } this.testFile = testFile; } @NotNull VirtualFile getTestFile() { return testFile; } @NotNull @Override protected ProcessHandler startProcess() throws ExecutionException { final RunMode mode = RunMode.fromEnv(getEnvironment()); return fields.run(getEnvironment().getProject(), mode); } public static BazelTestLaunchState create(@NotNull ExecutionEnvironment env, @NotNull BazelTestConfig config) throws ExecutionException { final BazelTestFields fields = config.getFields(); try { fields.checkRunnable(env.getProject()); } catch (RuntimeConfigurationError e) { throw new ExecutionException(e); } FileDocumentManager.getInstance().saveAllDocuments(); final VirtualFile virtualFile = fields.getFile(); final BazelTestLaunchState launcher = new BazelTestLaunchState(env, config, virtualFile); final Workspace workspace = FlutterModuleUtils.getFlutterBazelWorkspace(env.getProject()); if (workspace != null) { DaemonConsoleView.install(launcher, env, workspace.getRoot()); } return launcher; } @Nullable @Override protected ConsoleView createConsole(@NotNull Executor executor) throws ExecutionException { // If the --machine output flag is not turned on, then don't activate the new window. if (fields.getAdditionalArgs() != null && fields.getAdditionalArgs().contains(BazelTestFields.Flags.noMachine)) { return super.createConsole(executor); } // Create a console showing a test tree. final Project project = getEnvironment().getProject(); final Workspace workspace = WorkspaceCache.getInstance(project).get(); // Fail gracefully if we have an unexpected null. if (workspace == null) { return super.createConsole(executor); } final DartUrlResolver resolver = DartUrlResolver.getInstance(project, workspace.getRoot()); final ConsoleProps props = ConsoleProps.forBazel(config, executor, resolver); final BaseTestsOutputConsoleView console = SMTestRunnerConnectionUtil.createConsole(ConsoleProps.bazelFrameworkName, props); // TODO(devoncarew): Will DartConsoleFilter work well in a Bazel context? console.addMessageFilter(new DartConsoleFilter(project, testFile)); final String baseDir = workspace.getRoot().getPath(); console.addMessageFilter(new DartRelativePathsConsoleFilter(project, baseDir)); console.addMessageFilter(new UrlFilter()); return console; } }
flutter-intellij/flutter-idea/src/io/flutter/run/bazelTest/BazelTestLaunchState.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/run/bazelTest/BazelTestLaunchState.java", "repo_id": "flutter-intellij", "token_count": 1452 }
500
/* * Copyright 2021 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.run.coverage; import com.intellij.coverage.CoverageEngine; import com.intellij.coverage.CoverageRunner; import com.intellij.coverage.CoverageSuite; import com.intellij.openapi.diagnostic.Logger; import com.intellij.rt.coverage.data.ProjectData; import io.flutter.FlutterBundle; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; public class FlutterCoverageRunner extends CoverageRunner { private static final String ID = "FlutterCoverageRunner"; private static final Logger LOG = Logger.getInstance(FlutterCoverageRunner.class.getName()); @Nullable @Override public ProjectData loadCoverageData(@NotNull final File sessionDataFile, @Nullable CoverageSuite baseCoverageSuite) { if (!(baseCoverageSuite instanceof FlutterCoverageSuite)) { return null; } return doLoadCoverageData(sessionDataFile, (FlutterCoverageSuite)baseCoverageSuite); } @Nullable private static ProjectData doLoadCoverageData(@NotNull final File sessionDataFile, @NotNull final FlutterCoverageSuite coverageSuite) { final ProjectData projectData = new ProjectData(); try { LcovInfo.readInto(projectData, sessionDataFile); } catch (IOException ex) { LOG.warn(FlutterBundle.message("coverage.data.not.read", sessionDataFile.getAbsolutePath())); return null; } return projectData; } @NotNull @Override public String getPresentableName() { return "Flutter"; } @NotNull @Override public String getId() { return ID; } @NotNull @Override public String getDataFileExtension() { return "info"; } @Override public boolean acceptsCoverageEngine(@NotNull CoverageEngine engine) { return engine instanceof FlutterCoverageEngine; } }
flutter-intellij/flutter-idea/src/io/flutter/run/coverage/FlutterCoverageRunner.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/run/coverage/FlutterCoverageRunner.java", "repo_id": "flutter-intellij", "token_count": 649 }
501
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.run.test; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.intellij.execution.testframework.TestConsoleProperties; import com.jetbrains.lang.dart.util.DartUrlResolver; import io.flutter.test.DartTestEventsConverterZ; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.text.ParseException; import java.util.Objects; public class FlutterTestEventsConverter extends DartTestEventsConverterZ { /** * Name of the synthetic group created dynamically by package:flutter_test when wrapping calls to test(). */ public static final String SYNTHETIC_WIDGET_GROUP_NAME = "-"; public FlutterTestEventsConverter(@NotNull String testFrameworkName, @NotNull TestConsoleProperties consoleProperties, @NotNull DartUrlResolver urlResolver) { super(testFrameworkName, consoleProperties, urlResolver); } /** * Checks if the given group is one created dynamically by flutter_test in the widget_tester * widget test wrapper. */ private static boolean isSyntheticWidgetTestGroup(@Nullable Item item) { return item instanceof Group && Objects.equals(item.getUrl(), "package:flutter_test/src/widget_tester.dart") && isSyntheticWidgetGroupName(item.getName()); } private static boolean isSyntheticWidgetGroupName(@Nullable String name) { return name != null && name.endsWith(SYNTHETIC_WIDGET_GROUP_NAME); } @Nullable private static JsonElement getValue(@NotNull JsonElement element, @NotNull String member) { if (!(element instanceof JsonObject)) return null; final JsonObject object = (JsonObject)element; return object.has(member) ? object.get(member) : null; } @Override protected boolean process(@NotNull JsonArray array) { // Consume (and don't print) observatoryUri output, e.g., // [{"event":"test.startedProcess","params":{"observatoryUri":"http://127.0.0.1:51770/"}}] if (array.size() == 1) { final JsonElement element = array.get(0); final JsonElement event = getValue(element, "event"); if (event != null) { if (Objects.equals(event.getAsString(), "test.startedProcess")) { final JsonElement params = getValue(element, "params"); if (params != null) { final JsonElement uri = getValue(params, "observatoryUri"); if (uri != null) return true; } } } } return false; } @Override protected void preprocessTestStart(@NotNull Test test) { // Reparent tests who are in a synthetic widget test group. // This (and the special treatment in #handleGroup()): // * gets rid of a needless extra group in the result tree, and // * properly wires up the test's location URL Item item = test; while (item != null) { if (isSyntheticWidgetTestGroup(item.myParent)) { // Skip the synthetic parent -- For example, // my_test.dart // "-" // "my first test" // becomes: // my_test.dart // "my first test" item.myParent = item.myParent.myParent; // Fix the URL to point to local source (and not the wrapped call in // "package:flutter_test/src/widget_tester.dart") item.myUrl = item.getSuite().myUrl; // Doctor the test name which is prefixed with the bogus group. final int groupNameIndex = item.myName.lastIndexOf(SYNTHETIC_WIDGET_GROUP_NAME); if (groupNameIndex != -1) { // e.g., // "- my first test" => "my first test" // "foo group - Counter increments smoke test" => "foo group Counter increments smoke test" final StringBuilder sb = new StringBuilder(item.myName); sb.replace(groupNameIndex, groupNameIndex + SYNTHETIC_WIDGET_GROUP_NAME.length() + 1, ""); item.myName = sb.toString(); } } item = item.myParent; } } @Override protected boolean handleGroup(@NotNull Group group) throws ParseException { // Special case synthetic widget test groups. return isSyntheticWidgetTestGroup(group) || super.handleGroup(group); } }
flutter-intellij/flutter-idea/src/io/flutter/run/test/FlutterTestEventsConverter.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/run/test/FlutterTestEventsConverter.java", "repo_id": "flutter-intellij", "token_count": 1680 }
502
/* * Copyright 2019 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.sdk; import com.google.common.collect.ImmutableSet; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.util.concurrency.AppExecutorUtil; import io.flutter.FlutterUtils; import io.flutter.android.AndroidEmulator; import io.flutter.android.AndroidSdk; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicReference; /** * This class manages the list of known Android eumlators, and handles refreshing the list as well * as notifying interested parties when the list changes. */ public class AndroidEmulatorManager { private static final Logger LOG = Logger.getInstance(AndroidEmulatorManager.class); @NotNull public static AndroidEmulatorManager getInstance(@NotNull Project project) { return Objects.requireNonNull(project.getService(AndroidEmulatorManager.class)); } private final @NotNull Project project; private final AtomicReference<ImmutableSet<Runnable>> listeners = new AtomicReference<>(ImmutableSet.of()); private List<AndroidEmulator> cachedEmulators = new ArrayList<>(); private AndroidEmulatorManager(@NotNull Project project) { this.project = project; } public void addListener(@NotNull Runnable callback) { listeners.updateAndGet((old) -> { final List<Runnable> changed = new ArrayList<>(old); changed.add(callback); return ImmutableSet.copyOf(changed); }); } public void removeListener(@NotNull Runnable callback) { listeners.updateAndGet((old) -> { final List<Runnable> changed = new ArrayList<>(old); changed.remove(callback); return ImmutableSet.copyOf(changed); }); } private CompletableFuture<List<AndroidEmulator>> inProgressRefresh; public CompletableFuture<List<AndroidEmulator>> refresh() { // We don't need to refresh if one is in progress. synchronized (this) { if (inProgressRefresh != null) { return inProgressRefresh; } } final CompletableFuture<List<AndroidEmulator>> future = new CompletableFuture<>(); synchronized (this) { inProgressRefresh = future; } AppExecutorUtil.getAppExecutorService().submit(() -> { final AndroidSdk sdk = AndroidSdk.createFromProject(project); if (sdk == null) { future.complete(Collections.emptyList()); } else { final List<AndroidEmulator> emulators = sdk.getEmulators(); emulators.sort((emulator1, emulator2) -> emulator1.getName().compareToIgnoreCase(emulator2.getName())); future.complete(emulators); } }); future.thenAccept(emulators -> { fireChangeEvent(emulators, cachedEmulators); synchronized (this) { inProgressRefresh = null; } }); return future; } public List<AndroidEmulator> getCachedEmulators() { return cachedEmulators; } private void fireChangeEvent(final List<AndroidEmulator> newEmulators, final List<AndroidEmulator> oldEmulators) { if (project.isDisposed()) return; // Don't fire if the list of devices is unchanged. if (cachedEmulators.equals(newEmulators)) { return; } cachedEmulators = newEmulators; for (Runnable listener : listeners.get()) { try { listener.run(); } catch (Exception e) { FlutterUtils.warn(LOG, "AndroidEmulatorManager listener threw an exception", e); } } } }
flutter-intellij/flutter-idea/src/io/flutter/sdk/AndroidEmulatorManager.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/sdk/AndroidEmulatorManager.java", "repo_id": "flutter-intellij", "token_count": 1271 }
503
/* * Copyright 2018 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.sdk; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.process.OSProcessUtil; import com.intellij.execution.process.ProcessInfo; import com.intellij.execution.process.ProcessOutput; import com.intellij.openapi.project.Project; import io.flutter.FlutterBundle; import io.flutter.FlutterMessages; import io.flutter.utils.SystemUtils; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class XcodeUtils { public static boolean isSimulatorRunning() { final ProcessInfo[] processInfos = OSProcessUtil.getProcessList(); for (ProcessInfo info : processInfos) { if (info.getExecutableName().equals("Simulator")) { return true; } } return false; } /** * Open the iOS simulator. * <p> * If there's an error opening the simulator, display that to the user via * {@link FlutterMessages#showError(String, String, Project)}. */ public static void openSimulator(@Nullable Project project, String... additionalArgs) { final List<String> params = new ArrayList<>(Arrays.asList(additionalArgs)); params.add("-a"); params.add("Simulator.app"); final GeneralCommandLine cmd = new GeneralCommandLine().withExePath("open").withParameters(params); SystemUtils.execAndGetOutput(cmd).thenAccept((ProcessOutput output) -> { if (output.getExitCode() != 0) { final StringBuilder textBuffer = new StringBuilder(); if (!output.getStdout().isEmpty()) { textBuffer.append(output.getStdout()); } if (!output.getStderr().isEmpty()) { if (!textBuffer.isEmpty()) { textBuffer.append("\n"); } textBuffer.append(output.getStderr()); } final String eventText = textBuffer.toString(); final String msg = !eventText.isEmpty() ? eventText : "Process error - exit code: (" + output.getExitCode() + ")"; FlutterMessages.showError("Error Opening Simulator", msg, project); } }).exceptionally(throwable -> { FlutterMessages.showError( "Error Opening Simulator", FlutterBundle.message("flutter.command.exception.message", throwable.getMessage()), project); return null; }); } }
flutter-intellij/flutter-idea/src/io/flutter/sdk/XcodeUtils.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/sdk/XcodeUtils.java", "repo_id": "flutter-intellij", "token_count": 898 }
504
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.utils; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.ColorUtil; import com.intellij.ui.LayeredIcon; import com.intellij.util.ui.GraphicsUtil; import com.intellij.util.ui.UIUtil; import icons.FlutterIcons; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.awt.geom.Rectangle2D; import java.util.HashMap; import java.util.Map; public class CustomIconMaker { private static final Color normalColor = ColorUtil.fromHex("231F20"); private final Map<String, Icon> iconCache = new HashMap<>(); public CustomIconMaker() { } public Icon getCustomIcon(String fromText) { return getCustomIcon(fromText, IconKind.kClass, false); } public Icon getCustomIcon(String fromText, IconKind kind) { return getCustomIcon(fromText, kind, false); } public Icon getCustomIcon(String fromText, IconKind kind, boolean isAbstract) { if (StringUtil.isEmpty(fromText)) { return null; } final String text = fromText.toUpperCase().substring(0, 1); final String mapKey = text + "_" + kind.name + "_" + isAbstract; if (!iconCache.containsKey(mapKey)) { final Icon baseIcon = isAbstract ? kind.abstractIcon : kind.icon; final Icon icon = new LayeredIcon(baseIcon, new Icon() { public void paintIcon(Component c, Graphics g, int x, int y) { final Graphics2D g2 = (Graphics2D)g.create(); try { GraphicsUtil.setupAAPainting(g2); g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2.setColor(normalColor); final Font font = UIUtil.getFont(UIUtil.FontSize.MINI, UIUtil.getTreeFont()); g2.setFont(font); final Rectangle2D bounds = g2.getFontMetrics().getStringBounds(text, g2); final float offsetX = (getIconWidth() - (float)bounds.getWidth()) / 2.0f; // Some black magic here for vertical centering. final float offsetY = getIconHeight() - ((getIconHeight() - (float)bounds.getHeight()) / 2.0f) - 2.0f; g2.drawString(text, x + offsetX, y + offsetY); } finally { g2.dispose(); } } public int getIconWidth() { return baseIcon != null ? baseIcon.getIconWidth() : 13; } public int getIconHeight() { return baseIcon != null ? baseIcon.getIconHeight() : 13; } }); iconCache.put(mapKey, icon); } return iconCache.get(mapKey); } @Nullable public Icon fromWidgetName(String name) { if (name == null) { return null; } final boolean isPrivate = name.startsWith("_"); while (!name.isEmpty() && !Character.isAlphabetic(name.charAt(0))) { name = name.substring(1); } if (name.isEmpty()) { return null; } return getCustomIcon(name, isPrivate ? CustomIconMaker.IconKind.kMethod : CustomIconMaker.IconKind.kClass); } public Icon fromInfo(String name) { if (name == null) { return null; } if (name.isEmpty()) { return null; } return getCustomIcon(name, CustomIconMaker.IconKind.kInfo); } public enum IconKind { kClass("class", FlutterIcons.CustomClass, FlutterIcons.CustomClassAbstract), kField("fields", FlutterIcons.CustomFields), kInterface("interface", FlutterIcons.CustomInterface), kMethod("method", FlutterIcons.CustomMethod, FlutterIcons.CustomMethodAbstract), kProperty("property", FlutterIcons.CustomProperty), kInfo("info", FlutterIcons.CustomInfo); public final String name; public final Icon icon; public final Icon abstractIcon; IconKind(String name, Icon icon) { this.name = name; this.icon = icon; this.abstractIcon = icon; } IconKind(String name, Icon icon, Icon abstractIcon) { this.name = name; this.icon = icon; this.abstractIcon = abstractIcon; } } }
flutter-intellij/flutter-idea/src/io/flutter/utils/CustomIconMaker.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/utils/CustomIconMaker.java", "repo_id": "flutter-intellij", "token_count": 1639 }
505
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.utils; import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.configurations.PathEnvironmentVariableUtil; import com.intellij.execution.process.ProcessOutput; import com.intellij.execution.util.ExecUtil; import com.intellij.openapi.util.SystemInfo; import com.intellij.util.concurrency.AppExecutorUtil; import org.jetbrains.annotations.Nullable; import java.io.File; import java.util.concurrent.CompletableFuture; public class SystemUtils { /** * Locate a given command-line tool given its name. * <p> * This is used to locate binaries that are not pre-installed. If it is necessary to find pre-installed * binaries it will require more work, especially on Windows. */ @Nullable public static String which(String toolName) { final File gitExecutableFromPath = PathEnvironmentVariableUtil.findInPath(SystemInfo.isWindows ? toolName + ".exe" : toolName, getPath(), null); if (gitExecutableFromPath != null) { return gitExecutableFromPath.getAbsolutePath(); } return null; } @Nullable private static String getPath() { return PathEnvironmentVariableUtil.getPathVariableValue(); } /** * Execute the given command line, and return the process output as one result in a future. * <p> * This is a non-blocking equivalient to {@link ExecUtil#execAndGetOutput(GeneralCommandLine)}. */ public static CompletableFuture<ProcessOutput> execAndGetOutput(GeneralCommandLine cmd) { final CompletableFuture<ProcessOutput> future = new CompletableFuture<>(); AppExecutorUtil.getAppExecutorService().submit(() -> { try { final ProcessOutput output = ExecUtil.execAndGetOutput(cmd); future.complete(output); } catch (ExecutionException e) { future.completeExceptionally(e); } }); return future; } }
flutter-intellij/flutter-idea/src/io/flutter/utils/SystemUtils.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/utils/SystemUtils.java", "repo_id": "flutter-intellij", "token_count": 680 }
506
/* * Copyright 2019 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.utils.math; import java.util.Arrays; /** * This class is ported from the Vector3 class in the Dart vector_math * package. The code is ported as is without concern for making the code * consistent with Java api conventions to keep the code consistent with * the Dart code to simplify using Transform Matrixes returned by Flutter. */ @SuppressWarnings({"PointlessArithmeticExpression", "UnusedReturnValue", "DuplicatedCode", "ConstantConditions"}) public class Vector3 implements Vector { final double[] _v3storage; /** * Construct a new vector with the specified values. */ public Vector3(double x, double y, double z) { _v3storage = new double[]{x, y, z}; } /** * Zero vector. */ Vector3() { _v3storage = new double[3]; } /** * Constructs Vector3 with given double[] as [storage]. */ public Vector3(double[] v3storage) { this._v3storage = v3storage; } /** * Set the values of [result] to the minimum of [a] and [b] for each line. */ public static void min(Vector3 a, Vector3 b, Vector3 result) { result.setX(Math.min(a.getX(), b.getX())); result.setY(Math.min(a.getY(), b.getY())); result.setZ(Math.min(a.getZ(), b.getZ())); } /** * Set the values of [result] to the maximum of [a] and [b] for each line. */ public static void max(Vector3 a, Vector3 b, Vector3 result) { result.setX(Math.max(a.getX(), b.getX())); result.setY(Math.max(a.getY(), b.getY())); result.setZ(Math.max(a.getZ(), b.getZ())); } /* * Interpolate between [min] and [max] with the amount of [a] using a linear * interpolation and store the values in [result]. */ public static void mix(Vector3 min, Vector3 max, double a, Vector3 result) { result.setX(min.getX() + a * (max.getX() - min.getX())); result.setY(min.getY() + a * (max.getY() - min.getY())); result.setZ(min.getZ() + a * (max.getZ() - min.getZ())); } /** * Initialized with values from [array] starting at [offset]. */ public static Vector3 array(double[] array) { return array(array, 0); } public static Vector3 array(double[] array, int offset) { final Vector3 ret = new Vector3(); ret.copyFromArray(array, offset); return ret; } public static Vector3 getZero() { return new Vector3(); } /** * Splat [value] into all lanes of the vector. */ static Vector3 all(double value) { final Vector3 ret = Vector3.getZero(); ret.splat(value); return ret; } /** * Copy of [other]. */ static Vector3 copy(Vector3 other) { final Vector3 ret = Vector3.getZero(); ret.setFrom(other); return ret; } public static Vector3 zero() { return new Vector3(); } /** * The components of the vector. */ @Override() public double[] getStorage() { return _v3storage; } /** * Set the values of the vector. */ public void setValues(double x_, double y_, double z_) { _v3storage[0] = x_; _v3storage[1] = y_; _v3storage[2] = z_; } /** * Zero vector. */ public void setZero() { _v3storage[2] = 0.0; _v3storage[1] = 0.0; _v3storage[0] = 0.0; } /** * Set the values by copying them from [other]. */ public void setFrom(Vector3 other) { final double[] otherStorage = other._v3storage; _v3storage[0] = otherStorage[0]; _v3storage[1] = otherStorage[1]; _v3storage[2] = otherStorage[2]; } /** * Splat [arg] into all lanes of the vector. */ public void splat(double arg) { _v3storage[2] = arg; _v3storage[1] = arg; _v3storage[0] = arg; } /** * Returns a printable string */ @Override() public String toString() { return "[" + _v3storage[0] + "," + _v3storage[1] + "," + _v3storage[2] + "]"; } /** * Check if two vectors are the same. */ @Override() public boolean equals(Object o) { if (!(o instanceof Vector3)) { return false; } final Vector3 other = (Vector3)o; return (_v3storage[0] == other._v3storage[0]) && (_v3storage[1] == other._v3storage[1]) && (_v3storage[2] == other._v3storage[2]); } @Override() public int hashCode() { return Arrays.hashCode(_v3storage); } /** * Negate */ public Vector3 operatorNegate() { final Vector3 ret = clone(); ret.negate(); return ret; } /** * Subtract two vectors. */ public Vector3 operatorSub(Vector3 other) { final Vector3 ret = clone(); ret.sub(other); return ret; } /** * Add two vectors. */ public Vector3 operatorAdd(Vector3 other) { final Vector3 ret = clone(); ret.add(other); return ret; } /** * Scale. */ public Vector3 operatorDiv(double scale) { final Vector3 ret = clone(); ret.scaled(1.0 / scale); return ret; } /** * Scale by [scale]. */ public Vector3 operatorScaled(double scale) { final Vector3 ret = clone(); ret.scaled(scale); return ret; } /** * Length. */ public double getLength() { return Math.sqrt(getLength2()); } /** * Set the length of the vector. A negative [value] will change the vectors * orientation and a [value] of zero will set the vector to zero. */ public void setLength(double value) { if (value == 0.0) { setZero(); } else { double l = getLength(); if (l == 0.0) { return; } l = value / l; _v3storage[0] *= l; _v3storage[1] *= l; _v3storage[2] *= l; } } /** * Length squared. */ public double getLength2() { double sum; sum = (_v3storage[0] * _v3storage[0]); sum += (_v3storage[1] * _v3storage[1]); sum += (_v3storage[2] * _v3storage[2]); return sum; } /** * Normalizes [this]. */ public double normalize() { final double l = getLength(); if (l == 0.0) { return 0.0; } final double d = 1.0 / l; _v3storage[0] *= d; _v3storage[1] *= d; _v3storage[2] *= d; return l; } /** * Normalizes copy of [this]. */ public Vector3 normalized() { final Vector3 ret = Vector3.copy(this); ret.normalize(); return ret; } /** * Normalize vector into [out]. */ public Vector3 normalizeInto(Vector3 out) { out.setFrom(this); out.normalize(); return out; } /** * Distance from [this] to [arg] */ public double distanceTo(Vector3 arg) { return Math.sqrt(distanceToSquared(arg)); } /** * Squared distance from [this] to [arg] */ public double distanceToSquared(Vector3 arg) { final double[] argStorage = arg._v3storage; final double dx = _v3storage[0] - argStorage[0]; final double dy = _v3storage[1] - argStorage[1]; final double dz = _v3storage[2] - argStorage[2]; return dx * dx + dy * dy + dz * dz; } /** * Returns the angle between [this] vector and [other] in radians. */ public double angleTo(Vector3 other) { final double[] otherStorage = other._v3storage; if (_v3storage[0] == otherStorage[0] && _v3storage[1] == otherStorage[1] && _v3storage[2] == otherStorage[2]) { return 0.0; } final double d = dot(other) / (getLength() * other.getLength()); return Math.acos(VectorUtil.clamp(d, -1.0, 1.0)); } /** * Returns the signed angle between [this] and [other] around [normal] * in radians. */ public double angleToSigned(Vector3 other, Vector3 normal) { final double angle = angleTo(other); final Vector3 c = cross(other); final double d = c.dot(normal); return d < 0.0 ? -angle : angle; } /** * Inner product. */ public double dot(Vector3 other) { final double[] otherStorage = other._v3storage; double sum; sum = _v3storage[0] * otherStorage[0]; sum += _v3storage[1] * otherStorage[1]; sum += _v3storage[2] * otherStorage[2]; return sum; } /** * Cross product. */ public Vector3 cross(Vector3 other) { final double _x = _v3storage[0]; final double _y = _v3storage[1]; final double _z = _v3storage[2]; final double[] otherStorage = other._v3storage; final double ox = otherStorage[0]; final double oy = otherStorage[1]; final double oz = otherStorage[2]; return new Vector3(_y * oz - _z * oy, _z * ox - _x * oz, _x * oy - _y * ox); } /** * Cross product. Stores result in [out]. */ public Vector3 crossInto(Vector3 other, Vector3 out) { final double x = _v3storage[0]; final double y = _v3storage[1]; final double z = _v3storage[2]; final double[] otherStorage = other._v3storage; final double ox = otherStorage[0]; final double oy = otherStorage[1]; final double oz = otherStorage[2]; final double[] outStorage = out._v3storage; outStorage[0] = y * oz - z * oy; outStorage[1] = z * ox - x * oz; outStorage[2] = x * oy - y * ox; return out; } /** * Reflect [this]. */ public Vector3 reflect(Vector3 normal) { sub(normal.scaled(2.0 * normal.dot(this))); return this; } /** * Reflected copy of [this]. */ public Vector3 reflected(Vector3 normal) { final Vector3 ret = clone(); ret.reflect(normal); return ret; } /** * Projects [this] using the projection matrix [arg] */ public void applyProjection(Matrix4 arg) { final double[] argStorage = arg.getStorage(); final double x = _v3storage[0]; final double y = _v3storage[1]; final double z = _v3storage[2]; final double d = 1.0 / (argStorage[3] * x + argStorage[7] * y + argStorage[11] * z + argStorage[15]); _v3storage[0] = (argStorage[0] * x + argStorage[4] * y + argStorage[8] * z + argStorage[12]) * d; _v3storage[1] = (argStorage[1] * x + argStorage[5] * y + argStorage[9] * z + argStorage[13]) * d; _v3storage[2] = (argStorage[2] * x + argStorage[6] * y + argStorage[10] * z + argStorage[14]) * d; } /** * Applies a rotation specified by [axis] and [angle]. */ public void applyAxisAngle(Vector3 axis, double angle) { applyQuaternion(Quaternion.axisAngle(axis, angle)); } /** * Applies a quaternion transform. */ public void applyQuaternion(Quaternion arg) { final double[] argStorage = arg._qStorage; final double v0 = _v3storage[0]; final double v1 = _v3storage[1]; final double v2 = _v3storage[2]; final double qx = argStorage[0]; final double qy = argStorage[1]; final double qz = argStorage[2]; final double qw = argStorage[3]; final double ix = qw * v0 + qy * v2 - qz * v1; final double iy = qw * v1 + qz * v0 - qx * v2; final double iz = qw * v2 + qx * v1 - qy * v0; final double iw = -qx * v0 - qy * v1 - qz * v2; _v3storage[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; _v3storage[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; _v3storage[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; } /** * Multiplies [this] by a 4x3 subset of [arg]. Expects [arg] to be an affine * transformation matrix. */ public void applyMatrix4(Matrix4 arg) { final double[] argStorage = arg.getStorage(); final double v0 = _v3storage[0]; final double v1 = _v3storage[1]; final double v2 = _v3storage[2]; _v3storage[0] = argStorage[0] * v0 + argStorage[4] * v1 + argStorage[8] * v2 + argStorage[12]; _v3storage[1] = argStorage[1] * v0 + argStorage[5] * v1 + argStorage[9] * v2 + argStorage[13]; _v3storage[2] = argStorage[2] * v0 + argStorage[6] * v1 + argStorage[10] * v2 + argStorage[14]; } /** * Relative error between [this] and [correct] */ public double relativeError(Vector3 correct) { final double correct_norm = correct.getLength(); final double diff_norm = (this.operatorSub(correct)).getLength(); return diff_norm / correct_norm; } /** * Absolute error between [this] and [correct] */ public double absoluteError(Vector3 correct) { return (this.operatorSub(correct)).getLength(); } /** * True if any component is infinite. */ public boolean isInfinite() { boolean is_infinite = false; is_infinite = is_infinite || Double.isInfinite(_v3storage[0]); is_infinite = is_infinite || Double.isInfinite(_v3storage[1]); is_infinite = is_infinite || Double.isInfinite(_v3storage[2]); return is_infinite; } /** * True if any component is NaN. */ public boolean isNaN() { boolean is_nan = false; is_nan = is_nan || Double.isNaN(_v3storage[0]); is_nan = is_nan || Double.isNaN(_v3storage[1]); is_nan = is_nan || Double.isNaN(_v3storage[2]); return is_nan; } /** * Add [arg] to [this]. */ public void add(Vector3 arg) { final double[] argStorage = arg._v3storage; _v3storage[0] = _v3storage[0] + argStorage[0]; _v3storage[1] = _v3storage[1] + argStorage[1]; _v3storage[2] = _v3storage[2] + argStorage[2]; } /** * Add [arg] scaled by [factor] to [this]. */ public void addScaled(Vector3 arg, double factor) { final double[] argStorage = arg._v3storage; _v3storage[0] = _v3storage[0] + argStorage[0] * factor; _v3storage[1] = _v3storage[1] + argStorage[1] * factor; _v3storage[2] = _v3storage[2] + argStorage[2] * factor; } /** * Subtract [arg] from [this]. */ public Vector3 sub(Vector3 arg) { final double[] argStorage = arg._v3storage; _v3storage[0] = _v3storage[0] - argStorage[0]; _v3storage[1] = _v3storage[1] - argStorage[1]; _v3storage[2] = _v3storage[2] - argStorage[2]; return this; } /** * Multiply entries in [this] with entries in [arg]. */ public Vector3 multiply(Vector3 arg) { final double[] argStorage = arg._v3storage; _v3storage[0] = _v3storage[0] * argStorage[0]; _v3storage[1] = _v3storage[1] * argStorage[1]; _v3storage[2] = _v3storage[2] * argStorage[2]; return this; } /** * Divide entries in [this] with entries in [arg]. */ public Vector3 divide(Vector3 arg) { final double[] argStorage = arg._v3storage; _v3storage[0] = _v3storage[0] / argStorage[0]; _v3storage[1] = _v3storage[1] / argStorage[1]; _v3storage[2] = _v3storage[2] / argStorage[2]; return this; } /** * Scale [this]. */ public void scale(double arg) { _v3storage[2] = _v3storage[2] * arg; _v3storage[1] = _v3storage[1] * arg; _v3storage[0] = _v3storage[0] * arg; } /** * Create a copy of [this] and scale it by [arg]. */ public Vector3 scaled(double arg) { final Vector3 ret = clone(); ret.scale(arg); return ret; } /** * Negate [this]. */ public void negate() { _v3storage[2] = -_v3storage[2]; _v3storage[1] = -_v3storage[1]; _v3storage[0] = -_v3storage[0]; } /** * Absolute value. */ public void absolute() { _v3storage[0] = Math.abs(_v3storage[0]); _v3storage[1] = Math.abs(_v3storage[1]); _v3storage[2] = Math.abs(_v3storage[2]); } /** * Clamp each entry n in [this] in the range [min[n]]-[max[n]]. */ public void clamp(Vector3 min, Vector3 max) { final double[] minStorage = min.getStorage(); final double[] maxStorage = max.getStorage(); _v3storage[0] = VectorUtil.clamp(_v3storage[0], minStorage[0], maxStorage[0]); _v3storage[1] = VectorUtil.clamp(_v3storage[1], minStorage[1], maxStorage[1]); _v3storage[2] = VectorUtil.clamp(_v3storage[2], minStorage[2], maxStorage[2]); } /** * Clamp entries in [this] in the range [min]-[max]. */ public void clampScalar(double min, double max) { _v3storage[0] = VectorUtil.clamp(_v3storage[0], min, max); _v3storage[1] = VectorUtil.clamp(_v3storage[1], min, max); _v3storage[2] = VectorUtil.clamp(_v3storage[2], min, max); } /** * Floor entries in [this]. */ public void floor() { _v3storage[0] = Math.floor(_v3storage[0]); _v3storage[1] = Math.floor(_v3storage[1]); _v3storage[2] = Math.floor(_v3storage[2]); } /** * Ceil entries in [this]. */ public void ceil() { _v3storage[0] = Math.ceil(_v3storage[0]); _v3storage[1] = Math.ceil(_v3storage[1]); _v3storage[2] = Math.ceil(_v3storage[2]); } /** * Round entries in [this]. */ public void round() { _v3storage[0] = Math.round(_v3storage[0]); _v3storage[1] = Math.round(_v3storage[1]); _v3storage[2] = Math.round(_v3storage[2]); } /** * Round entries in [this] towards zero. */ public void roundToZero() { _v3storage[0] = _v3storage[0] < 0.0 ? Math.ceil(_v3storage[0]) : Math.floor(_v3storage[0]); _v3storage[1] = _v3storage[1] < 0.0 ? Math.ceil(_v3storage[1]) : Math.floor(_v3storage[1]); _v3storage[2] = _v3storage[2] < 0.0 ? Math.ceil(_v3storage[2]) : Math.floor(_v3storage[2]); } /** * Clone of [this]. */ @SuppressWarnings("MethodDoesntCallSuperMethod") @Override public Vector3 clone() { final Vector3 ret = new Vector3(); copyInto(ret); return ret; } /** * Copy [this] into [arg]. */ public Vector3 copyInto(Vector3 arg) { final double[] argStorage = arg._v3storage; argStorage[0] = _v3storage[0]; argStorage[1] = _v3storage[1]; argStorage[2] = _v3storage[2]; return arg; } /** * Copies [this] into [array] starting at [offset]. */ public void copyIntoArray(double[] array) { copyIntoArray(array, 0); } public void copyIntoArray(double[] array, int offset) { array[offset + 2] = _v3storage[2]; array[offset + 1] = _v3storage[1]; array[offset + 0] = _v3storage[0]; } /** * Copies elements from [array] into [this] starting at [offset]. */ public void copyFromArray(double[] array) { copyFromArray(array, 0); } public void copyFromArray(double[] array, int offset) { _v3storage[2] = array[offset + 2]; _v3storage[1] = array[offset + 1]; _v3storage[0] = array[offset + 0]; } public double getX() { return _v3storage[0]; } public void setX(double arg) { _v3storage[0] = arg; } public double getY() { return _v3storage[1]; } public void setY(double arg) { _v3storage[1] = arg; } public double getZ() { return _v3storage[2]; } public void setZ(double arg) { _v3storage[2] = arg; } }
flutter-intellij/flutter-idea/src/io/flutter/utils/math/Vector3.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/utils/math/Vector3.java", "repo_id": "flutter-intellij", "token_count": 8098 }
507
/* * Copyright 2018 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.view; import com.intellij.ui.JBColor; import com.intellij.ui.table.JBTable; import org.jetbrains.annotations.NotNull; import javax.swing.event.MouseInputAdapter; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableModel; import java.awt.*; import java.awt.event.MouseEvent; /** * JBTable custom selection and hover renderer for a table view. */ public class HighlightedTable extends JBTable { final static private JBColor HOVER_BACKGROUND_COLOR = new JBColor(new Color(0xCFE6EF), JBColor.LIGHT_GRAY.brighter()); final static private JBColor HOVER_FOREGROUND_COLOR = JBColor.BLACK; private int rollOverRowIndex = -1; private int lastClickedRow = -1; public HighlightedTable(TableModel model) { super(model); final RollOverListener listener = new RollOverListener(); addMouseMotionListener(listener); addMouseListener(listener); } @NotNull @Override public Component prepareRenderer(@NotNull TableCellRenderer renderer, int row, int column) { final Component c = super.prepareRenderer(renderer, row, column); final Font font = c.getFont(); if (font != null) { // Iff we have a font for this component (TableRow). if (lastClickedRow == row) { c.setFont(font.deriveFont(Font.BOLD)); c.setForeground(getSelectionForeground()); c.setBackground(getSelectionBackground()); } else { c.setFont(font.deriveFont(Font.PLAIN)); if (row == rollOverRowIndex) { c.setForeground(HOVER_FOREGROUND_COLOR); c.setBackground(HOVER_BACKGROUND_COLOR); } else { c.setForeground(getForeground()); c.setBackground(getBackground()); } } } return c; } private class RollOverListener extends MouseInputAdapter { @Override public void mouseExited(MouseEvent e) { rollOverRowIndex = -1; repaint(); } @Override public void mouseMoved(MouseEvent e) { final int row = rowAtPoint(e.getPoint()); if (row != rollOverRowIndex) { rollOverRowIndex = row; repaint(); } } @Override public void mouseClicked(MouseEvent e) { lastClickedRow = rowAtPoint(e.getPoint()); repaint(); } } }
flutter-intellij/flutter-idea/src/io/flutter/view/HighlightedTable.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/view/HighlightedTable.java", "repo_id": "flutter-intellij", "token_count": 939 }
508
package io.flutter.vmService; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.concurrency.Semaphore; import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.XSourcePosition; import com.intellij.xdebugger.breakpoints.XBreakpoint; import com.intellij.xdebugger.breakpoints.XBreakpointProperties; import com.intellij.xdebugger.breakpoints.XLineBreakpoint; import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; import com.intellij.xdebugger.frame.XStackFrame; import com.intellij.xdebugger.frame.XSuspendContext; import com.intellij.xdebugger.frame.XValue; import com.jetbrains.lang.dart.ide.runner.DartExceptionBreakpointProperties; import io.flutter.vmService.frame.DartVmServiceSuspendContext; import io.flutter.vmService.frame.DartVmServiceValue; import org.dartlang.vm.service.VmServiceListener; import org.dartlang.vm.service.element.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class DartVmServiceListener implements VmServiceListener { private static final Logger LOG = Logger.getInstance(DartVmServiceListener.class.getName()); @NotNull private final DartVmServiceDebugProcess myDebugProcess; @NotNull private final DartVmServiceBreakpointHandler myBreakpointHandler; @Nullable private XSourcePosition myLatestSourcePosition; public DartVmServiceListener(@NotNull final DartVmServiceDebugProcess debugProcess, @NotNull final DartVmServiceBreakpointHandler breakpointHandler) { myDebugProcess = debugProcess; myBreakpointHandler = breakpointHandler; } @Override public void connectionOpened() { } @SuppressWarnings("DuplicateBranchesInSwitch") @Override public void received(@NotNull final String streamId, @NotNull final Event event) { switch (event.getKind()) { case BreakpointAdded: // TODO Respond to breakpoints added by the observatory. // myBreakpointHandler.vmBreakpointAdded(null, event.getIsolate().getId(), event.getBreakpoint()); break; case BreakpointRemoved: break; case BreakpointResolved: myBreakpointHandler.breakpointResolved(event.getBreakpoint()); break; case Extension: break; case GC: break; case Inspect: break; case IsolateStart: break; case IsolateRunnable: myDebugProcess.getVmServiceWrapper().handleIsolate(event.getIsolate(), false); break; case IsolateReload: break; case IsolateUpdate: break; case IsolateExit: myDebugProcess.isolateExit(event.getIsolate()); break; case PauseBreakpoint: case PauseException: case PauseInterrupted: myDebugProcess.isolateSuspended(event.getIsolate()); ApplicationManager.getApplication().executeOnPooledThread(() -> { final ElementList<Breakpoint> breakpoints = event.getKind() == EventKind.PauseBreakpoint ? event.getPauseBreakpoints() : null; final InstanceRef exception = event.getKind() == EventKind.PauseException ? event.getException() : null; onIsolatePaused(event.getIsolate(), breakpoints, exception, event.getTopFrame(), event.getAtAsyncSuspension()); }); break; case PausePostRequest: // We get this event after an isolate reload call, when pause after reload has been requested. // This adds the "supports.pausePostRequest" capability. myDebugProcess.getVmServiceWrapper().restoreBreakpointsForIsolate(event.getIsolate().getId(), () -> myDebugProcess.getVmServiceWrapper() .resumeIsolate(event.getIsolate().getId(), null)); break; case PauseExit: break; case PauseStart: myDebugProcess.getVmServiceWrapper().handleIsolate(event.getIsolate(), true); break; case Resume: myDebugProcess.isolateResumed(event.getIsolate()); break; case ServiceExtensionAdded: break; case ServiceRegistered: break; case ServiceUnregistered: break; case VMUpdate: break; case WriteEvent: myDebugProcess.handleWriteEvent(event.getBytes()); break; case None: break; case Unknown: break; } } @Override public void connectionClosed() { myDebugProcess.getSession().stop(); } void onIsolatePaused(@NotNull final IsolateRef isolateRef, @Nullable final ElementList<Breakpoint> vmBreakpoints, @Nullable final InstanceRef exception, @Nullable final Frame vmTopFrame, boolean atAsyncSuspension) { if (vmTopFrame == null) { myDebugProcess.getSession().positionReached(new XSuspendContext() { }); return; } final DartVmServiceSuspendContext suspendContext = new DartVmServiceSuspendContext(myDebugProcess, isolateRef, vmTopFrame, exception, atAsyncSuspension); final XStackFrame xTopFrame = suspendContext.getActiveExecutionStack().getTopFrame(); final XSourcePosition sourcePosition = xTopFrame == null ? null : xTopFrame.getSourcePosition(); if (vmBreakpoints == null || vmBreakpoints.isEmpty()) { final StepOption latestStep = myDebugProcess.getVmServiceWrapper().getLatestStep(); if (latestStep == StepOption.Over && equalSourcePositions(myLatestSourcePosition, sourcePosition)) { final StepOption nextStep = atAsyncSuspension ? StepOption.OverAsyncSuspension : latestStep; // continue stepping to change current line myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), nextStep); } else if (exception != null) { final XBreakpoint<DartExceptionBreakpointProperties> breakpoint = DartExceptionBreakpointHandler.getDefaultExceptionBreakpoint(myDebugProcess.getSession().getProject()); final boolean suspend = myDebugProcess.getSession().breakpointReached(breakpoint, null, suspendContext); if (!suspend) { myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), null); } } else { myLatestSourcePosition = sourcePosition; myDebugProcess.getSession().positionReached(suspendContext); } } else { if (vmBreakpoints.size() > 1) { // Shouldn't happen. IDE doesn't allow to set 2 breakpoints on one line. LOG.warn(vmBreakpoints.size() + " breakpoints hit in one shot."); } // Remove any temporary (run to cursor) breakpoints. myBreakpointHandler.removeTemporaryBreakpoints(isolateRef.getId()); final XLineBreakpoint<XBreakpointProperties> xBreakpoint = myBreakpointHandler.getXBreakpoint(vmBreakpoints.get(0)); if (xBreakpoint == null) { // breakpoint could be set in the Observatory myLatestSourcePosition = sourcePosition; myDebugProcess.getSession().positionReached(suspendContext); return; } if ("false".equals(evaluateExpression(isolateRef.getId(), vmTopFrame, xBreakpoint.getConditionExpression()))) { myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), null); return; } myLatestSourcePosition = sourcePosition; final String logExpression = evaluateExpression(isolateRef.getId(), vmTopFrame, xBreakpoint.getLogExpressionObject()); final boolean suspend = myDebugProcess.getSession().breakpointReached(xBreakpoint, logExpression, suspendContext); if (!suspend) { myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), null); } } } private static boolean equalSourcePositions(@Nullable final XSourcePosition position1, @Nullable final XSourcePosition position2) { return position1 != null && position2 != null && position1.getFile().equals(position2.getFile()) && position1.getLine() == position2.getLine(); } @Nullable private String evaluateExpression(final @NotNull String isolateId, final @Nullable Frame vmTopFrame, final @Nullable XExpression xExpression) { final String evalText = xExpression == null ? null : xExpression.getExpression(); if (vmTopFrame == null || StringUtil.isEmptyOrSpaces(evalText)) return null; final Ref<String> evalResult = new Ref<>(); final Semaphore semaphore = new Semaphore(); semaphore.down(); myDebugProcess.getVmServiceWrapper().evaluateInFrame(isolateId, vmTopFrame, evalText, new XDebuggerEvaluator.XEvaluationCallback() { @Override public void evaluated(@NotNull final XValue result) { if (result instanceof DartVmServiceValue) { evalResult.set(getSimpleStringPresentation(((DartVmServiceValue)result).getInstanceRef())); } semaphore.up(); } @Override public void errorOccurred(@NotNull final String errorMessage) { evalResult.set("Failed to evaluate log expression [" + evalText + "]: " + errorMessage); semaphore.up(); } }); semaphore.waitFor(1000); return evalResult.get(); } @NotNull private static String getSimpleStringPresentation(@NotNull final InstanceRef instanceRef) { // getValueAsString() is provided for the instance kinds: Null, Bool, Double, Int, String (value may be truncated), Float32x4, Float64x2, Int32x4, StackTrace switch (instanceRef.getKind()) { case Null: case Bool: case Double: case Int: case String: case Float32x4: case Float64x2: case Int32x4: case StackTrace: return instanceRef.getValueAsString(); default: return "Instance of " + instanceRef.getClassRef().getName(); } } }
flutter-intellij/flutter-idea/src/io/flutter/vmService/DartVmServiceListener.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/vmService/DartVmServiceListener.java", "repo_id": "flutter-intellij", "token_count": 3868 }
509
package io.flutter.vmService.frame; import com.intellij.icons.AllIcons; import com.intellij.xdebugger.frame.XExecutionStack; import com.intellij.xdebugger.frame.XStackFrame; import io.flutter.vmService.DartVmServiceDebugProcess; import org.dartlang.vm.service.element.Frame; import org.dartlang.vm.service.element.InstanceRef; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collections; public class DartVmServiceExecutionStack extends XExecutionStack { private final DartVmServiceDebugProcess myDebugProcess; private final String myIsolateId; @Nullable private final XStackFrame myTopFrame; @Nullable private final InstanceRef myException; public DartVmServiceExecutionStack(@NotNull final DartVmServiceDebugProcess debugProcess, @NotNull final String isolateId, @NotNull final String isolateName, @Nullable final Frame topFrame, @Nullable final InstanceRef exception) { // topFrame is not null for (and only for) the active execution stack super(debugProcess.isIsolateSuspended(isolateId) ? beautify(isolateName) : beautify(isolateName) + " (running)", topFrame != null ? AllIcons.Debugger.ThreadCurrent : debugProcess.isIsolateSuspended(isolateId) ? AllIcons.Debugger.ThreadAtBreakpoint : AllIcons.Debugger.ThreadRunning); myDebugProcess = debugProcess; myIsolateId = isolateId; myException = exception; myTopFrame = topFrame == null ? null : new DartVmServiceStackFrame(debugProcess, isolateId, topFrame, null, exception); } @NotNull private static String beautify(@NotNull final String isolateName) { // in tests it is "foo_test.dart%22%20as%20test;%0A%0A%20%20%20%20%20%20%20%20void%20main(_,%20SendPort%20message)..." final int index = isolateName.indexOf(".dart%22%20as%20test;"); return index > 0 ? isolateName.substring(0, index + ".dart".length()) : isolateName; } @Nullable @Override public XStackFrame getTopFrame() { // engine calls getTopFrame for active execution stack only, for which myTopFrame is calculated in constructor return myTopFrame; } @Override public void computeStackFrames(final int firstFrameIndex, @NotNull final XStackFrameContainer container) { if (myDebugProcess.isIsolateSuspended(myIsolateId)) { myDebugProcess.getVmServiceWrapper().computeStackFrames(myIsolateId, firstFrameIndex, container, myException); } else { container.addStackFrames(Collections.emptyList(), true); } } public String getIsolateId() { return myIsolateId; } }
flutter-intellij/flutter-idea/src/io/flutter/vmService/frame/DartVmServiceExecutionStack.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/io/flutter/vmService/frame/DartVmServiceExecutionStack.java", "repo_id": "flutter-intellij", "token_count": 1125 }
510
/* * Copyright (c) 2019, 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. * To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files". */ package org.dartlang.analysis.server.protocol; /** * An enumeration of the types of errors that can occur in the execution of the server. * * @coverage dart.server.generated.types */ public class RequestErrorCode { /** * An "analysis.getErrors" or "analysis.getNavigation" request could not be satisfied because the * content of the file changed before the requested results could be computed. */ public static final String CONTENT_MODIFIED = "CONTENT_MODIFIED"; /** * The server was unable to open a port for the diagnostic server. */ public static final String DEBUG_PORT_COULD_NOT_BE_OPENED = "DEBUG_PORT_COULD_NOT_BE_OPENED"; /** * A request specified a FilePath which does not match a file in an analysis root, or the requested * operation is not available for the file. */ public static final String FILE_NOT_ANALYZED = "FILE_NOT_ANALYZED"; /** * The given location does not have a supported widget. */ public static final String FLUTTER_GET_WIDGET_DESCRIPTION_NO_WIDGET = "FLUTTER_GET_WIDGET_DESCRIPTION_NO_WIDGET"; /** * The given property identifier is not valid. It might have never been valid, or a change to code * invalidated it, or its TTL was exceeded. */ public static final String FLUTTER_SET_WIDGET_PROPERTY_VALUE_INVALID_ID = "FLUTTER_SET_WIDGET_PROPERTY_VALUE_INVALID_ID"; /** * The value of the property cannot be removed, for example because the corresponding constructor * argument is required, and the server does not know what default value to use. */ public static final String FLUTTER_SET_WIDGET_PROPERTY_VALUE_IS_REQUIRED = "FLUTTER_SET_WIDGET_PROPERTY_VALUE_IS_REQUIRED"; /** * An "edit.format" request specified a FilePath which does not match a Dart file in an analysis * root. */ public static final String FORMAT_INVALID_FILE = "FORMAT_INVALID_FILE"; /** * An "edit.format" request specified a file that contains syntax errors. */ public static final String FORMAT_WITH_ERRORS = "FORMAT_WITH_ERRORS"; /** * An "analysis.getErrors" request specified a FilePath which does not match a file currently * subject to analysis. */ public static final String GET_ERRORS_INVALID_FILE = "GET_ERRORS_INVALID_FILE"; /** * An "analysis.getImportedElements" request specified a FilePath that does not match a file * currently subject to analysis. */ public static final String GET_IMPORTED_ELEMENTS_INVALID_FILE = "GET_IMPORTED_ELEMENTS_INVALID_FILE"; /** * An "analysis.getKytheEntries" request specified a FilePath that does not match a file that is * currently subject to analysis. */ public static final String GET_KYTHE_ENTRIES_INVALID_FILE = "GET_KYTHE_ENTRIES_INVALID_FILE"; /** * An "analysis.getNavigation" request specified a FilePath which does not match a file currently * subject to analysis. */ public static final String GET_NAVIGATION_INVALID_FILE = "GET_NAVIGATION_INVALID_FILE"; /** * An "analysis.getReachableSources" request specified a FilePath which does not match a file * currently subject to analysis. */ public static final String GET_REACHABLE_SOURCES_INVALID_FILE = "GET_REACHABLE_SOURCES_INVALID_FILE"; /** * An "analysis.getSignature" request specified a FilePath which does not match a file currently * subject to analysis. */ public static final String GET_SIGNATURE_INVALID_FILE = "GET_SIGNATURE_INVALID_FILE"; /** * An "analysis.getSignature" request specified an offset which is not a valid location within for * the contents of the file specified FilePath. */ public static final String GET_SIGNATURE_INVALID_OFFSET = "GET_SIGNATURE_INVALID_OFFSET"; /** * An "analysis.getSignature" request specified an offset that could not be matched to a function * call. */ public static final String GET_SIGNATURE_UNKNOWN_FUNCTION = "GET_SIGNATURE_UNKNOWN_FUNCTION"; /** * An "edit.importElements" request specified a FilePath that does not match a file currently * subject to analysis. */ public static final String IMPORT_ELEMENTS_INVALID_FILE = "IMPORT_ELEMENTS_INVALID_FILE"; /** * A path passed as an argument to a request (such as analysis.reanalyze) is required to be an * analysis root, but isn't. */ public static final String INVALID_ANALYSIS_ROOT = "INVALID_ANALYSIS_ROOT"; /** * The context root used to create an execution context does not exist. */ public static final String INVALID_EXECUTION_CONTEXT = "INVALID_EXECUTION_CONTEXT"; /** * The format of the given file path is invalid, e.g. is not absolute and normalized. */ public static final String INVALID_FILE_PATH_FORMAT = "INVALID_FILE_PATH_FORMAT"; /** * An "analysis.updateContent" request contained a ChangeContentOverlay object which can't be * applied, due to an edit having an offset or length that is out of range. */ public static final String INVALID_OVERLAY_CHANGE = "INVALID_OVERLAY_CHANGE"; /** * One of the method parameters was invalid. */ public static final String INVALID_PARAMETER = "INVALID_PARAMETER"; /** * A malformed request was received. */ public static final String INVALID_REQUEST = "INVALID_REQUEST"; /** * An "edit.organizeDirectives" request specified a Dart file that cannot be analyzed. The reason * is described in the message. */ public static final String ORGANIZE_DIRECTIVES_ERROR = "ORGANIZE_DIRECTIVES_ERROR"; /** * Another refactoring request was received during processing of this one. */ public static final String REFACTORING_REQUEST_CANCELLED = "REFACTORING_REQUEST_CANCELLED"; /** * The analysis server has already been started (and hence won't accept new connections). * <p> * This error is included for future expansion; at present the analysis server can only speak to * one client at a time so this error will never occur. */ public static final String SERVER_ALREADY_STARTED = "SERVER_ALREADY_STARTED"; /** * An internal error occurred in the analysis server. Also see the server.error notification. */ public static final String SERVER_ERROR = "SERVER_ERROR"; /** * An "edit.sortMembers" request specified a FilePath which does not match a Dart file in an * analysis root. */ public static final String SORT_MEMBERS_INVALID_FILE = "SORT_MEMBERS_INVALID_FILE"; /** * An "edit.sortMembers" request specified a Dart file that has scan or parse errors. */ public static final String SORT_MEMBERS_PARSE_ERRORS = "SORT_MEMBERS_PARSE_ERRORS"; /** * A dartfix request was received containing the name of a fix which does not match the name of any * known fixes. */ public static final String UNKNOWN_FIX = "UNKNOWN_FIX"; /** * A request was received which the analysis server does not recognize, or cannot handle in its * current configuration. */ public static final String UNKNOWN_REQUEST = "UNKNOWN_REQUEST"; /** * The analysis server was requested to perform an action which is not supported. * <p> * This is a legacy error; it will be removed before the API reaches version 1.0. */ public static final String UNSUPPORTED_FEATURE = "UNSUPPORTED_FEATURE"; }
flutter-intellij/flutter-idea/src/org/dartlang/analysis/server/protocol/RequestErrorCode.java/0
{ "file_path": "flutter-intellij/flutter-idea/src/org/dartlang/analysis/server/protocol/RequestErrorCode.java", "repo_id": "flutter-intellij", "token_count": 2353 }
511
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.testing; import com.intellij.openapi.Disposable; import com.intellij.openapi.module.Module; import com.jetbrains.lang.dart.util.DartTestUtils; import io.flutter.sdk.FlutterSdk; import org.junit.rules.ExternalResource; /** * Provides a Flutter Module with the Flutter SDK configured. * * <p>Depends on a {@link ProjectFixture} already being installed. */ public class FlutterModuleFixture extends ExternalResource { private final ProjectFixture parent; private final Disposable testRoot = () -> {}; private final boolean realSdk; public FlutterModuleFixture(ProjectFixture parent) { this(parent, true); } public FlutterModuleFixture(ProjectFixture parent, boolean realSdk) { this.parent = parent; this.realSdk = realSdk; } @Override protected void before() throws Exception { Testing.runOnDispatchThread(() -> { FlutterTestUtils.configureFlutterSdk(parent.getModule(), testRoot, realSdk); if (realSdk) { final FlutterSdk sdk = FlutterSdk.getFlutterSdk(parent.getProject()); assert (sdk != null); final String path = sdk.getHomePath(); final String dartSdkPath = path + "/bin/cache/dart-sdk"; System.setProperty("dart.sdk", dartSdkPath); } DartTestUtils.configureDartSdk(parent.getModule(), testRoot, realSdk); }); } @Override protected void after() { testRoot.dispose(); } public Module getModule() { return parent.getModule(); } }
flutter-intellij/flutter-idea/testSrc/integration/io/flutter/testing/FlutterModuleFixture.java/0
{ "file_path": "flutter-intellij/flutter-idea/testSrc/integration/io/flutter/testing/FlutterModuleFixture.java", "repo_id": "flutter-intellij", "token_count": 574 }
512
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.dart; import com.intellij.psi.PsiElement; import com.intellij.psi.impl.source.tree.LeafPsiElement; import com.intellij.psi.util.PsiTreeUtil; import com.jetbrains.lang.dart.psi.DartCallExpression; import com.jetbrains.lang.dart.psi.DartFunctionDeclarationWithBodyOrNative; import com.jetbrains.lang.dart.psi.DartStringLiteralExpression; import io.flutter.AbstractDartElementTest; import org.junit.Test; import java.util.regex.Pattern; import static org.junit.Assert.*; public class DartSyntaxTest extends AbstractDartElementTest { @Test public void isTestCall() throws Exception { run(() -> { final PsiElement testIdentifier = setUpDartElement("main() { test('my first test', () {} ); }", "test", LeafPsiElement.class); final DartCallExpression call = DartSyntax.findEnclosingFunctionCall(testIdentifier, "test"); assert call != null; assertTrue(DartSyntax.isCallToFunctionNamed(call, "test")); }); } @Test public void isTestCallPattern() throws Exception { run(() -> { final PsiElement testIdentifier = setUpDartElement("main() { test('my first test', () {} ); }", "test", LeafPsiElement.class); final DartCallExpression call = DartSyntax.findEnclosingFunctionCall(testIdentifier, "test"); assert call != null; assertTrue(DartSyntax.isCallToFunctionMatching(call, Pattern.compile("t.*t"))); }); } @Test public void isMainFunctionDeclaration() throws Exception { run(() -> { final PsiElement mainIdentifier = setUpDartElement("main() { test('my first test', () {} ); }", "main", LeafPsiElement.class); final PsiElement main = PsiTreeUtil.findFirstParent(mainIdentifier, element -> element instanceof DartFunctionDeclarationWithBodyOrNative); assertTrue(DartSyntax.isMainFunctionDeclaration(main)); }); } @Test public void shouldFindEnclosingFunctionCall() throws Exception { run(() -> { final PsiElement helloElt = setUpDartElement("main() { test(\"hello\"); }", "hello", LeafPsiElement.class); final DartCallExpression call = DartSyntax.findEnclosingFunctionCall(helloElt, "test"); assertNotNull("findEnclosingFunctionCall() didn't find enclosing function call", call); }); } @Test public void shouldFindEnclosingFunctionCallPattern() throws Exception { run(() -> { final PsiElement helloElt = setUpDartElement("main() { test(\"hello\"); }", "hello", LeafPsiElement.class); final DartCallExpression call = DartSyntax.findEnclosingFunctionCall(helloElt, Pattern.compile("t.*t")); assertNotNull("findEnclosingFunctionCall() didn't find enclosing function call", call); }); } @Test public void shouldNotFindEnclosingFunctionCallPattern() throws Exception { run(() -> { final PsiElement helloElt = setUpDartElement("main() { test(\"hello\"); }", "hello", LeafPsiElement.class); final DartCallExpression call = DartSyntax.findEnclosingFunctionCall(helloElt, Pattern.compile("t.*a")); assertNull("findEnclosingFunctionCall() didn't find enclosing function call", call); }); } @Test public void shouldGetFirstArgumentFromFunctionCall() throws Exception { run(() -> { final PsiElement helloElt = setUpDartElement("main() { test(\"hello\"); }", "hello", LeafPsiElement.class); final DartCallExpression call = DartSyntax.findEnclosingFunctionCall(helloElt, "test"); assertNotNull(call); final DartStringLiteralExpression lit = DartSyntax.getArgument(call, 0, DartStringLiteralExpression.class); assertNotNull("getSyntax() didn't return first argument", lit); }); } @Test public void shouldUnquoteStringLiteral() throws Exception { run(() -> { final DartStringLiteralExpression quoted = setUpDartElement("var x = \"hello\";", "\"hello\"", DartStringLiteralExpression.class); final String unquoted = DartSyntax.unquote(quoted); assertEquals("hello", unquoted); }); } }
flutter-intellij/flutter-idea/testSrc/unit/io/flutter/dart/DartSyntaxTest.java/0
{ "file_path": "flutter-intellij/flutter-idea/testSrc/unit/io/flutter/dart/DartSyntaxTest.java", "repo_id": "flutter-intellij", "token_count": 1416 }
513
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.run.daemon; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonObject; import io.flutter.utils.JsonUtils; import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.concurrent.Future; import static io.flutter.testing.JsonTesting.curly; import static org.junit.Assert.*; /** * Verifies that we can send commands and read replies using the Flutter daemon protocol. */ public class DaemonApiTest { private List<String> log; private DaemonApi api; @Before public void setUp() { log = new ArrayList<>(); api = new DaemonApi(log::add); } // app domain @Test public void canRestartApp() throws Exception { final Future<DaemonApi.RestartResult> result = api.restartApp("foo", true, false, "manual"); checkSent(result, "app.restart", curly("appId:\"foo\"", "fullRestart:true", "pause:false", "reason:\"manual\"")); replyWithResult(result, curly("code:42", "message:\"sorry\"")); assertFalse(result.get().ok()); assertEquals(42, result.get().getCode()); assertEquals("sorry", result.get().getMessage()); } @Test public void canStopApp() throws Exception { final Future<Boolean> result = api.stopApp("foo"); checkSent(result, "app.stop", curly("appId:\"foo\"")); replyWithResult(result, "true"); assertEquals(true, result.get()); } @Test public void daemonGetSupportedPlatforms() throws Exception { final Future<List<String>> result = api.daemonGetSupportedPlatforms("foo/bar"); checkSent(result, "daemon.getSupportedPlatforms", curly("projectRoot:\"foo/bar\"")); replyWithResult(result, curly("platforms:[\"ios\"]")); final List<String> platforms = result.get(); assertEquals(1, platforms.size()); assertEquals("ios", platforms.get(0)); } @Test public void canCallServiceExtension() throws Exception { final Map<String, Object> params = ImmutableMap.of("reversed", true); final Future<JsonObject> result = api.callAppServiceExtension("foo", "rearrange", params); checkSent(result, "app.callServiceExtension", curly("appId:\"foo\"", "methodName:\"rearrange\"", "params:" + curly("reversed:true"))); replyWithResult(result, curly("type:_extensionType", "method:\"rearrange\"")); assertEquals("_extensionType", result.get().get("type").getAsString()); } // device domain @Test public void canEnableDeviceEvents() { final Future<Void> result = api.enableDeviceEvents(); checkLog("{\"method\":\"device.enable\",\"id\":0}"); assertFalse(result.isDone()); api.dispatch(JsonUtils.parseString("{id: \"0\"}").getAsJsonObject(), null); assertTrue(result.isDone()); } @Test public void parseAndValidateDaemonEventGood() { final JsonObject result = DaemonApi.parseAndValidateDaemonEvent("[{'id':23}]"); assertNotNull(result); } @Test public void parseAndValidateDaemonEventBad() { JsonObject result = DaemonApi.parseAndValidateDaemonEvent("[{id:'23'}]"); assertNull(result); result = DaemonApi.parseAndValidateDaemonEvent("[{}]"); assertNull(result); result = DaemonApi.parseAndValidateDaemonEvent("[{'foo':'bar"); assertNull(result); } // helpers private void checkSent(Future<?> result, String expectedMethod, String expectedParamsJson) { checkLog("{\"method\":\"" + expectedMethod + "\",\"params\":" + expectedParamsJson + ",\"id\":0}"); assertFalse(result.isDone()); } private void replyWithResult(Future<?> result, String resultJson) { api.dispatch(JsonUtils.parseString("{id: \"0\", result: " + resultJson + "}").getAsJsonObject(), null); assertTrue(result.isDone()); } private void checkLog(String... expectedEntries) { assertEquals("log entries are different", Arrays.asList(expectedEntries), log); log.clear(); } }
flutter-intellij/flutter-idea/testSrc/unit/io/flutter/run/daemon/DaemonApiTest.java/0
{ "file_path": "flutter-intellij/flutter-idea/testSrc/unit/io/flutter/run/daemon/DaemonApiTest.java", "repo_id": "flutter-intellij", "token_count": 1445 }
514
/* * Copyright 2018 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.utils; import com.google.common.collect.ImmutableList; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import java.util.TimerTask; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import static org.hamcrest.core.Is.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.fail; public class EventStreamTest { private final List<String> logEntries = new ArrayList<>(); private final Object logValueListenerLock = new Object(); private EventStream<Integer> eventStream; private CompletableFuture<Object> callbacksDone; private volatile int expectedEvents; private volatile int numEvents; private boolean onUiThread; @Before public void setUp() { numEvents = 0; callbacksDone = new CompletableFuture<>(); eventStream = new EventStream<>(42); } void logValueListener(Integer value) { synchronized (logValueListenerLock) { if (onUiThread && !SwingUtilities.isEventDispatchThread()) { log("subscriber should be called on Swing thread"); return; } log("" + value); numEvents++; if (numEvents == expectedEvents) { callbacksDone.complete(null); } else if (numEvents > expectedEvents) { log("unexpected number of events fired"); } } } StreamSubscription<Integer> addLogValueListener(boolean onUiThread) { this.onUiThread = onUiThread; return eventStream.listen(this::logValueListener, onUiThread); } @Test public void valueSetBeforeStart() { eventStream.setValue(100); eventStream.setValue(200); // Only value that will show up. expectedEvents = 1; SwingUtilities.invokeLater(() -> { addLogValueListener(true); }); checkLog("200"); } @Test public void calledWithDefaultValue() { expectedEvents = 1; SwingUtilities.invokeLater(() -> { addLogValueListener(true); }); checkLog("42"); } @Ignore @Test public void duplicateValues() throws Exception { expectedEvents = 6; SwingUtilities.invokeAndWait(() -> { addLogValueListener(true); eventStream.setValue(100); eventStream.setValue(100); eventStream.setValue(100); eventStream.setValue(200); eventStream.setValue(200); }); checkLog("42", "200"); } @Ignore @Test public void nullInitialValue() throws Exception { expectedEvents = 3; SwingUtilities.invokeAndWait(() -> { eventStream = new EventStream<>(); addLogValueListener(true); eventStream.setValue(100); eventStream.setValue(200); }); checkLog("null", "200"); } @Test public void ignoreValuesAfterDispose() { expectedEvents = 5; final StreamSubscription<Integer> listener = addLogValueListener(false); eventStream.setValue(100); eventStream.setValue(200); eventStream.setValue(300); listener.dispose(); eventStream.setValue(400); // Ignored. eventStream.setValue(500); // Ignored. eventStream.setValue(9); // Subscribe back getting the current value (9). addLogValueListener(false); checkLog("42", "100", "200", "300", "9"); } @Test public void doubleDispose() { expectedEvents = 6; final StreamSubscription<Integer> listener = addLogValueListener(false); final StreamSubscription<Integer> listener2 = addLogValueListener(false); eventStream.setValue(100); // This event will be received by both listeners. listener.dispose(); // A second dispose is harmless and doesn't crash anything. listener.dispose(); eventStream.setValue(200); eventStream.setValue(300); checkLog("42", "42", "100", "100", "200", "300"); } @Test public void eventsFromOtherThread() { expectedEvents = 6; addLogValueListener(false); final Timer timer = new Timer(15, null); timer.setRepeats(true); timer.addActionListener(new ActionListener() { int count = 0; @Override public void actionPerformed(ActionEvent e) { count++; eventStream.setValue(count); if (count == 5) { timer.stop(); } } }); timer.start(); checkLog("42", "1", "2", "3", "4", "5"); } @Test public void eventsFromOtherThreadOnUiThread() { expectedEvents = 6; SwingUtilities.invokeLater(() -> { addLogValueListener(true); final Timer timer = new Timer(15, null); timer.setRepeats(true); timer.addActionListener(new ActionListener() { int count = 0; @Override public void actionPerformed(ActionEvent e) { count++; eventStream.setValue(count); if (count == 5) { timer.stop(); } } }); timer.start(); }); checkLog("42", "1", "2", "3", "4", "5"); } @Test public void unsubscribeFromUiThread() { expectedEvents = 6; SwingUtilities.invokeLater(() -> { addLogValueListener(true); final StreamSubscription[] subscription = new StreamSubscription[]{null}; subscription[0] = eventStream.listen((Integer value) -> { log("L2: " + value); if (value == 3) { log("L2: stopped"); subscription[0].dispose(); } }, true); final Timer timer = new Timer(15, null); timer.setRepeats(true); timer.addActionListener(new ActionListener() { int count = 0; @Override public void actionPerformed(ActionEvent e) { count++; eventStream.setValue(count); if (count == 5) { timer.stop(); } } }); timer.start(); }); checkLog("42", "L2: 42", "1", "L2: 1", "2", "L2: 2", "3", "L2: 3", "L2: stopped", "4", "5"); } private synchronized void log(String message) { synchronized (logEntries) { logEntries.add(message); } } private synchronized List<String> getLogEntries() { synchronized (logEntries) { return ImmutableList.copyOf(logEntries); } } private void reportFailure(Exception e) { fail("Exception: " + e + "\nLog: " + getLogEntries()); } private void checkLog(String... expectedEntries) { final java.util.Timer timer = new java.util.Timer(); try { final TimerTask task = new TimerTask() { @Override public void run() { timer.cancel(); callbacksDone.completeExceptionally(new InterruptedException("Expected more events")); fail(); } }; timer.schedule(task, 1000); callbacksDone.get(); timer.cancel(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } assertThat("logEntries entries are different", getLogEntries(), is(ImmutableList.copyOf(expectedEntries))); logEntries.clear(); } }
flutter-intellij/flutter-idea/testSrc/unit/io/flutter/utils/EventStreamTest.java/0
{ "file_path": "flutter-intellij/flutter-idea/testSrc/unit/io/flutter/utils/EventStreamTest.java", "repo_id": "flutter-intellij", "token_count": 2755 }
515
/* * Copyright (c) 2015, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * 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. */ package org.dartlang.vm.service; import com.google.common.collect.Maps; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import de.roderick.weberknecht.WebSocket; import de.roderick.weberknecht.WebSocketEventHandler; import de.roderick.weberknecht.WebSocketException; import de.roderick.weberknecht.WebSocketMessage; import org.dartlang.vm.service.consumer.*; import org.dartlang.vm.service.element.*; import org.dartlang.vm.service.internal.RequestSink; import org.dartlang.vm.service.internal.VmServiceConst; import org.dartlang.vm.service.internal.WebSocketRequestSink; import org.dartlang.vm.service.logging.Logging; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; /** * Internal {@link VmService} base class containing non-generated code. */ @SuppressWarnings({"unused", "WeakerAccess"}) abstract class VmServiceBase implements VmServiceConst { /** * Connect to the VM observatory service via the specified URI * * @return an API object for interacting with the VM service (not {@code null}). */ public static VmService connect(final String url) throws IOException { // Validate URL URI uri; try { uri = new URI(url); } catch (URISyntaxException e) { throw new IOException("Invalid URL: " + url, e); } String wsScheme = uri.getScheme(); if (!"ws".equals(wsScheme) && !"wss".equals(wsScheme)) { throw new IOException("Unsupported URL scheme: " + wsScheme); } // Create web socket and observatory WebSocket webSocket; try { webSocket = new WebSocket(uri); } catch (WebSocketException e) { throw new IOException("Failed to create websocket: " + url, e); } final VmService vmService = new VmService(); // Setup event handler for forwarding responses webSocket.setEventHandler(new WebSocketEventHandler() { @Override public void onClose() { Logging.getLogger().logInformation("VM connection closed: " + url); vmService.connectionClosed(); } @Override public void onMessage(WebSocketMessage message) { Logging.getLogger().logInformation("VM message: " + message.getText()); try { vmService.processMessage(message.getText()); } catch (Exception e) { Logging.getLogger().logError(e.getMessage(), e); } } @Override public void onOpen() { vmService.connectionOpened(); Logging.getLogger().logInformation("VM connection open: " + url); } @Override public void onPing() { } @Override public void onPong() { } }); // Establish WebSocket Connection //noinspection TryWithIdenticalCatches try { webSocket.connect(); } catch (WebSocketException e) { throw new IOException("Failed to connect: " + url, e); } catch (ArrayIndexOutOfBoundsException e) { // The weberknecht can occasionally throw an array index exception if a connect terminates on initial connect // (de.roderick.weberknecht.WebSocket.connect, WebSocket.java:126). throw new IOException("Failed to connect: " + url, e); } vmService.requestSink = new WebSocketRequestSink(webSocket); // Check protocol version final CountDownLatch latch = new CountDownLatch(1); final String[] errMsg = new String[1]; vmService.getVersion(new VersionConsumer() { @Override public void onError(RPCError error) { String msg = "Failed to determine protocol version: " + error.getCode() + "\n message: " + error.getMessage() + "\n details: " + error.getDetails(); Logging.getLogger().logInformation(msg); errMsg[0] = msg; } @Override public void received(Version version) { vmService.runtimeVersion = version; latch.countDown(); } }); try { if (!latch.await(5, TimeUnit.SECONDS)) { throw new IOException("Failed to determine protocol version"); } if (errMsg[0] != null) { throw new IOException(errMsg[0]); } } catch (InterruptedException e) { throw new RuntimeException("Interrupted while waiting for response", e); } return vmService; } /** * Connect to the VM observatory service on the given local port. * * @return an API object for interacting with the VM service (not {@code null}). * * @deprecated prefer the Url based constructor {@link VmServiceBase#connect} */ @Deprecated public static VmService localConnect(int port) throws IOException { return connect("ws://localhost:" + port + "/ws"); } /** * A mapping between {@link String} ids' and the associated {@link Consumer} that was passed when * the request was made. Synchronize against {@link #consumerMapLock} before accessing this field. */ private final Map<String, Consumer> consumerMap = Maps.newHashMap(); /** * The object used to synchronize access to {@link #consumerMap}. */ private final Object consumerMapLock = new Object(); /** * The unique ID for the next request. */ private final AtomicInteger nextId = new AtomicInteger(); /** * A list of objects to which {@link Event}s from the VM are forwarded. */ private final List<VmServiceListener> vmListeners = new ArrayList<>(); /** * A list of objects to which {@link Event}s from the VM are forwarded. */ private final Map<String, RemoteServiceRunner> remoteServiceRunners = Maps.newHashMap(); /** * The channel through which observatory requests are made. */ RequestSink requestSink; Version runtimeVersion; /** * Add a listener to receive {@link Event}s from the VM. */ public void addVmServiceListener(VmServiceListener listener) { vmListeners.add(listener); } /** * Remove the given listener from the VM. */ public void removeVmServiceListener(VmServiceListener listener) { vmListeners.remove(listener); } /** * Add a VM RemoteServiceRunner. */ public void addServiceRunner(String service, RemoteServiceRunner runner) { remoteServiceRunners.put(service, runner); } /** * Remove a VM RemoteServiceRunner. */ public void removeServiceRunner(String service) { remoteServiceRunners.remove(service); } /** * Return the VM service protocol version supported by the current debug connection. */ public Version getRuntimeVersion() { return runtimeVersion; } /** * Disconnect from the VM observatory service. */ public void disconnect() { requestSink.close(); } /** * Return the instance with the given identifier. */ public void getInstance(String isolateId, String instanceId, final GetInstanceConsumer consumer) { getObject(isolateId, instanceId, new GetObjectConsumer() { @Override public void onError(RPCError error) { consumer.onError(error); } @Override public void received(Obj response) { if (response instanceof Instance) { consumer.received((Instance) response); } else { onError(RPCError.unexpected("Instance", response)); } } @Override public void received(Sentinel response) { onError(RPCError.unexpected("Instance", response)); } }); } /** * Return the library with the given identifier. */ public void getLibrary(String isolateId, String libraryId, final GetLibraryConsumer consumer) { getObject(isolateId, libraryId, new GetObjectConsumer() { @Override public void onError(RPCError error) { consumer.onError(error); } @Override public void received(Obj response) { if (response instanceof Library) { consumer.received((Library) response); } else { onError(RPCError.unexpected("Library", response)); } } @Override public void received(Sentinel response) { onError(RPCError.unexpected("Library", response)); } }); } public abstract void getObject(String isolateId, String objectId, GetObjectConsumer consumer); /** * Invoke a specific service protocol extension method. * <p> * See https://api.dart.dev/stable/dart-developer/dart-developer-library.html. */ public void callServiceExtension(String isolateId, String method, ServiceExtensionConsumer consumer) { JsonObject params = new JsonObject(); params.addProperty("isolateId", isolateId); request(method, params, consumer); } /** * Invoke a specific service protocol extension method. * <p> * See https://api.dart.dev/stable/dart-developer/dart-developer-library.html. */ public void callServiceExtension(String isolateId, String method, JsonObject params, ServiceExtensionConsumer consumer) { params.addProperty("isolateId", isolateId); request(method, params, consumer); } /** * Sends the request and associates the request with the passed {@link Consumer}. */ protected void request(String method, JsonObject params, Consumer consumer) { // Assemble the request String id = Integer.toString(nextId.incrementAndGet()); JsonObject request = new JsonObject(); request.addProperty(JSONRPC, JSONRPC_VERSION); request.addProperty(ID, id); request.addProperty(METHOD, method); request.add(PARAMS, params); // Cache the consumer to receive the response synchronized (consumerMapLock) { consumerMap.put(id, consumer); } // Send the request requestSink.add(request); } public void connectionOpened() { for (VmServiceListener listener : new ArrayList<>(vmListeners)) { try { listener.connectionOpened(); } catch (Exception e) { Logging.getLogger().logError("Exception notifying listener", e); } } } private void forwardEvent(String streamId, Event event) { for (VmServiceListener listener : new ArrayList<>(vmListeners)) { try { listener.received(streamId, event); } catch (Exception e) { Logging.getLogger().logError("Exception processing event: " + streamId + ", " + event.getJson(), e); } } } public void connectionClosed() { for (VmServiceListener listener : new ArrayList<>(vmListeners)) { try { listener.connectionClosed(); } catch (Exception e) { Logging.getLogger().logError("Exception notifying listener", e); } } } abstract void forwardResponse(Consumer consumer, String type, JsonObject json); void logUnknownResponse(Consumer consumer, JsonObject json) { Class<? extends Consumer> consumerClass = consumer.getClass(); StringBuilder msg = new StringBuilder(); msg.append("Expected response for ").append(consumerClass).append("\n"); for (Class<?> interf : consumerClass.getInterfaces()) { msg.append(" implementing ").append(interf).append("\n"); } msg.append(" but received ").append(json); Logging.getLogger().logError(msg.toString()); } /** * Process the response from the VM service and forward that response to the consumer associated * with the response id. */ void processMessage(String jsonText) { if (jsonText == null || jsonText.isEmpty()) { return; } // Decode the JSON JsonObject json; try { json = (JsonObject) new JsonParser().parse(jsonText); } catch (Exception e) { Logging.getLogger().logError("Parse message failed: " + jsonText, e); return; } if (json.has("method")) { if (!json.has(PARAMS)) { final String message = "Missing " + PARAMS; Logging.getLogger().logError(message); final JsonObject response = new JsonObject(); response.addProperty(JSONRPC, JSONRPC_VERSION); final JsonObject error = new JsonObject(); error.addProperty(CODE, INVALID_REQUEST); error.addProperty(MESSAGE, message); response.add(ERROR, error); requestSink.add(response); return; } if (json.has("id")) { processRequest(json); } else { processNotification(json); } } else if (json.has("result") || json.has("error")) { processResponse(json); } else { Logging.getLogger().logError("Malformed message"); } } void processRequest(JsonObject json) { final JsonObject response = new JsonObject(); response.addProperty(JSONRPC, JSONRPC_VERSION); // Get the consumer associated with this request String id; try { id = json.get(ID).getAsString(); } catch (Exception e) { final String message = "Request malformed " + ID; Logging.getLogger().logError(message, e); final JsonObject error = new JsonObject(); error.addProperty(CODE, INVALID_REQUEST); error.addProperty(MESSAGE, message); response.add(ERROR, error); requestSink.add(response); return; } response.addProperty(ID, id); String method; try { method = json.get(METHOD).getAsString(); } catch (Exception e) { final String message = "Request malformed " + METHOD; Logging.getLogger().logError(message, e); final JsonObject error = new JsonObject(); error.addProperty(CODE, INVALID_REQUEST); error.addProperty(MESSAGE, message); response.add(ERROR, error); requestSink.add(response); return; } JsonObject params; try { params = json.get(PARAMS).getAsJsonObject(); } catch (Exception e) { final String message = "Request malformed " + METHOD; Logging.getLogger().logError(message, e); final JsonObject error = new JsonObject(); error.addProperty(CODE, INVALID_REQUEST); error.addProperty(MESSAGE, message); response.add(ERROR, error); requestSink.add(response); return; } if (!remoteServiceRunners.containsKey(method)) { final String message = "Unknown service " + method; Logging.getLogger().logError(message); final JsonObject error = new JsonObject(); error.addProperty(CODE, METHOD_NOT_FOUND); error.addProperty(MESSAGE, message); response.add(ERROR, error); requestSink.add(response); return; } final RemoteServiceRunner runner = remoteServiceRunners.get(method); try { runner.run(params, new RemoteServiceCompleter() { public void result(JsonObject result) { response.add(RESULT, result); requestSink.add(response); } public void error(int code, String message, JsonObject data) { final JsonObject error = new JsonObject(); error.addProperty(CODE, code); error.addProperty(MESSAGE, message); if (data != null) { error.add(DATA, data); } response.add(ERROR, error); requestSink.add(response); } }); } catch (Exception e) { final String message = "Internal Server Error"; Logging.getLogger().logError(message, e); final JsonObject error = new JsonObject(); error.addProperty(CODE, SERVER_ERROR); error.addProperty(MESSAGE, message); response.add(ERROR, error); requestSink.add(response); } } private static final RemoteServiceCompleter ignoreCallback = new RemoteServiceCompleter() { public void result(JsonObject result) { // ignore } public void error(int code, String message, JsonObject data) { // ignore } }; void processNotification(JsonObject json) { String method; try { method = json.get(METHOD).getAsString(); } catch (Exception e) { Logging.getLogger().logError("Request malformed " + METHOD, e); return; } JsonObject params; try { params = json.get(PARAMS).getAsJsonObject(); } catch (Exception e) { Logging.getLogger().logError("Event missing " + PARAMS, e); return; } if ("streamNotify".equals(method)) { String streamId; try { streamId = params.get(STREAM_ID).getAsString(); } catch (Exception e) { Logging.getLogger().logError("Event missing " + STREAM_ID, e); return; } Event event; try { event = new Event(params.get(EVENT).getAsJsonObject()); } catch (Exception e) { Logging.getLogger().logError("Event missing " + EVENT, e); return; } forwardEvent(streamId, event); } else { if (!remoteServiceRunners.containsKey(method)) { Logging.getLogger().logError("Unknown service " + method); return; } final RemoteServiceRunner runner = remoteServiceRunners.get(method); try { runner.run(params, ignoreCallback); } catch (Exception e) { Logging.getLogger().logError("Internal Server Error", e); } } } protected String removeNewLines(String str) { return str.replaceAll("\r\n", " ").replaceAll("\n", " "); } void processResponse(JsonObject json) { JsonElement idElem = json.get(ID); if (idElem == null) { Logging.getLogger().logError("Response missing " + ID); return; } // Get the consumer associated with this response String id; try { id = idElem.getAsString(); } catch (Exception e) { Logging.getLogger().logError("Response missing " + ID, e); return; } Consumer consumer = consumerMap.remove(id); if (consumer == null) { Logging.getLogger().logError("No consumer associated with " + ID + ": " + id); return; } // Forward the response if the request was successfully executed JsonElement resultElem = json.get(RESULT); if (resultElem != null) { JsonObject result; try { result = resultElem.getAsJsonObject(); } catch (Exception e) { Logging.getLogger().logError("Response has invalid " + RESULT, e); return; } String responseType = ""; if (result.has(TYPE)) { responseType = result.get(TYPE).getAsString(); } // ServiceExtensionConsumers do not care about the response type. else if (!(consumer instanceof ServiceExtensionConsumer)) { Logging.getLogger().logError("Response missing " + TYPE + ": " + result); return; } forwardResponse(consumer, responseType, result); return; } // Forward an error if the request failed resultElem = json.get(ERROR); if (resultElem != null) { JsonObject error; try { error = resultElem.getAsJsonObject(); } catch (Exception e) { Logging.getLogger().logError("Response has invalid " + RESULT, e); return; } consumer.onError(new RPCError(error)); return; } Logging.getLogger().logError("Response missing " + RESULT + " and " + ERROR); } }
flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/VmServiceBase.java/0
{ "file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/VmServiceBase.java", "repo_id": "flutter-intellij", "token_count": 7275 }
516
/* * Copyright (c) 2015, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * 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. */ package org.dartlang.vm.service.element; // This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk. import com.google.gson.JsonArray; import com.google.gson.JsonObject; @SuppressWarnings({"WeakerAccess", "unused"}) public class AllocationProfile extends Response { public AllocationProfile(JsonObject json) { super(json); } /** * The timestamp of the last accumulator reset. * * If the accumulators have not been reset, this field is not present. * * Can return <code>null</code>. */ public int getDateLastAccumulatorReset() { return getAsInt("dateLastAccumulatorReset"); } /** * The timestamp of the last manually triggered GC. * * If a GC has not been triggered manually, this field is not present. * * Can return <code>null</code>. */ public int getDateLastServiceGC() { return getAsInt("dateLastServiceGC"); } /** * Allocation information for all class types. */ public ElementList<ClassHeapStats> getMembers() { return new ElementList<ClassHeapStats>(json.get("members").getAsJsonArray()) { @Override protected ClassHeapStats basicGet(JsonArray array, int index) { return new ClassHeapStats(array.get(index).getAsJsonObject()); } }; } /** * Information about memory usage for the isolate. */ public MemoryUsage getMemoryUsage() { return new MemoryUsage((JsonObject) json.get("memoryUsage")); } }
flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/AllocationProfile.java/0
{ "file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/AllocationProfile.java", "repo_id": "flutter-intellij", "token_count": 648 }
517
/* * Copyright (c) 2015, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * 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. */ package org.dartlang.vm.service.element; // This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk. import com.google.gson.JsonObject; import java.util.List; /** * See getCpuSamples and CpuSamples. */ @SuppressWarnings({"WeakerAccess", "unused"}) public class CpuSample extends Element { public CpuSample(JsonObject json) { super(json); } /** * Matches the index of a class in HeapSnapshot.classes. Provided for CpuSample instances * returned from a getAllocationTraces(). * * Can return <code>null</code>. */ public int getClassId() { return getAsInt("classId"); } /** * The identityHashCode assigned to the allocated object. This hash code is the same as the hash * code provided in HeapSnapshot. Provided for CpuSample instances returned from a * getAllocationTraces(). * * Can return <code>null</code>. */ public int getIdentityHashCode() { return getAsInt("identityHashCode"); } /** * The call stack at the time this sample was collected. The stack is to be interpreted as top to * bottom. Each element in this array is a key into the `functions` array in `CpuSamples`. * * Example: * * `functions[stack[0]] = @Function(bar())` `functions[stack[1]] = @Function(foo())` * `functions[stack[2]] = @Function(main())` */ public List<Integer> getStack() { return getListInt("stack"); } /** * The thread ID representing the thread on which this sample was collected. */ public int getTid() { return getAsInt("tid"); } /** * The time this sample was collected in microseconds. */ public long getTimestamp() { return json.get("timestamp") == null ? -1 : json.get("timestamp").getAsLong(); } /** * Provided and set to true if the sample's stack was truncated. This can happen if the stack is * deeper than the `stackDepth` in the `CpuSamples` response. * * Can return <code>null</code>. */ public boolean getTruncated() { return getAsBoolean("truncated"); } /** * The name of the User tag set when this sample was collected. Omitted if no User tag was set * when this sample was collected. * * Can return <code>null</code>. */ public String getUserTag() { return getAsString("userTag"); } /** * The name of VM tag set when this sample was collected. Omitted if the VM tag for the sample is * not considered valid. * * Can return <code>null</code>. */ public String getVmTag() { return getAsString("vmTag"); } }
flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/CpuSample.java/0
{ "file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/CpuSample.java", "repo_id": "flutter-intellij", "token_count": 1008 }
518
/* * Copyright (c) 2015, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * 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. */ package org.dartlang.vm.service.element; // This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk. import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @SuppressWarnings({"WeakerAccess", "unused"}) public class Frame extends Response { public Frame(JsonObject json) { super(json); } /** * Can return <code>null</code>. */ public CodeRef getCode() { JsonObject obj = (JsonObject) json.get("code"); if (obj == null) return null; final String type = json.get("type").getAsString(); if ("Instance".equals(type) || "@Instance".equals(type)) { final String kind = json.get("kind").getAsString(); if ("Null".equals(kind)) return null; } return new CodeRef(obj); } /** * Can return <code>null</code>. */ public FuncRef getFunction() { JsonObject obj = (JsonObject) json.get("function"); if (obj == null) return null; final String type = json.get("type").getAsString(); if ("Instance".equals(type) || "@Instance".equals(type)) { final String kind = json.get("kind").getAsString(); if ("Null".equals(kind)) return null; } return new FuncRef(obj); } public int getIndex() { return getAsInt("index"); } /** * Can return <code>null</code>. */ public FrameKind getKind() { if (json.get("kind") == null) return null; final JsonElement value = json.get("kind"); try { return value == null ? FrameKind.Unknown : FrameKind.valueOf(value.getAsString()); } catch (IllegalArgumentException e) { return FrameKind.Unknown; } } /** * Can return <code>null</code>. */ public SourceLocation getLocation() { JsonObject obj = (JsonObject) json.get("location"); if (obj == null) return null; final String type = json.get("type").getAsString(); if ("Instance".equals(type) || "@Instance".equals(type)) { final String kind = json.get("kind").getAsString(); if ("Null".equals(kind)) return null; } return new SourceLocation(obj); } /** * Can return <code>null</code>. */ public ElementList<BoundVariable> getVars() { if (json.get("vars") == null) return null; return new ElementList<BoundVariable>(json.get("vars").getAsJsonArray()) { @Override protected BoundVariable basicGet(JsonArray array, int index) { return new BoundVariable(array.get(index).getAsJsonObject()); } }; } }
flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/Frame.java/0
{ "file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/Frame.java", "repo_id": "flutter-intellij", "token_count": 1082 }
519
/* * Copyright (c) 2015, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * 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. */ package org.dartlang.vm.service.element; // This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk. import com.google.gson.JsonObject; import java.util.List; /** * A {@link LibraryDependency} provides information about an import or export. */ @SuppressWarnings({"WeakerAccess", "unused"}) public class LibraryDependency extends Element { public LibraryDependency(JsonObject json) { super(json); } /** * The list of symbols hidden from this dependency. * * Can return <code>null</code>. */ public List<String> getHides() { return json.get("hides") == null ? null : getListString("hides"); } /** * Is this dependency deferred? */ public boolean getIsDeferred() { return getAsBoolean("isDeferred"); } /** * Is this dependency an import (rather than an export)? */ public boolean getIsImport() { return getAsBoolean("isImport"); } /** * The prefix of an 'as' import, or null. */ public String getPrefix() { return getAsString("prefix"); } /** * The list of symbols made visible from this dependency. * * Can return <code>null</code>. */ public List<String> getShows() { return json.get("shows") == null ? null : getListString("shows"); } /** * The library being imported or exported. */ public LibraryRef getTarget() { return new LibraryRef((JsonObject) json.get("target")); } }
flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/LibraryDependency.java/0
{ "file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/LibraryDependency.java", "repo_id": "flutter-intellij", "token_count": 636 }
520
/* * Copyright (c) 2015, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * 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. */ package org.dartlang.vm.service.element; // This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk. import com.google.gson.JsonObject; /** * See getSupportedProtocols. */ @SuppressWarnings({"WeakerAccess", "unused"}) public class Protocol extends Element { public Protocol(JsonObject json) { super(json); } /** * The major revision of the protocol. */ public int getMajor() { return getAsInt("major"); } /** * The minor revision of the protocol. */ public int getMinor() { return getAsInt("minor"); } /** * The name of the supported protocol. */ public String getProtocolName() { return getAsString("protocolName"); } }
flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/Protocol.java/0
{ "file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/Protocol.java", "repo_id": "flutter-intellij", "token_count": 400 }
521
/* * Copyright (c) 2015, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * 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. */ package org.dartlang.vm.service.element; // This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk. import com.google.gson.JsonObject; /** * See Versioning. */ @SuppressWarnings({"WeakerAccess", "unused"}) public class Version extends Response { public Version(JsonObject json) { super(json); } /** * The major version number is incremented when the protocol is changed in a potentially * incompatible way. */ public int getMajor() { return getAsInt("major"); } /** * The minor version number is incremented when the protocol is changed in a backwards compatible * way. */ public int getMinor() { return getAsInt("minor"); } }
flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/Version.java/0
{ "file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/Version.java", "repo_id": "flutter-intellij", "token_count": 383 }
522
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter; import com.intellij.openapi.application.ApplicationInfo; import com.intellij.openapi.ui.Messages; public class FlutterStudioInitializer implements Runnable { private static void reportVersionIncompatibility(ApplicationInfo info) { Messages.showErrorDialog("The Flutter plugin requires a more recent version of Android Studio.", "Version Mismatch"); } @Override public void run() { // Unlike StartupActivity, this runs before the welcome screen (FlatWelcomeFrame) is displayed. // StartupActivity runs just before a project is opened. ApplicationInfo info = ApplicationInfo.getInstance(); if ("Google".equals(info.getCompanyName())) { String version = info.getFullVersion(); if (version.startsWith("2.")) { reportVersionIncompatibility(info); } } } }
flutter-intellij/flutter-studio/src/io/flutter/FlutterStudioInitializer.java/0
{ "file_path": "flutter-intellij/flutter-studio/src/io/flutter/FlutterStudioInitializer.java", "repo_id": "flutter-intellij", "token_count": 296 }
523
/* * Copyright 2019 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package io.flutter.utils; //import static com.android.tools.idea.gradle.project.importing.GradleProjectImporter.ANDROID_PROJECT_TYPE; import static com.intellij.util.ReflectionUtil.findAssignableField; import static io.flutter.actions.AttachDebuggerAction.ATTACH_IS_ACTIVE; import static io.flutter.actions.AttachDebuggerAction.findRunConfig; import com.android.tools.idea.gradle.project.sync.GradleSyncListener; import com.android.tools.idea.gradle.project.sync.GradleSyncState; import com.intellij.ProjectTopics; import com.intellij.debugger.engine.DebugProcess; import com.intellij.debugger.engine.DebugProcessListener; import com.intellij.debugger.impl.DebuggerManagerListener; import com.intellij.debugger.impl.DebuggerSession; import com.intellij.execution.RunManagerEx; import com.intellij.execution.configurations.RunConfiguration; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.*; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ThreeState; import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.messages.Topic; import io.flutter.FlutterUtils; import io.flutter.actions.AttachDebuggerAction; import io.flutter.pub.PubRoot; import io.flutter.run.SdkAttachConfig; import io.flutter.run.SdkRunConfig; import io.flutter.sdk.FlutterSdk; import com.intellij.openapi.diagnostic.Logger; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.List; import java.util.Objects; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class AddToAppUtils { //private static final Logger LOG = Logger.getInstance(AddToAppUtils.class); private AddToAppUtils() { } public static boolean initializeAndDetectFlutter(@NotNull Project project) { MessageBusConnection connection = project.getMessageBus().connect(project); // GRADLE_SYNC_TOPIC is not public in Android Studio 3.5. It is in 3.6. It isn't defined in 3.4. //noinspection unchecked Topic<GradleSyncListener> topic = getStaticFieldValue(GradleSyncState.class, Topic.class, "GRADLE_SYNC_TOPIC"); if (topic != null) { connection.subscribe(topic, makeSyncListener(project)); } if (!FlutterModuleUtils.hasFlutterModule(project)) { connection.subscribe(ProjectTopics.MODULES, new ModuleListener() { @Override public void moduleAdded(@NotNull Project proj, @NotNull Module mod) { if (AndroidUtils.FLUTTER_MODULE_NAME.equals(mod.getName()) || (FlutterUtils.flutterGradleModuleName(project)).equals(mod.getName())) { //connection.disconnect(); TODO(messick) Test this deletion! AppExecutorUtil.getAppExecutorService().execute(() -> { GradleUtils.enableCoeditIfAddToAppDetected(project); }); } } }); return false; } else { @Nullable ProjectType projectType = ProjectTypeService.getProjectType(project); if (projectType != null && "Android".equals(projectType.getId())) { // This is an add-to-app project. connection.subscribe(DebuggerManagerListener.TOPIC, makeAddToAppAttachListener(project)); } } return true; } // Derived from the method in ReflectionUtil, with the addition of setAccessible(). public static <T> T getStaticFieldValue(@NotNull Class objectClass, @Nullable("null means any type") Class<T> fieldType, @NotNull @NonNls String fieldName) { try { final Field field = findAssignableField(objectClass, fieldType, fieldName); if (!Modifier.isStatic(field.getModifiers())) { throw new IllegalArgumentException("Field " + objectClass + "." + fieldName + " is not static"); } field.setAccessible(true); //noinspection unchecked return (T)field.get(null); } catch (NoSuchFieldException | IllegalAccessException e) { return null; } } @NotNull private static GradleSyncListener makeSyncListener(@NotNull Project project) { return new GradleSyncListener() { @Override public void syncSucceeded(@NotNull Project project) { GradleUtils.checkDartSupport(project); } @Override public void syncFailed(@NotNull Project project, @NotNull String errorMessage) { GradleUtils.checkDartSupport(project); } @Override public void syncSkipped(@NotNull Project project) { GradleUtils.checkDartSupport(project); } @SuppressWarnings("override") public void sourceGenerationFinished(@NotNull Project project) { } }; } @NotNull private static DebuggerManagerListener makeAddToAppAttachListener(@NotNull Project project) { return new DebuggerManagerListener() { DebugProcessListener dpl = new DebugProcessListener() { @Override public void processDetached(@NotNull DebugProcess process, boolean closedByUser) { ThreeState state = project.getUserData(ATTACH_IS_ACTIVE); if (state != null) { project.putUserData(ATTACH_IS_ACTIVE, null); } } @Override public void processAttached(@NotNull DebugProcess process) { if (project.getUserData(ATTACH_IS_ACTIVE) != null) { return; } // Launch flutter attach if a run config can be found. @Nullable RunConfiguration runConfig = findRunConfig(project); if (runConfig == null) { // Either there is no Flutter run config or there are more than one. return; } if (!(runConfig instanceof SdkAttachConfig)) { // The selected run config at this point is not Flutter, so we can't start the process automatically. return; } FlutterSdk sdk = FlutterSdk.getFlutterSdk(project); if (sdk == null) { return; } // If needed, DataContext could be saved by FlutterReloadManager.beforeActionPerformed() in project user data. DataContext context = DataContext.EMPTY_CONTEXT; PubRoot pubRoot = ((SdkAttachConfig)runConfig).pubRoot; Application app = ApplicationManager.getApplication(); project.putUserData(ATTACH_IS_ACTIVE, ThreeState.fromBoolean(true)); // Note: Using block comments to preserve formatting. app.invokeLater( /* After the Android launch completes, */ () -> app.executeOnPooledThread( /* but not on the EDT, */ () -> app.runReadAction( /* with read access, */ () -> new AttachDebuggerAction().startCommand(project, sdk, pubRoot, context)))); /* attach. */ } }; @Override public void sessionCreated(DebuggerSession session) { session.getProcess().addDebugProcessListener(dpl); } @Override public void sessionRemoved(DebuggerSession session) { session.getProcess().removeDebugProcessListener(dpl); } }; } }
flutter-intellij/flutter-studio/src/io/flutter/utils/AddToAppUtils.java/0
{ "file_path": "flutter-intellij/flutter-studio/src/io/flutter/utils/AddToAppUtils.java", "repo_id": "flutter-intellij", "token_count": 2848 }
524
/* * Copyright 2017 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ package com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard; import static com.android.tools.idea.tests.gui.framework.GuiTests.findAndClickButton; import com.android.tools.adtui.ASGallery; import com.android.tools.idea.tests.gui.framework.GuiTests; import com.android.tools.idea.tests.gui.framework.fixture.IdeaFrameFixture; import com.android.tools.idea.tests.gui.framework.fixture.wizard.AbstractWizardFixture; import com.android.tools.idea.tests.gui.framework.matcher.Matchers; import io.flutter.module.FlutterProjectType; import javax.swing.JDialog; import javax.swing.JRootPane; import org.fest.swing.core.Robot; import org.fest.swing.fixture.JListFixture; import org.fest.swing.timing.Wait; import org.jetbrains.annotations.NotNull; public class NewFlutterModuleWizardFixture extends AbstractWizardFixture<NewFlutterModuleWizardFixture> { private NewFlutterModuleWizardFixture(@NotNull Robot robot, @NotNull JDialog target) { super(NewFlutterModuleWizardFixture.class, robot, target); } public NewFlutterModuleWizardFixture chooseModuleType(@NotNull String activity) { JListFixture listFixture = new JListFixture(robot(), robot().finder().findByType(target(), ASGallery.class)); listFixture.clickItem(activity); return this; } @NotNull public FlutterProjectStepFixture<NewFlutterModuleWizardFixture> getFlutterProjectStep(@NotNull FlutterProjectType type) { String projectType; //noinspection Duplicates switch (type) { case APP: projectType = "application"; break; case PACKAGE: projectType = "package"; break; case PLUGIN: projectType = "plugin"; break; default: throw new IllegalArgumentException(); } JRootPane rootPane = findStepWithTitle("Configure the new Flutter " + projectType); return new FlutterProjectStepFixture<>(this, rootPane); } @NotNull public FlutterSettingsStepFixture getFlutterSettingsStep() { JRootPane rootPane = findStepWithTitle("Set the package name"); return new FlutterSettingsStepFixture<>(this, rootPane); } @SuppressWarnings("UnusedReturnValue") @NotNull public NewFlutterModuleWizardFixture clickFinish() { // Do not use superclass method. When the project/module wizard is run from the IDE (not the Welcome screen) // the dialog does not disappear within the time allotted by the superclass method. findAndClickButton(this, "Finish"); Wait.seconds(30).expecting("dialog to disappear").until(() -> !target().isShowing()); return myself(); } @NotNull public static NewFlutterModuleWizardFixture find(@NotNull IdeaFrameFixture fixture) { Robot robot = fixture.robot(); JDialog dialog = GuiTests.waitUntilShowing(robot, Matchers.byTitle(JDialog.class, "Create New Module")); return new NewFlutterModuleWizardFixture(robot, dialog); } }
flutter-intellij/flutter-studio/testSrc/com/android/tools/idea/tests/gui/framework/fixture/newProjectWizard/NewFlutterModuleWizardFixture.java/0
{ "file_path": "flutter-intellij/flutter-studio/testSrc/com/android/tools/idea/tests/gui/framework/fixture/newProjectWizard/NewFlutterModuleWizardFixture.java", "repo_id": "flutter-intellij", "token_count": 1023 }
525
{ "list": [ { "channel": "stable", "comments": "IntelliJ 2023.2, Android Studio Iguana 2023.2", "name": "2023.2", "version": "2023.2", "isUnitTestTarget": "false", "ideaProduct": "android-studio", "ideaVersion": "2023.2.1.23", "baseVersion": "232.10072.27", "androidPluginVersion": "X.Y.Z", "dartPluginVersion": "232.10305", "sinceBuild": "232.10072.27", "untilBuild": "232.*" }, { "channel": "stable", "comments": "IntelliJ 2023.3, Android Studio Jellyfish 2023.3", "name": "2023.3", "version": "2023.3", "isUnitTestTarget": "true", "ideaProduct": "android-studio", "ideaVersion": "2023.3.1.13", "baseVersion": "233.13135.103", "androidPluginVersion": "X.Y.Z", "dartPluginVersion": "233.14888", "sinceBuild": "233.13135.103", "untilBuild": "233.*" } ] }
flutter-intellij/product-matrix.json/0
{ "file_path": "flutter-intellij/product-matrix.json", "repo_id": "flutter-intellij", "token_count": 448 }
526
{ "activeBlue": "ff007aff", "activeBlue.darkColor": "ff0a84ff", "activeBlue.darkElevatedColor": "ff0a84ff", "activeBlue.darkHighContrastColor": "ff409cff", "activeBlue.darkHighContrastElevatedColor": "ff409cff", "activeBlue.elevatedColor": "ff007aff", "activeBlue.highContrastColor": "ff0040dd", "activeBlue.highContrastElevatedColor": "ff0040dd", "activeGreen": "ff34c759", "activeGreen.darkColor": "ff30d158", "activeGreen.darkElevatedColor": "ff30d158", "activeGreen.darkHighContrastColor": "ff30db5b", "activeGreen.darkHighContrastElevatedColor": "ff30db5b", "activeGreen.elevatedColor": "ff34c759", "activeGreen.highContrastColor": "ff248a3d", "activeGreen.highContrastElevatedColor": "ff248a3d", "activeOrange": "ffff9500", "activeOrange.darkColor": "ffff9f0a", "activeOrange.darkElevatedColor": "ffff9f0a", "activeOrange.darkHighContrastColor": "ffffb340", "activeOrange.darkHighContrastElevatedColor": "ffffb340", "activeOrange.elevatedColor": "ffff9500", "activeOrange.highContrastColor": "ffc93400", "activeOrange.highContrastElevatedColor": "ffc93400", "black": "ff000000", "darkBackgroundGray": "ff171717", "destructiveRed": "ffff3b30", "destructiveRed.darkColor": "ffff453a", "destructiveRed.darkElevatedColor": "ffff453a", "destructiveRed.darkHighContrastColor": "ffff6961", "destructiveRed.darkHighContrastElevatedColor": "ffff6961", "destructiveRed.elevatedColor": "ffff3b30", "destructiveRed.highContrastColor": "ffd70015", "destructiveRed.highContrastElevatedColor": "ffd70015", "extraLightBackgroundGray": "ffefeff4", "inactiveGray": "ff999999", "inactiveGray.darkColor": "ff757575", "inactiveGray.darkElevatedColor": "ff757575", "inactiveGray.darkHighContrastColor": "ff757575", "inactiveGray.darkHighContrastElevatedColor": "ff757575", "inactiveGray.elevatedColor": "ff999999", "inactiveGray.highContrastColor": "ff999999", "inactiveGray.highContrastElevatedColor": "ff999999", "label": "ff000000", "label.darkColor": "ffffffff", "label.darkElevatedColor": "ffffffff", "label.darkHighContrastColor": "ffffffff", "label.darkHighContrastElevatedColor": "ffffffff", "label.elevatedColor": "ff000000", "label.highContrastColor": "ff000000", "label.highContrastElevatedColor": "ff000000", "lightBackgroundGray": "ffe5e5ea", "link": "ff007aff", "link.darkColor": "ff0984ff", "link.darkElevatedColor": "ff0984ff", "link.darkHighContrastColor": "ff0984ff", "link.darkHighContrastElevatedColor": "ff0984ff", "link.elevatedColor": "ff007aff", "link.highContrastColor": "ff007aff", "link.highContrastElevatedColor": "ff007aff", "opaqueSeparator": "ffc6c6c8", "opaqueSeparator.darkColor": "ff38383a", "opaqueSeparator.darkElevatedColor": "ff38383a", "opaqueSeparator.darkHighContrastColor": "ff38383a", "opaqueSeparator.darkHighContrastElevatedColor": "ff38383a", "opaqueSeparator.elevatedColor": "ffc6c6c8", "opaqueSeparator.highContrastColor": "ffc6c6c8", "opaqueSeparator.highContrastElevatedColor": "ffc6c6c8", "placeholderText": "4c3c3c43", "placeholderText.darkColor": "4cebebf5", "placeholderText.darkElevatedColor": "4cebebf5", "placeholderText.darkHighContrastColor": "60ebebf5", "placeholderText.darkHighContrastElevatedColor": "60ebebf5", "placeholderText.elevatedColor": "4c3c3c43", "placeholderText.highContrastColor": "603c3c43", "placeholderText.highContrastElevatedColor": "603c3c43", "quaternaryLabel": "2d3c3c43", "quaternaryLabel.darkColor": "28ebebf5", "quaternaryLabel.darkElevatedColor": "28ebebf5", "quaternaryLabel.darkHighContrastColor": "3debebf5", "quaternaryLabel.darkHighContrastElevatedColor": "3debebf5", "quaternaryLabel.elevatedColor": "2d3c3c43", "quaternaryLabel.highContrastColor": "423c3c43", "quaternaryLabel.highContrastElevatedColor": "423c3c43", "quaternarySystemFill": "14747480", "quaternarySystemFill.darkColor": "2d767680", "quaternarySystemFill.darkElevatedColor": "2d767680", "quaternarySystemFill.darkHighContrastColor": "42767680", "quaternarySystemFill.darkHighContrastElevatedColor": "42767680", "quaternarySystemFill.elevatedColor": "14747480", "quaternarySystemFill.highContrastColor": "28747480", "quaternarySystemFill.highContrastElevatedColor": "28747480", "secondaryLabel": "993c3c43", "secondaryLabel.darkColor": "99ebebf5", "secondaryLabel.darkElevatedColor": "99ebebf5", "secondaryLabel.darkHighContrastColor": "adebebf5", "secondaryLabel.darkHighContrastElevatedColor": "adebebf5", "secondaryLabel.elevatedColor": "993c3c43", "secondaryLabel.highContrastColor": "ad3c3c43", "secondaryLabel.highContrastElevatedColor": "ad3c3c43", "secondarySystemBackground": "fff2f2f7", "secondarySystemBackground.darkColor": "ff1c1c1e", "secondarySystemBackground.darkElevatedColor": "ff2c2c2e", "secondarySystemBackground.darkHighContrastColor": "ff242426", "secondarySystemBackground.darkHighContrastElevatedColor": "ff363638", "secondarySystemBackground.elevatedColor": "fff2f2f7", "secondarySystemBackground.highContrastColor": "ffebebf0", "secondarySystemBackground.highContrastElevatedColor": "ffebebf0", "secondarySystemFill": "28787880", "secondarySystemFill.darkColor": "51787880", "secondarySystemFill.darkElevatedColor": "51787880", "secondarySystemFill.darkHighContrastColor": "66787880", "secondarySystemFill.darkHighContrastElevatedColor": "66787880", "secondarySystemFill.elevatedColor": "28787880", "secondarySystemFill.highContrastColor": "3d787880", "secondarySystemFill.highContrastElevatedColor": "3d787880", "secondarySystemGroupedBackground": "ffffffff", "secondarySystemGroupedBackground.darkColor": "ff1c1c1e", "secondarySystemGroupedBackground.darkElevatedColor": "ff2c2c2e", "secondarySystemGroupedBackground.darkHighContrastColor": "ff242426", "secondarySystemGroupedBackground.darkHighContrastElevatedColor": "ff363638", "secondarySystemGroupedBackground.elevatedColor": "ffffffff", "secondarySystemGroupedBackground.highContrastColor": "ffffffff", "secondarySystemGroupedBackground.highContrastElevatedColor": "ffffffff", "separator": "493c3c43", "separator.darkColor": "99545458", "separator.darkElevatedColor": "99545458", "separator.darkHighContrastColor": "ad545458", "separator.darkHighContrastElevatedColor": "ad545458", "separator.elevatedColor": "493c3c43", "separator.highContrastColor": "5e3c3c43", "separator.highContrastElevatedColor": "5e3c3c43", "systemBackground": "ffffffff", "systemBackground.darkColor": "ff000000", "systemBackground.darkElevatedColor": "ff1c1c1e", "systemBackground.darkHighContrastColor": "ff000000", "systemBackground.darkHighContrastElevatedColor": "ff242426", "systemBackground.elevatedColor": "ffffffff", "systemBackground.highContrastColor": "ffffffff", "systemBackground.highContrastElevatedColor": "ffffffff", "systemBlue": "ff007aff", "systemBlue.darkColor": "ff0a84ff", "systemBlue.darkElevatedColor": "ff0a84ff", "systemBlue.darkHighContrastColor": "ff409cff", "systemBlue.darkHighContrastElevatedColor": "ff409cff", "systemBlue.elevatedColor": "ff007aff", "systemBlue.highContrastColor": "ff0040dd", "systemBlue.highContrastElevatedColor": "ff0040dd", "systemFill": "33787880", "systemFill.darkColor": "5b787880", "systemFill.darkElevatedColor": "5b787880", "systemFill.darkHighContrastColor": "70787880", "systemFill.darkHighContrastElevatedColor": "70787880", "systemFill.elevatedColor": "33787880", "systemFill.highContrastColor": "47787880", "systemFill.highContrastElevatedColor": "47787880", "systemGreen": "ff34c759", "systemGreen.darkColor": "ff30d158", "systemGreen.darkElevatedColor": "ff30d158", "systemGreen.darkHighContrastColor": "ff30db5b", "systemGreen.darkHighContrastElevatedColor": "ff30db5b", "systemGreen.elevatedColor": "ff34c759", "systemGreen.highContrastColor": "ff248a3d", "systemGreen.highContrastElevatedColor": "ff248a3d", "systemGrey": "ff8e8e93", "systemGrey.darkColor": "ff8e8e93", "systemGrey.darkElevatedColor": "ff8e8e93", "systemGrey.darkHighContrastColor": "ffaeaeb2", "systemGrey.darkHighContrastElevatedColor": "ffaeaeb2", "systemGrey.elevatedColor": "ff8e8e93", "systemGrey.highContrastColor": "ff6c6c70", "systemGrey.highContrastElevatedColor": "ff6c6c70", "systemGrey2": "ffaeaeb2", "systemGrey2.darkColor": "ff636366", "systemGrey2.darkElevatedColor": "ff636366", "systemGrey2.darkHighContrastColor": "ff7c7c80", "systemGrey2.darkHighContrastElevatedColor": "ff7c7c80", "systemGrey2.elevatedColor": "ffaeaeb2", "systemGrey2.highContrastColor": "ff8e8e93", "systemGrey2.highContrastElevatedColor": "ff8e8e93", "systemGrey3": "ffc7c7cc", "systemGrey3.darkColor": "ff48484a", "systemGrey3.darkElevatedColor": "ff48484a", "systemGrey3.darkHighContrastColor": "ff545456", "systemGrey3.darkHighContrastElevatedColor": "ff545456", "systemGrey3.elevatedColor": "ffc7c7cc", "systemGrey3.highContrastColor": "ffaeaeb2", "systemGrey3.highContrastElevatedColor": "ffaeaeb2", "systemGrey4": "ffd1d1d6", "systemGrey4.darkColor": "ff3a3a3c", "systemGrey4.darkElevatedColor": "ff3a3a3c", "systemGrey4.darkHighContrastColor": "ff444446", "systemGrey4.darkHighContrastElevatedColor": "ff444446", "systemGrey4.elevatedColor": "ffd1d1d6", "systemGrey4.highContrastColor": "ffbcbcc0", "systemGrey4.highContrastElevatedColor": "ffbcbcc0", "systemGrey5": "ffe5e5ea", "systemGrey5.darkColor": "ff2c2c2e", "systemGrey5.darkElevatedColor": "ff2c2c2e", "systemGrey5.darkHighContrastColor": "ff363638", "systemGrey5.darkHighContrastElevatedColor": "ff363638", "systemGrey5.elevatedColor": "ffe5e5ea", "systemGrey5.highContrastColor": "ffd8d8dc", "systemGrey5.highContrastElevatedColor": "ffd8d8dc", "systemGrey6": "fff2f2f7", "systemGrey6.darkColor": "ff1c1c1e", "systemGrey6.darkElevatedColor": "ff1c1c1e", "systemGrey6.darkHighContrastColor": "ff242426", "systemGrey6.darkHighContrastElevatedColor": "ff242426", "systemGrey6.elevatedColor": "fff2f2f7", "systemGrey6.highContrastColor": "ffebebf0", "systemGrey6.highContrastElevatedColor": "ffebebf0", "systemGroupedBackground": "fff2f2f7", "systemGroupedBackground.darkColor": "ff000000", "systemGroupedBackground.darkElevatedColor": "ff1c1c1e", "systemGroupedBackground.darkHighContrastColor": "ff000000", "systemGroupedBackground.darkHighContrastElevatedColor": "ff242426", "systemGroupedBackground.elevatedColor": "fff2f2f7", "systemGroupedBackground.highContrastColor": "ffebebf0", "systemGroupedBackground.highContrastElevatedColor": "ffebebf0", "systemIndigo": "ff5856d6", "systemIndigo.darkColor": "ff5e5ce6", "systemIndigo.darkElevatedColor": "ff5e5ce6", "systemIndigo.darkHighContrastColor": "ff7d7aff", "systemIndigo.darkHighContrastElevatedColor": "ff7d7aff", "systemIndigo.elevatedColor": "ff5856d6", "systemIndigo.highContrastColor": "ff3634a3", "systemIndigo.highContrastElevatedColor": "ff3634a3", "systemOrange": "ffff9500", "systemOrange.darkColor": "ffff9f0a", "systemOrange.darkElevatedColor": "ffff9f0a", "systemOrange.darkHighContrastColor": "ffffb340", "systemOrange.darkHighContrastElevatedColor": "ffffb340", "systemOrange.elevatedColor": "ffff9500", "systemOrange.highContrastColor": "ffc93400", "systemOrange.highContrastElevatedColor": "ffc93400", "systemPink": "ffff2d55", "systemPink.darkColor": "ffff375f", "systemPink.darkElevatedColor": "ffff375f", "systemPink.darkHighContrastColor": "ffff6482", "systemPink.darkHighContrastElevatedColor": "ffff6482", "systemPink.elevatedColor": "ffff2d55", "systemPink.highContrastColor": "ffd30f45", "systemPink.highContrastElevatedColor": "ffd30f45", "systemPurple": "ffaf52de", "systemPurple.darkColor": "ffbf5af2", "systemPurple.darkElevatedColor": "ffbf5af2", "systemPurple.darkHighContrastColor": "ffda8fff", "systemPurple.darkHighContrastElevatedColor": "ffda8fff", "systemPurple.elevatedColor": "ffaf52de", "systemPurple.highContrastColor": "ff8944ab", "systemPurple.highContrastElevatedColor": "ff8944ab", "systemRed": "ffff3b30", "systemRed.darkColor": "ffff453a", "systemRed.darkElevatedColor": "ffff453a", "systemRed.darkHighContrastColor": "ffff6961", "systemRed.darkHighContrastElevatedColor": "ffff6961", "systemRed.elevatedColor": "ffff3b30", "systemRed.highContrastColor": "ffd70015", "systemRed.highContrastElevatedColor": "ffd70015", "systemTeal": "ff5ac8fa", "systemTeal.darkColor": "ff64d2ff", "systemTeal.darkElevatedColor": "ff64d2ff", "systemTeal.darkHighContrastColor": "ff70d7ff", "systemTeal.darkHighContrastElevatedColor": "ff70d7ff", "systemTeal.elevatedColor": "ff5ac8fa", "systemTeal.highContrastColor": "ff0071a4", "systemTeal.highContrastElevatedColor": "ff0071a4", "systemYellow": "ffffcc00", "systemYellow.darkColor": "ffffd60a", "systemYellow.darkElevatedColor": "ffffd60a", "systemYellow.darkHighContrastColor": "ffffd426", "systemYellow.darkHighContrastElevatedColor": "ffffd426", "systemYellow.elevatedColor": "ffffcc00", "systemYellow.highContrastColor": "ffa05a00", "systemYellow.highContrastElevatedColor": "ffa05a00", "tertiaryLabel": "4c3c3c43", "tertiaryLabel.darkColor": "4cebebf5", "tertiaryLabel.darkElevatedColor": "4cebebf5", "tertiaryLabel.darkHighContrastColor": "60ebebf5", "tertiaryLabel.darkHighContrastElevatedColor": "60ebebf5", "tertiaryLabel.elevatedColor": "4c3c3c43", "tertiaryLabel.highContrastColor": "603c3c43", "tertiaryLabel.highContrastElevatedColor": "603c3c43", "tertiarySystemBackground": "ffffffff", "tertiarySystemBackground.darkColor": "ff2c2c2e", "tertiarySystemBackground.darkElevatedColor": "ff3a3a3c", "tertiarySystemBackground.darkHighContrastColor": "ff363638", "tertiarySystemBackground.darkHighContrastElevatedColor": "ff444446", "tertiarySystemBackground.elevatedColor": "ffffffff", "tertiarySystemBackground.highContrastColor": "ffffffff", "tertiarySystemBackground.highContrastElevatedColor": "ffffffff", "tertiarySystemFill": "1e767680", "tertiarySystemFill.darkColor": "3d767680", "tertiarySystemFill.darkElevatedColor": "3d767680", "tertiarySystemFill.darkHighContrastColor": "51767680", "tertiarySystemFill.darkHighContrastElevatedColor": "51767680", "tertiarySystemFill.elevatedColor": "1e767680", "tertiarySystemFill.highContrastColor": "33767680", "tertiarySystemFill.highContrastElevatedColor": "33767680", "tertiarySystemGroupedBackground": "fff2f2f7", "tertiarySystemGroupedBackground.darkColor": "ff2c2c2e", "tertiarySystemGroupedBackground.darkElevatedColor": "ff3a3a3c", "tertiarySystemGroupedBackground.darkHighContrastColor": "ff363638", "tertiarySystemGroupedBackground.darkHighContrastElevatedColor": "ff444446", "tertiarySystemGroupedBackground.elevatedColor": "fff2f2f7", "tertiarySystemGroupedBackground.highContrastColor": "ffebebf0", "tertiarySystemGroupedBackground.highContrastElevatedColor": "ffebebf0", "white": "ffffffff" }
flutter-intellij/resources/flutter/colors/cupertino.json/0
{ "file_path": "flutter-intellij/resources/flutter/colors/cupertino.json", "repo_id": "flutter-intellij", "token_count": 5717 }
527
{ "frameworkVersion": "3.1.0", "channel": "beta", "repositoryUrl": "https://github.com/flutter/flutter", "frameworkRevision": "bcea432bce54a83306b3c00a7ad0ed98f777348d", "frameworkCommitDate": "2022-05-26 09:05:34 -0700", "engineRevision": "44e5b38ee83a1282981a30abc08ffcf6cd0e44bd", "dartSdkVersion": "2.18.0 (build 2.18.0-44.1.beta)", "devToolsVersion": "2.12.2" }
flutter-intellij/resources/flutter/version.json/0
{ "file_path": "flutter-intellij/resources/flutter/version.json", "repo_id": "flutter-intellij", "token_count": 178 }
528
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> <path d="M0 0h24v24H0z" fill="none"/> <path d="M5 15H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zM12 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/> </svg>
flutter-intellij/resources/icons/preview/center.svg/0
{ "file_path": "flutter-intellij/resources/icons/preview/center.svg", "repo_id": "flutter-intellij", "token_count": 235 }
529
#!/bin/bash source ./tool/kokoro/setup.sh setup (cd flutter-idea/testData/sample_tests; echo "dart pub get `pwd`"; dart pub get --no-precompile) echo "kokoro test start" ./bin/plugin test echo "kokoro test finished"
flutter-intellij/tool/kokoro/test.sh/0
{ "file_path": "flutter-intellij/tool/kokoro/test.sh", "repo_id": "flutter-intellij", "token_count": 82 }
530
# Describes the targets run in continuous integration environment. # # Flutter infra uses this file to generate a checklist of tasks to be performed # for every commit. # # The recipes mentioned below refer to those in this repo: # https://flutter.googlesource.com/recipes/+/refs/heads/main/recipes/ # # The "flutter_drone" recipe just defers to dev/bots/test.dart in this repo, # with the shard set according to the "shard" key in this file. # # More information at: # * https://github.com/flutter/cocoon/blob/main/CI_YAML.md enabled_branches: - master - flutter-\d+\.\d+-candidate\.\d+ platform_properties: staging_build_linux: properties: dependencies: >- [ {"dependency": "curl", "version": "version:7.64.0"} ] os: Ubuntu cores: "8" device_type: none ignore_flakiness: "true" linux: properties: dependencies: >- [ {"dependency": "curl", "version": "version:7.64.0"} ] os: Ubuntu cores: "8" device_type: none # The current android emulator config names can be found here: # https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/android/avd/proto # You may use those names for the android_virtual_device version. linux_android_emu: properties: contexts: >- [ "android_virtual_device" ] dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "android_virtual_device", "version": "android_34_google_apis_x64.textpb"}, {"dependency": "avd_cipd_version", "version": "build_id:8759428741582061553"}, {"dependency": "open_jdk", "version": "version:17"} ] os: Ubuntu cores: "8" device_type: none kvm: "1" linux_build_test: properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "curl", "version": "version:7.64.0"} ] os: Ubuntu cores: "8" device_type: none linux_android: properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "curl", "version": "version:7.64.0"} ] os: Linux device_type: "msm8952" linux_pixel_7pro: properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "curl", "version": "version:7.64.0"} ] os: Linux device_type: "Pixel 7 Pro" linux_samsung_a02: properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "curl", "version": "version:7.64.0"} ] os: Linux device_type: "SM-A025V" mac: properties: contexts: >- [ "osx_sdk" ] dependencies: >- [ {"dependency": "apple_signing", "version": "version:to_2024"} ] os: Mac-13 device_type: none $flutter/osx_sdk : >- { "sdk_version": "15a240d" } mac_arm64: properties: contexts: >- [ "osx_sdk" ] dependencies: >- [ {"dependency": "apple_signing", "version": "version:to_2024"} ] os: Mac-13 device_type: none cpu: arm64 $flutter/osx_sdk : >- { "sdk_version": "15a240d" } mac_benchmark: properties: contexts: >- [ "osx_sdk" ] dependencies: >- [ {"dependency": "apple_signing", "version": "version:to_2024"} ] device_type: none mac_model: "Macmini8,1" os: Mac-13 tags: > ["devicelab", "hostonly", "mac"] $flutter/osx_sdk : >- { "sdk_version": "15a240d" } mac_x64: properties: contexts: >- [ "osx_sdk" ] dependencies: >- [ {"dependency": "apple_signing", "version": "version:to_2024"} ] os: Mac-13 device_type: none cpu: x86 $flutter/osx_sdk : >- { "sdk_version": "15a240d" } mac_build_test: properties: contexts: >- [ "osx_sdk" ] dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "apple_signing", "version": "version:to_2024"} ] os: Mac-13 device_type: none cpu: x86 $flutter/osx_sdk : >- { "sdk_version": "15a240d" } mac_android: properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] os: Mac-12|Mac-13 cpu: x86 device_type: "msm8952" mac_arm64_android: properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] os: Mac-12|Mac-13 cpu: arm64 device_type: "msm8952" mac_pixel_7pro: properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] os: Mac-12|Mac-13 cpu: x86 device_type: "Pixel 7 Pro" mac_ios: properties: contexts: >- [ "osx_sdk_devicelab" ] dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "apple_signing", "version": "version:to_2024"} ] os: Mac-13 cpu: x86 device_os: iOS-17 $flutter/osx_sdk : >- { "sdk_version": "15a240d" } mac_x64_ios: properties: contexts: >- [ "osx_sdk_devicelab" ] dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "apple_signing", "version": "version:to_2024"} ] os: Mac-13 cpu: x86 device_os: iOS-17 $flutter/osx_sdk : >- { "sdk_version": "15a240d" } mac_arm64_ios: properties: contexts: >- [ "osx_sdk_devicelab" ] dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "apple_signing", "version": "none"} ] os: Mac-13 cpu: arm64 device_os: iOS-17 $flutter/osx_sdk : >- { "sdk_version": "15a240d" } windows: properties: os: Windows-10 device_type: none windows_arm64: properties: # The arch can be removed after https://github.com/flutter/flutter/issues/135722. arch: arm os: Windows cpu: arm64 windows_android: properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] os: Windows-10 device_type: "msm8952" targets: - name: Linux analyze recipe: flutter/flutter_drone timeout: 60 properties: shard: analyze tags: > ["framework","hostonly","shard","linux"] - name: Linux analyzer_benchmark recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: test_timeout_secs: "3600" # 1 hour dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "curl", "version": "version:7.64.0"} ] cores: "32" tags: > ["devicelab", "hostonly", "linux"] task_name: analyzer_benchmark - name: Linux coverage presubmit: false recipe: flutter/coverage timeout: 120 enabled_branches: # Don't run this on release branches - master properties: tags: > ["framework", "hostonly", "shard", "linux"] - name: Linux packages_autoroller presubmit: false recipe: pub_autoroller/pub_autoroller timeout: 30 enabled_branches: # Don't run this on release branches - master properties: tags: > ["framework","hostonly","linux"] dependencies: >- [ {"dependency": "gh_cli", "version": "version:2.8.0-2-g32256d38"} ] - name: Linux_android_emu android views recipe: devicelab/devicelab_drone properties: tags: > ["framework","hostonly","linux"] task_name: android_views timeout: 60 - name: Linux build_tests_1_3 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "ninja", "version": "version:1.9.0"} ] shard: build_tests subshard: "1_3" tags: > ["framework", "hostonly", "shard", "linux"] - name: Linux build_tests_2_3 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "ninja", "version": "version:1.9.0"} ] shard: build_tests subshard: "2_3" tags: > ["framework", "hostonly", "shard", "linux"] - name: Linux build_tests_3_3 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "ninja", "version": "version:1.9.0"} ] shard: build_tests subshard: "3_3" tags: > ["framework", "hostonly", "shard", "linux"] - name: Linux ci_yaml flutter roller recipe: infra/ci_yaml presubmit: false timeout: 30 properties: tags: > ["framework", "hostonly", "shard", "linux"] runIf: - .ci.yaml - name: Linux customer_testing # This really just runs dev/bots/customer_testing/ci.sh, # but it does so indirectly via the flutter_drone recipe # calling the dev/bots/test.dart script. enabled_branches: - master recipe: flutter/flutter_drone timeout: 60 properties: shard: customer_testing tags: > ["framework", "hostonly", "shard", "linux"] - name: Linux docs_publish recipe: flutter/docs presubmit: false timeout: 60 dimensions: os: "Linux" properties: cores: "32" dependencies: >- [ {"dependency": "dashing", "version": "0.4.0"}, {"dependency": "firebase", "version": "v11.0.1"} ] tags: > ["framework", "hostonly", "linux"] backfill: "false" validation: docs validation_name: Docs firebase_project: main-docs-flutter-prod release_ref: refs/heads/master release_build: "true" drone_dimensions: - os=Linux - name: Linux docs_test recipe: flutter/flutter_drone timeout: 90 # https://github.com/flutter/flutter/issues/120901 properties: cores: "32" dependencies: >- [ {"dependency": "dashing", "version": "0.4.0"} ] firebase_project: "" release_ref: "" tags: > ["framework", "hostonly", "shard", "linux"] shard: docs runIf: - bin/** - dev/** - packages/flutter/** - packages/flutter_drive/** - packages/flutter_localizations/** - packages/flutter_test/** - packages/flutter_web_plugins/** - packages/integration_test/** - .ci.yaml - dartdoc_options.yaml - name: Linux engine_dependency_proxy_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: engine_dependency_proxy_test runIf: - dev/** - bin/** - .ci.yaml - name: Linux firebase_abstract_method_smoke_test presubmit: false recipe: firebaselab/firebaselab timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["firebaselab"] task_name: abstract_method_smoke_test physical_devices: >- [ "--device", "model=shiba,version=34", "--device", "model=panther,version=33", "--device", "model=redfin,version=30" ] # TODO(flutter/flutter#123331): This device is flaking. # "--device", "model=Nexus6P,version=25" virtual_devices: >- [ "--device", "model=Nexus5.gce_x86,version=21", "--device", "model=Nexus5.gce_x86,version=22", "--device", "model=Nexus5.gce_x86,version=23", "--device", "model=Nexus6P,version=25", "--device", "model=Nexus6P,version=26", "--device", "model=Nexus6P,version=27", "--device", "model=NexusLowRes,version=29" ] - name: Linux firebase_android_embedding_v2_smoke_test recipe: firebaselab/firebaselab timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["firebaselab"] task_name: android_embedding_v2_smoke_test physical_devices: >- [ "--device", "model=shiba,version=34", "--device", "model=redfin,version=30", "--device", "model=griffin,version=24" ] # TODO(flutter/flutter#123331): This device is flaking. # "--device", "model=Nexus6P,version=25" virtual_devices: >- [ "--device", "model=Nexus5.gce_x86,version=21", "--device", "model=Nexus5.gce_x86,version=22", "--device", "model=Nexus5.gce_x86,version=23", "--device", "model=Nexus6P,version=25", "--device", "model=Nexus6P,version=26", "--device", "model=Nexus6P,version=27", "--device", "model=NexusLowRes,version=29" ] - name: Linux firebase_release_smoke_test recipe: firebaselab/firebaselab timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["firebaselab"] task_name: release_smoke_test physical_devices: >- [ "--device", "model=shiba,version=34", "--device", "model=redfin,version=30", "--device", "model=griffin,version=24" ] # TODO(flutter/flutter#123331): This device is flaking. # "--device", "model=Nexus6P,version=25" virtual_devices: >- [ "--device", "model=Nexus5.gce_x86,version=21", "--device", "model=Nexus5.gce_x86,version=22", "--device", "model=Nexus5.gce_x86,version=23", "--device", "model=Nexus6P,version=25", "--device", "model=Nexus6P,version=26", "--device", "model=Nexus6P,version=27", "--device", "model=NexusLowRes,version=29" ] - name: Linux flutter_packaging_test recipe: packaging/packaging presubmit: false enabled_branches: - master properties: task_name: flutter_packaging tags: > ["framework", "hostonly", "shard", "linux"] runIf: - .ci.yaml - dev/bots/** - name: Linux flutter_plugins recipe: flutter/flutter_drone enabled_branches: - master timeout: 60 properties: shard: flutter_plugins subshard: analyze tags: > ["framework", "hostonly", "shard", "linux"] - name: Linux framework_tests_libraries recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: libraries tags: > ["framework","hostonly","shard", "linux"] runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux framework_tests_slow recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: framework_tests subshard: slow tags: > ["framework", "hostonly", "shard", "linux"] runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux framework_tests_misc recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "ninja", "version": "version:1.9.0"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "android_sdk", "version": "version:34v3"} ] shard: framework_tests subshard: misc tags: > ["framework", "hostonly", "shard", "linux"] runIf: - dev/** - examples/api/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux framework_tests_widgets recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: widgets tags: > ["framework","hostonly","shard", "linux"] runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux fuchsia_precache recipe: flutter/flutter_drone timeout: 60 properties: shard: fuchsia_precache tags: > ["framework", "hostonly", "shard", "linux"] runIf: - bin/internal/engine.version - .ci.yaml - name: Linux gradle_desugar_classes_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: gradle_desugar_classes_test runIf: - dev/** - bin/** - .ci.yaml - name: Linux gradle_java8_compile_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: gradle_java8_compile_test runIf: - dev/** - bin/** - .ci.yaml - name: Linux gradle_plugin_bundle_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: gradle_plugin_bundle_test runIf: - dev/** - bin/** - .ci.yaml - name: Linux gradle_plugin_fat_apk_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: gradle_plugin_fat_apk_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux gradle_plugin_light_apk_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: gradle_plugin_light_apk_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux module_custom_host_app_name_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: module_custom_host_app_name_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux module_host_with_custom_build_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: module_host_with_custom_build_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux module_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: module_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux plugin_dependencies_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: plugin_dependencies_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux plugin_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: plugin_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux plugin_test_linux recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "ninja", "version": "version:1.9.0"}, {"dependency": "curl", "version": "version:7.64.0"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: plugin_test_linux runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux run_debug_test_linux recipe: devicelab/devicelab_drone timeout: 60 properties: xvfb: "1" dependencies: >- [ {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "ninja", "version": "version:1.9.0"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: run_debug_test_linux runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux run_release_test_linux recipe: devicelab/devicelab_drone timeout: 60 properties: xvfb: "1" dependencies: >- [ {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "ninja", "version": "version:1.9.0"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: run_release_test_linux runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux skp_generator enabled_branches: - main - master recipe: flutter/flutter_drone timeout: 60 properties: shard: skp_generator subshard: "0" tags: > ["framework", "hostonly", "shard", "linux"] runIf: - dev/** - packages/flutter/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux technical_debt__cost recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"} ] tags: > ["devicelab", "hostonly", "linux"] task_name: technical_debt__cost - name: Linux test_ownership recipe: infra/test_ownership enabled_branches: - main - master properties: tags: > ["framework", "hostonly", "shard", "linux"] runIf: - bin/internal/engine.version - .ci.yaml - name: Linux tool_integration_tests_1_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "ninja", "version": "version:1.9.0"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_integration_tests subshard: "1_4" tags: > ["framework", "hostonly", "shard", "linux"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux tool_integration_tests_2_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "ninja", "version": "version:1.9.0"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_integration_tests subshard: "2_4" tags: > ["framework", "hostonly", "shard", "linux"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux tool_integration_tests_3_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "ninja", "version": "version:1.9.0"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_integration_tests subshard: "3_4" tags: > ["framework", "hostonly", "shard", "linux"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux tool_integration_tests_4_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "ninja", "version": "version:1.9.0"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_integration_tests subshard: "4_4" tags: > ["framework", "hostonly", "shard", "linux"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux android_preview_tool_integration_tests recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" # This makes use of UpsideDownCake, a preview version of android. Preview versions eventually # get removed from the sdk manager, so it is hosted on CIPD to ensure integration testing # doesn't flake when that happens. # https://chrome-infra-packages.appspot.com/p/flutter/android/sdk/all/linux-amd64/+/version:udcv1 dependencies: >- [ {"dependency": "android_sdk", "version": "version:udcv1"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, {"dependency": "cmake", "version": "build_id:8787856497187628321"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "ninja", "version": "version:1.9.0"}, {"dependency": "open_jdk", "version": "version:11"} ] shard: android_preview_tool_integration_tests tags: > ["framework", "hostonly", "shard", "linux"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux tool_tests_commands recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_tests subshard: commands tags: > ["framework", "hostonly", "shard", "linux"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux tool_tests_general recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_tests subshard: general tags: > ["framework", "hostonly", "shard", "linux"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux realm_checker recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" shard: realm_checker tags: > ["framework", "hostonly", "shard", "linux"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux web_benchmarks_canvaskit recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"} ] tags: > ["devicelab","hostonly", "linux"] task_name: web_benchmarks_canvaskit - name: Linux web_benchmarks_html recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"} ] tags: > ["devicelab"] task_name: web_benchmarks_html runIf: - dev/** - bin/** - .ci.yaml - name: Linux web_benchmarks_skwasm recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"} ] tags: > ["devicelab"] task_name: web_benchmarks_skwasm runIf: - dev/** - bin/** - .ci.yaml - name: Linux web_long_running_tests_1_5 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_long_running_tests subshard: "1_5" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_long_running_tests_2_5 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_long_running_tests subshard: "2_5" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_long_running_tests_3_5 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_long_running_tests subshard: "3_5" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_long_running_tests_4_5 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_long_running_tests subshard: "4_5" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_long_running_tests_5_5 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_long_running_tests subshard: "5_5" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tests_0 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tests subshard: "0" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tests_1 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tests subshard: "1" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tests_2 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tests subshard: "2" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tests_3 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tests subshard: "3" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tests_4 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tests subshard: "4" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tests_5 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tests subshard: "5" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tests_6 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tests subshard: "6" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tests_7_last recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tests subshard: "7_last" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_canvaskit_tests_0 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_canvaskit_tests subshard: "0" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_canvaskit_tests_1 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_canvaskit_tests subshard: "1" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_canvaskit_tests_2 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_canvaskit_tests subshard: "2" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_canvaskit_tests_3 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_canvaskit_tests subshard: "3" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_canvaskit_tests_4 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_canvaskit_tests subshard: "4" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_canvaskit_tests_5 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_canvaskit_tests subshard: "5" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_canvaskit_tests_6 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_canvaskit_tests subshard: "6" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_canvaskit_tests_7_last recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_canvaskit_tests subshard: "7_last" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/** - bin/** - .ci.yaml - name: Linux web_tool_tests recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tool_tests subshard: "1_1" tags: > ["framework", "hostonly", "shard", "linux"] # Retry for flakes caused by https://github.com/flutter/flutter/issues/132654 presubmit_max_attempts: "2" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Linux_android_emu android_defines_test recipe: devicelab/devicelab_drone timeout: 60 properties: tags: > ["devicelab", "linux"] task_name: android_defines_test - name: Linux_pixel_7pro android_obfuscate_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: android_obfuscate_test - name: Linux_pixel_7pro android_semantics_integration_test recipe: devicelab/devicelab_drone bringup: true # Flaky: https://github.com/flutter/flutter/issues/124636 presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: android_semantics_integration_test # linux motog4 test - name: Linux_android android_stack_size_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: android_stack_size_test # linux motog4 benchmark - name: Linux_android android_view_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: android_view_scroll_perf__timeline_summary # linux motog4 benchmark - name: Linux_android animated_image_gc_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: animated_image_gc_perf # linux motog4 benchmark - name: Linux_android animated_complex_opacity_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: animated_complex_opacity_perf__e2e_summary # linux motog4 benchmark - name: Linux_android animated_complex_image_filtered_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: animated_complex_image_filtered_perf__e2e_summary # linux motog4 benchmark - name: Linux_android animated_placeholder_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: animated_placeholder_perf__e2e_summary # linux motog4 benchmark - name: Linux_android backdrop_filter_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: backdrop_filter_perf__e2e_summary - name: Linux_pixel_7pro backdrop_filter_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: backdrop_filter_perf__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro draw_atlas_perf_opengles__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: draw_atlas_perf_opengles__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro draw_atlas_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: draw_atlas_perf__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro dynamic_path_tessellation_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: dynamic_path_tessellation_perf__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro static_path_tessellation_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: static_path_tessellation_perf__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro hello_world_impeller recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: hello_world_impeller - name: Linux_pixel_7pro basic_material_app_android__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: basic_material_app_android__compile - name: Linux_pixel_7pro channels_integration_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: channels_integration_test # linux motog4 benchmark - name: Linux_android clipper_cache_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab","android","linux"] task_name: clipper_cache_perf__e2e_summary # linux motog4 benchmark - name: Linux_android color_filter_and_fade_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: color_filter_and_fade_perf__e2e_summary # linux motog4 benchmark - name: Linux_android color_filter_cache_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: color_filter_cache_perf__e2e_summary # linux motog4 benchmark - name: Linux_android color_filter_with_unstable_child_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab","android","linux"] task_name: color_filter_with_unstable_child_perf__e2e_summary # linux motog4 benchmark - name: Linux_android raster_cache_use_memory_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab","android","linux"] task_name: raster_cache_use_memory_perf__e2e_summary # linux motog4 benchmark - name: Linux_android shader_mask_cache_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: shader_mask_cache_perf__e2e_summary # linux motog4 benchmark - name: Linux_android complex_layout_android__scroll_smoothness recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: complex_layout_android__scroll_smoothness dependencies: >- [ {"dependency": "open_jdk", "version": "version:17"} ] # linux motog4 benchmark - name: Linux_android complex_layout_scroll_perf__devtools_memory recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab","android","linux"] task_name: complex_layout_scroll_perf__devtools_memory dependencies: >- [ {"dependency": "open_jdk", "version": "version:17"} ] # linux motog4 benchmark - name: Linux_android complex_layout_scroll_perf__memory recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab","android","linux"] task_name: complex_layout_scroll_perf__memory dependencies: >- [ {"dependency": "open_jdk", "version": "version:17"} ] # linux motog4 benchmark - name: Linux_android complex_layout_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab","android","linux"] task_name: complex_layout_scroll_perf__timeline_summary dependencies: >- [ {"dependency": "open_jdk", "version": "version:17"} ] - name: Linux_pixel_7pro complex_layout_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: complex_layout_scroll_perf__timeline_summary dependencies: >- [ {"dependency": "open_jdk", "version": "version:17"} ] - name: Linux_pixel_7pro complex_layout_scroll_perf_impeller__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 bringup: true properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: complex_layout_scroll_perf_impeller__timeline_summary dependencies: >- [ {"dependency": "open_jdk", "version": "version:11"} ] - name: Linux_pixel_7pro complex_layout_scroll_perf_impeller_gles__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: complex_layout_scroll_perf_impeller_gles__timeline_summary dependencies: >- [ {"dependency": "open_jdk", "version": "version:11"} ] # linux motog4 benchmark - name: Linux_android complex_layout_semantics_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: complex_layout_semantics_perf dependencies: >- [ {"dependency": "open_jdk", "version": "version:17"} ] # linux motog4 benchmark - name: Linux_android complex_layout__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: complex_layout__start_up dependencies: >- [ {"dependency": "open_jdk", "version": "version:17"} ] # linux motog4 benchmark - name: Linux_android cubic_bezier_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: cubic_bezier_perf__e2e_summary - name: Linux_pixel_7pro cubic_bezier_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: cubic_bezier_perf__timeline_summary # linux motog4 benchmark - name: Linux_android cull_opacity_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: cull_opacity_perf__e2e_summary - name: Linux_pixel_7pro cull_opacity_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: cull_opacity_perf__timeline_summary # linux motog4 benchmark - name: Linux_android devtools_profile_start_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: devtools_profile_start_test - name: Linux_pixel_7pro drive_perf_debug_warning recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: drive_perf_debug_warning - name: Linux_pixel_7pro embedded_android_views_integration_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: embedded_android_views_integration_test - name: Linux_android_emu external_textures_integration_test recipe: devicelab/devicelab_drone timeout: 60 # Functionally the same as "presubmit: false", except that we will run on # presubmit during engine rolls. This test is the *only* automated e2e # test for external textures for the engine, it should never break. runIf: - bin/internal/engine.version - .ci.yaml properties: tags: > ["devicelab", "linux"] task_name: external_textures_integration_test # linux motog4 benchmark - name: Linux_android fading_child_animation_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: fading_child_animation_perf__timeline_summary # linux motog4 benchmark - name: Linux_android fast_scroll_heavy_gridview__memory recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: fast_scroll_heavy_gridview__memory # linux motog4 benchmark - name: Linux_android fast_scroll_large_images__memory recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: fast_scroll_large_images__memory - name: Linux_pixel_7pro flavors_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: flavors_test # linux motog4 benchmark - name: Linux_android flutter_engine_group_performance recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_engine_group_performance # linux motog4 benchmark - name: Linux_android flutter_gallery__back_button_memory recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_gallery__back_button_memory # linux motog4 benchmark - name: Linux_android flutter_gallery__image_cache_memory recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_gallery__image_cache_memory # linux motog4 benchmark - name: Linux_android flutter_gallery__memory_nav recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab" ,"android", "linux"] task_name: flutter_gallery__memory_nav # linux motog4 benchmark - name: Linux_android flutter_gallery__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_gallery__start_up # linux motog4 benchmark - name: Linux_android flutter_gallery__start_up_delayed recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_gallery__start_up_delayed - name: Linux_pixel_7pro flutter_gallery_android__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: flutter_gallery_android__compile - name: Linux_pixel_7pro flutter_gallery_v2_chrome_run_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: flutter_gallery_v2_chrome_run_test - name: Linux flutter_gallery_v2_web_compile_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "linux"] task_name: flutter_gallery_v2_web_compile_test # linux motog4 benchmark - name: Linux_android flutter_test_performance recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_test_performance # linux motog4 benchmark - name: Linux_android flutter_view__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_view__start_up - name: Linux_pixel_7pro frame_policy_delay_test_android recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: frame_policy_delay_test_android # linux motog4 benchmark - name: Linux_android fullscreen_textfield_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: fullscreen_textfield_perf # linux motog4 benchmark - name: Linux_android fullscreen_textfield_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: fullscreen_textfield_perf__e2e_summary # linux motog4 benchmark - name: Linux_android very_long_picture_scrolling_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 120 properties: tags: > ["devicelab", "android", "linux"] task_name: very_long_picture_scrolling_perf__e2e_summary # linux motog4 benchmark - name: Linux_android hello_world__memory recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: hello_world__memory # linux motog4 benchmark - name: Linux_android home_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: home_scroll_perf__timeline_summary # linux motog4 benchmark - name: Linux_android hot_mode_dev_cycle_linux__benchmark recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: hot_mode_dev_cycle_linux__benchmark runIf: - .ci.yaml - dev/** # linux motog4 test - name: Linux_android hybrid_android_views_integration_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: hybrid_android_views_integration_test # linux motog4 benchmark - name: Linux_android image_list_jit_reported_duration recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: image_list_jit_reported_duration # linux motog4 benchmark - name: Linux_android imagefiltered_transform_animation_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: imagefiltered_transform_animation_perf__timeline_summary - name: Linux_pixel_7pro imagefiltered_transform_animation_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: imagefiltered_transform_animation_perf__timeline_summary # linux motog4 benchmark - name: Linux_android image_list_reported_duration recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: image_list_reported_duration - name: Linux_pixel_7pro integration_ui_driver recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: integration_ui_driver - name: Linux_pixel_7pro integration_ui_keyboard_resize recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: integration_ui_keyboard_resize - name: Linux_pixel_7pro integration_ui_textfield recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: integration_ui_textfield # linux motog4 benchmark - name: Linux_android large_image_changer_perf_android recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: large_image_changer_perf_android - name: Linux_pixel_7pro linux_chrome_dev_mode recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: linux_chrome_dev_mode # linux motog4 benchmark - name: Linux_android multi_widget_construction_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: multi_widget_construction_perf__e2e_summary # linux motog4 benchmark - name: Linux_android list_text_layout_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: list_text_layout_perf__e2e_summary # linux a02s benchmark - name: Linux_samsung_a02 list_text_layout_impeller_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false bringup: true timeout: 60 properties: ignore_flakiness: "true" tags: > ["devicelab", "android", "linux", "samsung", "a02"] task_name: list_text_layout_impeller_perf__e2e_summary - name: Linux_pixel_7pro native_assets_android recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: native_assets_android # linux motog4 benchmark - name: Linux_android new_gallery__crane_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: new_gallery__crane_perf # linux motog4 benchmark - name: Linux_android old_gallery__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: old_gallery__transition_perf - name: Linux_build_test flutter_gallery__transition_perf recipe: devicelab/devicelab_drone_build_test presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_gallery__transition_perf artifact: gallery__transition_perf drone_dimensions: > ["device_os=N","os=Linux", "device_type=msm8952"] - name: Linux_build_test flutter_gallery__transition_perf_e2e recipe: devicelab/devicelab_drone_build_test presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_gallery__transition_perf_e2e artifact: gallery__transition_perf_e2e drone_dimensions: > ["device_os=N","os=Linux", "device_type=msm8952"] - name: Linux_build_test flutter_gallery__transition_perf_hybrid recipe: devicelab/devicelab_drone_build_test presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_gallery__transition_perf_hybrid artifact: gallery__transition_perf_hybrid drone_dimensions: > ["device_os=N","os=Linux", "device_type=msm8952"] # linux motog4 benchmark - name: Linux_android flutter_gallery__transition_perf_with_semantics recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: flutter_gallery__transition_perf_with_semantics # linux motog4 benchmark # MotoG4, Skia - name: Linux_android new_gallery__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: new_gallery__transition_perf # Pixel 7 Pro, Skia - name: Linux_pixel_7pro new_gallery__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: new_gallery__transition_perf # Samsung A02, Skia - name: Linux_samsung_a02 new_gallery__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "samsung", "a02"] task_name: new_gallery__transition_perf # linux motog4 benchmark # Moto G4, Impeller (OpenGL) - name: Linux_android new_gallery_opengles_impeller__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: new_gallery_opengles_impeller__transition_perf # Pixel 7 Pro, Impeller (Vulkan) - name: Linux_pixel_7pro new_gallery_impeller_old_zoom__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: new_gallery_impeller_old_zoom__transition_perf # Pixel 7 Pro, Impeller (Vulkan) - name: Linux_pixel_7pro new_gallery_impeller__transition_perf bringup: true # Flaky https://github.com/flutter/flutter/issues/139643 recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: new_gallery_impeller__transition_perf # Samsung A02, Impeller (Vulkan) - name: Linux_samsung_a02 new_gallery_impeller__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "samsung", "a02"] task_name: new_gallery_impeller__transition_perf # Pixel 7 Pro, Impeller (OpenGL) - name: Linux_pixel_7pro new_gallery_opengles_impeller__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: new_gallery_opengles_impeller__transition_perf # linux motog4 benchmark - name: Linux_android picture_cache_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: picture_cache_perf__e2e_summary - name: Linux_pixel_7pro picture_cache_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: picture_cache_perf__timeline_summary # linux motog4 benchmark - name: Linux_android android_picture_cache_complexity_scoring_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: android_picture_cache_complexity_scoring_perf__timeline_summary # linux motog4 benchmark - name: Linux_android slider_perf_android recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: slider_perf_android # linux motog4 benchmark - name: Linux_android platform_channels_benchmarks recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: platform_channels_benchmarks - name: Linux_pixel_7pro platform_channels_benchmarks recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: platform_channels_benchmarks - name: Linux_pixel_7pro platform_channel_sample_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: platform_channel_sample_test - name: Linux_pixel_7pro platform_interaction_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: platform_interaction_test # linux motog4 benchmark - name: Linux_android platform_views_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: platform_views_scroll_perf__timeline_summary - name: Linux_pixel_7pro platform_views_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: platform_views_scroll_perf__timeline_summary # linux a02s benchmark - name: Linux_samsung_a02 platform_views_scroll_perf_impeller__timeline_summary bringup: true recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: ignore_flakiness: "true" tags: > ["devicelab", "android", "linux", "samsung", "a02"] task_name: platform_views_scroll_perf_impeller__timeline_summary - name: Linux_pixel_7pro platform_views_scroll_perf_impeller__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: platform_views_scroll_perf_impeller__timeline_summary # linux motog4 benchmark - name: Linux_android platform_view__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: platform_view__start_up - name: Linux_pixel_7pro routing_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: routing_test - name: Linux_pixel_7pro service_extensions_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: service_extensions_test # linux motog4 benchmark - name: Linux_android textfield_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: textfield_perf__e2e_summary - name: Linux_pixel_7pro textfield_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: textfield_perf__timeline_summary # linux motog4 benchmark - name: Linux_android tiles_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab","android","linux"] task_name: tiles_scroll_perf__timeline_summary dependencies: >- [ {"dependency": "open_jdk", "version": "version:17"} ] - name: Linux web_size__compile_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "linux"] task_name: web_size__compile_test # linux motog4 benchmark - name: Linux_android opacity_peephole_one_rect_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: opacity_peephole_one_rect_perf__e2e_summary # linux motog4 benchmark - name: Linux_android opacity_peephole_col_of_rows_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: opacity_peephole_col_of_rows_perf__e2e_summary # linux motog4 benchmark - name: Linux_android opacity_peephole_opacity_of_grid_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: opacity_peephole_opacity_of_grid_perf__e2e_summary # linux motog4 benchmark - name: Linux_android opacity_peephole_grid_of_opacity_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: opacity_peephole_grid_of_opacity_perf__e2e_summary # linux motog4 benchmark - name: Linux_android opacity_peephole_fade_transition_text_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: opacity_peephole_fade_transition_text_perf__e2e_summary # linux motog4 benchmark - name: Linux_android opacity_peephole_grid_of_alpha_savelayers_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: opacity_peephole_grid_of_alpha_savelayers_perf__e2e_summary # linux motog4 benchmark - name: Linux_android opacity_peephole_col_of_alpha_savelayer_rows_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: opacity_peephole_col_of_alpha_savelayer_rows_perf__e2e_summary # linux motog4 benchmark - name: Linux_android gradient_dynamic_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: gradient_dynamic_perf__e2e_summary # linux motog4 benchmark - name: Linux_android gradient_consistent_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: gradient_consistent_perf__e2e_summary # linux motog4 benchmark - name: Linux_android gradient_static_perf__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux"] task_name: gradient_static_perf__e2e_summary - name: Linux_pixel_7pro android_choreographer_do_frame_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: android_choreographer_do_frame_test # linux a02s benchmark - name: linux_samsung_a02 animated_blur_backdrop_filter_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false bringup: true timeout: 60 properties: ignore_flakiness: "true" tags: > ["devicelab", "android", "linux", "samsung", "a02"] task_name: animated_blur_backdrop_filter_perf__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro animated_blur_backdrop_filter_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: animated_blur_backdrop_filter_perf__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro animated_advanced_blend_perf_opengles__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: animated_advanced_blend_perf_opengles__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro animated_advanced_blend_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false bringup: true # https://github.com/flutter/flutter/issues/138385 timeout: 60 properties: ignore_flakiness: "true" tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: animated_advanced_blend_perf__timeline_summary - name: Mac_ios animated_advanced_blend_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: animated_advanced_blend_perf_ios__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro animated_blur_backdrop_filter_perf_opengles__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: animated_blur_backdrop_filter_perf_opengles__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro draw_vertices_perf_opengles__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: draw_vertices_perf_opengles__timeline_summary # Uses Impeller. - name: Linux_pixel_7pro draw_vertices_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "linux", "pixel", "7pro"] task_name: draw_vertices_perf__timeline_summary - name: Mac_ios draw_vertices_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: draw_vertices_perf_ios__timeline_summary - name: Mac_ios draw_atlas_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: draw_atlas_perf_ios__timeline_summary - name: Mac_ios static_path_tessellation_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: static_path_tessellation_perf_ios__timeline_summary - name: Mac_ios dynamic_path_tessellation_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: dynamic_path_tessellation_perf_ios__timeline_summary - name: Staging_build_linux analyze presubmit: false bringup: true recipe: flutter/flutter_drone timeout: 60 properties: shard: analyze ignore_flakiness: "true" tags: > ["framework","hostonly","shard","linux"] - name: Mac_benchmark animated_complex_opacity_perf_macos__e2e_summary presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] task_name: animated_complex_opacity_perf_macos__e2e_summary - name: Mac_benchmark basic_material_app_macos__compile presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: task_name: basic_material_app_macos__compile - name: Mac build_ios_framework_module_test recipe: devicelab/devicelab_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: build_ios_framework_module_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_arm64 build_ios_framework_module_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac", "arm64"] task_name: build_ios_framework_module_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_x64 build_tests_1_4 recipe: flutter/flutter_drone presubmit: false # Rely on Mac_arm build_tests in presubmit. timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: build_tests subshard: "1_4" tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_x64 build_tests_2_4 recipe: flutter/flutter_drone presubmit: false # Rely on Mac_arm build_tests in presubmit. timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: build_tests subshard: "2_4" tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_x64 build_tests_3_4 recipe: flutter/flutter_drone presubmit: false # Rely on Mac_arm build_tests in presubmit. timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: build_tests subshard: "3_4" tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_x64 build_tests_4_4 recipe: flutter/flutter_drone presubmit: false # Rely on Mac_arm build_tests in presubmit. timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: build_tests subshard: "4_4" tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_arm64 build_tests_1_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: build_tests subshard: "1_4" tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_arm64 build_tests_2_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: build_tests subshard: "2_4" tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_arm64 build_tests_3_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: build_tests subshard: "3_4" tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_arm64 build_tests_4_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: build_tests subshard: "4_4" tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_benchmark complex_layout_macos__start_up presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] task_name: complex_layout_macos__start_up - name: Mac_benchmark complex_layout_scroll_perf_macos__timeline_summary presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] task_name: complex_layout_scroll_perf_macos__timeline_summary - name: Mac customer_testing enabled_branches: - master recipe: flutter/flutter_drone timeout: 60 properties: shard: customer_testing tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac dart_plugin_registry_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: dart_plugin_registry_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac flavors_test_macos presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: flavors_test_macos - name: Mac_benchmark flutter_gallery_macos__compile presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] task_name: flutter_gallery_macos__compile - name: Mac_benchmark flutter_gallery_macos__start_up presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] task_name: flutter_gallery_macos__start_up - name: Mac flutter_packaging_test recipe: packaging/packaging presubmit: false enabled_branches: - master properties: task_name: flutter_packaging tags: > ["framework", "hostonly", "shard", "mac"] runIf: - .ci.yaml - dev/bots/** - name: Mac_arm64 flutter_packaging_test recipe: packaging/packaging presubmit: false enabled_branches: - master properties: task_name: flutter_packaging tags: > ["framework", "hostonly", "shard", "mac"] runIf: - .ci.yaml - dev/bots/** - name: Mac_benchmark flutter_view_macos__start_up presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: task_name: flutter_view_macos__start_up - name: Mac framework_tests_libraries recipe: flutter/flutter_drone timeout: 60 properties: cpu: x86 # https://github.com/flutter/flutter/issues/119880 dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: libraries tags: > ["framework", "hostonly", "shard", "mac"] runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac framework_tests_impeller recipe: flutter/flutter_drone timeout: 60 properties: cpu: x86 # https://github.com/flutter/flutter/issues/119880 dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: impeller tags: > ["framework", "hostonly", "shard", "mac"] runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_x64 framework_tests_misc recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "android_sdk", "version": "version:34v3"} ] shard: framework_tests subshard: misc tags: > ["framework", "hostonly", "shard", "mac"] runIf: - dev/** - examples/api/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_arm64 framework_tests_misc recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "android_sdk", "version": "version:34v3"} ] shard: framework_tests subshard: misc tags: > ["framework", "hostonly", "shard", "mac"] runIf: - dev/** - examples/api/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac framework_tests_widgets recipe: flutter/flutter_drone timeout: 60 properties: cpu: x86 # https://github.com/flutter/flutter/issues/119880 dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: widgets tags: > ["framework", "hostonly", "shard", "mac"] runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac gradle_plugin_bundle_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: gradle_plugin_bundle_test runIf: - dev/** - bin/** - .ci.yaml - name: Mac_benchmark hello_world_macos__compile presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: task_name: hello_world_macos__compile - name: Mac integration_ui_test_test_macos recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "mac"] task_name: integration_ui_test_test_macos - name: Mac module_custom_host_app_name_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: module_custom_host_app_name_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac module_host_with_custom_build_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: module_host_with_custom_build_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac module_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: module_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_x64 module_test_ios bringup: true # Flaky https://github.com/flutter/flutter/issues/144680 recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: module_test_ios runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_arm64 module_test_ios recipe: devicelab/devicelab_drone bringup: true timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: module_test_ios runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_arm64_ios module_test_ios # Must be run on devicelab bot for codesigning https://github.com/flutter/flutter/issues/112033 recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac", "arm64"] task_name: module_test_ios runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_benchmark platform_view_macos__start_up presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: task_name: platform_view_macos__start_up - name: Mac platform_channel_sample_test_macos recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "mac"] task_name: platform_channel_sample_test_macos - name: Mac plugin_dependencies_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: plugin_dependencies_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_x64 plugin_lint_mac recipe: devicelab/devicelab_drone bringup: true timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: plugin_lint_mac runIf: - dev/** - packages/flutter_tools/** - packages/integration_test/** - bin/** - .ci.yaml - name: Mac_arm64 plugin_lint_mac recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac", "arm64"] task_name: plugin_lint_mac runIf: - dev/** - packages/flutter_tools/** - packages/integration_test/** - bin/** - .ci.yaml - name: Mac plugin_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: plugin_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac plugin_test_ios recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: plugin_test_ios runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac plugin_test_macos recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: plugin_test_macos runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_x64 tool_host_cross_arch_tests recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] shard: tool_host_cross_arch_tests tags: > ["framework", "hostonly", "shard", "mac"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_arm64 tool_host_cross_arch_tests recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] shard: tool_host_cross_arch_tests tags: > ["framework", "hostonly", "shard", "mac"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac tool_integration_tests_1_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: tool_integration_tests subshard: "1_4" tags: > ["framework", "hostonly", "shard", "mac"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac tool_integration_tests_2_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: tool_integration_tests subshard: "2_4" tags: > ["framework", "hostonly", "shard", "mac"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac tool_integration_tests_3_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: tool_integration_tests subshard: "3_4" tags: > ["framework", "hostonly", "shard", "mac"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac tool_integration_tests_4_4 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: tool_integration_tests subshard: "4_4" tags: > ["framework", "hostonly", "shard", "mac"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_x64 tool_tests_commands recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_tests subshard: commands tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac_arm64 tool_tests_commands recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_tests subshard: commands tags: > ["framework", "hostonly", "shard", "mac"] - name: Mac tool_tests_general recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_tests subshard: general tags: > ["framework", "hostonly", "shard", "mac"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_x64 verify_binaries_codesigned enabled_branches: - flutter-\d+\.\d+-candidate\.\d+ recipe: flutter/flutter_drone presubmit: false timeout: 60 properties: tags: > ["framework", "hostonly", "shard", "mac"] shard: verify_binaries_codesigned - name: Mac_arm64 verify_binaries_codesigned enabled_branches: - flutter-\d+\.\d+-candidate\.\d+ recipe: flutter/flutter_drone presubmit: false timeout: 60 properties: tags: > ["framework", "hostonly", "shard", "mac"] shard: verify_binaries_codesigned - name: Mac web_tool_tests recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tool_tests subshard: "1_1" tags: > ["framework", "hostonly", "shard", "mac"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_pixel_7pro entrypoint_dart_registrant recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac", "pixel", "7pro"] task_name: entrypoint_dart_registrant runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_pixel_7pro hello_world_android__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac", "pixel", "7pro"] task_name: hello_world_android__compile # mac motog4 test - name: Mac_arm64_android hello_world_android__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac", "arm64"] task_name: hello_world_android__compile # mac motog4 benchmark - name: Mac_android hot_mode_dev_cycle__benchmark recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac"] task_name: hot_mode_dev_cycle__benchmark - name: Mac_pixel_7pro integration_test_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac", "pixel", "7pro"] task_name: integration_test_test # mac motog4 test - name: Mac_arm64_android integration_test_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac", "arm64"] task_name: integration_test_test - name: Mac_pixel_7pro integration_ui_frame_number recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac", "pixel", "7pro"] task_name: integration_ui_frame_number # mac motog4 benchmark - name: Mac_android microbenchmarks recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac"] task_name: microbenchmarks - name: Mac_pixel_7pro native_assets_android recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "mac", "pixel", "7pro"] task_name: native_assets_android - name: Mac_pixel_7pro run_debug_test_android recipe: devicelab/devicelab_drone presubmit: false runIf: - .ci.yaml - dev/** timeout: 60 properties: tags: > ["devicelab", "android", "mac", "pixel", "7pro"] task_name: run_debug_test_android # mac motog4 test - name: Mac_arm64_android run_debug_test_android recipe: devicelab/devicelab_drone presubmit: false runIf: - .ci.yaml - dev/** timeout: 60 properties: tags: > ["devicelab", "android", "mac", "arm64"] task_name: run_debug_test_android - name: Mac_pixel_7pro run_release_test recipe: devicelab/devicelab_drone presubmit: false runIf: - .ci.yaml - dev/** timeout: 60 properties: tags: > ["devicelab", "android", "mac", "pixel", "7pro"] task_name: run_release_test # mac motog4 test - name: Mac_arm64_android run_release_test recipe: devicelab/devicelab_drone presubmit: false runIf: - .ci.yaml - dev/** timeout: 60 properties: tags: > ["devicelab", "android", "mac", "arm64"] task_name: run_release_test - name: Mac_ios animation_with_microtasks_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: animation_with_microtasks_perf_ios__timeline_summary - name: Mac_ios backdrop_filter_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: backdrop_filter_perf_ios__timeline_summary - name: Mac_arm64_ios basic_material_app_ios__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: basic_material_app_ios__compile - name: Mac_ios channels_integration_test_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: channels_integration_test_ios - name: Mac_ios complex_layout_ios__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: complex_layout_ios__start_up - name: Mac_ios complex_layout_scroll_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: complex_layout_scroll_perf_ios__timeline_summary - name: Mac_ios complex_layout_scroll_perf_bad_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: complex_layout_scroll_perf_bad_ios__timeline_summary - name: Mac_ios color_filter_and_fade_perf_ios__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: color_filter_and_fade_perf_ios__e2e_summary - name: Mac_ios imagefiltered_transform_animation_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: imagefiltered_transform_animation_perf_ios__timeline_summary # TODO(https://github.com/flutter/flutter/issues/106806): Find a way to # re-enable this without "ignore_flakiness: "true"", likely by loostening the # test assertions, or potentially not running the frame rate tests at all on # iOS (for example, doing pixel-tests instead). # # Also, rename this to "external_textures_integration_test" to be consistent # with the Android test, but that can wait until we've figured out the flake. - name: Mac_ios external_ui_integration_test_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: external_textures_integration_test_ios ignore_flakiness: "true" - name: Mac_ios route_test_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: route_test_ios - name: Mac_ios flavors_test_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: flavors_test_ios - name: Mac_arm64_ios flutter_gallery_ios__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac", "arm64"] task_name: flutter_gallery_ios__compile - name: Mac_ios flutter_gallery_ios__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: flutter_gallery_ios__start_up - name: Mac_ios flutter_view_ios__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: flutter_view_ios__start_up - name: Mac_arm64_ios hello_world_ios__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac", "arm64"] task_name: hello_world_ios__compile - name: Mac_x64 hot_mode_dev_cycle_macos_target__benchmark recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: hot_mode_dev_cycle_macos_target__benchmark runIf: - dev/** - .ci.yaml - name: Mac_arm64 hot_mode_dev_cycle_macos_target__benchmark recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac", "arm64"] task_name: hot_mode_dev_cycle_macos_target__benchmark runIf: - .ci.yaml - dev/** - name: Mac_x64_ios integration_test_test_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: integration_test_test_ios - name: Mac_arm64_ios integration_test_test_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: integration_test_test_ios - name: Mac_ios integration_ui_ios_driver recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: integration_ui_ios_driver - name: Mac_ios integration_ui_ios_frame_number recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: integration_ui_ios_frame_number - name: Mac_ios integration_ui_ios_keyboard_resize recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: integration_ui_ios_keyboard_resize - name: Mac_ios integration_ui_ios_textfield recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: integration_ui_ios_textfield - name: Mac_x64 ios_app_with_extensions_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: ios_app_with_extensions_test - name: Mac_arm64 ios_app_with_extensions_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac", "arm64"] task_name: ios_app_with_extensions_test - name: Mac_ios ios_defines_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: ios_defines_test - name: Mac_ios ios_platform_view_tests recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: ios_platform_view_tests - name: Mac_ios large_image_changer_perf_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: large_image_changer_perf_ios - name: Mac_x64 macos_chrome_dev_mode recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: macos_chrome_dev_mode - name: Mac_arm64 macos_chrome_dev_mode recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac", "arm64"] task_name: macos_chrome_dev_mode - name: Mac_ios microbenchmarks_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: microbenchmarks_ios - name: Mac native_assets_ios_simulator recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: native_assets_ios_simulator - name: Mac_ios native_assets_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: native_assets_ios - name: Mac_ios native_platform_view_ui_tests_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: native_platform_view_ui_tests_ios - name: Mac_ios new_gallery_ios__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: new_gallery_ios__transition_perf - name: Mac_ios new_gallery_skia_ios__transition_perf recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: new_gallery_skia_ios__transition_perf - name: Mac_ios platform_channel_sample_test_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: platform_channel_sample_test_ios - name: Mac_ios platform_channel_sample_test_swift recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: platform_channel_sample_test_swift - name: Mac_ios platform_channels_benchmarks_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: platform_channels_benchmarks_ios - name: Mac_ios platform_interaction_test_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: platform_interaction_test_ios - name: Mac_ios platform_view_ios__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: platform_view_ios__start_up - name: Mac_ios platform_views_scroll_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: platform_views_scroll_perf_ios__timeline_summary - name: Mac_ios platform_views_scroll_perf_ad_banners__timeline_summary recipe: devicelab/devicelab_drone presubmit: false bringup: true timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: platform_views_scroll_perf_ad_banners__timeline_summary - name: Mac_ios platform_views_scroll_perf_non_intersecting_impeller_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: platform_views_scroll_perf_non_intersecting_impeller_ios__timeline_summary - name: Mac_ios post_backdrop_filter_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: post_backdrop_filter_perf_ios__timeline_summary - name: Mac_ios simple_animation_perf_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: simple_animation_perf_ios - name: Mac_ios wide_gamut_ios recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: wide_gamut_ios - name: Mac_x64_ios hot_mode_dev_cycle_ios__benchmark recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: hot_mode_dev_cycle_ios__benchmark - name: Mac_arm64_ios hot_mode_dev_cycle_ios__benchmark recipe: devicelab/devicelab_drone presubmit: false bringup: true timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] # TODO(vashworth): Use "hot_mode_dev_cycle_ios__benchmark" once https://github.com/flutter/flutter/issues/142305 is fixed. task_name: hot_mode_dev_cycle_ios__benchmark_no_dds - name: Mac_x64 hot_mode_dev_cycle_ios_simulator recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: hot_mode_dev_cycle_ios_simulator - name: Mac_ios fullscreen_textfield_perf_ios__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: fullscreen_textfield_perf_ios__e2e_summary - name: Mac_ios very_long_picture_scrolling_perf_ios__e2e_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 120 properties: tags: > ["devicelab", "ios", "mac"] task_name: very_long_picture_scrolling_perf_ios__e2e_summary - name: Mac_ios tiles_scroll_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: tiles_scroll_perf_ios__timeline_summary - name: Mac_build_test flutter_gallery__transition_perf_e2e_ios recipe: devicelab/devicelab_drone_build_test presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: flutter_gallery__transition_perf_e2e_ios drone_dimensions: > ["device_os=iOS-17","os=Mac-13", "cpu=x86"] - name: Mac_ios animated_blur_backdrop_filter_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: animated_blur_backdrop_filter_perf_ios__timeline_summary - name: Mac_ios draw_points_perf_ios__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: draw_points_perf_ios__timeline_summary - name: Mac_ios spell_check_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "ios", "mac"] task_name: spell_check_test_ios - name: Mac_x64 native_ui_tests_macos recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: native_ui_tests_macos runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_arm64 native_ui_tests_macos recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: native_ui_tests_macos runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac channels_integration_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: channels_integration_test_macos runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac run_debug_test_macos recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] task_name: run_debug_test_macos runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_arm64 run_debug_test_macos recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac", "arm64"] task_name: run_debug_test_macos runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Mac_arm64 run_release_test_macos recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac", "arm64"] task_name: run_release_test_macos runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows build_tests_1_7 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: build_tests subshard: "1_7" tags: > ["framework", "hostonly", "shard", "windows"] - name: Windows build_tests_2_7 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: build_tests subshard: "2_7" tags: > ["framework", "hostonly", "shard", "windows"] - name: Windows build_tests_3_7 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: build_tests subshard: "3_7" tags: > ["framework", "hostonly", "shard", "windows"] - name: Windows build_tests_4_7 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: build_tests subshard: "4_7" tags: > ["framework", "hostonly", "shard", "windows"] - name: Windows build_tests_5_7 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: build_tests subshard: "5_7" tags: > ["framework", "hostonly", "shard", "windows"] - name: Windows build_tests_6_7 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:118.0.5993.70"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: build_tests subshard: "6_7" tags: > ["framework", "hostonly", "shard", "windows"] - name: Windows build_tests_7_7 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:33v6"}, {"dependency": "chrome_and_driver", "version": "version:118.0.5993.70"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: build_tests subshard: "7_7" tags: > ["framework", "hostonly", "shard", "windows"] - name: Windows customer_testing enabled_branches: - master recipe: flutter/flutter_drone timeout: 60 properties: shard: customer_testing tags: > ["framework", "hostonly", "shard", "windows"] - name: Windows framework_tests_libraries recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: libraries tags: > ["framework", "hostonly", "shard", "windows"] runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows framework_tests_libraries_leak_tracking recipe: flutter/flutter_drone bringup: true # New target: https://github.com/flutter/flutter/issues/140414 timeout: 120 properties: ignore_flakiness: "true" test_timeout_secs: "3600" # 1 hour dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: libraries tags: > ["framework", "hostonly", "shard", "windows"] env_variables: >- { "LEAK_TRACKING": "true" } runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows framework_tests_misc recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "android_sdk", "version": "version:34v3"} ] shard: framework_tests subshard: misc tags: > ["framework", "hostonly", "shard", "windows"] runIf: - dev/** - examples/api/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows framework_tests_widgets recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: widgets tags: > ["framework", "hostonly", "shard", "windows"] runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows framework_tests_widgets_leak_tracking recipe: flutter/flutter_drone bringup: true # New target: https://github.com/flutter/flutter/issues/140414 timeout: 120 properties: ignore_flakiness: "true" test_timeout_secs: "3600" # 1 hour dependencies: >- [ {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: framework_tests subshard: widgets tags: > ["framework", "hostonly", "shard", "windows"] env_variables: >- { "LEAK_TRACKING": "true" } runIf: - dev/** - packages/flutter/** - packages/flutter_driver/** - packages/integration_test/** - packages/flutter_localizations/** - packages/fuchsia_remote_debug_protocol/** - packages/flutter_test/** - packages/flutter_goldens/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows gradle_plugin_bundle_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: gradle_plugin_bundle_test runIf: - dev/** - bin/** - .ci.yaml - name: Windows hot_mode_dev_cycle_win_target__benchmark recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: hot_mode_dev_cycle_win_target__benchmark - name: Windows_arm64 hot_mode_dev_cycle_win_target__benchmark recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows", "arm64"] task_name: hot_mode_dev_cycle_win_target__benchmark - name: Windows module_custom_host_app_name_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: module_custom_host_app_name_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows module_host_with_custom_build_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: module_host_with_custom_build_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows module_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: module_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows platform_channel_sample_test_windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: platform_channel_sample_test_windows - name: Windows_arm64 platform_channel_sample_test_windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows", "arm64"] task_name: platform_channel_sample_test_windows - name: Windows plugin_dependencies_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: plugin_dependencies_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows plugin_test recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: plugin_test runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows plugin_test_windows recipe: devicelab/devicelab_drone timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: plugin_test_windows runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows_arm64 plugin_test_windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows", "arm64"] task_name: plugin_test_windows test_timeout_secs: "900" # 15 minutes runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows run_debug_test_windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: run_debug_test_windows runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows_arm64 run_debug_test_windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows", "arm64"] task_name: run_debug_test_windows runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows run_release_test_windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: run_release_test_windows runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows_arm64 run_release_test_windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows", "arm64"] task_name: run_release_test_windows runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows tool_integration_tests_1_6 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: tool_integration_tests subshard: "1_6" tags: > ["framework", "hostonly", "shard", "windows"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows tool_integration_tests_2_6 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: tool_integration_tests subshard: "2_6" tags: > ["framework", "hostonly", "shard", "windows"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows tool_integration_tests_3_6 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: tool_integration_tests subshard: "3_6" tags: > ["framework", "hostonly", "shard", "windows"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows tool_integration_tests_4_6 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: tool_integration_tests subshard: "4_6" tags: > ["framework", "hostonly", "shard", "windows"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows tool_integration_tests_5_6 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: tool_integration_tests subshard: "5_6" tags: > ["framework", "hostonly", "shard", "windows"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows tool_integration_tests_6_6 recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}, {"dependency": "vs_build", "version": "version:vs2019"} ] shard: tool_integration_tests subshard: "6_6" tags: > ["framework", "hostonly", "shard", "windows"] test_timeout_secs: "2700" runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows tool_tests_commands recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_tests subshard: commands tags: > ["framework", "hostonly", "shard", "windows"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows tool_tests_general recipe: flutter/flutter_drone timeout: 60 properties: add_recipes_cq: "true" dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "open_jdk", "version": "version:17"} ] shard: tool_tests subshard: general tags: > ["framework", "hostonly", "shard", "windows"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows web_tool_tests_1_2 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tool_tests subshard: "1_2" tags: > ["framework", "hostonly", "shard", "windows"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows web_tool_tests_2_2 recipe: flutter/flutter_drone timeout: 60 properties: dependencies: >- [ {"dependency": "android_sdk", "version": "version:34v3"}, {"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"}, {"dependency": "open_jdk", "version": "version:17"}, {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] shard: web_tool_tests subshard: "2_2" tags: > ["framework", "hostonly", "shard"] runIf: - dev/** - packages/flutter_tools/** - bin/** - .ci.yaml - name: Windows windows_home_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: windows_home_scroll_perf__timeline_summary - name: Windows_arm64 windows_home_scroll_perf__timeline_summary recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows", "arm64"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: windows_home_scroll_perf__timeline_summary - name: Windows hello_world_win_desktop__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: hello_world_win_desktop__compile - name: Windows_arm64 hello_world_win_desktop__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows", "arm64"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: hello_world_win_desktop__compile - name: Windows flutter_gallery_win_desktop__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: flutter_gallery_win_desktop__compile - name: Windows_arm64 flutter_gallery_win_desktop__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows", "arm64"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: flutter_gallery_win_desktop__compile - name: Windows flutter_gallery_win_desktop__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: flutter_gallery_win_desktop__start_up - name: Windows_arm64 flutter_gallery_win_desktop__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows", "arm64"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: flutter_gallery_win_desktop__start_up - name: Windows complex_layout_win_desktop__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: complex_layout_win_desktop__start_up - name: Windows_arm64 complex_layout_win_desktop__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows", "arm64"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: complex_layout_win_desktop__start_up - name: Windows flutter_view_win_desktop__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: flutter_view_win_desktop__start_up - name: Windows_arm64 flutter_view_win_desktop__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows", "arm64"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: flutter_view_win_desktop__start_up - name: Windows platform_view_win_desktop__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: platform_view_win_desktop__start_up - name: Windows_arm64 platform_view_win_desktop__start_up recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows", "arm64"] dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] task_name: platform_view_win_desktop__start_up # windows motog4 test - name: Windows_android basic_material_app_win__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "windows"] task_name: basic_material_app_win__compile # windows motog4 test - name: Windows_android channels_integration_test_win recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "windows"] task_name: channels_integration_test_win # windows motog4 test - name: Windows_android flavors_test_win recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "windows"] task_name: flavors_test # windows motog4 test - name: Windows_android flutter_gallery_win__compile recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "windows"] task_name: flutter_gallery_win__compile # windows motog4 benchmark - name: Windows_android hot_mode_dev_cycle_win__benchmark recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "windows"] task_name: hot_mode_dev_cycle_win__benchmark # windows motog4 test - name: Windows_android native_assets_android recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "windows"] task_name: native_assets_android # windows motog4 test - name: Windows_android windows_chrome_dev_mode recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "android", "windows"] task_name: windows_chrome_dev_mode - name: Windows flutter_packaging_test recipe: packaging/packaging presubmit: false enabled_branches: - master properties: task_name: flutter_packaging tags: > ["framework", "hostonly", "shard", "windows"] runIf: - .ci.yaml - dev/bots/** - name: Windows windows_startup_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows"] task_name: windows_startup_test - name: Windows_arm64 windows_startup_test recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: dependencies: >- [ {"dependency": "vs_build", "version": "version:vs2019"} ] tags: > ["devicelab", "hostonly", "windows", "arm64"] task_name: windows_startup_test - name: Windows flutter_tool_startup__windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows"] task_name: flutter_tool_startup - name: Windows_arm64 flutter_tool_startup__windows recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "windows", "arm64"] task_name: flutter_tool_startup - name: Linux flutter_tool_startup__linux recipe: devicelab/devicelab_drone presubmit: false timeout: 60 properties: tags: > ["devicelab", "hostonly", "linux"] task_name: flutter_tool_startup - name: Mac_benchmark flutter_tool_startup__macos presubmit: false recipe: devicelab/devicelab_drone timeout: 60 properties: task_name: flutter_tool_startup - name: Linux flutter_packaging recipe: packaging/packaging timeout: 60 scheduler: release bringup: true # https://github.com/flutter/flutter/issues/126286 enabled_branches: - beta - stable properties: task_name: flutter_packaging tags: > ["framework", "hostonly", "shard", "linux"] drone_dimensions: - os=Linux - name: Mac flutter_packaging recipe: packaging/packaging timeout: 60 scheduler: release enabled_branches: - beta - stable properties: task_name: flutter_packaging tags: > ["framework", "hostonly", "shard", "mac"] drone_dimensions: - os=Mac - cpu=x86 - name: Mac_arm64 flutter_packaging recipe: packaging/packaging timeout: 60 scheduler: release enabled_branches: - beta - stable properties: task_name: flutter_packaging tags: > ["framework", "hostonly", "shard", "mac"] drone_dimensions: - os=Mac - cpu=arm64 - name: Windows flutter_packaging recipe: packaging/packaging timeout: 60 scheduler: release bringup: true enabled_branches: - beta - stable properties: task_name: flutter_packaging tags: > ["framework", "hostonly", "shard", "windows"] drone_dimensions: - os=Windows - name: Linux docs_deploy_beta recipe: flutter/docs scheduler: release bringup: true enabled_branches: - beta presubmit: false timeout: 60 properties: cores: "32" dependencies: >- [ {"dependency": "dashing", "version": "0.4.0"}, {"dependency": "firebase", "version": "v11.0.1"} ] tags: > ["framework", "hostonly", "linux"] validation: docs_deploy validation_name: Docs_deploy firebase_project: master-docs-flutter-dev drone_dimensions: - os=Linux - name: Linux docs_deploy_stable recipe: flutter/docs scheduler: release bringup: true enabled_branches: - stable presubmit: false timeout: 60 properties: cores: "32" dependencies: >- [ {"dependency": "dashing", "version": "0.4.0"}, {"dependency": "firebase", "version": "v11.0.1"} ] tags: > ["framework", "hostonly", "linux"] validation: docs_deploy validation_name: Docs_deploy firebase_project: docs-flutter-dev drone_dimensions: - os=Linux
flutter/.ci.yaml/0
{ "file_path": "flutter/.ci.yaml", "repo_id": "flutter", "token_count": 82990 }
531
@ECHO off REM Copyright 2014 The Flutter Authors. All rights reserved. REM Use of this source code is governed by a BSD-style license that can be REM found in the LICENSE file. REM ---------------------------------- NOTE ---------------------------------- REM REM Please keep the logic in this file consistent with the logic in the REM `dart` script in the same directory to ensure that Flutter & Dart continue to REM work across all platforms! REM REM -------------------------------------------------------------------------- SETLOCAL FOR %%i IN ("%~dp0..") DO SET FLUTTER_ROOT=%%~fi REM Include shared scripts in shared.bat SET shared_bin=%FLUTTER_ROOT%/bin/internal/shared.bat CALL "%shared_bin%" SET cache_dir=%FLUTTER_ROOT%\bin\cache SET dart_sdk_path=%cache_dir%\dart-sdk SET dart=%dart_sdk_path%\bin\dart.exe SET exit_with_errorlevel=%FLUTTER_ROOT%/bin/internal/exit_with_errorlevel.bat REM Chaining the call to 'dart' and 'exit' with an ampersand ensures that REM Windows reads both commands into memory once before executing them. This REM avoids nasty errors that may otherwise occur when the dart command (e.g. as REM part of 'flutter upgrade') modifies this batch script while it is executing. REM REM Do not use the CALL command in the next line to execute Dart. CALL causes REM Windows to re-read the line from disk after the CALL command has finished REM regardless of the ampersand chain. "%dart%" %* & "%exit_with_errorlevel%"
flutter/bin/dart.bat/0
{ "file_path": "flutter/bin/dart.bat", "repo_id": "flutter", "token_count": 403 }
532
flutter_infra_release/flutter/fonts/3012db47f3130e62f7cc0beabff968a33cbec8d8/fonts.zip
flutter/bin/internal/material_fonts.version/0
{ "file_path": "flutter/bin/internal/material_fonts.version", "repo_id": "flutter", "token_count": 44 }
533
// Copyright 2014 The Flutter 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 'use_cases.dart'; class RadioListTileUseCase extends UseCase { @override String get name => 'RadioListTile'; @override String get route => '/radio-list-tile'; @override Widget build(BuildContext context) => _MainWidget(); } class _MainWidget extends StatefulWidget { @override State<_MainWidget> createState() => _MainWidgetState(); } enum SingingCharacter { lafayette, jefferson } class _MainWidgetState extends State<_MainWidget> { SingingCharacter _value = SingingCharacter.lafayette; void _onChanged(SingingCharacter? value) { setState(() { _value = value!; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Radio button')), body: ListView( children: <Widget>[ RadioListTile<SingingCharacter>( title: const Text('Lafayette'), value: SingingCharacter.lafayette, groupValue: _value, onChanged: _onChanged, ), RadioListTile<SingingCharacter>( title: const Text('Jefferson'), value: SingingCharacter.jefferson, groupValue: _value, onChanged: _onChanged, ), ], ), ); } }
flutter/dev/a11y_assessments/lib/use_cases/radio_list_tile.dart/0
{ "file_path": "flutter/dev/a11y_assessments/lib/use_cases/radio_list_tile.dart", "repo_id": "flutter", "token_count": 571 }
534
#include "../../Flutter/Flutter-Release.xcconfig" #include "Warnings.xcconfig"
flutter/dev/a11y_assessments/macos/Runner/Configs/Release.xcconfig/0
{ "file_path": "flutter/dev/a11y_assessments/macos/Runner/Configs/Release.xcconfig", "repo_id": "flutter", "token_count": 32 }
535
// Copyright 2014 The Flutter 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:a11y_assessments/use_cases/radio_list_tile.dart'; import 'package:flutter_test/flutter_test.dart'; import 'test_utils.dart'; void main() { testWidgets('radio list tile use-case renders radio buttons', (WidgetTester tester) async { await pumpsUseCase(tester, RadioListTileUseCase()); expect(find.text('Lafayette'), findsOneWidget); expect(find.text('Jefferson'), findsOneWidget); }); }
flutter/dev/a11y_assessments/test/radio_list_tile_test.dart/0
{ "file_path": "flutter/dev/a11y_assessments/test/radio_list_tile_test.dart", "repo_id": "flutter", "token_count": 187 }
536
// Copyright 2014 The Flutter 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/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Exception handling in test harness - string', (WidgetTester tester) async { throw 'Who lives, who dies, who tells your story?'; }); testWidgets('Exception handling in test harness - FlutterError', (WidgetTester tester) async { throw FlutterError('Who lives, who dies, who tells your story?'); }); testWidgets('Exception handling in test harness - uncaught Future error', (WidgetTester tester) async { Future<void>.error('Who lives, who dies, who tells your story?'); }); }
flutter/dev/automated_tests/integration_test/exception_handling_test.dart/0
{ "file_path": "flutter/dev/automated_tests/integration_test/exception_handling_test.dart", "repo_id": "flutter", "token_count": 228 }
537
// Copyright 2014 The Flutter 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'; import 'package:flutter/material.dart'; // Based on https://github.com/eseidelGoogle/bezier_perf/blob/master/lib/main.dart class CubicBezierPage extends StatelessWidget { const CubicBezierPage({super.key}); @override Widget build(BuildContext context) { return const Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Bezier(Colors.amber, 1.0), ], ), ); } } class Bezier extends StatelessWidget { const Bezier(this.color, this.scale, {super.key, this.blur = 0.0, this.delay = 0.0}); final Color color; final double scale; final double blur; final double delay; List<PathDetail> _getLogoPath() { final List<PathDetail> paths = <PathDetail>[]; final Path path = Path(); path.moveTo(100.0, 97.0); path.cubicTo(100.0, 97.0, 142.0, 59.0, 169.91, 41.22); path.cubicTo(197.82, 23.44, 249.24, 5.52, 204.67, 85.84); paths.add(PathDetail(path)); // Path 2 final Path bezier2Path = Path(); bezier2Path.moveTo(0.0, 70.55); bezier2Path.cubicTo(0.0, 70.55, 42.0, 31.55, 69.91, 14.77); bezier2Path.cubicTo(97.82, -2.01, 149.24, -20.93, 104.37, 59.39); paths.add(PathDetail(bezier2Path, translate: <double>[29.45, 151.0], rotation: -1.5708)); // Path 3 final Path bezier3Path = Path(); bezier3Path.moveTo(0.0, 69.48); bezier3Path.cubicTo(0.0, 69.48, 44.82, 27.92, 69.91, 13.7); bezier3Path.cubicTo(95.0, -0.52, 149.24, -22.0, 104.37, 58.32); paths.add(PathDetail(bezier3Path, translate: <double>[53.0, 200.48], rotation: -3.14159)); // Path 4 final Path bezier4Path = Path(); bezier4Path.moveTo(0.0, 69.48); bezier4Path.cubicTo(0.0, 69.48, 43.82, 27.92, 69.91, 13.7); bezier4Path.cubicTo(96.0, -0.52, 149.24, -22.0, 104.37, 58.32); paths.add(PathDetail(bezier4Path, translate: <double>[122.48, 77.0], rotation: -4.71239)); return paths; } @override Widget build(BuildContext context) { return Stack(children: <Widget>[ CustomPaint( foregroundPainter: BezierPainter(Colors.grey, 0.0, _getLogoPath(), false), size: const Size(100.0, 100.0), ), AnimatedBezier(color, scale, blur: blur), ]); } } class PathDetail { PathDetail(this.path, {this.translate, this.rotation}); Path path; List<double>? translate = <double>[]; double? rotation; } class AnimatedBezier extends StatefulWidget { const AnimatedBezier(this.color, this.scale, {super.key, this.blur = 0.0}); final Color color; final double scale; final double blur; @override State createState() => AnimatedBezierState(); } class Point { Point(this.x, this.y); double x; double y; } class AnimatedBezierState extends State<AnimatedBezier> with SingleTickerProviderStateMixin { late AnimationController controller; late CurvedAnimation curve; bool isPlaying = false; List<List<Point>> pointList = <List<Point>>[ <Point>[], <Point>[], <Point>[], <Point>[], ]; bool isReversed = false; List<PathDetail> _playForward() { final List<PathDetail> paths = <PathDetail>[]; final double t = curve.value; final double b = controller.upperBound; double pX; double pY; final Path path = Path(); if (t < b / 2) { pX = _getCubicPoint(t * 2, 100.0, 100.0, 142.0, 169.91); pY = _getCubicPoint(t * 2, 97.0, 97.0, 59.0, 41.22); pointList[0].add(Point(pX, pY)); } else { pX = _getCubicPoint(t * 2 - b, 169.91, 197.80, 249.24, 204.67); pY = _getCubicPoint(t * 2 - b, 41.22, 23.44, 5.52, 85.84); pointList[0].add(Point(pX, pY)); } path.moveTo(100.0, 97.0); for (final Point p in pointList[0]) { path.lineTo(p.x, p.y); } paths.add(PathDetail(path)); // Path 2 final Path bezier2Path = Path(); if (t <= b / 2) { final double pX = _getCubicPoint(t * 2, 0.0, 0.0, 42.0, 69.91); final double pY = _getCubicPoint(t * 2, 70.55, 70.55, 31.55, 14.77); pointList[1].add(Point(pX, pY)); } else { final double pX = _getCubicPoint(t * 2 - b, 69.91, 97.82, 149.24, 104.37); final double pY = _getCubicPoint(t * 2 - b, 14.77, -2.01, -20.93, 59.39); pointList[1].add(Point(pX, pY)); } bezier2Path.moveTo(0.0, 70.55); for (final Point p in pointList[1]) { bezier2Path.lineTo(p.x, p.y); } paths.add(PathDetail(bezier2Path, translate: <double>[29.45, 151.0], rotation: -1.5708)); // Path 3 final Path bezier3Path = Path(); if (t <= b / 2) { pX = _getCubicPoint(t * 2, 0.0, 0.0, 44.82, 69.91); pY = _getCubicPoint(t * 2, 69.48, 69.48, 27.92, 13.7); pointList[2].add(Point(pX, pY)); } else { pX = _getCubicPoint(t * 2 - b, 69.91, 95.0, 149.24, 104.37); pY = _getCubicPoint(t * 2 - b, 13.7, -0.52, -22.0, 58.32); pointList[2].add(Point(pX, pY)); } bezier3Path.moveTo(0.0, 69.48); for (final Point p in pointList[2]) { bezier3Path.lineTo(p.x, p.y); } paths.add(PathDetail(bezier3Path, translate: <double>[53.0, 200.48], rotation: -3.14159)); // Path 4 final Path bezier4Path = Path(); if (t < b / 2) { final double pX = _getCubicPoint(t * 2, 0.0, 0.0, 43.82, 69.91); final double pY = _getCubicPoint(t * 2, 69.48, 69.48, 27.92, 13.7); pointList[3].add(Point(pX, pY)); } else { final double pX = _getCubicPoint(t * 2 - b, 69.91, 96.0, 149.24, 104.37); final double pY = _getCubicPoint(t * 2 - b, 13.7, -0.52, -22.0, 58.32); pointList[3].add(Point(pX, pY)); } bezier4Path.moveTo(0.0, 69.48); for (final Point p in pointList[3]) { bezier4Path.lineTo(p.x, p.y); } paths.add(PathDetail(bezier4Path, translate: <double>[122.48, 77.0], rotation: -4.71239)); return paths; } List<PathDetail> _playReversed() { for (final List<Point> list in pointList) { if (list.isNotEmpty) { list.removeLast(); } } final List<Point> points = pointList[0]; final Path path = Path(); path.moveTo(100.0, 97.0); for (final Point point in points) { path.lineTo(point.x, point.y); } final Path bezier2Path = Path(); bezier2Path.moveTo(0.0, 70.55); for (final Point p in pointList[1]) { bezier2Path.lineTo(p.x, p.y); } final Path bezier3Path = Path(); bezier3Path.moveTo(0.0, 69.48); for (final Point p in pointList[2]) { bezier3Path.lineTo(p.x, p.y); } final Path bezier4Path = Path(); bezier4Path.moveTo(0.0, 69.48); for (final Point p in pointList[3]) { bezier4Path.lineTo(p.x, p.y); } return <PathDetail>[ PathDetail(path), PathDetail(bezier2Path, translate: <double>[29.45, 151.0], rotation: -1.5708), PathDetail(bezier3Path, translate: <double>[53.0, 200.48], rotation: -3.14159), PathDetail(bezier4Path, translate: <double>[122.48, 77.0], rotation: -4.71239), ]; } List<PathDetail> _getLogoPath() { if (!isReversed) { return _playForward(); } return _playReversed(); } //From http://wiki.roblox.com/index.php?title=File:Beziereq4.png double _getCubicPoint(double t, double p0, double p1, double p2, double p3) { return (pow(1 - t, 3) as double) * p0 + 3 * pow(1 - t, 2) * t * p1 + 3 * (1 - t) * pow(t, 2) * p2 + pow(t, 3) * p3; } void playAnimation() { isPlaying = true; isReversed = false; for (final List<Point> list in pointList) { list.clear(); } controller.reset(); controller.forward(); } void stopAnimation() { isPlaying = false; controller.stop(); for (final List<Point> list in pointList) { list.clear(); } } void reverseAnimation() { isReversed = true; controller.reverse(); } @override void initState() { super.initState(); controller = AnimationController( vsync: this, duration: const Duration(milliseconds: 1000)); // Animations are typically implemented using the AnimatedBuilder widget. // This code uses a manual listener for historical reasons and will remain // in order to preserve compatibility with the history of measurements for // this benchmark. curve = CurvedAnimation(parent: controller, curve: Curves.linear) ..addListener(() { setState(() {}); }) ..addStatusListener((AnimationStatus state) { if (state == AnimationStatus.completed) { reverseAnimation(); } else if (state == AnimationStatus.dismissed) { playAnimation(); } }); playAnimation(); } @override void dispose() { controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return CustomPaint( foregroundPainter: BezierPainter(widget.color, curve.value * widget.blur, _getLogoPath(), isPlaying), size: const Size(100.0, 100.0)); } } class BezierPainter extends CustomPainter { BezierPainter(this.color, this.blur, this.path, this.isPlaying); Color color; final double blur; List<PathDetail> path; bool isPlaying; @override void paint(Canvas canvas, Size size) { final Paint paint = Paint(); paint.strokeWidth = 18.0; paint.style = PaintingStyle.stroke; paint.strokeCap = StrokeCap.round; paint.color = color; canvas.scale(0.5, 0.5); for (int i = 0; i < path.length; i++) { if (path[i].translate != null) { canvas.translate(path[i].translate![0], path[i].translate![1]); } if (path[i].rotation != null) { canvas.rotate(path[i].rotation!); } if (blur > 0) { final MaskFilter blur = MaskFilter.blur(BlurStyle.normal, this.blur); paint.maskFilter = blur; canvas.drawPath(path[i].path, paint); } paint.maskFilter = null; canvas.drawPath(path[i].path, paint); } } @override bool shouldRepaint(BezierPainter oldDelegate) => true; @override bool shouldRebuildSemantics(BezierPainter oldDelegate) => false; }
flutter/dev/benchmarks/macrobenchmarks/lib/src/cubic_bezier.dart/0
{ "file_path": "flutter/dev/benchmarks/macrobenchmarks/lib/src/cubic_bezier.dart", "repo_id": "flutter", "token_count": 4610 }
538
// Copyright 2014 The Flutter 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'; class PictureCacheComplexityScoringPage extends StatelessWidget { const PictureCacheComplexityScoringPage({super.key}); static const List<String> kTabNames = <String>['1', '2']; @override Widget build(BuildContext context) { return DefaultTabController( length: kTabNames.length, // This is the number of tabs. child: Scaffold( appBar: AppBar( title: const Text('Picture Cache Complexity Scoring'), // pinned: true, // expandedHeight: 50.0, // forceElevated: innerBoxIsScrolled, bottom: TabBar( tabs: kTabNames.map((String name) => Tab(text: name)).toList(), ), ), body: TabBarView( key: const Key('tabbar_view_complexity'), // this key is used by the driver test children: kTabNames.map((String name) { return _buildComplexityScoringWidgets(name); }).toList(), ), ), ); } // For now we just test a single case where the widget being cached is actually // relatively cheap to rasterize, and so should not be in the cache. // // Eventually we can extend this to add new test cases based on the tab name. Widget _buildComplexityScoringWidgets(String name) { return Column(children: <Widget>[ Slider(value: 50, label: 'Slider 1', onChanged: (double _) {}, max: 100, divisions: 10,), Slider(value: 50, label: 'Slider 2', onChanged: (double _) {}, max: 100, divisions: 10,), Slider(value: 50, label: 'Slider 3', onChanged: (double _) {}, max: 100, divisions: 10,), ]); } }
flutter/dev/benchmarks/macrobenchmarks/lib/src/picture_cache_complexity_scoring.dart/0
{ "file_path": "flutter/dev/benchmarks/macrobenchmarks/lib/src/picture_cache_complexity_scoring.dart", "repo_id": "flutter", "token_count": 675 }
539
// Copyright 2014 The Flutter 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:ui'; import 'recorder.dart'; /// Repeatedly paints a grid of rectangles. /// /// Measures the performance of the `drawRect` operation. class BenchDrawRect extends SceneBuilderRecorder { /// A variant of the benchmark that uses the same [Paint] object for all rectangles. /// /// This variant focuses on the performance of the `drawRect` method itself. BenchDrawRect.staticPaint() : benchmarkPaint = false, super(name: benchmarkName); /// A variant of the benchmark that creates a unique [Paint] for each rectangle. /// /// Does not cache the [Paint] objects across frames, but generates new /// objects every time. This variant of the benchmark focuses on construction /// and transfer of paint data to the renderer. BenchDrawRect.variablePaint() : benchmarkPaint = true, super(name: variablePaintBenchmarkName); static const String benchmarkName = 'draw_rect'; static const String variablePaintBenchmarkName = 'draw_rect_variable_paint'; /// Number of rows in the grid. static const int kRows = 25; /// Number of columns in the grid. static const int kColumns = 40; /// Whether each cell should gets its own unique [Paint] value. /// /// This is used to benchmark the efficiency of passing a large number of /// paint objects to the rendering system. final bool benchmarkPaint; /// Counter used to offset the rendered rects to make them wobble. /// /// The wobbling is there so a human could visually verify that the benchmark /// is correctly pumping frames. double wobbleCounter = 0; static final Paint _staticPaint = Paint()..color = const Color.fromARGB(255, 255, 0, 0); Paint makePaint(int row, int col) { if (benchmarkPaint) { final Paint paint = Paint(); final double rowRatio = row / kRows; paint.color = Color.fromARGB(255, (255 * rowRatio).floor(), (255 * col / kColumns).floor(), 255); paint.filterQuality = FilterQuality.values[(FilterQuality.values.length * rowRatio).floor()]; paint.strokeCap = StrokeCap.values[(StrokeCap.values.length * rowRatio).floor()]; paint.strokeJoin = StrokeJoin.values[(StrokeJoin.values.length * rowRatio).floor()]; paint.blendMode = BlendMode.values[(BlendMode.values.length * rowRatio).floor()]; paint.style = PaintingStyle.values[(PaintingStyle.values.length * rowRatio).floor()]; paint.strokeWidth = 1.0 + rowRatio; paint.strokeMiterLimit = rowRatio; return paint; } else { return _staticPaint; } } @override void onDrawFrame(SceneBuilder sceneBuilder) { final PictureRecorder pictureRecorder = PictureRecorder(); final Canvas canvas = Canvas(pictureRecorder); final Size viewSize = view.physicalSize; final Size cellSize = Size( viewSize.width / kColumns, viewSize.height / kRows, ); final Size rectSize = cellSize * 0.8; for (int row = 0; row < kRows; row++) { canvas.save(); for (int col = 0; col < kColumns; col++) { canvas.drawRect( Offset((wobbleCounter - 5).abs(), 0) & rectSize, makePaint(row, col), ); canvas.translate(cellSize.width, 0); } canvas.restore(); canvas.translate(0, cellSize.height); } wobbleCounter += 1; wobbleCounter = wobbleCounter % 10; final Picture picture = pictureRecorder.endRecording(); sceneBuilder.pushOffset(0.0, 0.0); sceneBuilder.addPicture(Offset.zero, picture); sceneBuilder.pop(); } }
flutter/dev/benchmarks/macrobenchmarks/lib/src/web/bench_draw_rect.dart/0
{ "file_path": "flutter/dev/benchmarks/macrobenchmarks/lib/src/web/bench_draw_rect.dart", "repo_id": "flutter", "token_count": 1204 }
540
// Copyright 2014 The Flutter 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 'dart:ui'; import 'recorder.dart'; import 'test_data.dart'; /// Draws 9 screens worth of text in a 3x3 grid with only the middle cell /// appearing on the visible screen: /// /// +-------------+-------------+-------------+ /// | | | | /// | invisible | invisible | invisible | /// | | | | /// +-----------------------------------------+ /// | | | | /// | invisible | visible | invisible | /// | | | | /// +-----------------------------------------+ /// | | | | /// | invisible | invisible | invisible | /// | | | | /// +-------------+-------------+-------------+ /// /// This reproduces the bug where we render more than visible causing /// performance issues: https://github.com/flutter/flutter/issues/48516 class BenchTextOutOfPictureBounds extends SceneBuilderRecorder { BenchTextOutOfPictureBounds() : super(name: benchmarkName) { const Color red = Color.fromARGB(255, 255, 0, 0); const Color green = Color.fromARGB(255, 0, 255, 0); // We don't want paragraph generation and layout to pollute benchmark numbers. singleLineParagraphs = generateLaidOutParagraphs( paragraphCount: 500, minWordCountPerParagraph: 2, maxWordCountPerParagraph: 4, widthConstraint: view.physicalSize.width / 2, color: red, ); multiLineParagraphs = generateLaidOutParagraphs( paragraphCount: 50, minWordCountPerParagraph: 30, maxWordCountPerParagraph: 49, widthConstraint: view.physicalSize.width / 2, color: green, ); } // Use hard-coded seed to make sure the data is stable across benchmark runs. static final math.Random _random = math.Random(0); static const String benchmarkName = 'text_out_of_picture_bounds'; late List<Paragraph> singleLineParagraphs; late List<Paragraph> multiLineParagraphs; @override void onDrawFrame(SceneBuilder sceneBuilder) { final PictureRecorder pictureRecorder = PictureRecorder(); final Canvas canvas = Canvas(pictureRecorder); final Size viewSize = view.physicalSize; const double padding = 10.0; // Fills a single cell with random text. void fillCellWithText(List<Paragraph> textSource) { canvas.save(); double topOffset = 0; while (topOffset < viewSize.height) { final Paragraph paragraph = textSource[_random.nextInt(textSource.length)]; // Give it enough space to make sure it ends up being a single-line paragraph. paragraph.layout(ParagraphConstraints(width: viewSize.width / 2)); canvas.drawParagraph(paragraph, Offset.zero); canvas.translate(0, paragraph.height + padding); topOffset += paragraph.height + padding; } canvas.restore(); } // Starting with the top-left cell, fill every cell with text. canvas.translate(-viewSize.width, -viewSize.height); for (int row = 0; row < 3; row++) { canvas.save(); for (int col = 0; col < 3; col++) { canvas.drawRect( Offset.zero & viewSize, Paint() ..style = PaintingStyle.stroke ..strokeWidth = 2.0, ); // Fill single-line text. fillCellWithText(singleLineParagraphs); // Fill multi-line text. canvas.save(); canvas.translate(viewSize.width / 2, 0); fillCellWithText(multiLineParagraphs); canvas.restore(); // Shift to next column. canvas.translate(viewSize.width, 0); } // Undo horizontal shift. canvas.restore(); // Shift to next row. canvas.translate(0, viewSize.height); } final Picture picture = pictureRecorder.endRecording(); sceneBuilder.pushOffset(0.0, 0.0); sceneBuilder.addPicture(Offset.zero, picture); sceneBuilder.pop(); } }
flutter/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_out_of_picture_bounds.dart/0
{ "file_path": "flutter/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_out_of_picture_bounds.dart", "repo_id": "flutter", "token_count": 1679 }
541
// Copyright 2014 The Flutter 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_driver/flutter_driver.dart'; import 'package:macrobenchmarks/common.dart'; import 'util.dart'; void main() { macroPerfTest( 'picture_cache_complexity_scoring_perf', kPictureCacheComplexityScoringRouteName, pageDelay: const Duration(seconds: 1), driverOps: (FlutterDriver driver) async { final SerializableFinder tabBarView = find.byValueKey('tabbar_view_complexity'); Future<void> scrollOnce(double offset) async { // Technically it's not scrolling but moving await driver.scroll(tabBarView, offset, 0.0, const Duration(milliseconds: 300)); await Future<void>.delayed(const Duration(milliseconds: 500)); } // When we eventually add more test panes we will want to tweak these // to go through all the panes for (int i = 0; i < 6; i += 1) { await scrollOnce(-300.0); await scrollOnce(300.0); } }, ); }
flutter/dev/benchmarks/macrobenchmarks/test_driver/picture_cache_complexity_scoring_perf_test.dart/0
{ "file_path": "flutter/dev/benchmarks/macrobenchmarks/test_driver/picture_cache_complexity_scoring_perf_test.dart", "repo_id": "flutter", "token_count": 393 }
542
// Copyright 2014 The Flutter 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/foundation.dart'; import '../common.dart'; const int _kNumIterations = 10000; void main() { assert(false, "Don't run benchmarks in debug mode! Use 'flutter run --release'."); final BenchmarkResultPrinter printer = BenchmarkResultPrinter(); final Stopwatch watch = Stopwatch(); watch.start(); for (int i = 0; i < _kNumIterations; i += 1) { FlutterTimeline.startSync('foo'); FlutterTimeline.finishSync(); } watch.stop(); printer.addResult( description: 'timeline events without arguments', value: watch.elapsedMicroseconds.toDouble() / _kNumIterations, unit: 'us per iteration', name: 'timeline_without_arguments', ); watch.reset(); watch.start(); for (int i = 0; i < _kNumIterations; i += 1) { FlutterTimeline.startSync('foo', arguments: <String, dynamic>{ 'int': 1234, 'double': 0.3, 'list': <int>[1, 2, 3, 4], 'map': <String, dynamic>{'map': true}, 'bool': false, }); FlutterTimeline.finishSync(); } watch.stop(); printer.addResult( description: 'timeline events with arguments', value: watch.elapsedMicroseconds.toDouble() / _kNumIterations, unit: 'us per iteration', name: 'timeline_with_arguments', ); printer.printToStdout(); }
flutter/dev/benchmarks/microbenchmarks/lib/foundation/timeline_bench.dart/0
{ "file_path": "flutter/dev/benchmarks/microbenchmarks/lib/foundation/timeline_bench.dart", "repo_id": "flutter", "token_count": 518 }
543
// Copyright 2014 The Flutter 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:ui' as ui; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import '../common.dart'; const List<String> assets = <String>[ 'packages/flutter_gallery_assets/people/ali_landscape.png', 'packages/flutter_gallery_assets/monochrome/red-square-1024x1024.png', 'packages/flutter_gallery_assets/logos/flutter_white/logo.png', 'packages/flutter_gallery_assets/logos/fortnightly/fortnightly_logo.png', 'packages/flutter_gallery_assets/videos/bee.mp4', 'packages/flutter_gallery_assets/videos/butterfly.mp4', 'packages/flutter_gallery_assets/animated_images/animated_flutter_lgtm.gif', 'packages/flutter_gallery_assets/animated_images/animated_flutter_stickers.webp', 'packages/flutter_gallery_assets/food/butternut_squash_soup.png', 'packages/flutter_gallery_assets/food/cherry_pie.png', 'packages/flutter_gallery_assets/food/chopped_beet_leaves.png', 'packages/flutter_gallery_assets/food/fruits.png', 'packages/flutter_gallery_assets/food/pesto_pasta.png', 'packages/flutter_gallery_assets/food/roasted_chicken.png', 'packages/flutter_gallery_assets/food/spanakopita.png', 'packages/flutter_gallery_assets/food/spinach_onion_salad.png', 'packages/flutter_gallery_assets/food/icons/fish.png', 'packages/flutter_gallery_assets/food/icons/healthy.png', 'packages/flutter_gallery_assets/food/icons/main.png', 'packages/flutter_gallery_assets/food/icons/meat.png', 'packages/flutter_gallery_assets/food/icons/quick.png', 'packages/flutter_gallery_assets/food/icons/spicy.png', 'packages/flutter_gallery_assets/food/icons/veggie.png', 'packages/flutter_gallery_assets/logos/pesto/logo_small.png', 'packages/flutter_gallery_assets/places/india_chennai_flower_market.png', 'packages/flutter_gallery_assets/places/india_thanjavur_market.png', 'packages/flutter_gallery_assets/places/india_tanjore_bronze_works.png', 'packages/flutter_gallery_assets/places/india_tanjore_market_merchant.png', 'packages/flutter_gallery_assets/places/india_tanjore_thanjavur_temple.png', 'packages/flutter_gallery_assets/places/india_pondicherry_salt_farm.png', 'packages/flutter_gallery_assets/places/india_chennai_highway.png', 'packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png', 'packages/flutter_gallery_assets/places/india_tanjore_thanjavur_temple_carvings.png', 'packages/flutter_gallery_assets/places/india_chettinad_produce.png', 'packages/flutter_gallery_assets/places/india_tanjore_market_technology.png', 'packages/flutter_gallery_assets/places/india_pondicherry_beach.png', 'packages/flutter_gallery_assets/places/india_pondicherry_fisherman.png', 'packages/flutter_gallery_assets/products/backpack.png', 'packages/flutter_gallery_assets/products/belt.png', 'packages/flutter_gallery_assets/products/cup.png', 'packages/flutter_gallery_assets/products/deskset.png', 'packages/flutter_gallery_assets/products/dress.png', 'packages/flutter_gallery_assets/products/earrings.png', 'packages/flutter_gallery_assets/products/flatwear.png', 'packages/flutter_gallery_assets/products/hat.png', 'packages/flutter_gallery_assets/products/jacket.png', 'packages/flutter_gallery_assets/products/jumper.png', 'packages/flutter_gallery_assets/products/kitchen_quattro.png', 'packages/flutter_gallery_assets/products/napkins.png', 'packages/flutter_gallery_assets/products/planters.png', 'packages/flutter_gallery_assets/products/platter.png', 'packages/flutter_gallery_assets/products/scarf.png', 'packages/flutter_gallery_assets/products/shirt.png', 'packages/flutter_gallery_assets/products/sunnies.png', 'packages/flutter_gallery_assets/products/sweater.png', 'packages/flutter_gallery_assets/products/sweats.png', 'packages/flutter_gallery_assets/products/table.png', 'packages/flutter_gallery_assets/products/teaset.png', 'packages/flutter_gallery_assets/products/top.png', 'packages/flutter_gallery_assets/people/square/ali.png', 'packages/flutter_gallery_assets/people/square/peter.png', 'packages/flutter_gallery_assets/people/square/sandra.png', 'packages/flutter_gallery_assets/people/square/stella.png', 'packages/flutter_gallery_assets/people/square/trevor.png', ]; // Measures the time it takes to load a fixed number of assets into an // immutable buffer to later be decoded by skia. Future<void> main() async { assert(false, "Don't run benchmarks in debug mode! Use 'flutter run --release'."); final Stopwatch watch = Stopwatch(); await benchmarkWidgets((WidgetTester tester) async { watch.start(); for (int i = 0; i < 10; i += 1) { await Future.wait(<Future<ui.ImmutableBuffer>>[ for (final String asset in assets) rootBundle.loadBuffer(asset) ]); } watch.stop(); }); final BenchmarkResultPrinter printer = BenchmarkResultPrinter(); printer.addResult( description: 'Image loading', value: watch.elapsedMilliseconds.toDouble(), unit: 'ms', name: 'image_load_ms', ); printer.printToStdout(); }
flutter/dev/benchmarks/microbenchmarks/lib/ui/image_bench.dart/0
{ "file_path": "flutter/dev/benchmarks/microbenchmarks/lib/ui/image_bench.dart", "repo_id": "flutter", "token_count": 1834 }
544
// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = "1.7.10" repositories { google() mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:7.3.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // Do not place your application dependencies here; they belong // in the individual module build.gradle files. } } allprojects { repositories { google() mavenCentral() } } tasks.register("clean", Delete) { delete rootProject.buildDir }
flutter/dev/benchmarks/multiple_flutters/android/build.gradle/0
{ "file_path": "flutter/dev/benchmarks/multiple_flutters/android/build.gradle", "repo_id": "flutter", "token_count": 300 }
545
# platform_views_layout_hybrid_composition ## Scrolling benchmark To run the scrolling benchmark on a device: ``` flutter drive --profile test_driver/scroll_perf.dart ``` Results should be in the file `build/platform_views_scroll_perf_hybrid_composition.timeline_summary.json`. More detailed logs should be in `build/platform_views_scroll_perf_hybrid_composition.timeline.json`. ## Startup benchmark To measure startup time on a device: ``` flutter run --profile --trace-startup ``` Results should be in the logs. Additional results should be in the file `build/start_up_info.json`.
flutter/dev/benchmarks/platform_views_layout_hybrid_composition/README.md/0
{ "file_path": "flutter/dev/benchmarks/platform_views_layout_hybrid_composition/README.md", "repo_id": "flutter", "token_count": 180 }
546
{ "images" : [ { "size" : "20x20", "idiom" : "iphone", "filename" : "[email protected]", "scale" : "2x" }, { "size" : "20x20", "idiom" : "iphone", "filename" : "[email protected]", "scale" : "3x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "[email protected]", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "[email protected]", "scale" : "3x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "[email protected]", "scale" : "2x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "[email protected]", "scale" : "3x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "[email protected]", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "[email protected]", "scale" : "3x" }, { "size" : "20x20", "idiom" : "ipad", "filename" : "Icon-Notification.png", "scale" : "1x" }, { "size" : "20x20", "idiom" : "ipad", "filename" : "[email protected]", "scale" : "2x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "Icon-Small.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "[email protected]", "scale" : "2x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon-Small-40.png", "scale" : "1x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "[email protected]", "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon-76.png", "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "[email protected]", "scale" : "2x" }, { "size" : "83.5x83.5", "idiom" : "ipad", "filename" : "[email protected]", "scale" : "2x" } ] }
flutter/dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json/0
{ "file_path": "flutter/dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json", "repo_id": "flutter", "token_count": 1277 }
547
// Copyright 2014 The Flutter 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 'stock_data.dart'; import 'stock_row.dart'; class StockList extends StatelessWidget { const StockList({ super.key, required this.stocks, required this.onOpen, required this.onShow, required this.onAction, }); final List<Stock> stocks; final StockRowActionCallback onOpen; final StockRowActionCallback onShow; final StockRowActionCallback onAction; @override Widget build(BuildContext context) { return ListView.builder( key: const ValueKey<String>('stock-list'), itemExtent: StockRow.kHeight, itemCount: stocks.length, itemBuilder: (BuildContext context, int index) { return StockRow( stock: stocks[index], onPressed: onOpen, onDoubleTap: onShow, onLongPressed: onAction, ); }, ); } }
flutter/dev/benchmarks/test_apps/stocks/lib/stock_list.dart/0
{ "file_path": "flutter/dev/benchmarks/test_apps/stocks/lib/stock_list.dart", "repo_id": "flutter", "token_count": 379 }
548
include: ../analysis_options.yaml linter: rules: avoid_js_rounded_ints: false # CLI code doesn't need to worry about JS issues
flutter/dev/bots/analysis_options.yaml/0
{ "file_path": "flutter/dev/bots/analysis_options.yaml", "repo_id": "flutter", "token_count": 44 }
549
// Copyright 2014 The Flutter 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:async'; import 'dart:convert'; import 'dart:io' hide Platform; import 'package:platform/platform.dart' show LocalPlatform, Platform; import 'package:process/process.dart'; import 'common.dart'; /// A helper class for classes that want to run a process. /// /// The stderr and stdout can optionally be reported as the process runs, and /// capture the stdout properly without dropping any. class ProcessRunner { ProcessRunner({ ProcessManager? processManager, this.subprocessOutput = true, this.defaultWorkingDirectory, this.platform = const LocalPlatform(), }) : processManager = processManager ?? const LocalProcessManager() { environment = Map<String, String>.from(platform.environment); } /// The platform to use for a starting environment. final Platform platform; /// Set [subprocessOutput] to show output as processes run. Stdout from the /// process will be printed to stdout, and stderr printed to stderr. final bool subprocessOutput; /// Set the [processManager] in order to inject a test instance to perform /// testing. final ProcessManager processManager; /// Sets the default directory used when `workingDirectory` is not specified /// to [runProcess]. final Directory? defaultWorkingDirectory; /// The environment to run processes with. late Map<String, String> environment; /// Run the command and arguments in `commandLine` as a sub-process from /// `workingDirectory` if set, or the [defaultWorkingDirectory] if not. Uses /// [Directory.current] if [defaultWorkingDirectory] is not set. /// /// Set `failOk` if [runProcess] should not throw an exception when the /// command completes with a non-zero exit code. Future<String> runProcess( List<String> commandLine, { Directory? workingDirectory, bool failOk = false, }) async { workingDirectory ??= defaultWorkingDirectory ?? Directory.current; if (subprocessOutput) { stderr.write('Running "${commandLine.join(' ')}" in ${workingDirectory.path}.\n'); } final List<int> output = <int>[]; final Completer<void> stdoutComplete = Completer<void>(); final Completer<void> stderrComplete = Completer<void>(); late Process process; Future<int> allComplete() async { await stderrComplete.future; await stdoutComplete.future; return process.exitCode; } try { process = await processManager.start( commandLine, workingDirectory: workingDirectory.absolute.path, environment: environment, ); process.stdout.listen( (List<int> event) { output.addAll(event); if (subprocessOutput) { stdout.add(event); } }, onDone: () async => stdoutComplete.complete(), ); if (subprocessOutput) { process.stderr.listen( (List<int> event) { stderr.add(event); }, onDone: () async => stderrComplete.complete(), ); } else { stderrComplete.complete(); } } on ProcessException catch (e) { final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} ' 'failed with:\n$e'; throw PreparePackageException(message); } on ArgumentError catch (e) { final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} ' 'failed with:\n$e'; throw PreparePackageException(message); } final int exitCode = await allComplete(); if (exitCode != 0 && !failOk) { final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} failed'; throw PreparePackageException( message, ProcessResult(0, exitCode, null, 'returned $exitCode'), ); } return utf8.decoder.convert(output).trim(); } }
flutter/dev/bots/prepare_package/process_runner.dart/0
{ "file_path": "flutter/dev/bots/prepare_package/process_runner.dart", "repo_id": "flutter", "token_count": 1367 }
550
// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @Deprecated( 'This is the reason and what you should use instead. ' 'This feature was deprecated after v1.2.3.' ) void test1() { } @Deprecated( 'Missing space ->.' //ignore: missing_whitespace_between_adjacent_strings 'This feature was deprecated after v1.2.3.' ) void test2() { } @Deprecated( 'bad grammar. ' 'This feature was deprecated after v1.2.3.' ) void test3() { } @Deprecated( 'Also bad grammar ' 'This feature was deprecated after v1.2.3.' ) void test4() { } @deprecated // ignore: provide_deprecation_message void test5() { } @Deprecated('Not the right syntax. This feature was deprecated after v1.2.3.') void test6() { } @Deprecated( 'Missing the version line. ' ) void test7() { } @Deprecated( 'This feature was deprecated after v1.2.3.' ) void test8() { } @Deprecated( 'Not the right syntax. ' 'This feature was deprecated after v1.2.3.' ) void test9() { } @Deprecated( 'Not the right syntax. ' 'This feature was deprecated after v1.2.3.' ) void test10() { } @Deprecated( 'URLs are not required. ' 'This feature was deprecated after v1.0.0.' ) void test11() { } @Deprecated( 'Version number test (should fail). ' 'This feature was deprecated after v1.19.0.' ) void test12() { } @Deprecated( 'Version number test (should fail). ' 'This feature was deprecated after v1.20.0.' ) void test13() { } @Deprecated( 'Version number test (should fail). ' 'This feature was deprecated after v1.21.0.' ) void test14() { } @Deprecated( 'Version number test (special beta should pass). ' 'This feature was deprecated after v3.1.0.' ) void test15() { } @Deprecated( 'Version number test (should be fine). ' 'This feature was deprecated after v0.1.0.' ) void test16() { } @Deprecated( 'Version number test (should be fine). ' 'This feature was deprecated after v1.20.0-1.0.pre.' ) void test17() { } @Deprecated( "Double quotes' test (should fail). " 'This feature was deprecated after v2.1.0-11.0.pre.' ) void test18() { } @Deprecated( // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/000000 'Missing the version line. ' ) void test19() { }
flutter/dev/bots/test/analyze-test-input/root/packages/foo/deprecation.dart/0
{ "file_path": "flutter/dev/bots/test/analyze-test-input/root/packages/foo/deprecation.dart", "repo_id": "flutter", "token_count": 790 }
551
// Copyright 2014 The Flutter 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:io'; import 'package:file/memory.dart'; import 'package:platform/platform.dart'; import '../../../packages/flutter_tools/test/src/fake_process_manager.dart'; import '../post_process_docs.dart'; import 'common.dart'; void main() async { group('getBranch', () { const String branchName = 'stable'; test('getBranchName does not call git if env LUCI_BRANCH provided', () async { final Platform platform = FakePlatform( environment: <String, String>{ 'LUCI_BRANCH': branchName, }, ); final ProcessManager processManager = FakeProcessManager.empty(); final String calculatedBranchName = await getBranchName( platform: platform, processManager: processManager, ); expect(calculatedBranchName, branchName); }); test('getBranchName calls git if env LUCI_BRANCH not provided', () async { final Platform platform = FakePlatform( environment: <String, String>{}, ); final ProcessManager processManager = FakeProcessManager.list( <FakeCommand>[ const FakeCommand( command: <String>['git', 'status', '-b', '--porcelain'], stdout: '## $branchName', ), ], ); final String calculatedBranchName = await getBranchName(platform: platform, processManager: processManager); expect( calculatedBranchName, branchName, ); expect(processManager, hasNoRemainingExpectations); }); test('getBranchName calls git if env LUCI_BRANCH is empty', () async { final Platform platform = FakePlatform( environment: <String, String>{ 'LUCI_BRANCH': '', }, ); final ProcessManager processManager = FakeProcessManager.list( <FakeCommand>[ const FakeCommand( command: <String>['git', 'status', '-b', '--porcelain'], stdout: '## $branchName', ), ], ); final String calculatedBranchName = await getBranchName( platform: platform, processManager: processManager, ); expect( calculatedBranchName, branchName, ); expect(processManager, hasNoRemainingExpectations); }); }); group('gitRevision', () { test('Return short format', () async { const String commitHash = 'e65f01793938e13cac2d321b9fcdc7939f9b2ea6'; final ProcessManager processManager = FakeProcessManager.list( <FakeCommand>[ const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: commitHash, ), ], ); final String revision = await gitRevision(processManager: processManager); expect(processManager, hasNoRemainingExpectations); expect(revision, commitHash.substring(0, 10)); }); test('Return full length', () async { const String commitHash = 'e65f01793938e13cac2d321b9fcdc7939f9b2ea6'; final ProcessManager processManager = FakeProcessManager.list( <FakeCommand>[ const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: commitHash, ), ], ); final String revision = await gitRevision(fullLength: true, processManager: processManager); expect(processManager, hasNoRemainingExpectations); expect(revision, commitHash); }); }); group('runProcessWithValidation', () { test('With no error', () async { const List<String> command = <String>['git', 'rev-parse', 'HEAD']; final ProcessManager processManager = FakeProcessManager.list( <FakeCommand>[ const FakeCommand( command: command, ), ], ); await runProcessWithValidations(command, '', processManager: processManager, verbose: false); expect(processManager, hasNoRemainingExpectations); }); test('With error', () async { const List<String> command = <String>['git', 'rev-parse', 'HEAD']; final ProcessManager processManager = FakeProcessManager.list( <FakeCommand>[ const FakeCommand( command: command, exitCode: 1, ), ], ); try { await runProcessWithValidations(command, '', processManager: processManager, verbose: false); throw Exception('Exception was not thrown'); } on CommandException catch (e) { expect(e, isA<Exception>()); } }); }); group('generateFooter', () { test('generated correctly', () async { const String expectedContent = ''' (function() { var span = document.querySelector('footer>span'); if (span) { span.innerText = 'Flutter 3.0.0 • 2022-09-22 14:09 • abcdef • stable'; } var sourceLink = document.querySelector('a.source-link'); if (sourceLink) { sourceLink.href = sourceLink.href.replace('/master/', '/abcdef/'); } })(); '''; final MemoryFileSystem fs = MemoryFileSystem(); final File footerFile = fs.file('/a/b/c/footer.js')..createSync(recursive: true); await createFooter(footerFile, '3.0.0', timestampParam: '2022-09-22 14:09', branchParam: 'stable', revisionParam: 'abcdef'); final String content = await footerFile.readAsString(); expect(content, expectedContent); }); }); }
flutter/dev/bots/test/post_process_docs_test.dart/0
{ "file_path": "flutter/dev/bots/test/post_process_docs_test.dart", "repo_id": "flutter", "token_count": 2188 }
552
// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // See: https://github.com/flutter/flutter/wiki/Release-process export 'src/candidates.dart'; export 'src/clean.dart'; export 'src/git.dart'; export 'src/globals.dart'; export 'src/next.dart' hide kStateOption, kYesFlag; export 'src/repository.dart'; export 'src/start.dart' hide kStateOption; export 'src/state.dart'; export 'src/status.dart' hide kStateOption; export 'src/stdio.dart';
flutter/dev/conductor/core/lib/conductor_core.dart/0
{ "file_path": "flutter/dev/conductor/core/lib/conductor_core.dart", "repo_id": "flutter", "token_count": 189 }
553
syntax = "proto3"; package conductor_state; // A git remote message Remote { string name = 1; string url = 2; } enum ReleasePhase { // Release was started with `conductor start` and repositories cloned. APPLY_ENGINE_CHERRYPICKS = 0; // Verify engine CI is green before opening framework PR. VERIFY_ENGINE_CI = 1; APPLY_FRAMEWORK_CHERRYPICKS = 2; // Git tag applied to framework RC branch HEAD and pushed upstream. PUBLISH_VERSION = 3; reserved 4; // Formerly PUBLISH_CHANNEL, merged into PUBLISH_VERSION. // Package artifacts verified to exist on cloud storage. VERIFY_RELEASE = 5; // There is no further work to be done. RELEASE_COMPLETED = 6; } enum CherrypickState { // The cherrypick has not yet been applied. PENDING = 0; // The cherrypick has not been applied and will require manual resolution. PENDING_WITH_CONFLICT = 1; // The cherrypick has been successfully applied to the local checkout. // // This state requires Cherrypick.appliedRevision to also be set. COMPLETED = 2; // The cherrypick will NOT be applied in this release. ABANDONED = 3; } // The type of release that is being created. // // This determines how the version will be calculated. enum ReleaseType { // All pre-release metadata from previous beta releases will be discarded. The // z must be 0. STABLE_INITIAL = 0; // Increment z. STABLE_HOTFIX = 1; // Compute x, y, and m from the candidate branch name. z and n should be 0. BETA_INITIAL = 2; // Increment n. BETA_HOTFIX = 3; } message Cherrypick { // The revision on trunk to cherrypick. string trunkRevision = 1; // Once applied, the actual commit revision of the cherrypick. string appliedRevision = 2; CherrypickState state = 3; } message Repository { // The development git branch the release is based on. // // Must be of the form /flutter-(\d+)\.(\d+)-candidate\.(\d+)/ string candidateBranch = 1; // The commit hash at the tip of the branch before cherrypicks were applied. string startingGitHead = 2; // The difference in commits between this and [startingGitHead] is the number // of cherrypicks that have been currently applied. string currentGitHead = 3; // Path to the git checkout on local disk. string checkoutPath = 4; // The remote commits will be fetched from. Remote upstream = 5; // The remote cherrypicks will be pushed to create a Pull Request. // // This should be a mirror owned by the user conducting the release. Remote mirror = 6; // Desired cherrypicks. repeated Cherrypick cherrypicks = 7; // Only for engine repositories. string dartRevision = 8; // Name of local and remote branch for applying cherrypicks. // // When the pull request is merged, all commits here will be squashed to a // single commit on the [candidateBranch]. string workingBranch = 9; } message ConductorState { // One of 'stable', 'beta', or 'dev' string releaseChannel = 1; // The name of the release. string releaseVersion = 2; Repository engine = 4; Repository framework = 5; int64 createdDate = 6; int64 lastUpdatedDate = 7; repeated string logs = 8; // The current [ReleasePhase] that has yet to be completed. ReleasePhase currentPhase = 9; // A string used to validate that the current conductor is the same version // that created the [ConductorState] object. string conductorVersion = 10; ReleaseType releaseType = 11; }
flutter/dev/conductor/core/lib/src/proto/conductor_state.proto/0
{ "file_path": "flutter/dev/conductor/core/lib/src/proto/conductor_state.proto", "repo_id": "flutter", "token_count": 1024 }
554
// Copyright 2014 The Flutter 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:convert' show jsonDecode; import 'package:args/command_runner.dart'; import 'package:conductor_core/src/proto/conductor_state.pb.dart' as pb; import 'package:conductor_core/src/proto/conductor_state.pbenum.dart'; import 'package:conductor_core/src/repository.dart'; import 'package:conductor_core/src/start.dart'; import 'package:conductor_core/src/state.dart'; import 'package:file/file.dart'; import 'package:file/memory.dart'; import 'package:platform/platform.dart'; import './common.dart'; void main() { group('start command', () { const String branchPointRevision = '5131a6e5e0c50b8b7b2906cd58dab8746d6450be'; const String flutterRoot = '/flutter'; const String checkoutsParentDirectory = '$flutterRoot/dev/tools/'; const String githubUsername = 'user'; const String frameworkMirror = '[email protected]:$githubUsername/flutter.git'; const String engineMirror = '[email protected]:$githubUsername/engine.git'; const String candidateBranch = 'flutter-1.2-candidate.3'; const String releaseChannel = 'beta'; const String revision = 'abcd1234'; const String conductorVersion = 'deadbeef'; late Checkouts checkouts; late MemoryFileSystem fileSystem; late FakePlatform platform; late TestStdio stdio; late FakeProcessManager processManager; setUp(() { stdio = TestStdio(); fileSystem = MemoryFileSystem.test(); }); CommandRunner<void> createRunner({ Map<String, String>? environment, String? operatingSystem, List<FakeCommand>? commands, }) { operatingSystem ??= const LocalPlatform().operatingSystem; final String pathSeparator = operatingSystem == 'windows' ? r'\' : '/'; environment ??= <String, String>{ 'HOME': '/path/to/user/home', }; final Directory homeDir = fileSystem.directory( environment['HOME'], ); // Tool assumes this exists homeDir.createSync(recursive: true); platform = FakePlatform( environment: environment, operatingSystem: operatingSystem, pathSeparator: pathSeparator, ); processManager = FakeProcessManager.list(commands ?? <FakeCommand>[]); checkouts = Checkouts( fileSystem: fileSystem, parentDirectory: fileSystem.directory(checkoutsParentDirectory), platform: platform, processManager: processManager, stdio: stdio, ); final StartCommand command = StartCommand( checkouts: checkouts, conductorVersion: conductorVersion, ); return CommandRunner<void>('codesign-test', '')..addCommand(command); } test('throws exception if run from Windows', () async { final CommandRunner<void> runner = createRunner( commands: <FakeCommand>[ const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision, ), ], operatingSystem: 'windows', ); await expectLater( () async => runner.run(<String>[ 'start', '--$kCandidateOption', candidateBranch, '--$kReleaseOption', 'beta', '--$kStateOption', '/path/to/statefile.json', ]), throwsExceptionWith( 'Error! This tool is only supported on macOS and Linux', ), ); }); test('throws if provided an invalid --$kVersionOverrideOption', () async { final CommandRunner<void> runner = createRunner(); final String stateFilePath = fileSystem.path.join( platform.environment['HOME']!, kStateFileName, ); await expectLater( () async => runner.run(<String>[ 'start', '--$kCandidateOption', candidateBranch, '--$kReleaseOption', releaseChannel, '--$kStateOption', stateFilePath, '--$kVersionOverrideOption', 'an invalid version string', '--$kGithubUsernameOption', githubUsername, ]), throwsExceptionWith('an invalid version string cannot be parsed'), ); }); test('creates state file if provided correct inputs', () async { stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged() const String revision2 = 'def789'; const String revision3 = '123abc'; const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; const String previousVersion = '1.2.0-1.0.pre'; // This is what this release will be const String nextVersion = '1.2.0-1.1.pre'; const String candidateBranch = 'flutter-1.2-candidate.1'; final Directory engine = fileSystem .directory(checkoutsParentDirectory) .childDirectory('flutter_conductor_checkouts') .childDirectory('engine'); final File depsFile = engine.childFile('DEPS'); final List<FakeCommand> engineCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', EngineRepository.defaultUpstream, engine.path, ], onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile .writeAsStringSync(generateMockDeps(previousDartRevision)); }), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', engineMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>['git', 'status', '--porcelain'], stdout: 'MM path/to/DEPS', ), const FakeCommand( command: <String>['git', 'add', '--all'], ), const FakeCommand( command: <String>[ 'git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision', ], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), ]; final List<FakeCommand> frameworkCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', FrameworkRepository.defaultUpstream, fileSystem.path.join( checkoutsParentDirectory, 'flutter_conductor_checkouts', 'framework', ), ], ), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', frameworkMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>[ 'git', 'describe', '--match', '*.*.*', '--tags', 'refs/remotes/upstream/$candidateBranch', ], stdout: '$previousVersion-42-gabc123', ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master', ], stdout: branchPointRevision, ), // check if commit is tagged, zero exit code means it is tagged const FakeCommand( command: <String>[ 'git', 'describe', '--exact-match', '--tags', branchPointRevision, ], ), ]; final CommandRunner<void> runner = createRunner( commands: <FakeCommand>[ ...engineCommands, ...frameworkCommands, ], ); final String stateFilePath = fileSystem.path.join( platform.environment['HOME']!, kStateFileName, ); await runner.run(<String>[ 'start', '--$kCandidateOption', candidateBranch, '--$kReleaseOption', releaseChannel, '--$kStateOption', stateFilePath, '--$kDartRevisionOption', nextDartRevision, '--$kGithubUsernameOption', githubUsername, ]); final File stateFile = fileSystem.file(stateFilePath); final pb.ConductorState state = pb.ConductorState(); state.mergeFromProto3Json( jsonDecode(stateFile.readAsStringSync()), ); expect(state.releaseType, ReleaseType.BETA_HOTFIX); expect( stdio.error, isNot(contains( 'Tried to tag the branch point, however the target version'))); expect(processManager, hasNoRemainingExpectations); expect(state.isInitialized(), true); expect(state.releaseChannel, releaseChannel); expect(state.releaseVersion, nextVersion); expect(state.engine.candidateBranch, candidateBranch); expect(state.engine.startingGitHead, revision2); expect(state.engine.dartRevision, nextDartRevision); expect(state.engine.upstream.url, '[email protected]:flutter/engine.git'); expect(state.framework.candidateBranch, candidateBranch); expect(state.framework.startingGitHead, revision3); expect( state.framework.upstream.url, '[email protected]:flutter/flutter.git'); expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS); expect(state.conductorVersion, conductorVersion); }); test('uses --$kVersionOverrideOption', () async { stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged() const String revision2 = 'def789'; const String revision3 = '123abc'; const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; const String previousVersion = '1.2.0-1.0.pre'; const String candidateBranch = 'flutter-1.2-candidate.1'; const String versionOverride = '42.0.0-42.0.pre'; final Directory engine = fileSystem .directory(checkoutsParentDirectory) .childDirectory('flutter_conductor_checkouts') .childDirectory('engine'); final File depsFile = engine.childFile('DEPS'); final List<FakeCommand> engineCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', EngineRepository.defaultUpstream, engine.path, ], onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile .writeAsStringSync(generateMockDeps(previousDartRevision)); }), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', engineMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>['git', 'status', '--porcelain'], stdout: 'MM path/to/DEPS', ), const FakeCommand( command: <String>['git', 'add', '--all'], ), const FakeCommand( command: <String>[ 'git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision' ], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), ]; final List<FakeCommand> frameworkCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', FrameworkRepository.defaultUpstream, fileSystem.path.join( checkoutsParentDirectory, 'flutter_conductor_checkouts', 'framework', ), ], ), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', frameworkMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>[ 'git', 'describe', '--match', '*.*.*', '--tags', 'refs/remotes/upstream/$candidateBranch', ], stdout: '$previousVersion-42-gabc123', ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master' ], stdout: branchPointRevision, ), ]; final CommandRunner<void> runner = createRunner( commands: <FakeCommand>[ ...engineCommands, ...frameworkCommands, ], ); final String stateFilePath = fileSystem.path.join( platform.environment['HOME']!, kStateFileName, ); await runner.run(<String>[ 'start', '--$kCandidateOption', candidateBranch, '--$kReleaseOption', releaseChannel, '--$kStateOption', stateFilePath, '--$kDartRevisionOption', nextDartRevision, '--$kVersionOverrideOption', versionOverride, '--$kGithubUsernameOption', githubUsername, ]); final File stateFile = fileSystem.file(stateFilePath); final pb.ConductorState state = pb.ConductorState(); state.mergeFromProto3Json( jsonDecode(stateFile.readAsStringSync()), ); expect(processManager, hasNoRemainingExpectations); expect(state.releaseVersion, versionOverride); }); test('logs to STDERR but does not fail on an unexpected candidate branch', () async { stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged() const String revision2 = 'def789'; const String revision3 = '123abc'; const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; // This is significantly behind the candidate branch name const String previousVersion = '0.9.0-1.0.pre'; // This is what this release will be const String nextVersion = '0.9.0-1.1.pre'; final Directory engine = fileSystem .directory(checkoutsParentDirectory) .childDirectory('flutter_conductor_checkouts') .childDirectory('engine'); final File depsFile = engine.childFile('DEPS'); final List<FakeCommand> engineCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', EngineRepository.defaultUpstream, engine.path, ], onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile .writeAsStringSync(generateMockDeps(previousDartRevision)); }), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', engineMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>['git', 'status', '--porcelain'], stdout: 'MM path/to/DEPS', ), const FakeCommand( command: <String>['git', 'add', '--all'], ), const FakeCommand( command: <String>[ 'git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision', ], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), ]; final List<FakeCommand> frameworkCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', FrameworkRepository.defaultUpstream, fileSystem.path.join( checkoutsParentDirectory, 'flutter_conductor_checkouts', 'framework', ), ], ), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', frameworkMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>[ 'git', 'describe', '--match', '*.*.*', '--tags', 'refs/remotes/upstream/$candidateBranch', ], stdout: '$previousVersion-42-gabc123', ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master', ], stdout: branchPointRevision, ), // check if commit is tagged, 0 exit code means it is tagged const FakeCommand( command: <String>[ 'git', 'describe', '--exact-match', '--tags', branchPointRevision, ], ), ]; final CommandRunner<void> runner = createRunner( commands: <FakeCommand>[ ...engineCommands, ...frameworkCommands, ], ); final String stateFilePath = fileSystem.path.join( platform.environment['HOME']!, kStateFileName, ); await runner.run(<String>[ 'start', '--$kCandidateOption', candidateBranch, '--$kReleaseOption', releaseChannel, '--$kStateOption', stateFilePath, '--$kDartRevisionOption', nextDartRevision, '--$kGithubUsernameOption', githubUsername, ]); final File stateFile = fileSystem.file(stateFilePath); final pb.ConductorState state = pb.ConductorState(); state.mergeFromProto3Json( jsonDecode(stateFile.readAsStringSync()), ); expect(stdio.error, isNot(contains('Tried to tag the branch point, however'))); expect(processManager, hasNoRemainingExpectations); expect(state.isInitialized(), true); expect(state.releaseChannel, releaseChannel); expect(state.releaseVersion, nextVersion); expect(state.engine.candidateBranch, candidateBranch); expect(state.engine.startingGitHead, revision2); expect(state.engine.dartRevision, nextDartRevision); expect(state.engine.upstream.url, '[email protected]:flutter/engine.git'); expect(state.framework.candidateBranch, candidateBranch); expect(state.framework.startingGitHead, revision3); expect( state.framework.upstream.url, '[email protected]:flutter/flutter.git'); expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS); expect(state.conductorVersion, conductorVersion); expect(state.releaseType, ReleaseType.BETA_HOTFIX); expect( stdio.error, contains( 'Parsed version $previousVersion.42 has a different x value than candidate branch $candidateBranch')); }); test('can convert from dev style version to stable version', () async { const String revision2 = 'def789'; const String revision3 = '123abc'; const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; const String previousVersion = '1.2.0-3.0.pre'; const String nextVersion = '1.2.0'; final Directory engine = fileSystem .directory(checkoutsParentDirectory) .childDirectory('flutter_conductor_checkouts') .childDirectory('engine'); final File depsFile = engine.childFile('DEPS'); final List<FakeCommand> engineCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', EngineRepository.defaultUpstream, engine.path, ], onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile .writeAsStringSync(generateMockDeps(previousDartRevision)); }), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', engineMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>['git', 'status', '--porcelain'], stdout: 'MM path/to/DEPS', ), const FakeCommand( command: <String>['git', 'add', '--all'], ), const FakeCommand( command: <String>[ 'git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision', ], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), ]; final List<FakeCommand> frameworkCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', FrameworkRepository.defaultUpstream, fileSystem.path.join( checkoutsParentDirectory, 'flutter_conductor_checkouts', 'framework', ), ], ), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', frameworkMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>[ 'git', 'describe', '--match', '*.*.*', '--tags', 'refs/remotes/upstream/$candidateBranch', ], stdout: '$previousVersion-42-gabc123', ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master' ], stdout: branchPointRevision, ), // check if commit is tagged, 0 exit code thus it is tagged const FakeCommand( command: <String>[ 'git', 'describe', '--exact-match', '--tags', branchPointRevision, ], ), ]; final CommandRunner<void> runner = createRunner( commands: <FakeCommand>[ ...engineCommands, ...frameworkCommands, ], ); final String stateFilePath = fileSystem.path.join( platform.environment['HOME']!, kStateFileName, ); await runner.run(<String>[ 'start', '--$kCandidateOption', candidateBranch, '--$kReleaseOption', 'stable', '--$kStateOption', stateFilePath, '--$kDartRevisionOption', nextDartRevision, '--$kGithubUsernameOption', githubUsername, ]); final File stateFile = fileSystem.file(stateFilePath); final pb.ConductorState state = pb.ConductorState(); state.mergeFromProto3Json( jsonDecode(stateFile.readAsStringSync()), ); expect(processManager.hasRemainingExpectations, false); expect(state.isInitialized(), true); expect(state.releaseChannel, 'stable'); expect(state.releaseVersion, nextVersion); expect(state.engine.candidateBranch, candidateBranch); expect(state.engine.startingGitHead, revision2); expect(state.engine.dartRevision, nextDartRevision); expect(state.framework.candidateBranch, candidateBranch); expect(state.framework.startingGitHead, revision3); expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS); expect(state.conductorVersion, conductorVersion); expect(state.releaseType, ReleaseType.STABLE_INITIAL); }); test( 'StartContext gets engine and framework checkout directories after run', () async { stdio.stdin.add('y'); const String revision2 = 'def789'; const String revision3 = '123abc'; const String branchPointRevision = 'deadbeef'; const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; const String previousVersion = '1.2.0-1.0.pre'; // This is a git tag applied to the branch point, not an actual release const String branchPointTag = '1.2.0-3.0.pre'; final Directory engine = fileSystem .directory(checkoutsParentDirectory) .childDirectory('flutter_conductor_checkouts') .childDirectory('engine'); final Directory framework = fileSystem .directory(checkoutsParentDirectory) .childDirectory('flutter_conductor_checkouts') .childDirectory('framework'); final File depsFile = engine.childFile('DEPS'); final List<FakeCommand> engineCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', EngineRepository.defaultUpstream, engine.path, ], onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile .writeAsStringSync(generateMockDeps(previousDartRevision)); }), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', engineMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>['git', 'status', '--porcelain'], stdout: 'MM path/to/DEPS', ), const FakeCommand( command: <String>['git', 'add', '--all'], ), const FakeCommand( command: <String>[ 'git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision' ], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision2, ), ]; final List<FakeCommand> frameworkCommands = <FakeCommand>[ FakeCommand( command: <String>[ 'git', 'clone', '--origin', 'upstream', '--', FrameworkRepository.defaultUpstream, framework.path, ], ), const FakeCommand( command: <String>['git', 'remote', 'add', 'mirror', frameworkMirror], ), const FakeCommand( command: <String>['git', 'fetch', 'mirror'], ), const FakeCommand( command: <String>['git', 'checkout', 'upstream/$candidateBranch'], ), const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: revision3, ), const FakeCommand( command: <String>[ 'git', 'checkout', '-b', 'cherrypicks-$candidateBranch', ], ), const FakeCommand( command: <String>[ 'git', 'describe', '--match', '*.*.*', '--tags', 'refs/remotes/upstream/$candidateBranch', ], stdout: '$previousVersion-42-gabc123', ), // HEAD and branch point are same const FakeCommand( command: <String>['git', 'rev-parse', 'HEAD'], stdout: branchPointRevision, ), const FakeCommand( command: <String>[ 'git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master' ], stdout: branchPointRevision, ), // check if commit is tagged const FakeCommand( command: <String>[ 'git', 'describe', '--exact-match', '--tags', branchPointRevision ], // non-zero exit code means branch point is NOT tagged exitCode: 128, ), const FakeCommand( command: <String>['git', 'tag', branchPointTag, branchPointRevision], ), const FakeCommand( command: <String>[ 'git', 'push', FrameworkRepository.defaultUpstream, branchPointTag ], ), ]; final String operatingSystem = const LocalPlatform().operatingSystem; final Map<String, String> environment = <String, String>{ 'HOME': '/path/to/user/home', }; final Directory homeDir = fileSystem.directory( environment['HOME'], ); // Tool assumes this exists homeDir.createSync(recursive: true); platform = FakePlatform( environment: environment, operatingSystem: operatingSystem, ); final String stateFilePath = fileSystem.path.join( platform.environment['HOME']!, kStateFileName, ); final File stateFile = fileSystem.file(stateFilePath); processManager = FakeProcessManager.list(<FakeCommand>[ ...engineCommands, ...frameworkCommands, ]); checkouts = Checkouts( fileSystem: fileSystem, parentDirectory: fileSystem.directory(checkoutsParentDirectory), platform: platform, processManager: processManager, stdio: stdio, ); final StartContext startContext = StartContext( candidateBranch: candidateBranch, checkouts: checkouts, dartRevision: nextDartRevision, engineMirror: engineMirror, engineUpstream: EngineRepository.defaultUpstream, frameworkMirror: frameworkMirror, frameworkUpstream: FrameworkRepository.defaultUpstream, releaseChannel: releaseChannel, processManager: processManager, conductorVersion: conductorVersion, githubUsername: githubUsername, stateFile: stateFile, ); await startContext.run(); final pb.ConductorState state = pb.ConductorState(); state.mergeFromProto3Json( jsonDecode(stateFile.readAsStringSync()), ); expect((await startContext.engine.checkoutDirectory).path, equals(engine.path)); expect((await startContext.framework.checkoutDirectory).path, equals(framework.path)); expect(state.releaseType, ReleaseType.BETA_INITIAL); expect(processManager, hasNoRemainingExpectations); }); }, onPlatform: <String, dynamic>{ 'windows': const Skip('Flutter Conductor only supported on macos/linux'), }); } String generateMockDeps(String dartRevision) { return ''' vars = { 'chromium_git': 'https://chromium.googlesource.com', 'swiftshader_git': 'https://swiftshader.googlesource.com', 'dart_git': 'https://dart.googlesource.com', 'flutter_git': 'https://flutter.googlesource.com', 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', 'ocmock_git': 'https://github.com/erikdoe/ocmock.git', 'skia_revision': '4e9d5e2bdf04c58bc0bff57be7171e469e5d7175', 'dart_revision': '$dartRevision', 'dart_boringssl_gen_rev': '7322fc15cc065d8d2957fccce6b62a509dc4d641', }'''; }
flutter/dev/conductor/core/test/start_test.dart/0
{ "file_path": "flutter/dev/conductor/core/test/start_test.dart", "repo_id": "flutter", "token_count": 18125 }
555
// Copyright 2014 The Flutter 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:io' show File; import 'dart:typed_data'; import 'package:collection/collection.dart'; import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/tasks/integration_tests.dart'; import 'package:path/path.dart' as path; import 'package:standard_message_codec/standard_message_codec.dart'; Future<void> main() async { deviceOperatingSystem = DeviceOperatingSystem.android; await task(() async { await createFlavorsTest().call(); await createIntegrationTestFlavorsTest().call(); final String projectPath = '${flutterDirectory.path}/dev/integration_tests/flavors'; final TaskResult installTestsResult = await inDirectory( projectPath, () async { final List<TaskResult> testResults = <TaskResult>[ await _testInstallDebugPaidFlavor(projectPath), await _testInstallBogusFlavor(), ]; final TaskResult? firstInstallFailure = testResults .firstWhereOrNull((TaskResult element) => element.failed); return firstInstallFailure ?? TaskResult.success(null); }, ); return installTestsResult; }); } // Ensures installation works. Also tests asset bundling while we are at it. Future<TaskResult> _testInstallDebugPaidFlavor(String projectDir) async { await evalFlutter( 'install', options: <String>['--debug', '--flavor', 'paid'], ); final Uint8List assetManifestFileData = File( path.join(projectDir, 'build', 'app', 'intermediates', 'assets', 'paidDebug', 'flutter_assets', 'AssetManifest.bin'), ).readAsBytesSync(); final Map<Object?, Object?> assetManifest = const StandardMessageCodec() .decodeMessage(ByteData.sublistView(assetManifestFileData)) as Map<Object?, Object?>; if (assetManifest.containsKey('assets/free/free.txt')) { return TaskResult.failure('Expected the asset "assets/free/free.txt", which ' ' was declared with a flavor of "free" to not be included in the asset bundle ' ' because the --flavor was set to "paid".'); } if (!assetManifest.containsKey('assets/paid/paid.txt')) { return TaskResult.failure('Expected the asset "assets/paid/paid.txt", which ' ' was declared with a flavor of "paid" to be included in the asset bundle ' ' because the --flavor was set to "paid".'); } await flutter( 'install', options: <String>['--debug', '--flavor', 'paid', '--uninstall-only'], ); return TaskResult.success(null); } Future<TaskResult> _testInstallBogusFlavor() async { final StringBuffer stderr = StringBuffer(); await evalFlutter( 'install', canFail: true, stderr: stderr, options: <String>['--flavor', 'bogus'], ); final String stderrString = stderr.toString(); final String expectedApkPath = path.join('build', 'app', 'outputs', 'flutter-apk', 'app-bogus-release.apk'); if (!stderrString.contains('"$expectedApkPath" does not exist.')) { print(stderrString); return TaskResult.failure('Should not succeed with bogus flavor'); } return TaskResult.success(null); }
flutter/dev/devicelab/bin/tasks/flavors_test.dart/0
{ "file_path": "flutter/dev/devicelab/bin/tasks/flavors_test.dart", "repo_id": "flutter", "token_count": 1165 }
556
// Copyright 2014 The Flutter 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_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/ios.dart'; import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/utils.dart'; import 'package:path/path.dart' as path; Future<void> main() async { deviceOperatingSystem = DeviceOperatingSystem.ios; await task(() async { final String projectDirectory = '${flutterDirectory.path}/dev/integration_tests/ios_platform_view_tests'; await inDirectory(projectDirectory, () async { // To address "Failed to terminate" failure. section('Uninstall previously installed app'); await flutter( 'install', options: <String>[ '--uninstall-only', ], ); section('Build clean'); await flutter('clean'); section('Build platform view app'); await flutter( 'build', options: <String>[ 'ios', '-v', '--release', '--config-only', ], ); }); section('Run platform view XCUITests'); final Device device = await devices.workingDevice; if (!await runXcodeTests( platformDirectory: path.join(projectDirectory, 'ios'), destination: 'id=${device.deviceId}', testName: 'native_platform_view_ui_tests_ios', )) { return TaskResult.failure('Platform view XCUITests failed'); } return TaskResult.success(null); }); }
flutter/dev/devicelab/bin/tasks/native_platform_view_ui_tests_ios.dart/0
{ "file_path": "flutter/dev/devicelab/bin/tasks/native_platform_view_ui_tests_ios.dart", "repo_id": "flutter", "token_count": 634 }
557
// Copyright 2014 The Flutter 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:async'; import 'dart:convert'; import 'dart:io'; import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/utils.dart'; import 'package:path/path.dart' as path; void main() { task(() async { int? vmServicePort; final Device device = await devices.workingDevice; await device.unlock(); final Directory appDir = dir(path.join(flutterDirectory.path, 'dev/integration_tests/ui')); section('TEST WHETHER `flutter drive --route` WORKS'); await inDirectory(appDir, () async { return flutter( 'drive', options: <String>[ '--verbose', '-d', device.deviceId, '--route', '/smuggle-it', 'lib/route.dart', ], ); }); section('TEST WHETHER `flutter run --route` WORKS'); await inDirectory(appDir, () async { final Completer<void> ready = Completer<void>(); late bool ok; print('run: starting...'); final Process run = await startFlutter( 'run', // --fast-start does not support routes. options: <String>['--verbose', '--disable-service-auth-codes', '--no-fast-start', '--no-publish-port', '-d', device.deviceId, '--route', '/smuggle-it', 'lib/route.dart'], ); run.stdout .transform<String>(utf8.decoder) .transform<String>(const LineSplitter()) .listen((String line) { print('run:stdout: $line'); if (vmServicePort == null) { vmServicePort = parseServicePort(line); if (vmServicePort != null) { print('service protocol connection available at port $vmServicePort'); print('run: ready!'); ready.complete(); ok = true; } } }); run.stderr .transform<String>(utf8.decoder) .transform<String>(const LineSplitter()) .listen((String line) { stderr.writeln('run:stderr: $line'); }); unawaited(run.exitCode.then<void>((int exitCode) { ok = false; })); await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]); if (!ok) { throw 'Failed to run test app.'; } print('drive: starting...'); final Process drive = await startFlutter( 'drive', options: <String>['--use-existing-app', 'http://127.0.0.1:$vmServicePort/', '--no-keep-app-running', 'lib/route.dart'], ); drive.stdout .transform<String>(utf8.decoder) .transform<String>(const LineSplitter()) .listen((String line) { print('drive:stdout: $line'); }); drive.stderr .transform<String>(utf8.decoder) .transform<String>(const LineSplitter()) .listen((String line) { stderr.writeln('drive:stderr: $line'); }); int result; result = await drive.exitCode; await flutter('install', options: <String>[ '--uninstall-only', ]); if (result != 0) { throw 'Failed to drive test app (exit code $result).'; } result = await run.exitCode; if (result != 0) { throw 'Received unexpected exit code $result from run process.'; } }); return TaskResult.success(null); }); }
flutter/dev/devicelab/bin/tasks/routing_test.dart/0
{ "file_path": "flutter/dev/devicelab/bin/tasks/routing_test.dart", "repo_id": "flutter", "token_count": 1567 }
558
// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /// Creates a situation when the test framework was not properly initialized. /// /// By not calling `task()` the VM service extension is not registered and /// therefore will not accept requests to run tasks. When the runner attempts to /// connect and run the test it will receive a "method not found" error from the /// VM service, will likely retry forever. /// /// The test in ../../test/run_test.dart runs this task until it detects /// the retry message and then aborts the task. Future<void> main() async {}
flutter/dev/devicelab/bin/tasks/smoke_test_setup_failure.dart/0
{ "file_path": "flutter/dev/devicelab/bin/tasks/smoke_test_setup_failure.dart", "repo_id": "flutter", "token_count": 168 }
559
// Copyright 2014 The Flutter 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:convert'; import 'dart:io'; import 'package:path/path.dart' as path; import 'host_agent.dart'; import 'utils.dart'; typedef SimulatorFunction = Future<void> Function(String deviceId); Future<String> fileType(String pathToBinary) { return eval('file', <String>[pathToBinary]); } Future<String?> minPhoneOSVersion(String pathToBinary) async { final String loadCommands = await eval('otool', <String>[ '-l', '-arch', 'arm64', pathToBinary, ]); if (!loadCommands.contains('LC_VERSION_MIN_IPHONEOS')) { return null; } String? minVersion; // Load command 7 // cmd LC_VERSION_MIN_IPHONEOS // cmdsize 16 // version 9.0 // sdk 15.2 // ... final List<String> lines = LineSplitter.split(loadCommands).toList(); lines.asMap().forEach((int index, String line) { if (line.contains('LC_VERSION_MIN_IPHONEOS') && lines.length - index - 1 > 3) { final String versionLine = lines .skip(index - 1) .take(4).last; final RegExp versionRegex = RegExp(r'\s*version\s*(\S*)'); minVersion = versionRegex.firstMatch(versionLine)?.group(1); } }); return minVersion; } /// Creates and boots a new simulator, passes the new simulator's identifier to /// `testFunction`. /// /// Remember to call removeIOSSimulator in the test teardown. Future<void> testWithNewIOSSimulator( String deviceName, SimulatorFunction testFunction, { String deviceTypeId = 'com.apple.CoreSimulator.SimDeviceType.iPhone-11', }) async { final String availableRuntimes = await eval( 'xcrun', <String>[ 'simctl', 'list', 'runtimes', ], workingDirectory: flutterDirectory.path, ); final String runtimesForSelectedXcode = await eval( 'xcrun', <String>[ 'simctl', 'runtime', 'match', 'list', '--json', ], workingDirectory: flutterDirectory.path, ); // Get the preferred runtime build for the selected Xcode version. Preferred // means the runtime was either bundled with Xcode, exactly matched your SDK // version, or it's indicated a better match for your SDK. final Map<String, Object?> decodeResult = json.decode(runtimesForSelectedXcode) as Map<String, Object?>; final String? iosKey = decodeResult.keys .where((String key) => key.contains('iphoneos')) .firstOrNull; final Object? iosDetails = decodeResult[iosKey]; String? runtimeBuildForSelectedXcode; if (iosDetails != null && iosDetails is Map<String, Object?>) { final Object? preferredBuild = iosDetails['preferredBuild']; if (preferredBuild is String) { runtimeBuildForSelectedXcode = preferredBuild; } } String? iOSSimRuntime; final RegExp iOSRuntimePattern = RegExp(r'iOS .*\) - (.*)'); // [availableRuntimes] may include runtime versions greater than the selected // Xcode's greatest supported version. Use [runtimeBuildForSelectedXcode] when // possible to pick which runtime to use. // For example, iOS 17 (released with Xcode 15) may be available even if the // selected Xcode version is 14. for (final String runtime in LineSplitter.split(availableRuntimes)) { if (runtimeBuildForSelectedXcode != null && !runtime.contains(runtimeBuildForSelectedXcode)) { continue; } // These seem to be in order, so allow matching multiple lines so it grabs // the last (hopefully latest) one. final RegExpMatch? iOSRuntimeMatch = iOSRuntimePattern.firstMatch(runtime); if (iOSRuntimeMatch != null) { iOSSimRuntime = iOSRuntimeMatch.group(1)!.trim(); continue; } } if (iOSSimRuntime == null) { if (runtimeBuildForSelectedXcode != null) { throw 'iOS simulator runtime $runtimeBuildForSelectedXcode not found. Available runtimes:\n$availableRuntimes'; } else { throw 'No iOS simulator runtime found. Available runtimes:\n$availableRuntimes'; } } final String deviceId = await eval( 'xcrun', <String>[ 'simctl', 'create', deviceName, deviceTypeId, iOSSimRuntime, ], workingDirectory: flutterDirectory.path, ); await eval( 'xcrun', <String>[ 'simctl', 'boot', deviceId, ], workingDirectory: flutterDirectory.path, ); await testFunction(deviceId); } /// Shuts down and deletes simulator with deviceId. Future<void> removeIOSSimulator(String? deviceId) async { if (deviceId != null && deviceId != '') { await eval( 'xcrun', <String>[ 'simctl', 'shutdown', deviceId, ], canFail: true, workingDirectory: flutterDirectory.path, ); await eval( 'xcrun', <String>[ 'simctl', 'delete', deviceId, ], canFail: true, workingDirectory: flutterDirectory.path, ); } } Future<bool> runXcodeTests({ required String platformDirectory, required String destination, required String testName, String configuration = 'Release', bool skipCodesign = false, }) async { final Map<String, String> environment = Platform.environment; String? developmentTeam; String? codeSignStyle; String? provisioningProfile; if (!skipCodesign) { // If not running on CI, inject the Flutter team code signing properties. developmentTeam = environment['FLUTTER_XCODE_DEVELOPMENT_TEAM'] ?? 'S8QB4VV633'; codeSignStyle = environment['FLUTTER_XCODE_CODE_SIGN_STYLE']; provisioningProfile = environment['FLUTTER_XCODE_PROVISIONING_PROFILE_SPECIFIER']; } final String resultBundleTemp = Directory.systemTemp.createTempSync('flutter_xcresult.').path; final String resultBundlePath = path.join(resultBundleTemp, 'result'); final int testResultExit = await exec( 'xcodebuild', <String>[ '-workspace', 'Runner.xcworkspace', '-scheme', 'Runner', '-configuration', configuration, '-destination', destination, '-resultBundlePath', resultBundlePath, 'test', 'COMPILER_INDEX_STORE_ENABLE=NO', if (developmentTeam != null) 'DEVELOPMENT_TEAM=$developmentTeam', if (codeSignStyle != null) 'CODE_SIGN_STYLE=$codeSignStyle', if (provisioningProfile != null) 'PROVISIONING_PROFILE_SPECIFIER=$provisioningProfile', ], workingDirectory: platformDirectory, canFail: true, ); if (testResultExit != 0) { final Directory? dumpDirectory = hostAgent.dumpDirectory; final Directory xcresultBundle = Directory(path.join(resultBundleTemp, 'result.xcresult')); if (dumpDirectory != null) { if (xcresultBundle.existsSync()) { // Zip the test results to the artifacts directory for upload. final String zipPath = path.join(dumpDirectory.path, '$testName-${DateTime.now().toLocal().toIso8601String()}.zip'); await exec( 'zip', <String>[ '-r', '-9', '-q', zipPath, path.basename(xcresultBundle.path), ], workingDirectory: resultBundleTemp, canFail: true, // Best effort to get the logs. ); } else { print('xcresult bundle ${xcresultBundle.path} does not exist, skipping upload'); } } return false; } return true; }
flutter/dev/devicelab/lib/framework/ios.dart/0
{ "file_path": "flutter/dev/devicelab/lib/framework/ios.dart", "repo_id": "flutter", "token_count": 2803 }
560
// Copyright 2014 The Flutter 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:io'; import 'package:path/path.dart' as path; import '../framework/task_result.dart'; import '../framework/utils.dart'; /// Run each benchmark this many times and compute average, min, max. const int _kRunsPerBenchmark = 10; Future<TaskResult> flutterToolStartupBenchmarkTask() async { final Directory projectParentDirectory = Directory.systemTemp.createTempSync('flutter_tool_startup_benchmark'); final Directory projectDirectory = dir(path.join(projectParentDirectory.path, 'benchmark')); await inDirectory<void>(flutterDirectory, () async { await flutter('update-packages'); await flutter('create', options: <String>[projectDirectory.path]); // Remove 'test' directory so we don't time the actual testing, but only the launching of the flutter tool rmTree(dir(path.join(projectDirectory.path, 'test'))); }); final Map<String, dynamic> data = <String, dynamic>{ // `flutter test` in dir with no `test` folder. ...(await _Benchmark( projectDirectory, 'test startup', 'test', ).run()) .asMap('flutter_tool_startup_test'), // `flutter test -d foo_device` in dir with no `test` folder. ...(await _Benchmark( projectDirectory, 'test startup with specified device', 'test', options: <String>['-d', 'foo_device'], ).run()) .asMap('flutter_tool_startup_test_with_specified_device'), // `flutter test -v` where no android sdk will be found (at least currently). ...(await _Benchmark( projectDirectory, 'test startup no android sdk', 'test', options: <String>['-v'], environment: <String, String>{ 'ANDROID_HOME': 'dummy value', 'ANDROID_SDK_ROOT': 'dummy value', 'PATH': pathWithoutWhereHits(<String>['adb', 'aapt']), }, ).run()) .asMap('flutter_tool_startup_test_no_android_sdk'), // `flutter -h`. ...(await _Benchmark( projectDirectory, 'help startup', '-h', ).run()) .asMap('flutter_tool_startup_help'), }; // Cleanup. rmTree(projectParentDirectory); return TaskResult.success(data, benchmarkScoreKeys: data.keys.toList()); } String pathWithoutWhereHits(List<String> whats) { final String pathEnvironment = Platform.environment['PATH'] ?? ''; List<String> paths; if (Platform.isWindows) { paths = pathEnvironment.split(';'); } else { paths = pathEnvironment.split(':'); } // This isn't great but will probably work for our purposes. final List<String> extensions = <String>['', '.exe', '.bat', '.com']; final List<String> notFound = <String>[]; for (final String path in paths) { bool found = false; for (final String extension in extensions) { for (final String what in whats) { final File f = File('$path${Platform.pathSeparator}$what$extension'); if (f.existsSync()) { found = true; break; } } if (found) { break; } } if (!found) { notFound.add(path); } } if (Platform.isWindows) { return notFound.join(';'); } else { return notFound.join(':'); } } class _BenchmarkResult { const _BenchmarkResult(this.mean, this.min, this.max); final int mean; // Milliseconds final int min; // Milliseconds final int max; // Milliseconds Map<String, dynamic> asMap(String name) { return <String, dynamic>{ name: mean, '${name}_minimum': min, '${name}_maximum': max, }; } } class _Benchmark { _Benchmark(this.directory, this.title, this.command, {this.options = const <String>[], this.environment}); final Directory directory; final String title; final String command; final List<String> options; final Map<String, String>? environment; Future<int> execute(int iteration, int targetIterations) async { section('Benchmark $title - ${iteration + 1} / $targetIterations'); final Stopwatch stopwatch = Stopwatch(); await inDirectory<void>(directory, () async { stopwatch.start(); // canFail is set to true, as e.g. `flutter test` in a dir with no `test` // directory sets a non-zero return value. await flutter(command, options: options, canFail: true, environment: environment); stopwatch.stop(); }); return stopwatch.elapsedMilliseconds; } /// Runs `benchmark` several times and reports the results. Future<_BenchmarkResult> run() async { final List<int> results = <int>[]; int sum = 0; for (int i = 0; i < _kRunsPerBenchmark; i++) { final int thisRuntime = await execute(i, _kRunsPerBenchmark); results.add(thisRuntime); sum += thisRuntime; } results.sort(); return _BenchmarkResult(sum ~/ results.length, results.first, results.last); } }
flutter/dev/devicelab/lib/tasks/flutter_tool_startup.dart/0
{ "file_path": "flutter/dev/devicelab/lib/tasks/flutter_tool_startup.dart", "repo_id": "flutter", "token_count": 1830 }
561
// Copyright 2014 The Flutter 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:async'; import 'dart:convert'; import 'dart:io'; import 'package:file/file.dart'; import 'package:file/memory.dart'; import 'package:flutter_devicelab/framework/cocoon.dart'; import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:http/http.dart'; import 'package:http/testing.dart'; import 'common.dart'; void main() { late ProcessResult processResult; ProcessResult runSyncStub(String executable, List<String> args, {Map<String, String>? environment, bool includeParentEnvironment = true, bool runInShell = false, Encoding? stderrEncoding, Encoding? stdoutEncoding, String? workingDirectory}) => processResult; // Expected test values. const String commitSha = 'a4952838bf288a81d8ea11edfd4b4cd649fa94cc'; const String serviceAccountTokenPath = 'test_account_file'; const String serviceAccountToken = 'test_token'; group('Cocoon', () { late Client mockClient; late Cocoon cocoon; late FileSystem fs; setUp(() { fs = MemoryFileSystem(); mockClient = MockClient((Request request) async => Response('{}', 200)); final File serviceAccountFile = fs.file(serviceAccountTokenPath)..createSync(); serviceAccountFile.writeAsStringSync(serviceAccountToken); }); test('returns expected commit sha', () { processResult = ProcessResult(1, 0, commitSha, ''); cocoon = Cocoon( serviceAccountTokenPath: serviceAccountTokenPath, fs: fs, httpClient: mockClient, processRunSync: runSyncStub, ); expect(cocoon.commitSha, commitSha); }); test('throws exception on git cli errors', () { processResult = ProcessResult(1, 1, '', ''); cocoon = Cocoon( serviceAccountTokenPath: serviceAccountTokenPath, fs: fs, httpClient: mockClient, processRunSync: runSyncStub, ); expect(() => cocoon.commitSha, throwsA(isA<CocoonException>())); }); test('writes expected update task json', () async { processResult = ProcessResult(1, 0, commitSha, ''); final TaskResult result = TaskResult.fromJson(<String, dynamic>{ 'success': true, 'data': <String, dynamic>{ 'i': 0, 'j': 0, 'not_a_metric': 'something', }, 'benchmarkScoreKeys': <String>['i', 'j'], }); cocoon = Cocoon( fs: fs, processRunSync: runSyncStub, ); const String resultsPath = 'results.json'; await cocoon.writeTaskResultToFile( builderName: 'builderAbc', gitBranch: 'master', result: result, resultsPath: resultsPath, ); final String resultJson = fs.file(resultsPath).readAsStringSync(); const String expectedJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; expect(resultJson, expectedJson); }); test('uploads metrics sends expected post body', () async { processResult = ProcessResult(1, 0, commitSha, ''); const String uploadMetricsRequestWithSpaces = '{"CommitBranch":"master","CommitSha":"a4952838bf288a81d8ea11edfd4b4cd649fa94cc","BuilderName":"builder a b c","NewStatus":"Succeeded","ResultData":{},"BenchmarkScoreKeys":[],"TestFlaky":false}'; final MockClient client = MockClient((Request request) async { if (request.body == uploadMetricsRequestWithSpaces) { return Response('{}', 200); } return Response('Expected: $uploadMetricsRequestWithSpaces\nReceived: ${request.body}', 500); }); cocoon = Cocoon( fs: fs, httpClient: client, processRunSync: runSyncStub, serviceAccountTokenPath: serviceAccountTokenPath, requestRetryLimit: 0, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builder a b c",' //ignore: missing_whitespace_between_adjacent_strings '"NewStatus":"Succeeded",' '"ResultData":{},' '"BenchmarkScoreKeys":[]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); await cocoon.sendTaskStatus(resultsPath: resultsPath); }); test('uploads expected update task payload from results file', () async { processResult = ProcessResult(1, 0, commitSha, ''); cocoon = Cocoon( fs: fs, httpClient: mockClient, processRunSync: runSyncStub, serviceAccountTokenPath: serviceAccountTokenPath, requestRetryLimit: 0, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); await cocoon.sendTaskStatus(resultsPath: resultsPath); }); test('Verify retries for task result upload', () async { int requestCount = 0; mockClient = MockClient((Request request) async { requestCount++; if (requestCount == 1) { return Response('{}', 500); } else { return Response('{}', 200); } }); processResult = ProcessResult(1, 0, commitSha, ''); cocoon = Cocoon( fs: fs, httpClient: mockClient, processRunSync: runSyncStub, serviceAccountTokenPath: serviceAccountTokenPath, requestRetryLimit: 3, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); await cocoon.sendTaskStatus(resultsPath: resultsPath); }); test('Verify timeout and retry for task result upload', () async { int requestCount = 0; const int timeoutValue = 2; mockClient = MockClient((Request request) async { requestCount++; if (requestCount == 1) { await Future<void>.delayed(const Duration(seconds: timeoutValue + 2)); throw Exception('Should not reach this, because timeout should trigger'); } else { return Response('{}', 200); } }); processResult = ProcessResult(1, 0, commitSha, ''); cocoon = Cocoon( fs: fs, httpClient: mockClient, processRunSync: runSyncStub, serviceAccountTokenPath: serviceAccountTokenPath, requestRetryLimit: 2, requestTimeoutLimit: timeoutValue, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); await cocoon.sendTaskStatus(resultsPath: resultsPath); }); test('Verify timeout does not trigger for result upload', () async { int requestCount = 0; const int timeoutValue = 2; mockClient = MockClient((Request request) async { requestCount++; if (requestCount == 1) { await Future<void>.delayed(const Duration(seconds: timeoutValue - 1)); return Response('{}', 200); } else { throw Exception('This iteration should not be reached, since timeout should not happen.'); } }); processResult = ProcessResult(1, 0, commitSha, ''); cocoon = Cocoon( fs: fs, httpClient: mockClient, processRunSync: runSyncStub, serviceAccountTokenPath: serviceAccountTokenPath, requestRetryLimit: 2, requestTimeoutLimit: timeoutValue, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); await cocoon.sendTaskStatus(resultsPath: resultsPath); }); test('Verify failure without retries for task result upload', () async { int requestCount = 0; mockClient = MockClient((Request request) async { requestCount++; if (requestCount == 1) { return Response('{}', 500); } else { return Response('{}', 200); } }); processResult = ProcessResult(1, 0, commitSha, ''); cocoon = Cocoon( fs: fs, httpClient: mockClient, processRunSync: runSyncStub, serviceAccountTokenPath: serviceAccountTokenPath, requestRetryLimit: 0, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); expect(() => cocoon.sendTaskStatus(resultsPath: resultsPath), throwsA(isA<ClientException>())); }); test('throws client exception on non-200 responses', () async { mockClient = MockClient((Request request) async => Response('', 500)); cocoon = Cocoon( serviceAccountTokenPath: serviceAccountTokenPath, fs: fs, httpClient: mockClient, requestRetryLimit: 0, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); expect(() => cocoon.sendTaskStatus(resultsPath: resultsPath), throwsA(isA<ClientException>())); }); test('does not upload results on non-supported branches', () async { // Any network failure would cause the upload to fail mockClient = MockClient((Request request) async => Response('', 500)); cocoon = Cocoon( serviceAccountTokenPath: serviceAccountTokenPath, fs: fs, httpClient: mockClient, requestRetryLimit: 0, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"stable",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); // This will fail if it decided to upload results await cocoon.sendTaskStatus(resultsPath: resultsPath); }); test('does not update for staging test', () async { // Any network failure would cause the upload to fail mockClient = MockClient((Request request) async => Response('', 500)); cocoon = Cocoon( serviceAccountTokenPath: serviceAccountTokenPath, fs: fs, httpClient: mockClient, requestRetryLimit: 0, ); const String resultsPath = 'results.json'; const String updateTaskJson = '{' '"CommitBranch":"master",' '"CommitSha":"$commitSha",' '"BuilderName":"builderAbc",' '"NewStatus":"Succeeded",' '"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},' '"BenchmarkScoreKeys":["i","j"]}'; fs.file(resultsPath).writeAsStringSync(updateTaskJson); // This will fail if it decided to upload results await cocoon.sendTaskStatus(resultsPath: resultsPath, builderBucket: 'staging'); }); }); group('AuthenticatedCocoonClient', () { late FileSystem fs; setUp(() { fs = MemoryFileSystem(); final File serviceAccountFile = fs.file(serviceAccountTokenPath)..createSync(); serviceAccountFile.writeAsStringSync(serviceAccountToken); }); test('reads token from service account file', () { final AuthenticatedCocoonClient client = AuthenticatedCocoonClient(serviceAccountTokenPath, filesystem: fs); expect(client.serviceAccountToken, serviceAccountToken); }); test('reads token from service account file with whitespace', () { final File serviceAccountFile = fs.file(serviceAccountTokenPath)..createSync(); serviceAccountFile.writeAsStringSync('$serviceAccountToken \n'); final AuthenticatedCocoonClient client = AuthenticatedCocoonClient(serviceAccountTokenPath, filesystem: fs); expect(client.serviceAccountToken, serviceAccountToken); }); test('throws error when service account file not found', () { final AuthenticatedCocoonClient client = AuthenticatedCocoonClient('idontexist', filesystem: fs); expect(() => client.serviceAccountToken, throwsA(isA<FileSystemException>())); }); }); }
flutter/dev/devicelab/test/cocoon_test.dart/0
{ "file_path": "flutter/dev/devicelab/test/cocoon_test.dart", "repo_id": "flutter", "token_count": 5798 }
562
analyzer: exclude: - 'lib/**'
flutter/dev/docs/analysis_options.yaml/0
{ "file_path": "flutter/dev/docs/analysis_options.yaml", "repo_id": "flutter", "token_count": 17 }
563
package com.example.abstract_method_smoke_test import android.content.Context import android.graphics.Color import android.view.View import android.view.inputmethod.InputMethodManager import androidx.annotation.NonNull import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.StandardMessageCodec import io.flutter.plugin.platform.PlatformView import io.flutter.plugin.platform.PlatformViewFactory import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity : FlutterActivity() { class SimplePlatformView(context: Context) : PlatformView { private val view: View = View(context) init { view.setBackgroundColor(Color.CYAN) } override fun dispose() {} override fun getView(): View { return view } } override fun configureFlutterEngine( @NonNull flutterEngine: FlutterEngine, ) { GeneratedPluginRegistrant.registerWith(flutterEngine) val shimPluginRegistry = ShimPluginRegistry(flutterEngine) shimPluginRegistry.registrarFor("com.example.abstract_method_smoke_test") .platformViewRegistry() .registerViewFactory( "simple", object : PlatformViewFactory(StandardMessageCodec.INSTANCE) { override fun create( context: Context?, viewId: Int, args: Any?, ): PlatformView { return SimplePlatformView(this@MainActivity) } }, ) // Triggers the Android keyboard, which causes the resize of the Flutter view. // We need to wait for the app to complete. MethodChannel(flutterEngine.getDartExecutor(), "com.example.abstract_method_smoke_test") .setMethodCallHandler { _, result -> toggleInput() result.success(null) } } override fun onPause() { // Hide the input when the app is closed. toggleInput() super.onPause() } private fun toggleInput() { val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0) } }
flutter/dev/integration_tests/abstract_method_smoke_test/android/app/src/main/kotlin/com/example/abstract_method_smoke_test/MainActivity.kt/0
{ "file_path": "flutter/dev/integration_tests/abstract_method_smoke_test/android/app/src/main/kotlin/com/example/abstract_method_smoke_test/MainActivity.kt", "repo_id": "flutter", "token_count": 1037 }
564
// Copyright 2014 The Flutter 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 'popup_constants.dart'; export 'popup_constants.dart'; /// A page with a popup menu, a dropdown menu, and a modal alert. class PopupControlsPage extends StatefulWidget { const PopupControlsPage({super.key}); @override State<StatefulWidget> createState() => _PopupControlsPageState(); } class _PopupControlsPageState extends State<PopupControlsPage> { final Key popupKey = const ValueKey<String>(popupKeyValue); final Key dropdownKey = const ValueKey<String>(dropdownKeyValue); final Key alertKey = const ValueKey<String>(alertKeyValue); String popupValue = popupItems.first; String dropdownValue = popupItems.first; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(leading: const BackButton(key: ValueKey<String>('back'))), body: SafeArea( child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: <Widget>[ PopupMenuButton<String>( key: const ValueKey<String>(popupButtonKeyValue), icon: const Icon(Icons.arrow_drop_down), itemBuilder: (BuildContext context) { return popupItems.map<PopupMenuItem<String>>((String item) { return PopupMenuItem<String>( key: ValueKey<String>('$popupKeyValue.$item'), value: item, child: Text(item), ); }).toList(); }, onSelected: (String value) { popupValue = value; }, ), DropdownButton<String>( key: const ValueKey<String>(dropdownButtonKeyValue), value: dropdownValue, items: popupItems.map<DropdownMenuItem<String>>((String item) { return DropdownMenuItem<String>( key: ValueKey<String>('$dropdownKeyValue.$item'), value: item, child: Text(item), ); }).toList(), onChanged: (String? value) { setState(() { dropdownValue = value!; }); }, ), MaterialButton( key: const ValueKey<String>(alertButtonKeyValue), child: const Text('Alert'), onPressed: () { showDialog<void>( context: context, barrierDismissible: false, // user must tap button! builder: (BuildContext context) { return AlertDialog( key: const ValueKey<String>(alertKeyValue), title: const Text('Title text', key: ValueKey<String>('$alertKeyValue.Title')), content: const SingleChildScrollView( child: ListBody( children: <Widget>[ Text('Body text line 1.', key: ValueKey<String>('$alertKeyValue.Body1')), Text('Body text line 2.', key: ValueKey<String>('$alertKeyValue.Body2')), ], ), ), actions: <Widget>[ TextButton( child: const Text('OK', key: ValueKey<String>('$alertKeyValue.OK')), onPressed: () { Navigator.of(context).pop(); }, ), ], ); }, ); }, ), ], ), ), ), ); } }
flutter/dev/integration_tests/android_semantics_testing/lib/src/tests/popup_page.dart/0
{ "file_path": "flutter/dev/integration_tests/android_semantics_testing/lib/src/tests/popup_page.dart", "repo_id": "flutter", "token_count": 2203 }
565
// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. plugins { id "com.android.application" id "dev.flutter.flutter-gradle-plugin" id "kotlin-android" } def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { namespace "io.flutter.integration.deferred_components_test" compileSdk flutter.compileSdkVersion sourceSets { main.java.srcDirs += 'src/main/kotlin' } lintOptions { disable 'InvalidPackage' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "io.flutter.integration.deferred_components_test" minSdkVersion flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.release } } } flutter { source '../..' } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" implementation "com.google.android.play:core:1.8.0" }
flutter/dev/integration_tests/deferred_components_test/android/app/build.gradle/0
{ "file_path": "flutter/dev/integration_tests/deferred_components_test/android/app/build.gradle", "repo_id": "flutter", "token_count": 905 }
566
#include "../../Flutter/Flutter-Release.xcconfig" #include "Warnings.xcconfig"
flutter/dev/integration_tests/flavors/macos/Runner/Configs/Release.xcconfig/0
{ "file_path": "flutter/dev/integration_tests/flavors/macos/Runner/Configs/Release.xcconfig", "repo_id": "flutter", "token_count": 32 }
567
// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package io.flutter.demo.gallery; import androidx.annotation.NonNull; import io.flutter.embedding.android.FlutterActivity; import io.flutter.embedding.engine.FlutterEngine; public class MainActivity extends FlutterActivity { private FlutterGalleryInstrumentation instrumentation; /** Instrumentation for testing. */ public FlutterGalleryInstrumentation getInstrumentation() { return instrumentation; } @Override public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { super.configureFlutterEngine(flutterEngine); instrumentation = new FlutterGalleryInstrumentation(flutterEngine.getDartExecutor()); } }
flutter/dev/integration_tests/flutter_gallery/android/app/src/main/java/io/flutter/demo/gallery/MainActivity.java/0
{ "file_path": "flutter/dev/integration_tests/flutter_gallery/android/app/src/main/java/io/flutter/demo/gallery/MainActivity.java", "repo_id": "flutter", "token_count": 252 }
568
// Copyright 2014 The Flutter 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'; const double kColorItemHeight = 48.0; class Palette { Palette({ this.name, this.primary, this.accent, this.threshold = 900}); final String? name; final MaterialColor? primary; final MaterialAccentColor? accent; final int threshold; // titles for indices > threshold are white, otherwise black bool get isValid => name != null && primary != null; } final List<Palette> allPalettes = <Palette>[ Palette(name: 'RED', primary: Colors.red, accent: Colors.redAccent, threshold: 300), Palette(name: 'PINK', primary: Colors.pink, accent: Colors.pinkAccent, threshold: 200), Palette(name: 'PURPLE', primary: Colors.purple, accent: Colors.purpleAccent, threshold: 200), Palette(name: 'DEEP PURPLE', primary: Colors.deepPurple, accent: Colors.deepPurpleAccent, threshold: 200), Palette(name: 'INDIGO', primary: Colors.indigo, accent: Colors.indigoAccent, threshold: 200), Palette(name: 'BLUE', primary: Colors.blue, accent: Colors.blueAccent, threshold: 400), Palette(name: 'LIGHT BLUE', primary: Colors.lightBlue, accent: Colors.lightBlueAccent, threshold: 500), Palette(name: 'CYAN', primary: Colors.cyan, accent: Colors.cyanAccent, threshold: 600), Palette(name: 'TEAL', primary: Colors.teal, accent: Colors.tealAccent, threshold: 400), Palette(name: 'GREEN', primary: Colors.green, accent: Colors.greenAccent, threshold: 500), Palette(name: 'LIGHT GREEN', primary: Colors.lightGreen, accent: Colors.lightGreenAccent, threshold: 600), Palette(name: 'LIME', primary: Colors.lime, accent: Colors.limeAccent, threshold: 800), Palette(name: 'YELLOW', primary: Colors.yellow, accent: Colors.yellowAccent), Palette(name: 'AMBER', primary: Colors.amber, accent: Colors.amberAccent), Palette(name: 'ORANGE', primary: Colors.orange, accent: Colors.orangeAccent, threshold: 700), Palette(name: 'DEEP ORANGE', primary: Colors.deepOrange, accent: Colors.deepOrangeAccent, threshold: 400), Palette(name: 'BROWN', primary: Colors.brown, threshold: 200), Palette(name: 'GREY', primary: Colors.grey, threshold: 500), Palette(name: 'BLUE GREY', primary: Colors.blueGrey, threshold: 500), ]; class ColorItem extends StatelessWidget { const ColorItem({ super.key, required this.index, required this.color, this.prefix = '', }); final int index; final Color color; final String prefix; String colorString() => "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; @override Widget build(BuildContext context) { return Semantics( container: true, child: Container( height: kColorItemHeight, padding: const EdgeInsets.symmetric(horizontal: 16.0), color: color, child: SafeArea( top: false, bottom: false, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Text('$prefix$index'), Text(colorString()), ], ), ), ), ); } } class PaletteTabView extends StatelessWidget { PaletteTabView({ super.key, required this.colors, }) : assert(colors.isValid); final Palette colors; static const List<int> primaryKeys = <int>[50, 100, 200, 300, 400, 500, 600, 700, 800, 900]; static const List<int> accentKeys = <int>[100, 200, 400, 700]; @override Widget build(BuildContext context) { final TextTheme textTheme = Theme.of(context).textTheme; final TextStyle whiteTextStyle = textTheme.bodyMedium!.copyWith(color: Colors.white); final TextStyle blackTextStyle = textTheme.bodyMedium!.copyWith(color: Colors.black); return Scrollbar( child: ListView( primary: true, itemExtent: kColorItemHeight, children: <Widget>[ ...primaryKeys.map<Widget>((int index) { return DefaultTextStyle( style: index > colors.threshold ? whiteTextStyle : blackTextStyle, child: ColorItem(index: index, color: colors.primary![index]!), ); }), if (colors.accent != null) ...accentKeys.map<Widget>((int index) { return DefaultTextStyle( style: index > colors.threshold ? whiteTextStyle : blackTextStyle, child: ColorItem(index: index, color: colors.accent![index]!, prefix: 'A'), ); }), ], ), ); } } class ColorsDemo extends StatelessWidget { const ColorsDemo({super.key}); static const String routeName = '/colors'; @override Widget build(BuildContext context) { return DefaultTabController( length: allPalettes.length, child: Scaffold( appBar: AppBar( elevation: 0.0, title: const Text('Colors'), bottom: TabBar( isScrollable: true, tabs: allPalettes.map<Widget>((Palette swatch) => Tab(text: swatch.name)).toList(), ), ), body: TabBarView( children: allPalettes.map<Widget>((Palette colors) { return PaletteTabView(colors: colors); }).toList(), ), ), ); } }
flutter/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart/0
{ "file_path": "flutter/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart", "repo_id": "flutter", "token_count": 2036 }
569
// Copyright 2014 The Flutter 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'; // This demo displays one Category at a time. The backdrop show a list // of all of the categories and the selected category is displayed // (CategoryView) on top of the backdrop. class Category { const Category({ this.title, this.assets }); final String? title; final List<String>? assets; @override String toString() => '$runtimeType("$title")'; } const List<Category> allCategories = <Category>[ Category( title: 'Accessories', assets: <String>[ 'products/belt.png', 'products/earrings.png', 'products/backpack.png', 'products/hat.png', 'products/scarf.png', 'products/sunnies.png', ], ), Category( title: 'Blue', assets: <String>[ 'products/backpack.png', 'products/cup.png', 'products/napkins.png', 'products/top.png', ], ), Category( title: 'Cold Weather', assets: <String>[ 'products/jacket.png', 'products/jumper.png', 'products/scarf.png', 'products/sweater.png', 'products/sweats.png', ], ), Category( title: 'Home', assets: <String>[ 'products/cup.png', 'products/napkins.png', 'products/planters.png', 'products/table.png', 'products/teaset.png', ], ), Category( title: 'Tops', assets: <String>[ 'products/jumper.png', 'products/shirt.png', 'products/sweater.png', 'products/top.png', ], ), Category( title: 'Everything', assets: <String>[ 'products/backpack.png', 'products/belt.png', 'products/cup.png', 'products/dress.png', 'products/earrings.png', 'products/flatwear.png', 'products/hat.png', 'products/jacket.png', 'products/jumper.png', 'products/napkins.png', 'products/planters.png', 'products/scarf.png', 'products/shirt.png', 'products/sunnies.png', 'products/sweater.png', 'products/sweats.png', 'products/table.png', 'products/teaset.png', 'products/top.png', ], ), ]; class CategoryView extends StatelessWidget { const CategoryView({ super.key, this.category }); final Category? category; @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); return Scrollbar( child: ListView( primary: true, key: PageStorageKey<Category?>(category), padding: const EdgeInsets.symmetric( vertical: 16.0, horizontal: 64.0, ), children: category!.assets!.map<Widget>((String asset) { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Card( child: Container( width: 144.0, alignment: Alignment.center, child: Column( children: <Widget>[ Image.asset( asset, package: 'flutter_gallery_assets', fit: BoxFit.contain, ), Container( padding: const EdgeInsets.only(bottom: 16.0), alignment: AlignmentDirectional.center, child: Text( asset, style: theme.textTheme.bodySmall, ), ), ], ), ), ), const SizedBox(height: 24.0), ], ); }).toList(), ), ); } } // One BackdropPanel is visible at a time. It's stacked on top of the // BackdropDemo. class BackdropPanel extends StatelessWidget { const BackdropPanel({ super.key, this.onTap, this.onVerticalDragUpdate, this.onVerticalDragEnd, this.title, this.child, }); final VoidCallback? onTap; final GestureDragUpdateCallback? onVerticalDragUpdate; final GestureDragEndCallback? onVerticalDragEnd; final Widget? title; final Widget? child; @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); return Material( elevation: 2.0, borderRadius: const BorderRadius.only( topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0), ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ GestureDetector( behavior: HitTestBehavior.opaque, onVerticalDragUpdate: onVerticalDragUpdate, onVerticalDragEnd: onVerticalDragEnd, onTap: onTap, child: Container( height: 48.0, padding: const EdgeInsetsDirectional.only(start: 16.0), alignment: AlignmentDirectional.centerStart, child: DefaultTextStyle( style: theme.textTheme.titleMedium!, child: Tooltip( message: 'Tap to dismiss', child: title, ), ), ), ), const Divider(height: 1.0), Expanded(child: child!), ], ), ); } } // Cross fades between 'Select a Category' and 'Asset Viewer'. class BackdropTitle extends AnimatedWidget { const BackdropTitle({ super.key, required Animation<double> super.listenable, }); @override Widget build(BuildContext context) { final Animation<double> animation = listenable as Animation<double>; return DefaultTextStyle( style: Theme.of(context).primaryTextTheme.titleLarge!, softWrap: false, overflow: TextOverflow.ellipsis, child: Stack( children: <Widget>[ Opacity( opacity: CurvedAnimation( parent: ReverseAnimation(animation), curve: const Interval(0.5, 1.0), ).value, child: const Text('Select a Category'), ), Opacity( opacity: CurvedAnimation( parent: animation, curve: const Interval(0.5, 1.0), ).value, child: const Text('Asset Viewer'), ), ], ), ); } } // This widget is essentially the backdrop itself. class BackdropDemo extends StatefulWidget { const BackdropDemo({super.key}); static const String routeName = '/material/backdrop'; @override State<BackdropDemo> createState() => _BackdropDemoState(); } class _BackdropDemoState extends State<BackdropDemo> with SingleTickerProviderStateMixin { final GlobalKey _backdropKey = GlobalKey(debugLabel: 'Backdrop'); late AnimationController _controller; Category _category = allCategories[0]; @override void initState() { super.initState(); _controller = AnimationController( duration: const Duration(milliseconds: 300), value: 1.0, vsync: this, ); } @override void dispose() { _controller.dispose(); super.dispose(); } void _changeCategory(Category category) { setState(() { _category = category; _controller.fling(velocity: 2.0); }); } bool get _backdropPanelVisible { final AnimationStatus status = _controller.status; return status == AnimationStatus.completed || status == AnimationStatus.forward; } void _toggleBackdropPanelVisibility() { _controller.fling(velocity: _backdropPanelVisible ? -2.0 : 2.0); } double get _backdropHeight { final RenderBox renderBox = _backdropKey.currentContext!.findRenderObject()! as RenderBox; return renderBox.size.height; } // By design: the panel can only be opened with a swipe. To close the panel // the user must either tap its heading or the backdrop's menu icon. void _handleDragUpdate(DragUpdateDetails details) { if (_controller.isAnimating || _controller.status == AnimationStatus.completed) { return; } _controller.value -= details.primaryDelta! / _backdropHeight; } void _handleDragEnd(DragEndDetails details) { if (_controller.isAnimating || _controller.status == AnimationStatus.completed) { return; } final double flingVelocity = details.velocity.pixelsPerSecond.dy / _backdropHeight; if (flingVelocity < 0.0) { _controller.fling(velocity: math.max(2.0, -flingVelocity)); } else if (flingVelocity > 0.0) { _controller.fling(velocity: math.min(-2.0, -flingVelocity)); } else { _controller.fling(velocity: _controller.value < 0.5 ? -2.0 : 2.0); } } // Stacks a BackdropPanel, which displays the selected category, on top // of the backdrop. The categories are displayed with ListTiles. Just one // can be selected at a time. This is a LayoutWidgetBuild function because // we need to know how big the BackdropPanel will be to set up its // animation. Widget _buildStack(BuildContext context, BoxConstraints constraints) { const double panelTitleHeight = 48.0; final Size panelSize = constraints.biggest; final double panelTop = panelSize.height - panelTitleHeight; final Animation<RelativeRect> panelAnimation = _controller.drive( RelativeRectTween( begin: RelativeRect.fromLTRB( 0.0, panelTop - MediaQuery.of(context).padding.bottom, 0.0, panelTop - panelSize.height, ), end: RelativeRect.fill, ), ); final ThemeData theme = Theme.of(context); final List<Widget> backdropItems = allCategories.map<Widget>((Category category) { final bool selected = category == _category; return Material( shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(4.0)), ), color: selected ? Colors.white.withOpacity(0.25) : Colors.transparent, child: ListTile( title: Text(category.title!), selected: selected, onTap: () { _changeCategory(category); }, ), ); }).toList(); return ColoredBox( key: _backdropKey, color: theme.primaryColor, child: Stack( children: <Widget>[ ListTileTheme( iconColor: theme.primaryIconTheme.color, textColor: theme.primaryTextTheme.titleLarge!.color!.withOpacity(0.6), selectedColor: theme.primaryTextTheme.titleLarge!.color, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: backdropItems, ), ), ), PositionedTransition( rect: panelAnimation, child: BackdropPanel( onTap: _toggleBackdropPanelVisibility, onVerticalDragUpdate: _handleDragUpdate, onVerticalDragEnd: _handleDragEnd, title: Text(_category.title!), child: CategoryView(category: _category), ), ), ], ), ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( elevation: 0.0, title: BackdropTitle( listenable: _controller.view, ), actions: <Widget>[ IconButton( onPressed: _toggleBackdropPanelVisibility, icon: AnimatedIcon( icon: AnimatedIcons.close_menu, semanticLabel: 'close', progress: _controller.view, ), ), ], ), body: LayoutBuilder( builder: _buildStack, ), ); } }
flutter/dev/integration_tests/flutter_gallery/lib/demo/material/backdrop_demo.dart/0
{ "file_path": "flutter/dev/integration_tests/flutter_gallery/lib/demo/material/backdrop_demo.dart", "repo_id": "flutter", "token_count": 5277 }
570