Gradle Project
Create a “starting” Gradle/Kotlin project and save it in Git.
Steps
Step 1. Getting working copy
First, you need to git clone
your GitLab repository to your local machine so that you have a working copy.
Open the web page for your GitLab project. Click on the Code
button, and copy the URL from Clone with HTTPS
.

In a terminal, on your computer, cd
to the location where you want to keep your source code. git clone
the URL.
$ git clone https://git.uwaterloo.ca/cs346/public/mm.git
In this example, we would have a folder named mm
that contains the contents of the Git repository.
Step 2. Create empty project
You will want to create a project directly in your Git working copy.
IntelliJ IDEA and Android Studio both fully support Gradle, and we can create a new project directly in the IDE.
Option A. Standalone Desktop
This project-type is suitable for a standalone desktop/JVM application. If you wish to build for multiple targets, see the KMP project below.
From the Splash screen in IntelliJ IDEA, select New Project
.

Choose Kotlin
from the list of project types, and provide the following:
Name
is the name of the folder that will contain your source code. e.g., “DesktopApp”.Location
is the location of your working copy (from Step 1 above).JDK
should point to your JDK installation.
Click Create
to proceed. If successful, IntelliJ IDEA will open into the main window to an empty project.

You should be able to click the Run
button in the toolbar to execute it.
Option B. Android
This project-type is suitable for a single-target application built for Android.
From the Splash screen in Android Studio, select New Project
.

Select Empty Activity
and Next
. A second screen will prompt you for project parameters.

Name
: Your application namePackage name
: A unique package name.Save location
: Your working copy location.Minimum SDK
: API 26 or later.Build configuration language
: Kotlin DSL.
Click Finish
and your project should be created.
You will need to add an Android Virtual Device for testing:
Tools
>Device Manager
+
,Create Virtual Device
and walk through the wizard to add an emulated device for testing.
Option C. KMP
This project-type is suitable for targetting two or more targets with your application e.g., Desktop/JVM + Android.
From the Splash screen in IntelliJ IDEA, select New Project
. Choose Kotlin Multiplatform
from the list of project types.

Provide the following:
Name
is the name of the folder that will contain your source code. e.g., “DesktopApp”.Location
is the location of your working copy (from Step 1 above).Group
is a reverse-DNS name, used for the top-level package name.Artifact
is the single-word name of the project.JDK
should point to your JDK installation (see toolchain).
Select the platforms that you wish to target, and make suer Share UI
is enabled (which will default to using Compose for all platforms). Click Create
to proceed. If successful, IntelliJ IDEA will open into the main window to an empty project.

You should be able to expand the folders to an individual target under the composeApp
folder, and click the Run
button in the toolbar to execute it.
Step 3. Update .gitignore
Check that you have a .gitignore
file in your source tree. It should include at a minimum .idea
and build/
folders.
Step 4. Push changes
Once you have confirmed that your project is working, you can commit and push the changes.
$ git add *
$ git commit -m "Initial commit"
$ git push
Step 5. Share with everyone
Your teammates should now be able to git clone
the project URL to get a copy of this repository.
Final Word
