Skip to content

Non-asset, ignored folders with asset filenames are included in the build. #116515

@khainke

Description

@khainke

description

While backing up some build results in an git-ignored project folder, i encountered an annoying bug with regard to assets. The mentioned folder was included in the next flutter build windows output in the flutter_assets folder, despite not being specified in the pubspec.yaml as assets folder. I could also reproduce this in a newly created project.

steps to reproduce

  1. flutter create test_assets
  2. Create a folder test_dir, create a file CHANGELOG.md
  3. pubspec.yaml
name: test_assets

description: A new Flutter project.



publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=2.18.2 <3.0.0'

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:

  uses-material-design: true
  assets:
   
    - assets/
    - CHANGELOG.md

  1. flutter build windows
  2. copy build/windows/runner/Release to test_dir
  3. flutter build windows
  4. now you can find a file ...\test_assets\build\windows\runner\Release\data\flutter_assets\test_dir\Release\data\flutter_assets\CHANGELOG.md in the build results.

This would increases the app size with every build, despite the test_dirfolder not being specified as assets folder.

expected result

  1. the test_dir folder is not included in the flutter_assets.

remarks

It looks like the cause for this is, that there is a CHANGELOG.md file found in the test_dir folder, and this filename is specified in the assets in the pubspec.yaml. But the intention is the inclusion of the top level test_assets/CHANGELOG.md file. Replacing the assets paragraph in the pubspec.yaml with relative paths does not fix the problem, unfortunally:

  assets:
   
    - ./assets/
    - ./CHANGELOG.md

environment

Target Platform: windows
Flutter version: 3.3.5

flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.5, on Microsoft Windows [Version 10.0.19045.2251], locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.5)
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: assetsPackaging, accessing, or using assetsplatform-windowsBuilding on or for Windows specificallyteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy