forked from CS2103JAN2018-F09-B1/main
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some documentation about learning basics of gradle.
- Loading branch information
Showing
12 changed files
with
76 additions
and
315 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
 | ||
|
||
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. | ||
 | ||
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.