Hi all! I'm creating a web-application with Kotlin...
# announcements
b
Hi all! I'm creating a web-application with Kotlin/JS. I want the generated .js files to be automatically copied into a directory whenever the modules successfully builds. Is there a clean and easy way? Couldn't find such a feature in IntelliJ, is it easier to create a bash script to copy the files whenever they change?
g
Gradle provides the complete set of features to do that (file manipulation tasks, up-to-date checks)
b
So my only option is to use Gradle? Was hoping I wouldn't have to, building with Gradle seems immensely slow compared to building with "just IntelliJ"...
g
With idea you can write something manually, some script and configure build to run it before build itself
Actually all new Kotlin js build features (dce, incremental compilation) available on Gradle first, so maybe Gradle it's still a bit good choice, especially if you project will be bigger and you want to use CI/CD, it would be hard to do with Idea build system
b
@gildor How can I configure IntelliJ to run scripts before/after a build?
g
Open run configuration settings
Depending on run configuration type you have different settings, but gradle and idea run types support “Before launch” config
b
But that's a run configuration. I want the files to copied specifically on build, because the project is automatically built...
g
run configuration it’s build too. It’s how build configurations called in Idea
or do you use “Build project”?
b
I've enabled the option "Build project automatically", so IntelliJ builds the project. I'm not using anything other than that atm. I've created a Run/Debug configuration with a script that copies the file, but to execute this I have to RUN the configuration.
I get that IntelliJ builds the project (and is able to execute scripts) when I'm running the project. But I really don't see how configuring the Run/Debug enables me to automatically execute scripts when building the project (which happens automatically)

https://i.imgur.com/eHLig8u.jpg

That's the Run/Debug configurations dialog. As you can see I've added a configuration to execute the script that I want. But still, I'm forced to RUN the project to use this configuration, right?
@gildor...
g
Hm. I’m not sure about “Build project automatically” feature, probably you cannot do that. Not sure. I would just use Gradle for this