devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Devtool Extension does not load in Devtools for git dependencies (with build generated)

Open mkorbel1 opened this issue 1 year ago • 7 comments

We are attempting a workflow where we use our CD flow in GitHub Actions to build the artifacts for our devtool extension on rohd and push them to a separate branch. The goal is that users can point to a pre-release version of our package hosted on git but still benefit from the devtools extension by pointing to this special branch instead of main. But, we're not seeing the devtools extension show up in devtools when we point it there.

If helpful, this PR (https://github.com/intel/rohd/pull/461) has the relevant changes we're making, and here's a dependency override that we expected would work (on a fork, for now):

dependency_overrides:
  rohd:
    git:
      url: https://github.com/quekyj/rohd.git
      ref: artifacts

You can see all the build output located here: https://github.com/quekyj/rohd/tree/artifacts/extension/devtools/build

This isn't working for me on Dart SDK version: 3.3.0 (stable) (None) on "linux_x64" (in windows 11 WSL2 ubuntu) Here's a tiny example program that you can set a breakpoint on after the call to .build(), and the extension should show up in the devtools and show the built module within it

import 'package:rohd/rohd.dart';

class MyMod extends Module {
  MyMod(Logic x) {
    x = addInput('x', x);
  }
}

void main(List<String> arguments) async {
  final m = MyMod(Logic());
  await m.build();

  print(m.generateSynth());
}

This is a follow-up to this Discord discussion: https://discord.com/channels/608014603317936148/1159561514072690739/1206721049430069248

mkorbel1 avatar Feb 17 '24 01:02 mkorbel1

After you run dart pub get on the package with the git dependency, can you check your .dart_tool/package_config.json file for the rohd entry. The pub cache location it points to is where DevTools looks for the rohd/extension/devtools folder. Do you see the content you expect in that location?

kenzieschmoll avatar Mar 07 '24 16:03 kenzieschmoll

After you run dart pub get on the package with the git dependency, can you check your .dart_tool/package_config.json file for the rohd entry. The pub cache location it points to is where DevTools looks for the rohd/extension/devtools folder. Do you see the content you expect in that location?

Yes, I see the built devtools extension in the downloaded git dependency

{
  "name": "rohd",
  "rootUri": "file:///home/max/.pub-cache/git/rohd-aba2c2ffac83c318615160b4172aa771f8422d45/",
  "packageUri": "lib/",
  "languageVersion": "2.19"
},
$ ls /home/max/.pub-cache/git/rohd-aba2c2ffac83c318615160b4172aa771f8422d45/extension/devtools/build/
assets  canvaskit  favicon.png  flutter.js  flutter_service_worker.js  icons  index.html  main.dart.js  manifest.json  version.json

mkorbel1 avatar Mar 07 '24 22:03 mkorbel1

Are you also on the latest version of the devtools_extensions package and Flutter master?

kenzieschmoll avatar Mar 07 '24 23:03 kenzieschmoll

I believe this was built on devtools_extensions 0.0.12 based on the actions run (vs. 0.0.14 current latest): https://github.com/quekyj/rohd/actions/runs/7913672857/job/21601807816

I'll try rerunning with the latest in case some recent change or fix resolves the issue. Is there any reason you'd expect it not to have worked on 0.0.12?

mkorbel1 avatar Mar 07 '24 23:03 mkorbel1

Oh also, it looks like we're running on "Flutter SDK version "3.18.0-0.2.pre" from the beta channel on linux", so we'll update that too.

mkorbel1 avatar Mar 07 '24 23:03 mkorbel1

@quekyj has shown me that using Flutter 3.19.0-0.3.pre on beta channel on Windows 11 (and the Dart version included) does properly load up the devtools extension. So perhaps this is specific to the version of Dart/Flutter, or Linux vs. Windows, or WSL vs. native?

mkorbel1 avatar Mar 08 '24 00:03 mkorbel1

It is possible that you were hitting some bugs that we've fixed in later versions of DevTools and / or the devtools_extensions package. Extension authors should develop their extensions using Flutter master (at least right now while the package is immature). But your extension should be able to be loaded by a user that is on Flutter stable.

kenzieschmoll avatar Mar 11 '24 21:03 kenzieschmoll

As an update, building with flutter stable 3.19.3, consuming with Dart 3.3.3 in WSL still doesn't have any rohd extension show up in the devtools.

dependency_overrides:
  rohd:
    git:
      url: https://github.com/intel/rohd
      ref: artifacts

This using not quite the latest devtools (0.1.0) stuff because it seems flutter_test is not compatible with vm_service 14.0.0 yet.

Here's the output from running and building the devtools extension: https://github.com/intel/rohd/actions/runs/8557398136/job/23449524118

+ devtools_app_shared 0.0.9 (0.1.0 available)
+ devtools_extensions 0.0.13 (0.1.0 available)
+ devtools_shared 6.0.4 (8.1.0 available)

mkorbel1 avatar Apr 04 '24 16:04 mkorbel1

Here's some reproduction steps on non-WSL using a GitHub codespace container, so it should be portable.

  1. Go to https://github.com/intel/rohd-vf and create a GitHub codespace on main.
  2. Add the artifacts branch as a dependency override to pubspec.yaml (and pub get/upgrade):
dependency_overrides:
  rohd:
    git:
      url: https://github.com/intel/rohd
      ref: artifacts
  1. Set a breakpoint in example/main.dart at Simulator.setMaxSimTime(300); (line 32) and launch the main in debug mode.
  2. Open devtools in browser. Note this is a little trickier in a codespace:
  • After clicking "open devtools in browser", it will open a new tab but not connect
  • Find the port number from the debug console in the codespace window
  • In the ports tab, make that port "public" visibility, then copy the forwarded address
  • Concatenate that forwarded address with the rest of the path from the debug console after the port, and put that into the devtools web page
  1. Observe that the "rohd" extension is not visible

mkorbel1 avatar Apr 05 '24 16:04 mkorbel1

Fixed by https://github.com/flutter/devtools/pull/7533. Thanks for flagging this issue with clear repro steps - made it easy to address.

kenzieschmoll avatar Apr 05 '24 16:04 kenzieschmoll