Skip to content
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

Gradle #233

Merged
merged 5 commits into from
Sep 21, 2020
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
66 changes: 25 additions & 41 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,47 @@
# Java Maven CircleCI 2.0 configuration file
# Java Gradle CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: maven:3.6-amazoncorretto-8

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
- image: cimg/openjdk:8.0

working_directory: ~/repo

environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m

steps:
- checkout

# Download and cache dependencies
- restore_cache:
key: v1-gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: mvn compile dependency:go-offline

- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}

# run tests!
- run:
name: Verify BDK 2.0
command: mvn verify -P2.0

# when lock file changes, use increasingly general patterns to restore cache
- gradle-repo-v1-{{ .Branch }}-{{ checksum "build.gradle" }}
- gradle-repo-v1-{{ .Branch }}-
- gradle-repo-v1-
# run tests!
- run:
name: Verify legacy projects
command: mvn verify -Plegacy
name: Build
# Jacoco does not support incremental build so we don't run it automatically with check
command: ./gradlew build jacocoTestReport jacocoTestCoverageVerification

- run:
name: Save test results
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
when: always

- run:
name: Save code coverage BDK 2.0
name: Save code coverage
command: |
mkdir -p ~/code-coverage/jacoco/symphony-bdk-core/
find . -type f -regex ".*/symphony-bdk-core/target/jacoco.exec" -exec cp {} ~/code-coverage/jacoco/symphony-bdk-core/ \;
find . -type d -regex ".*/symphony-bdk-core/target/jacoco-report" -exec cp -r {} ~/code-coverage/jacoco/symphony-bdk-core/ \;

- run:
name: Save code coverage Legacy SDK
command: |
mkdir -p ~/code-coverage/jacoco/symphony-api-client-java/
find . -type f -regex ".*/symphony-api-client-java/target/jacoco.exec" -exec cp {} ~/code-coverage/jacoco/symphony-api-client-java/ \;
find . -type d -regex ".*/symphony-api-client-java/target/jacoco-report" -exec cp -r {} ~/code-coverage/jacoco/symphony-api-client-java/ \;
mkdir -p ~/code-coverage/jacoco/
find . -type d -regex ".*/build/reports/jacoco/test/html" -exec cp --parents -r {} ~/code-coverage/jacoco/ \;
when: always

- store_test_results:
path: ~/test-results
Expand All @@ -76,3 +52,11 @@ jobs:
- store_artifacts:
path: ~/code-coverage/jacoco

- save_cache:
paths:
- ~/.gradle/wrapper
key: v1-gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- save_cache:
paths:
- ~/.gradle
key: gradle-repo-v1-{{ .Branch }}-{{ checksum "build.gradle" }}
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

target/
*!.mvn/wrapper/maven-wrapper.jar
*.jar

target/

build/
.gradle/
!gradle/wrapper/gradle-wrapper.jar

.DS_Store
settings.xml
datafeed.id
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class BotApplication {
```

## Build from Source
The Symphony BDK uses a [Maven](https://maven.apache.org/) build. The instructions below use the [Maven Wrapper](https://github.com/takari/maven-wrapper)
The Symphony BDK uses a [Gradle](https://docs.gradle.org/) build. The instructions below use the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html)
from the root of the source tree. The wrapper script serves as a cross-platform, self-contained bootstrap mechanism for
the build system.

Expand All @@ -42,12 +42,12 @@ Be sure that your `JAVA_HOME` environment variable points to the `jdk1.8+` folde
### Build from the Command Line
To compile, test and build all jars, use:
```shell script
./mvnw clean package
./gradlew
```
### Install in local Maven repository
To install all Symphony BDK jars in your local Maven repository, use:
```shell script
./mvnw clean install
./gradlew publishToMavenLocal
```

## License
Expand Down
64 changes: 64 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
allprojects {
group = 'com.symphony.platformsolutions'
version = '1.2.0-SNAPSHOT'

defaultTasks 'build'
}

subprojects {
apply plugin: 'signing'
}

configure(subprojects.findAll { it.name != 'symphony-bdk-bom' }) {
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'

repositories {
mavenCentral()
}

publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}

signing {
sign publishing.publications.maven
}

sourceCompatibility = '1.8'

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}

java {
withJavadocJar()
withSourcesJar()
}

jar {
manifest {
attributes("Implementation-Title": project.name,
"Implementation-Version": project.version)
}
}

test {
useJUnitPlatform()
}

dependencies {
implementation platform(project(':symphony-bdk-bom'))
annotationProcessor platform(project(':symphony-bdk-bom'))
testAnnotationProcessor platform(project(':symphony-bdk-bom'))
}
}
2 changes: 1 addition & 1 deletion docs/internal/bdk-architecture.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BDK2.0 - Project Architecture

The BDK project is composed in a set of different Maven modules. The approach consists in having one module per BDK
The BDK project is composed in a set of different modules. The approach consists in having one module per BDK
"layer".

## The layers
Expand Down
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading