AY1920S2-CS2113T-T12-1 / tp

WhenFree
0 stars 5 forks source link

Project Template for the tP

This is a project template for a small CLI Java project. It uses Gradle for build automation and GitHub Actions for CI.

Setting up in Intellij

Prerequisites: JDK 11, update Intellij to the most recent version

  1. Open Intellij (if you are not in the welcome screen, click File > Close Project to close the existing project dialog first)
  2. Set up the correct JDK version
    1. Click Configure > Structure for New Projects and then Project Settings > Project > Project SDK
    2. If JDK 11 is listed in the drop down, select it. If it is not, click New... and select the directory where you installed JDK 11
    3. Click OK
  3. Click Import Project
  4. IMPORTANT: Locate the build.gradle file in the project directory, select it, and click OK
  5. If there are any further prompts, accept the defaults.
  6. After the set up is complete, you can locate the src/main/java/seedu/duke/Duke.java file, right-click it, and choose Run Duke.main(). If the setup is correct, you should see something like the below:

    > Task :compileJava
    > Task :processResources NO-SOURCE
    > Task :classes
    
    > Task :Duke.main()
    Hello from
    ____        _        
    |  _ \ _   _| | _____ 
    | | | | | | | |/ / _ \
    | |_| | |_| |   <  __/
    |____/ \__,_|_|\_\___|
    
    What is your name?

    Type some word and press enter to let the execution proceed to the end. Also note how Intellij is now using Gradle to run your code (you can make Intellij run the code without Gradle this way).

Build Automation using Gradle

This project is already configured to use Gradle. Read the following tutorial to learn how to use gradle to do tasks such as running tests, checking code against teh style rules, and generating the JAR file.

Testing

To run I/O redirection tests (aka Text ui tests), navigate to the text-ui-test and run the runtest(.bat/.sh) script.

To run JUnit tests (after you have added JUnit tests), you can run the test Gradle task.

CI using GitHub Actions

The project is already configured to use GitHub actions. When you push a commit to your fork or PR against an upstream repo, GitHub actions will run automatically to build and verify the product.