Permalink
Browse files

Migrate build process to gradle

  • Loading branch information...
wallner committed Aug 28, 2016
1 parent 2f40840 commit 31450d65b7b56348c7aca288d319cbb2e821b812
View
@@ -1,119 +1,12 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### Java template
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
!/gradle/wrapper/gradle-wrapper.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Eclipse template
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
/build/
# OSIAM dev
.osiam/
View
@@ -0,0 +1,208 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.1.RELEASE")
}
}
plugins {
id 'antlr'
id 'java'
id 'groovy'
id 'war'
id 'jacoco'
id 'maven'
id 'maven-publish'
id 'com.github.hierynomus.license' version '0.13.1'
id 'com.github.kt3k.coveralls' version '2.6.3'
id 'com.jfrog.bintray' version '1.7.2'
}
apply plugin: 'spring-boot'
group = 'org.osiam'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
publishing {
publications {
OsiamPublication(MavenPublication) {
from components.web
groupId 'org.osiam'
artifactId 'osiam'
if (project.version == 'latest') {
version 'latest-SNAPSHOT'
} else {
version project.version
}
}
}
repositories {
maven {
name 'JFrog OSS snapshot repository'
if (project.version == 'latest') {
url 'https://oss.jfrog.org/artifactory/oss-snapshot-local'
} else {
url 'https://api.bintray.com/maven/osiam/OSIAM/org.osiam:osiam/;publish=1'
}
credentials {
username System.getenv('BINTRAY_USER')
password System.getenv('BINTRAY_KEY')
}
}
}
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publish = true
override = true
filesSpec {
from 'build/libs/osiam.war'
into "osiam/${project.version}"
rename '(.+)\\.(.+)', "\$1-${project.version}.\$2"
}
pkg {
repo = 'downloads'
name = 'osiam'
userOrg = 'osiam'
licenses = ['MIT']
vcsUrl = 'https://github.com/osiam/osiam.git'
version {
name = project.version
released = new Date()
gpg {
sign = true
passphrase = System.getenv('GPG_PASSPHRASE')
}
}
}
}
war {
archiveName = 'osiam.war'
version = project.version
}
springBoot {
executable = true
}
ext {
generatedSourcesDir = new File("${projectDir}/build/generated")
generatedSourcesJavaDir = new File(generatedSourcesDir, "/java")
}
configurations {
jpaModelGen
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.security.oauth:spring-security-oauth2'
compile 'org.springframework.security:spring-security-ldap'
compile 'org.springframework.boot:spring-boot-devtools'
compile 'org.flywaydb:flyway-core'
compile 'org.postgresql:postgresql'
compile 'mysql:mysql-connector-java'
compile 'com.h2database:h2'
compile 'com.zaxxer:HikariCP'
compile 'joda-time:joda-time'
compile 'org.aspectj:aspectjrt'
compile 'org.aspectj:aspectjweaver'
compile 'org.hibernate:hibernate-validator'
compile 'org.apache.tika:tika-core:1.13'
compile 'com.google.guava:guava:19.0'
compile 'org.antlr:antlr4:4.5.3'
testCompile 'org.codehaus.groovy:groovy-all'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.spockframework:spock-core'
testCompile 'cglib:cglib-nodep:3.2.4'
testCompile 'org.objenesis:objenesis:2.4'
testCompile 'com.jayway.restassured:json-path:2.9.0'
testCompile 'com.jayway.jsonpath:json-path:2.2.0'
testCompile 'nl.jqno.equalsverifier:equalsverifier:1.7.8'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
antlr 'org.antlr:antlr4:4.5.3'
jpaModelGen 'org.hibernate:hibernate-jpamodelgen'
}
sourceSets {
main {
java {
srcDir generatedSourcesJavaDir
}
}
}
task generateJPAMetaModel(type: JavaCompile, group: 'build', description: 'Generate JPA Meta Models') {
source = sourceSets.main.java
outputs.dir generatedSourcesJavaDir
destinationDir = generatedSourcesJavaDir
dependencyCacheDir = compileJava.dependencyCacheDir
classpath = configurations.compile + configurations.jpaModelGen
options.compilerArgs = [
"-proc:only"
]
}
generateGrammarSource {
outputDirectory = generatedSourcesJavaDir
arguments += ["-visitor", "-long-messages"]
}
compileJava {
dependsOn generateJPAMetaModel
}
license {
mapping {
g4 = 'JAVADOC_STYLE'
}
excludes(["**/*_.java", "**/LogicalOperatorRules*.java", "**/*.json"])
}
jacoco {
toolVersion = "0.7.7.201606060606"
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'**/ * _ * ',
'**/LogicalOperatorRules*'
])
})
}
}
check.dependsOn jacocoTestReport
tasks.coveralls {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'
dependsOn jacocoTestReport
onlyIf {
System.env.'COVERALLS_REPO_TOKEN'
}
}
View
@@ -4,37 +4,33 @@ machine:
dependencies:
override:
- mvn -U dependency:resolve dependency:resolve-plugins
- curl http://www.jpm4j.org/install/script > jpmInstall.sh
- sudo sh jpmInstall.sh
- sudo jpm install com.codacy:codacy-coverage-reporter:assembly
- ./gradlew dependencies
test:
pre:
- test -z ${CIRCLE_TAG} || mvn versions:set -DnewVersion=${CIRCLE_TAG}
override:
- mvn verify
- test -z ${CIRCLE_TAG} && ./gradlew check || ./gradlew -Pversion=${CIRCLE_TAG} check
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/target/.*-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
- cp -r target/coverage-reports/jacoco/ $CIRCLE_ARTIFACTS
- test -z $CODACY_PROJECT_TOKEN || codacy-coverage-reporter -l Java -r target/coverage-reports/jacoco/jacoco.xml --projectToken $CODACY_PROJECT_TOKEN
- test -z $COVERALLS_REPO_TOKEN || mvn coveralls:report -DrepoToken=$COVERALLS_REPO_TOKEN
- find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
- cp -r build/reports/jacoco/ $CIRCLE_ARTIFACTS
- test -z $CODACY_PROJECT_TOKEN || codacy-coverage-reporter -l Java -r build/reports/jacoco/test/jacocoTestReport.xml --projectToken $CODACY_PROJECT_TOKEN
- test -z $COVERALLS_REPO_TOKEN || ./gradlew coveralls
deployment:
staging:
branch: master
commands:
- wget https://raw.githubusercontent.com/osiam/circleci/master/settings.xml
- mvn deploy:deploy-file -DrepositoryId=snapshots -Durl=https://oss.jfrog.org/artifactory/oss-snapshot-local -s settings.xml
- curl -T target/osiam.war -u${BINTRAY_USER}:${BINTRAY_KEY} -H "X-Bintray-Package:osiam" -H "X-Bintray-Version:latest" -H "X-Bintray-Publish:1" -H "X-Bintray-Override:1" https://api.bintray.com/content/osiam/downloads/osiam/latest/osiam-latest.war
- ./gradlew assemble publish
- ./gradlew bintrayUpload
- curl -X POST https://circleci.com/api/v1/project/osiam/connector4java-integration-tests/tree/master?circle-token=$CIRCLE_TOKEN
- >
curl -H "Content-Type: application/json" --data '{"source_type": "Branch", "source_name": "master"}' -X POST https://registry.hub.docker.com/u/osiamorg/osiam/trigger/${DOCKER_HUB_TRIGGER_TOKEN}/
release:
tag: /.*/
owner: osiam
commands:
- wget https://raw.githubusercontent.com/osiam/circleci/master/settings.xml
- mvn deploy:deploy-file -DrepositoryId=releases -Durl="https://api.bintray.com/maven/osiam/OSIAM/org.osiam:osiam/;publish=1" -s settings.xml
- curl -T target/osiam.war -u${BINTRAY_USER}:${BINTRAY_KEY} -H "X-Bintray-Package:osiam" -H "X-Bintray-Version:${CIRCLE_TAG}" -H "X-Bintray-Publish:1" -H "X-Bintray-Override:1" https://api.bintray.com/content/osiam/downloads/osiam/${CIRCLE_TAG}/osiam-${CIRCLE_TAG}.war
- ./gradlew -Pversion=${CIRCLE_TAG} assemble publish
- ./gradlew -Pversion=${CIRCLE_TAG} bintrayUpload
View
@@ -0,0 +1 @@
version = latest
Binary file not shown.
@@ -0,0 +1,6 @@
#Thu Oct 27 23:26:06 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
Oops, something went wrong.

0 comments on commit 31450d6

Please sign in to comment.