rokucommunity / vscode-brightscript-language

A Visual Studio Code extension for Roku's BrightScript language
MIT License
104 stars 41 forks source link

1.4.2 broke builds #60

Closed kbunch closed 5 years ago

kbunch commented 5 years ago

The 1.4.2 build broke our builds. It is giving a no such file or directory for source/Main.brs even though the file exist in source. It looks like something changed in the way the files are moved/defined.

We simply had { "src":"source", "dest" : "source" }, Which seems not to work now. I'm guessing the way the files get defined now just changed.

TwitchBronBron commented 5 years ago

I updated the roku-deploy dependency to support multi-glob patterns for publishing....but all of my existing tests passed so it should have been fully backwards compatible. Could you give me a little more details on how to reproduce, or even a quick sample project to use?

kbunch commented 5 years ago

We resolved it like this

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "brightscript",
            "request": "launch",
            "name": "staging",
            "stopOnEntry": false,
            "host": "XXX",
            "password": "XXX",
            "rootDir": "${workspaceFolder}",
            "outDir": "${workspaceFolder}/out",
            "files" : [
                "fonts/**/*.*", 
                "locale/**/*.*", 
                "source/**/*.*", 
                "components/**/*.*", 
                "ADBMobileConfig.json",
                "manifest",
                {
                    "src":"flavors/staging/Config.xml", 
                    "dest" : "components/values/Config.xml"
                }
            ],
            "consoleOutput": "normal"
        }
    ]
}

VS it breaking like this

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "brightscript",
            "request": "launch",
            "name": "staging",
            "stopOnEntry": false,
            "host": "XXX",
            "password": "XXX",
            "rootDir": "${workspaceFolder}",
            "outDir": "${workspaceFolder}/out",
            "files" : [
                {
                    "src":"ADBMobileConfig.json", 
                    "dest" : "ADBMobileConfig.json"
                },
                {
                    "src":"manifest", 
                    "dest" : "manifest"
                },
                {
                    "src":"flavors/staging/Config.xml", 
                    "dest" : "components/values/Config.xml"
                },
                {
                    "src":"components", 
                    "dest" : "components"
                },
                {
                    "src":"source", 
                    "dest" : "source"
                },
                {
                    "src":"locale", 
                    "dest" : "locale"
                },
                {
                    "src":"fonts", 
                    "dest" : "fonts"
                }
            ],
            "consoleOutput": "normal"
        }
    ]
}
TwitchBronBron commented 5 years ago

This is all the information that I needed, thanks! I'll investigate and see how I can restore the previous functionality. I'm glad you found a workaround though in the mean time.

kbunch commented 5 years ago

@TwitchBronBron on another project

                "components/**/*.*", 
                "source/**/*.*", 

Doesn't work correctly. There it seems to be writing it including the full path rather than the relative path ex: projects/client/roku/components vs: components

TwitchBronBron commented 5 years ago

I found the problem with the { "source"": "source", "dest" : "source"}, issue, and I'm working on a fix now. Hopefully that will also resolve the "components/**/*.*", "source/**/*.*", issue

kbunch commented 5 years ago

@TwitchBronBron To be clear....

          "components/**/*.*", 
                "source/**/*.*",

Works on all projects except one. That one project uses the entire path from the root. None of the other projects do that. Not sure why.

PS. There is a Slack channel for this repo, but it says I have to have a tantawowa.com email to join. I'd like to be able to get on a slack channel, but have no means to

kbunch commented 5 years ago

@TwitchBronBron The issue for that project is that the manifest isn't in the root

For example we have different flavors and each flavor has its own manifest (same project creates multiple apps)

                {
                    "src":"flavors/flavor1/manifest", 
                    "dest" : "manifest"
                },
                {
                    "src":"flavors/flavor2/manifest", 
                    "dest" : "manifest"
                },
kbunch commented 5 years ago

Another thing I found...

"!components/test/**/*.*",

Will only negate it if there are multiple subfolders there. If there is only one subfolder it will include it. Possible I don't know the proper expressions to use. Do you have a reference for it?

TwitchBronBron commented 5 years ago

Thanks for the extra info. I'll make sure to try all of those variations out and see what I find.

Concerning the slack group, I am a member, and I have a gmail account. I think I may have included the wrong link in the readme. Try this link instead: http://tiny.cc/nrdf0y We hang out in the #vscode-bs-lang-ext room.

TwitchBronBron commented 5 years ago

Just wanted to give an update. I think I have fixed the { "source"": "source", "dest" : "source"}, issue. I added several new tests which should prevent this from breaking in the future. I will move on to the other scenarios next and see how I make out.

TwitchBronBron commented 5 years ago

The issue for that project is that the manifest isn't in the root

This project requires that a manifest be at the root of your source project. We use the manifest location to help determine the relative location of other files/folders so we can put them in the right place in the target folder.

As a workaround, try putting manifest file at the root of your source project (it can be empty, we just look for the file with that name), and then overwrite it with one of your { "src":"flavors/flavor1/manifest", "dest" : "manifest" }, mappings during the build.

TwitchBronBron commented 5 years ago

Another thing I found...

"!components/test/*/.*",

Will only negate it if there are multiple subfolders there. If there is only one subfolder it will include it. Possible I don't know the proper expressions to use. Do you have a reference for it?

We're using the glob-all package to support negative globs. My first guess is that you have files without extensions in components/test, or several subfolders.

Try using "!components/test/**/*. (removed the .* because that is restricting the negative glob to only items with a period in the filename, meaning files without a period are not excluded).

kbunch commented 5 years ago

The issue for that project is that the manifest isn't in the root

This project requires that a manifest be at the root of your source project. We use the manifest location to help determine the relative location of other files/folders so we can put them in the right place in the target folder.

As a workaround, try putting manifest file at the root of your source project (it can be empty, we just look for the file with that name), and then overwrite it with one of your { "src":"flavors/flavor1/manifest", "dest" : "manifest" }, mappings during the build.

Are you saying put a blank stub manifest in the root just so the script has awareness? We can do that as a workaround, if that works. I would have thought rootDir was what was used for finding the root. If that couldn't be used, I'd suggest a projectRootDir (though that gets confusing) for the future. As is, making it reliant on that file makes it a little brittle and fixed.

TwitchBronBron commented 5 years ago

I'm just probably not fully understanding your project structure. The manifest needs to be at the top of rootDir. I was imagining you had the manifests in their own folder, something like this:

kbunch commented 5 years ago

@TwitchBronBron We have different flavors akin to Android. Flavors == different versions of an app that run off the same code (different resources, images, configs, etc). All of the manifests in the source exist in folders like flavor1/manifest, flavor2/manifest, etc. However, the launch.json defines their dest to be the root so they move to the base of the directory via roku deploy. The problem though is unless the manifest is in the root (in the source) all the paths for the other files get messed up.

TwitchBronBron commented 5 years ago

Appologies, but I'm still a little unsure of your project structure. Would you be able to give a more verbose example of your folder structure? Like the bullet list in my comment above, or a screenshot with an expanded tree view in vscode?

TwitchBronBron commented 5 years ago

@kbunch All of this functionality is baked into the roku-deploy npm package. I just released version 2.0.0-beta1 which addresses the initial issue, as well as removed the code that searched for the manifest file location. Could you do the following to test my changes:

  1. pull down the latest version of vscode-brightscript-language
  2. Open that folder in vscode
  3. Open a new terminal window inside vscode and run npm install roku-deploy@2.0.0-beta1.
  4. Run the extension by pressing F5 on your keyboard. At this point, a new vscode instance will appear, and you can test out the compiled version of vscode-brightscript-language with the new version of roku-deploy.

Let me know how it goes!

kbunch commented 5 years ago

@TwitchBronBron This worked, but then a new issue surfaced...

For the following path directive...

"src":"flavors/shared/resources",
"dest" : "resources"

the resources folder has subfolders ex: images/fhd/foo.png roku_deploy is putting foo.png at the root of resources rather than copying the subfolder structure over

TwitchBronBron commented 5 years ago

Thanks. I'll take a look.

TwitchBronBron commented 5 years ago

This was fixed in v1.6.0.