Skip to content

[native_assets_cli] Deprecate output_directory #2130

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

Merged
merged 2 commits into from
Mar 26, 2025

Conversation

dcharkes
Copy link
Collaborator

@dcharkes dcharkes commented Mar 24, 2025

Closes: #2058

Implements input.outputDirectory on top of input.outputDirectoryShared in the hook API.

New directory structure

  • .dart_tool/
    • native_assets_builder/
      • <package_name>/
        • <config-checksum>/
          • input.json
          • output.json
          • dependencies.dependencies_hash_file.json
          • package_config_hashable.json
          • hook.dill
          • hook.dill.d
          • stderr.txt
          • stdout.txt
          • out/ <- old output directory, created by SDK (stays here for backwards compatibility purposes)
      • shared/
        • <package_name>/
          • build/ (input.outputDirectoryShared)
            • <config-checksum>/ <- new output directory, created by the hook
          • link/ (input.outputDirectoryShared)
            • <config-checksum>/ <- new output directory, created by the hook

Version skew

The out_dir in the JSON is still emitted for the time being, until everyone has migrated.

Fixes in this PR

The native_toolchain_c tests were not looking at what the input.outputDirectory was but assumed that the temp dir was that directory. These tests have been fixed.

The NativeAssetsBuildRunner was passing HookInput around instead of the buildDir and tried to reverse engineer the buildDir by doing input.outputDirector.resolve('../'). This has now been cleaned up.

Copy link

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, 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.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

@dcharkes dcharkes force-pushed the deprecate-output-directory branch from bc6884f to dea58ed Compare March 24, 2025 19:35
@@ -56,6 +56,7 @@ void main() async {
File.fromUri(
buildInputUri,
).writeAsStringSync(jsonEncode(inputBuilder.json));
outputDirectory = BuildInput(inputBuilder.json).outputDirectory;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this conceptually - why do we need to pass the outputDirectory to then retrieve the outputDirectory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BuildInput.outputDirectory now comes up with it's own directory instead of taking the one from the constructor.

I think we should deprecate the parameter in the constructor so that it's clear that that's no longer used.

@dcharkes dcharkes force-pushed the json-schema-enums branch from 0ae413d to 4730075 Compare March 26, 2025 07:00
Base automatically changed from json-schema-enums to main March 26, 2025 07:03
@dcharkes dcharkes force-pushed the deprecate-output-directory branch from dea58ed to d5e3137 Compare March 26, 2025 07:13
@dcharkes dcharkes merged commit 781fc27 into main Mar 26, 2025
47 checks passed
@dcharkes dcharkes deleted the deprecate-output-directory branch March 26, 2025 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[native_assets_cli] Deprecate and remove outputDirectory
2 participants