Make launch.json less confusing #345
TwitchBronBron
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Our launch config options are confusing to newcomers, sometimes even to seasoned users of our extension. It's time for us to rethink the patterns in order to help everyone better use the tools.
Part of the confusion is around
rootDir
,sourceDirs
, and the concept of a staging dir/outdir. in scenario 1,rootDir
points to your code, and that's what should be deployed. But for scenario 2 and 3,rootDir
is actually the "staging directory" for your build process, yet it's the start of the extension's process. It all gets very confusing. So, I have a proposal for simplifying and clarifying our configs. Here are the patterns:Overall, i propose the following changes to launch.json:
sourceDirs
sources
andstagingDir
You won't be able to use
rootDir
andfiles
at the same time assources
. Hopefully this can be enforced in json schema, but if not possible, it'll definitely be enforced at launch time and fail early.I do not expect this to be a breaking change, as we should be able to support the old patterns and the new patterns at the same time, but we will see once I get into it.
1. Project with no custom build process
This is currently supported by our extension, an we're not making changes to this pattern. Continue using
rootDir
for the root of your project, and specify an array offiles
for what files should be included in the zip. In this situation, users should not specify astagingDir
so the extension knows it needs to copy to staging. If you specify astagingDir
, it is assumed that you're copying the files there yourself...so don't use it in this scenario.2. custom copy-and-paste build process.
This requires that line numbers and project-relative paths remain unchanged.
We currently support this concept, but it's confusing. You need to use
sourceDirs
to point to source folders, androotDir
points to the OUTPUT folder. Instead, we should have a different pattern for this.The changes:
sourceDirs
since "dirs" doesn't accurately describe its contents anymoresources
property to specify paths to source code{src;dest}
objects that allow mapping source folders to differently-named dest foldersstagingDir
property which is where the engineer will write out their generated code. This is a required property.Example scenario 1
The "build" prelaunch task copies the
src
folder todist
and then replaces values indist/source/config.brs
with environment-specific values.Example scenario 2
The "build" prelaunch task merges "Base" and "Flavor1" projects into the "dist" folder, copies the "swrve-roku-sdk" folder into "components/SwrveComponents", and renames
runners/main-dev.brs
tosource/main.brs
.3. sourcemap-enabled custom build (i.e. BrighterScript)
In this scenario, the tool generates sourcemaps for every transformation, which means we can use sourcemaps to translate source files to staging, and then also staging locations back to source locations. Since sourcemaps are generated, "sources" should be omitted as the sourcemaps will be used exclusively.
Beta Was this translation helpful? Give feedback.
All reactions