README.md 2.89 KB
Newer Older
Christian Meyer's avatar
Christian Meyer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Gradle build scripts developed in zmt-bremen's department of Theoretical Ecology & Modelling. For more information about Gradle visit https://gradle.org/.

# General
## IDE Support    
To generate .project and .classpath files for developing in the Eclipse IDE enter:
```shell
./gradlew eclipse
```
This will also generate a launch configuration for simulations to run them via GUI.

### Eclipse Support for Gradle
Gradle is supported by Eclipse via Buildship:
https://github.com/eclipse/buildship/

## Versioning
Versioning is done by tagging via git. The current version name is generated from the last git tag. If the current version is not tagged, a short version of the commit hash is added.

## Credentials
You can store your credentials for the dochost server in encrypted form:
```shell
./gradlew addCredentials --key dochostUser --value <username>
./gradlew addCredentials --key dochostPw --value <password>
```
Credentials are stored in `~/.gradle/gradle.encrypted.properties`. This will save you from entering them every time you want to publish or deploy.

For more information about the credentials plugin visit https://github.com/etiennestuder/gradle-credentials-plugin.

## Maven Repository
29
There is a maven repository on the dochost server within the `maven2/` subdirectory. Libraries are stored there and fetched by Gradle when they are required. See the [Publishing entry](#publishing) for more info.
Christian Meyer's avatar
Christian Meyer committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

## Javadoc
Javadoc files of the current project can be build and stored on dochost's `javadoc/` subdirectory:
```
./gradlew deployJavadoc
```
Only the recent version is stored and outdated files will be overwritten.

# Simulations
To make your simulation build with the zmt-build add the following to your `build.gradle` file:
```groovy
buildscript {
    repositories {
        maven {
            url "http://dochost.intra.zmt/maven2/"
        }
    }
    
    dependencies {
        classpath 'de.zmt:zmt-build:1+'
    }
}
apply plugin: 'de.zmt.simulation'
```

## Distribution
You can build a distribution by running the following in the project root directory:
```shell
./gradlew installDist
```

Build files are then stored in the build subdirectory. The file name of the distribution is generated from the project name and the current version. A CHANGES file will be generated containing all git tags with their messages.

## Deployment
Distributions can be uploaded to the `dist/` subdirectory on 'dochost' server:
```shell
./gradlew deployZip
```

# Libraries
To make your simulation build with the zmt-build add the following to your `build.gradle` file:
```groovy
buildscript {
    repositories {
        maven {
            url "http://dochost.intra.zmt/maven2/"
        }
    }
    
    dependencies {
        classpath 'de.zmt:zmt-build:1+'
    }
}
apply plugin: 'de.zmt.library'
```
## Publishing
Libraries can be published to dochost:
```
./gradlew publish
```
After that, they will be accessible by Gradle when required.