Skip to content

Commit

Permalink
Some documentation about learning basics of gradle.
Browse files Browse the repository at this point in the history
  • Loading branch information
m133225 committed Aug 29, 2016
1 parent 386dffd commit 6fe47b3
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 315 deletions.
78 changes: 0 additions & 78 deletions docs/addressbook/CloudSimulation.md

This file was deleted.

22 changes: 0 additions & 22 deletions docs/addressbook/KeyboardShortcuts.md

This file was deleted.

37 changes: 37 additions & 0 deletions docs/devops/gradle/Configuring Travis CI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Travis CI

## Background
[Travis CI](https://travis-ci.org/) is a continuous integration platform for GitHub projects.

We are able to setup Travis CI such that it is able to run the projects' tests automatically whenever there is a new update. This is to ensure that existing functionality and features have not been broken with the new commits.

See [Travis CI Documentation](https://docs.travis-ci.com/) for more details.

## Setting up Travis CI

1. Fork the repository to your own organization.
2. Go to https://travis-ci.org/ and click `Sign in with GitHub`, then enter your GitHub account details if needed.
![Signing into Travis CI](../../images/signing_in.png)

3. Head to the travis [Accounts](https://travis-ci.org/profile) page, and find the travis CI switch for the forked repository.
- If repository cannot be found, click `Sync account`
4. Activate the travis CI switch.
![Activate the switch](../../images/flick_repository_switch.png)
5. Create the following `travis.yml` file in the main folder
```
language: java
matrix:
include:
- jdk: oraclejdk8
script: ./gradlew clean headless allTests coverage coveralls -i
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
addons:
apt:
packages:
- oracle-java8-installer
```

To see the CI in action, push a commit to the master branch!
39 changes: 39 additions & 0 deletions docs/devops/gradle/Introduction to Gradle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Gradle

## Background
[Gradle](https://gradle.org/) is an integration technology that addressbook uses for continuous integration:
- building the application JAR
- handling project dependencies
- testing (including coverage of test cases)
- checking for bugs & code style violations

We have wrapped our project in a [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), so that anyone who has cloned the repository can perform the same gradle tasks to manage dependencies or perform automated testing.
The gradle details are defined in `build.gradle`, which is a Groovy script. You can start learning them from [Build Scripts Basics](https://docs.gradle.org/current/userguide/tutorial_using_tasks.html).


## Gradle Tasks

There are default gradle tasks provided for each plugin (e.g. `java`, `checkstyle`) used in the gradle script. In addition, we are able to define custom gradle tasks if required. (See [Testing.md](./Testing.md))
See Gradle's [Java Plugin](https://docs.gradle.org/current/userguide/java_plugin.html)'s `Figure 45.1` to see the hierarchical overview of common gradle tasks.

### Managing Dependencies

To manage dependencies, we simply have to define [maven repositories](https://maven.apache.org/guides/introduction/introduction-to-repositories.html) in `build.gradle` to download each of them.
This will allow us to avoid adding dependencies into the repository.
- Consistent version of dependencies between developers
- If there are updates to the dependencies, developers will be able to download the latest versions (only if specified in the script) without having to update the script
- Less bloated repository

The following tasks are related to ensuring that the required dependencies are downloaded and used.

#### `compileJava`
`assemble`, `build`, `jar` are **examples** of tasks that will call `compileJava`.
This will check whether the project has the required dependencies to run the main program, and download any missing dependencies before compiling the classes.

See `build.gradle` -> `allprojects` -> `dependencies` -> `compile` for the list of dependencies required.

#### `compileTestJava`
`test` is an **example** of a task that will call `compileTestJava`.
This will check whether the project has the required dependencies to perform testing, and download any missing dependencies before compiling the test classes.

See `build.gradle` -> `allprojects` -> `dependencies` -> `testCompile` for the list of dependencies required.
File renamed without changes.
Binary file removed docs/images/Release Cycle.jpg
Binary file not shown.
Binary file added docs/images/flick_repository_switch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/signing_in.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 0 additions & 40 deletions docs/releases/Automatic Update Architecture.md

This file was deleted.

2 changes: 0 additions & 2 deletions docs/releases/Launcher.md

This file was deleted.

Loading

0 comments on commit 6fe47b3

Please sign in to comment.