Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Migrate to Gradle DSL as a build tool #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

# Maven
target/
build
.gradle
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
Expand All @@ -18,3 +20,4 @@ buildNumber.properties

#Exclude CoverageHTMLReporter resources as they are managed by maven
src/main/resources/CoverageHTMLReporter/
/gradle.properties
28 changes: 16 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ env:
- DOCKER_CFG=$HOME/.docker
- DOCKER_REPO="utplsqlv3/oracledb"
- CACHE_DIR=$HOME/.cache
- MAVEN_HOME=/usr/local/maven
- MAVEN_CFG=$HOME/.m2
- DB_URL="127.0.0.1:1521:XE"
- DB_USER=app
- DB_PASS=app
Expand All @@ -33,30 +31,36 @@ env:
- UTPLSQL_VERSION="develop"
UTPLSQL_FILE="utPLSQL"

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $DOCKER_CFG
- $CACHE_DIR
- $MAVEN_CFG

install:
- bash .travis/maven_cfg.sh
- bash .travis/start_db.sh
- bash .travis/install_utplsql.sh
- bash .travis/install_demo_project.sh

before_script:
- cp .travis/settings.xml $MAVEN_CFG/settings.xml
- echo JAVA_HOME = ${JAVA_HOME}
- echo PATH = ${PATH}
- ls ${JAVA_HOME}
- java -version
- echo $JAVA_OPTS
- echo $GRADLE_OPTS
- echo JAVA_HOME = ${GRADLE_HOME}

script:
- mvn verify -B

before_deploy:
- if [ ! -z "$TRAVIS_TAG" ]; then VERSION=$(tr -d "/v/" <<<$TRAVIS_TAG); mvn org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion=${VERSION}; fi
- ./gradlew check

deploy:
- provider: script
script: mvn clean deploy -DskipTests=true -B -U -DtravisBuildNumber=$TRAVIS_BUILD_NUMBER
script: ./gradlew uploadArchives
skip_cleanup: true
on:
repository: utPLSQL/utPLSQL-java-api
Expand All @@ -65,7 +69,7 @@ deploy:
condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$"

- provider: script
script: mvn clean deploy -DskipTests=true -B -U -DtravisBuildNumber=$TRAVIS_BUILD_NUMBER
script: ./gradlew uploadArchives
skip_cleanup: true
on:
repository: utPLSQL/utPLSQL-java-api
Expand Down
51 changes: 0 additions & 51 deletions .travis/settings.tmpl.xml

This file was deleted.

55 changes: 0 additions & 55 deletions .travis/settings.xml

This file was deleted.

48 changes: 15 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,32 @@ https://maven.apache.org/install.html

### Oracle Maven Repository
The library uses OJDBC Driver to connect to the database, it's added as a maven dependency. To be able to download the Oracle dependencies, you need to configure your access to Oracle's Maven Repository:
Create file `gradle.properties` in the root directory of the repository and place OTN credentials there:
```properties
[email protected]
ORACLE_OTN_PASSWORD=password
```

http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9010
After configuring your access to Oracle's Maven repository, you will be able to successfully build this API by disabling integration tests.

*Sections 6.1 and 6.5 are the more important ones, and the only ones you need if you're using the latest Maven version.*
```bash
./gradlew build -x intTest
```

### Local database with utPLSQL and utPLSQL-demo-project

To usefully contribute you'll have to setup a local database with installed [latest utPLSQL v3](https://github.com/utPLSQL/utPLSQL) and [utPLSQL-demo-project](https://github.com/utPLSQL/utPLSQL-demo-project).
The demo-project will serve as your test user. See .travis.yml to see an example on how it can be installed.
By default tests are executed against `app/app` user of `localhost:1521/XE database`.

### Maven settings for utPLSQL-local profile

utPLSQL-java-api comes with a preconfigured profile "utPLSQL-local". This profile uses properties to set the correct
environment variables for DB_URL, DB_USER and DB_PASS which is needed to run the integration tests.
You can set these properties by adding the following to your Maven settings.xml:

```xml
<settings>
<!-- ... -->
<profiles>
<profile>
<id>utPLSQL-local</id>
<properties>
<dbUrl>localhost:1521/XE</dbUrl>
<dbUser>app</dbUser>
<dbPass>app</dbPass>
</properties>
</profile>
</profiles>

<activeProfiles>
<activeProfile>utPLSQL-local</activeProfile>
</activeProfiles>
</settings>
```

After configuring your access to Oracle's Maven repository, you will be able to successfully build this API.
If you want to run tests against another database you may set `DB_URL`, `DB_USER`, `DB_PASS` environment variables.

When you have local database set up you can run the complete build including integration tests by executing
```bash
cd utPLSQL-java-api
mvn clean package install
./gradlew build
```

### Skip the local database part

If you want to skip the local database part, just run ``mvn clean package install -DskipTests``.
You will still be able to run ``mvn test`` because integration tests are run in the ``verify``-phase.
If you want to skip the local database part, just run ``./gradlew test``.
You will be able to run ``./gradle test`` because integration tests are executed in the separate ``intTest`` task as part of overall ``check``.
Loading