CLI does not handle deleted files from App_Resources/Android/src

Open
#5,083 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, java, javascript, kotlin

Research direction

Start in lib/services/android-project-service.ts at prepareAppResources and inspect the related build.gradle sourceSets and dependencies handling. Reproduce the issue by building, deleting a file under App_Resources/Android/src, and building again; done means the generated platforms/android/app/src state reflects deletions as well as additions.

Written by the indexing model from the issue text.

Description

bug build debug os: android prepare run unit testing

If a user adds some Java/Kotlin files in the App_Resources/Android/src folder and runs a build, the files are copied into the platforms/android/app/src folder.
If the user, however, deletes some file in App_Resources/Android/src and triggers a second build, this does not change the state of the platforms/android/app/src directory.

Issue seems to be due to this logic: https://github.com/NativeScript/nativescript-cli/blob/master/lib/services/android-project-service.ts#L294

The whole implementation of the prepareAppResources method could probably be improved with setting an additional value provided to srcDir in the build.gradle

sourceSets {
    main {
        java {
            srcDir 'src/src'
        }
    }
}

As for the libs folder, it's probably a good idea to attach it as an implementation filetree(<libs_path>) in the dependencies block in the build.gradle

Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NativeScript/nativescript-cli

All issues in NativeScript/nativescript-cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.