bubblewrap icon indicating copy to clipboard operation
bubblewrap copied to clipboard

Allow specifying a different output directory than app/?

Open JoshuaKGoldberg opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe. I'm trying to use bubblewrap on an existing project that, per Rails conventions, has .rb files in folders under app/ such as app/models. This conflicts with the default bubblewrap build outputs under app/build and app/src.

Describe the solution you'd like Can we have a flag like --outDir to output to a different location?

bubblewrap build --outDir built

Describe alternatives you've considered Moving the original app/ to a temp dir before build, then moving the build app/ to another temp folder, and moving the original app/ contents back. I don't like this 😄

JoshuaKGoldberg avatar Jul 30 '21 14:07 JoshuaKGoldberg

You should be able to modify your gradle.properties and specify a different build directory, as described here: https://stackoverflow.com/questions/13915351/change-gradles-working-directory-when-compiling-a-groovy-project

We could add this to twa-manifest.json so that gradle.properties is generated with the correct value when the project is regenerated.

andreban avatar Jul 30 '21 15:07 andreban

+1, having to dive into Gradle for a web project is not something I'd expect to have to do 😉

JoshuaKGoldberg avatar Jul 30 '21 15:07 JoshuaKGoldberg

The goal is that you shouldn't have to.

Generally, you shouldn't have to care about the app folder too. I wonder if the reason is that you are using it in an existing project? Can you provide more details?

andreban avatar Jul 30 '21 16:07 andreban

Yup! It's an existing Rails project that has app/, config/, and lib/ directories for Ruby code, alongside a webpack/ directory for frontend code.

JoshuaKGoldberg avatar Jul 30 '21 16:07 JoshuaKGoldberg

My solution was to create a custom npm script in the package.json. The script could cd into another directory other than app/ and then run the command. It would look something like this:

"scripts": {
    "build-android": "cd ./android && bubblewrap init ..."
}

You could do the same thing with bubblewrap build or combine them into one command. Then all I have to do is run npm run build-android from app/ and it'll do the rest. Or since you're using Rails, you could use the rails equivalent of these custom commands.

joshua-holmes avatar Jul 29 '22 03:07 joshua-holmes

Closing out my old issues I no longer have context on. If anybody else is still seeing this, I'd encourage you to file a new issue with more information. Cheers!

JoshuaKGoldberg avatar Feb 17 '24 20:02 JoshuaKGoldberg