
== Build the application

[listing.terminal.sample-command]
----
\$ ./gradlew build

BUILD SUCCESSFUL in 0s
${tasksExecuted.raw} actionable tasks: ${tasksExecuted.raw} executed
----

NOTE: The first time you run the wrapper script, `gradlew`, there may be a delay while that version of `gradle` is downloaded and stored locally in your `~/.gradle/wrapper/dists` folder.

The `build` task compiles the ${language.raw} sources, links the object files, and runs the tests.
It also packages the main and test applications for distribution on other systems.
The `installDebug` and `installTest` tasks, which both run as part of `build`, copy the executable and generates a shell script for executing the application.
The following shows the content of the `build/install` folder:

[listing.terminal.sample-command]
----
./${subprojectName.raw}/build/install
├── main
│   └── debug
│       ├── app      // <1>
│       └── lib
│           └── app  // <2>
└── test
    ├── appTest      // <1>
    └── lib
        └── appTest  // <3>
----
<1> The script for executing the application variant
<2> The main executable binary (debug variant)
<3> The test executable binary

NOTE: When a build has dependencies, the dependent libraries are also copied into the installation folder.
The shell scripts properly configure the library path so the package can be relocated.

NOTE: Dependencies on other projects isn't covered in this guide.
To learn more about this subject, have a look at the https://github.com/gradle/native-samples/tree/master/cpp/transitive-dependencies[transitive dependency sample] for a demonstration.

NOTE: Gradle integrates with several IDEs: link:{userManualPath}/visual_studio_plugin.html[Visual Studio], link:{userManualPath}/xcode_plugin.html[Xcode] and https://www.jetbrains.com/help/clion/gradle-support.html[Clion].
To learn more, have a look at their respective linked documentation to configure those IDE integration in your project.

== Run the application

Look inside the `build` folder and you will notice the appearance of an `exe` folder.
By convention, Gradle will place all applications in subfolders named according to the component name.
In this case, you will find your assembled executable in `build/exe/main/debug` and it will be called `${subprojectName.raw}` (or `${subprojectName.raw}.exe` under Windows).

Now run your newly built executable.

[listing.terminal.sample-command]
----
\$ ./${subprojectName.raw}/build/exe/main/debug/${subprojectName.raw}
Hello, World!
----
