Skip to content

Commit

Permalink
Merge branch 'main' into feature/analyzer-6-0-0
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough committed Nov 27, 2023
2 parents 700c4ae + 966c546 commit d3f2a5e
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .cloud_build/dart_pad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ steps:
dir: pkgs/dart_pad
- name: gcr.io/$PROJECT_ID/firebase
args: ['deploy', '--project=$PROJECT_ID', '--only=hosting']
dir: pkgs/dart_pad
dir: pkgs/dart_pad
2 changes: 1 addition & 1 deletion .cloud_build/flutter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ RUN flutter upgrade
# Perform an artifact precache so that no extra assets need to be downloaded on demand.
RUN flutter precache --web

ENTRYPOINT [ "flutter" ]
ENTRYPOINT [ "flutter" ]
32 changes: 16 additions & 16 deletions pkgs/dart_pad/lib/elements/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ enum DialogResult {

class Dialog {
final MDCDialog _mdcDialog;
final Element? _leftButton;
final Element? _rightButton;
final Element? _title;
final Element? _content;
final Element _leftButton;
final Element _rightButton;
final Element _title;
final Element _content;

Dialog()
: assert(querySelector('.mdc-dialog') != null),
Expand All @@ -30,10 +30,10 @@ class Dialog {
assert(querySelector('#my-dialog-title') != null),
assert(querySelector('#my-dialog-content') != null),
_mdcDialog = MDCDialog(querySelector('.mdc-dialog')!),
_leftButton = querySelector('#dialog-left-button'),
_rightButton = querySelector('#dialog-right-button'),
_title = querySelector('#my-dialog-title'),
_content = querySelector('#my-dialog-content');
_leftButton = querySelector('#dialog-left-button')!,
_rightButton = querySelector('#dialog-right-button')!,
_title = querySelector('#my-dialog-title')!,
_content = querySelector('#my-dialog-content')!;

Future<DialogResult> showYesNo(String title, String htmlMessage,
{String yesText = 'Yes', String noText = 'No'}) {
Expand Down Expand Up @@ -78,24 +78,24 @@ class Dialog {
DialogResult leftButtonResult,
DialogResult rightButtonResult,
[bool showLeftButton = true]) {
_title!.text = title;
_content!.setInnerHtml(htmlMessage, validator: PermissiveNodeValidator());
_rightButton!.text = rightButtonText;
_title.text = title;
_content.setInnerHtml(htmlMessage, validator: PermissiveNodeValidator());
_rightButton.text = rightButtonText;

final completer = Completer<DialogResult>();
StreamSubscription<MouseEvent>? leftSub;

if (showLeftButton) {
_leftButton!.text = leftButtonText;
_leftButton!.removeAttribute('hidden');
leftSub = _leftButton!.onClick.listen((_) {
_leftButton.text = leftButtonText;
_leftButton.removeAttribute('hidden');
leftSub = _leftButton.onClick.listen((_) {
completer.complete(leftButtonResult);
});
} else {
_leftButton!.setAttribute('hidden', 'true');
_leftButton.setAttribute('hidden', 'true');
}

final rightSub = _rightButton!.onClick.listen((_) {
final rightSub = _rightButton.onClick.listen((_) {
completer.complete(rightButtonResult);
});

Expand Down
2 changes: 1 addition & 1 deletion pkgs/dart_pad/pubspec.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkgs/dart_pad/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: The front end of DartPad.
publish_to: none

environment:
sdk: ^3.1.0
sdk: ^3.2.0

dependencies:
checked_yaml: ^2.0.3
Expand Down
2 changes: 1 addition & 1 deletion pkgs/dart_pad/third_party/pkg/split/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/flutter/devtools/tree/master/third_party/packages/s
version: 0.0.7

environment:
sdk: ^3.1.0
sdk: ^3.2.0

dependencies:
js: ^0.6.7
2 changes: 2 additions & 0 deletions pkgs/dart_services/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ config.properties

# Editor configuration
.vscode/

bin/server
46 changes: 32 additions & 14 deletions pkgs/dart_services/lib/src/sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,23 @@ class Sdk {
}

void _initPaths() {
// <flutter-sdk>/bin/cache/dart-sdk
final dartVM = Platform.resolvedExecutable;
// Note below, 'Platform.resolvedExecutable' will not lead to a real SDK if
// we've been compiled into an AOT binary. In those cases we fall back to
// looking for a 'FLUTTER_ROOT' environment variable.

// <flutter-sdk>/bin/cache/dart-sdk/bin/dart
String? potentialPath = path.dirname(path.dirname(
path.dirname(path.dirname(path.dirname(Platform.resolvedExecutable)))));
if (!_validFlutterSdk(potentialPath)) {
potentialPath = Platform.environment['FLUTTER_ROOT'];
if (potentialPath == null || !_validFlutterSdk(potentialPath)) {
throw StateError('Flutter SDK not found');
}
}

dartSdkPath = path.dirname(path.dirname(dartVM));
flutterSdkPath = path.dirname(path.dirname(path.dirname(dartSdkPath)));
flutterSdkPath = potentialPath;
_flutterBinPath = path.join(flutterSdkPath, 'bin');

// Verify that this is a flutter sdk; check for bin/, packages/, and
// packages/flutter/.
final packages = path.join(flutterSdkPath, 'packages');
if (!FileSystemEntity.isDirectorySync(flutterSdkPath) ||
!FileSystemEntity.isDirectorySync(path.join(flutterSdkPath, 'bin')) ||
!FileSystemEntity.isDirectorySync(packages) ||
!FileSystemEntity.isDirectorySync(path.join(packages, 'flutter'))) {
throw StateError('flutter sdk not found (from $dartSdkPath)');
}
dartSdkPath = path.join(flutterSdkPath, 'bin', 'cache', 'dart-sdk');
}

Sdk() {
Expand Down Expand Up @@ -123,4 +124,21 @@ class Sdk {
final file = File(path.join(filePath, 'version'));
return file.readAsStringSync().trim();
}

static bool _validFlutterSdk(String sdkPath) {
// Verify that this is a Flutter sdk; check for bin/, packages/, and
// packages/flutter/.
if (!FileSystemEntity.isDirectorySync(sdkPath) ||
!FileSystemEntity.isDirectorySync(path.join(sdkPath, 'bin'))) {
return false;
}

final packages = path.join(sdkPath, 'packages');
if (!FileSystemEntity.isDirectorySync(packages) ||
!FileSystemEntity.isDirectorySync(path.join(packages, 'flutter'))) {
return false;
}

return true;
}
}
2 changes: 1 addition & 1 deletion pkgs/dartpad_shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Shared code between the DartPad frontend and backend.
publish_to: 'none'

environment:
sdk: ^3.1.0
sdk: ^3.2.0

dependencies:
http: ^1.1.0
Expand Down
2 changes: 1 addition & 1 deletion pkgs/samples/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Sample code snippets for DartPad.
publish_to: 'none'

environment:
sdk: ^3.1.0
sdk: ^3.2.0

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion pkgs/sketch_pad/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: An experimental redux of the DartPad UI.
publish_to: 'none'

environment:
sdk: ^3.1.0
sdk: ^3.2.0

dependencies:
codemirror: any
Expand Down

0 comments on commit d3f2a5e

Please sign in to comment.