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

Added support for custom versionFile name, instead of static version.… #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
37 changes: 23 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.gradle.publish:plugin-publish-plugin:0.10.1'
}
}

plugins {
id 'java-gradle-plugin'
id "com.gradle.plugin-publish" version "0.19.0"
}

apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'com.gradle.plugin-publish'

repositories {
jcenter()
mavenCentral()
mavenLocal()
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation gradleApi()
implementation localGroovy()
implementation 'nu.studer:java-ordered-properties:1.0.2'
implementation 'nu.studer:java-ordered-properties:1.0.4'

testImplementation gradleTestKit()
testImplementation group: 'junit', name: 'junit', version: '4.12'
Expand All @@ -39,16 +42,14 @@ ext {

// Library Repository
libraryName = 'GrabVer'
libraryVersion = '2.0.2'
libraryVersion = '2.0.3'
displayName = 'Gradle Automatic Build Versioning Plugin'
libraryDescription = 'An easy Gradle plugin that follows semver.org rules to automatically generate the Patch version, Build number and Code version, while Major, Minor and Pre-Release suffix remain under our control.'
libraryLabels = ['semver', 'version', 'versioning', 'build-versioning', 'automatic-versioning', 'intellij-idea', 'android-studio', 'auto-reset']
siteUrl = 'https://github.com/davideas/GrabVer'
gitUrl = 'https://github.com/davideas/GrabVer.git'
bintrayRepo = 'maven'
bintrayName = 'grabver'
publishedGroupId = 'eu.davidea'
id = publishedGroupId + '.' + bintrayName
id = publishedGroupId + '.' + 'grabver'

// License
licenseName = 'The Apache Software License, Version 2.0'
Expand All @@ -60,6 +61,18 @@ ext {
group publishedGroupId
version libraryVersion

tasks.withType(Copy).all { duplicatesStrategy 'exclude' }

/*
gradlePlugin {
plugins {
myPlugin {
id = 'eu.davidea.grabver'
implementationClass = 'eu.davidea.gradle.GrabVer'
}
}
}
*/
pluginBundle {
website = project.siteUrl
vcsUrl = project.gitUrl
Expand All @@ -75,12 +88,8 @@ pluginBundle {

mavenCoordinates {
groupId = publishedGroupId
artifactId = bintrayName
artifactId = "grabver"
version = libraryVersion
}
}

// To publish on Bintray: gradle bintrayUpload
if (gradle.getStartParameter().getTaskNames().contains("bintrayUpload")) {
apply from: 'jfrog-bintray-publish.gradle'
}
26 changes: 26 additions & 0 deletions gradle/docker.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import org.gradle.internal.os.OperatingSystem

task buildDocker(type: Exec) {
doFirst {
copy {
from "src/main/docker/"
into "build/docker/"
include "*"
}
copy {
from "${projectDir}/plugins"
into "build/docker/plugins"
include "*.zip"
}
copy {
from "build/libs"
into "build/docker/"
include "*.war"
}
}
if (OperatingSystem.current().isWindows()) {
commandLine 'cmd', '/c', 'docker', 'build', '-f', 'build/docker/Dockerfile', '-t', 'halos-jserver', 'build/docker/'
} else {
commandLine 'docker', 'build', '-f', 'build/docker/Dockerfile', '-t', 'halos-jserver', 'build/docker/'
}
}
75 changes: 75 additions & 0 deletions gradle/gatling.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
apply plugin: 'scala'

sourceSets {
test {
scala {
srcDirs = ['src/test/gatling/simulations']
output.classesDir = 'build/test-classes'
}
}
}

task manifestJar(dependsOn:'compileTestScala',type: Jar) {
dependsOn configurations.testCompile
archiveName 'gatlingBooter.jar'
doFirst {
manifest {
// uri is just needed for Windows-compatibility
attributes 'Class-Path': configurations.testCompile.files.collect{ project.uri(it) }.join(' ')
}
}
}

task gatlingRun(dependsOn:'manifestJar') {
group = 'gatling'
description = 'Run a single gatling simulation. By default the simulation is *.'

doLast {
def String gatlingSimulationClass = "*"
if (project.hasProperty('gatlingSimulationClass')) {
gatlingSimulationClass = project.property('gatlingSimulationClass')
}

createGatlingRunTask(gatlingSimulationClass).dependsOn('manifestJar').execute()
}
}

task gatlingRunAll(dependsOn: 'manifestJar') {
group = 'gatling'
description = 'Run all available gatling simulation.'

doLast {
FileTree tree = fileTree(dir: './src/test/gatling/simulations')
tree.include '**/*.scala'
tree.each {File file ->
def simulationClassName = file.name.replaceFirst(".scala", "")
createGatlingRunTask(simulationClassName).dependsOn('manifestJar').execute();
}
}
}

def createGatlingRunTask(def gatlingSimulationClassName) {
return tasks.create("gatlingRun${gatlingSimulationClassName}", JavaExec) {

standardInput = System.in

final def sourceSet = sourceSets.test

def String gatlingDataFolder = "$project.rootDir.absolutePath/src/test/gatling/data"
def String gatlingReportsFolder = "$project.buildDir.absolutePath/reports/gatling"
def String gatlingBodiesFolder = "$project.rootDir.absolutePath/src/test/gatling/bodies"
def String gatlingSimulationsFolder = "$project.rootDir.absolutePath/src/test/gatling/simulations"

classpath sourceSet.output + files(manifestJar.archivePath) + files("src/test/gatling/conf")
main = "io.gatling.app.Gatling"

environment GATLING_HOME:''

args '-df', gatlingDataFolder
args '-rf', gatlingReportsFolder
args '-bdf', gatlingBodiesFolder
args '-sf', gatlingSimulationsFolder
args '-m'
args '-s', gatlingSimulationClassName
}
}
3 changes: 3 additions & 0 deletions gradle/graphite.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies {
compile "io.dropwizard.metrics:metrics-graphite:${dropwizard_metrics_version}"
}
55 changes: 55 additions & 0 deletions gradle/liquibase.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import org.gradle.internal.os.OperatingSystem

configurations {
liquibase
}

dependencies {
liquibase "org.liquibase.ext:liquibase-hibernate5:${liquibase_hibernate5_version}"
}

if (OperatingSystem.current().isWindows()) {
task pathingLiquibaseJar(type: Jar) {
dependsOn configurations.liquibase
appendix = 'pathingLiquibase'

doFirst {
manifest {
attributes 'Class-Path':
sourceSets.main.runtimeClasspath.plus(configurations.liquibase)
.collect {
it.toURL().toString().replaceFirst(/file:\/+/, '/')
}.join(' ')
}
}
}
}

task liquibaseDiffChangelog(dependsOn: compileJava, type: JavaExec) {
group = "liquibase"

if (OperatingSystem.current().isWindows()) {
dependsOn pathingLiquibaseJar
doFirst {
classpath = files(pathingLiquibaseJar.archivePath)
}
} else {
classpath sourceSets.main.runtimeClasspath
classpath configurations.liquibase
}
main = "liquibase.integration.commandline.Main"

args "--changeLogFile=src/main/resources/config/liquibase/changelog/" + buildTimestamp() +"_changelog.xml"
args "--referenceUrl=hibernate:spring:com.mentor.dvt.halos.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
args "--username=halos"
args "--password="
args "--url=jdbc:h2:file:./target/h2db/db/halos"
args "--driver=org.h2.Driver"
args "diffChangeLog"
}

def buildTimestamp() {
def date = new Date()
def formattedDate = date.format('yyyyMMddHHmmss')
return formattedDate
}
5 changes: 5 additions & 0 deletions gradle/mapstruct.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apply plugin: "net.ltgt.apt"

dependencies {
annotationProcessor "org.mapstruct:mapstruct-processor:${mapstruct_version}"
}
73 changes: 73 additions & 0 deletions gradle/profile_cov.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apply plugin: 'org.springframework.boot'
apply plugin: 'com.moowork.node'

ext {
logbackLoglevel = "INFO"
}

dependencies {

}

def profiles = 'prod'
project.ext.profile=profiles
if (project.hasProperty('no-liquibase')) {
profiles += ',no-liquibase'
}

if (project.hasProperty('swagger')) {
profiles += ',swagger'
}

bootRun {
args = []
}


task buildFrontEnd (type:Copy, dependsOn: ['mod_permission' , ':jserver7:Instrument']) {
from '../jserver7/dist/jserver7'
into 'build/www'
}

task buildOSLCFrontEnd (type:Copy, dependsOn: ['mod_permission',':jserver7:buildprod', 'buildFrontEnd']) {
from 'build/www/oslc'
into 'src/main/resources/oslc/template'
}

war {
webAppDirName = 'build/www/'
}

processResources {
filesMatching('**/logback-spring.xml') {
filter {
it.replace('#logback.loglevel#', logbackLoglevel)
}
filter {
it.replace('#logback.loglevelConsole#', "CONSOLE")
}
}
filesMatching('**/application.yml') {
filter {
it.replace('#spring.profiles.active#', profiles)
}
filter {
it.replace('#application.version.buildDate#', project.buildDate)
}
filter {
it.replace('#application.version.clNumber#', project.clNumber)
}
filter {
it.replace('#application.version.buildNumber#', project.version)
}
filter {
it.replace('#application.version.viqVersion#', project.viqVersion)
}
filter {
it.replace('#application.version.viqPatchLevel#', project.viqPatchLevel)
}
}
}

processResources.dependsOn buildOSLCFrontEnd

Loading