Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[native_assets_cli] Package name #999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #882
dcharkes opened this issue Mar 12, 2024 · 15 comments · Fixed by #2259
Closed
Tracked by #882

[native_assets_cli] Package name #999

dcharkes opened this issue Mar 12, 2024 · 15 comments · Fixed by #2259
Assignees
Labels
P2 A bug or feature request we're likely to work on package:hooks

Comments

@dcharkes
Copy link
Collaborator

After we add support for hook/link.dart we'll have a LinkConfig and LinkOutput that will share some types with the BuildConfig and BuildOutput.

And after adding DataAssets we'll have more assets than CCodeAssets/NativeCodeAssets.

So, the question is what this package should be renamed to:

Original tracking issue:

cc @mosuem @mkustermann

@dcharkes dcharkes added P2 A bug or feature request we're likely to work on package:hooks labels Mar 12, 2024
@mkustermann
Copy link
Member

Would it make sense to go away from "native" and from "assets" and instead use package:dart_build / package:dbuild / ...?

@dcharkes
Copy link
Collaborator Author

dart_build still doesn't cover a link hook.

I think I'd prefer build_hook over dart_build, it's more clearly connected the "hook"s (dart-lang/sdk#54334).

What's a good name for the "build hook" and "link hook"? (I think they should live in the same package, as they will have many shared classes.)

@dcharkes
Copy link
Collaborator Author

dcharkes commented Mar 14, 2024

Notes from discussion with @mosuem

  • package:build_hook/build.dart
  • package:build_hook/link.dart contains LinkConfig and LinkOutput

(package:compilation_hooks/build.dart was rejected because compilation_hooks is hard to connect with build.dart and link.dart)

@mosuem
Copy link
Member

mosuem commented Mar 14, 2024

Throwing some nice not-as-technical names in the ring: package:weave or package:forge (my personal favorite).

@dcharkes dcharkes added P1 A high priority bug; for example, a single project is unusable or has many test failures and removed P2 A bug or feature request we're likely to work on labels Jun 20, 2024
@dcharkes
Copy link
Collaborator Author

dcharkes commented Jul 8, 2024

From discussion with @mkustermann @HosseinYousefi @mosuem:

  • package:hook/build.dart and package:hook/link.dart.

Which might conflict with package:hooks (11 years old, not update in 10 years). Maybe that package can be deprecated.

@HosseinYousefi
Copy link
Member

I like package:hook.

@influx6 Would you mind transferring the ownership of your package:hooks to us? I don't want any confusion with package:hook.

cc/ @jonasfj

@influx6
Copy link

influx6 commented Jul 9, 2024

@HosseinYousefi I need an email to use to transfer to

@influx6
Copy link

influx6 commented Jul 9, 2024

I sent the invite to [email protected]

@HosseinYousefi
Copy link
Member

HosseinYousefi commented Jul 9, 2024

I sent the invite to [redacted].

We can move this conversation to email. I think @mosuem had already contacted you, let's talk about the correct email there.

@dcharkes
Copy link
Collaborator Author

dcharkes commented Jul 9, 2024

I sent the invite to [email protected]

Thanks @influx6! I have accepted the invite. 👍

@jonasfj Is marking the package:hooks discontinued enough for us to be able to upload a new package:hook?

@dcharkes
Copy link
Collaborator Author

@influx6 You might want to update the readme on the repo that it's discontinued and archive the GitHub repo.

Given that the SDK constraint is <2.0.0, I presume at this point we have 0 users. 😄 (The current Dart SDK releases can only run 2.12 and higher.) So we might even retract the whole package to avoid users making a typo in their pubspec and getting an error that they need Dart 1 instead of package:hooks not existing.

@jonasfj
Copy link
Member

jonasfj commented Jul 11, 2024

@jonasfj Is marking the package:hooks discontinued enough for us to be able to upload a new package:hook?

No, it's not.

pub.dev will generally, not allow publication of hook if hooks exist (and vice versa).
This just some arbitrary rules we have in place to disallow similar package names.
Exceptions to the rules on similar package names can be granted on a case by case basis.

The rules on similar package names are there to prevent typo squatting attacks. But if we can see that it's not an attack, we can make exemptions on a case by case basis.

In a case like this, where:

  • The owner of hooks consent to the creation of hook; AND;
  • The owners of both packages are aware that these similarly named packages exist; AND;
  • All parties trust each other not to attempt a typo squatting attack; AND;
  • All parties are aware of the potential confusion (and minor pain) that similarly named packages can bring.
    In such cases, I think an exemption to allow the creation of package:hook is fair :D

Formally, this is done by adding hook to reserved package name list:
https://github.com/dart-lang/pub-dev/blob/b786b24ebea84705d0ba6c13b11a9e6f8d72a0c2/app/lib/package/overrides.dart#L9

Once deployed a Googler can create the package, and transfer it the people who requested it be created. In this case, that'd be you, so really you could just create it.

jonasfj added a commit to dart-lang/pub-dev that referenced this issue Jul 11, 2024
jonasfj added a commit to dart-lang/pub-dev that referenced this issue Jul 11, 2024
@dcharkes dcharkes added this to the native assets v1.0 milestone Aug 30, 2024
@dcharkes dcharkes added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jan 10, 2025
@dcharkes
Copy link
Collaborator Author

If we're going for package:hook (singular), then it's slightly weird to go for package:code_assets (plural) and package:data_assets (plural).

Because we will start name spacing with package name (#2132), we need to decide on those package names now.

Should we consider package:data_asset and package:code_asset instead? cc @HosseinYousefi @mosuem @mkustermann? (Let the bike shedding begin!)

@mosuem
Copy link
Member

mosuem commented Mar 25, 2025

Should we consider package:data_asset and package:code_asset instead?

Yes (let the bike shedding stop 😉 ). I am also fine with package:hooks though. We should just be kind of consistent.

@dcharkes
Copy link
Collaborator Author

The majority of packages related to icon, font, asset have plural names on pub.dev, so I'm leaning towards plural for data_assets and code_assets.

For the hook/ directory we've settled in singular as per Dart conventions: https://dart.dev/tools/pub/package-layout. (Flutter diverges from these conventions with the assets/ directory: https://dart.dev/tools/pub/package-layout#public-assets.)

So should package:hooks follow the package name conventions then or stay close to the directory name as in package:hook. (package:hooks will ensure users will never land on the 11 year old package:hooks, but also means that history is forever visible.)

auto-submit bot pushed a commit that referenced this issue Mar 26, 2025
Bug: #999

A package name is either a verb, a singular noun, or a plural noun. Since this package name is a noun and there is more than one hook (build hook and link hook), rename the package to a plural noun.
@dcharkes dcharkes self-assigned this Apr 24, 2025
@dcharkes dcharkes moved this to In Progress in Native Assets Apr 24, 2025
auto-submit bot pushed a commit that referenced this issue Apr 28, 2025
This PR tries the curate the classes which are in the public API of `native_assets_cli.dart` and adds some documentation to them.

* `(Build|Link)(Input|Output)` refer to the hooks the are the input or output of.
* `Hook(Input|Output)` refer to the subclasses
* `(Build|Link|Hook)Config` refer to the input they are the config of.
* `XXXBuilder` refer to the class they build.
* `Builder|Linker` refer to the hooks they should be used in.
* `EncodedAsset` refers to protocol extensions for encoding/decoding
* `PackageMetadata|PackageUserDefines|PackageUserDefinesSource` refer to the classes where they are used.
* `ProtocolExtension` documents it's the specification for an extension of the base protocol.
* `AssetRouting|ToAppBundle|ToBuildHooks|ToLinkHook` refer to each other in the hook output.

Deprecated classes have been removed:

* `Metadata|Dependencies` these were no longer used since the `XXXBuilder` pattern.

Classes only used in `package:native_assets_builder` have been moved there:

* `Target`.

The Dart docs can be inspected by `pkgs/native_assets_cli$ dart doc .`.

TODOs:

* This PR does not yet curate extension types, extensions, and top level functions.
* This PR does not yet curate the `code_assets.dart` and `data_assets.dart` libraries.

Context:

* Work before splitting up the package: #999
auto-submit bot pushed a commit that referenced this issue Apr 28, 2025
This PR tries the curate the toplevel functions which are in the public API of what will be `package:hooks`,   `package:code_assets` and `package:data_assets`.

The validate functions for the base protocol are moved into a `ProtocolBase` class. (These need to be public because `package:native_assets_builder` uses them. And these need to be in `package:native_assets_cli` because the `test` methods use them.)

The Dart docs can be inspected by `pkgs/native_assets_cli$ dart doc .`.

TODOs:

* This PR does not yet curate extension types, and extensions.

Context:

* Work before splitting up the package: #999
auto-submit bot pushed a commit that referenced this issue Apr 28, 2025
This PR replaces all extension types with classes.

This PR renames all classes that mostly belong to another class to start with the name of that class.

I'm not entirely satisfied with how this looks, but I think it's a step in the right direction.

The Dart docs can be inspected by `pkgs/native_assets_cli$ dart doc .`.

Open question:

* Should we _not_ export all those helper classes? That would prevent users using these types in their code. But this would be considered a leaked symbol. So this probably doesn't work.
* Should we not generate dartdocs for those helper classes. They usually simply have an `add`, `addAll` or `operator []`. The interesting doc comments are on the accessors that return those classes.

Context:

* Work before splitting up the package: #999
@auto-submit auto-submit bot closed this as completed in b324678 Apr 30, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Native Assets Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on package:hooks
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants