Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Add more development gradle tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
fieldju committed Feb 21, 2017
2 parents 6091e5e + 33830ba commit 1827fb5
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,5 @@ cms-local-overrides.conf

# embedded mysql stuff
/target/
/.proxy-dash.pid.lock
/.vault-sql.pid.lock
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'embedded-mysql'
apply plugin: 'com.wiredforcode.spawn'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
2 changes: 2 additions & 0 deletions gradle/buildscript.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

repositories {
jcenter()
maven { url 'http://dl.bintray.com/vermeulen-mp/gradle-plugins' }
}

dependencies {
Expand All @@ -26,4 +27,5 @@ dependencies {
classpath group: 'com.typesafe', name: 'config', version: '1.3.1'
classpath group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
classpath 'com.github.michaelruocco:embedded-mysql-plugin:2.1.4'
classpath 'com.wiredforcode:gradle-spawn-plugin:0.8.1'
}
42 changes: 38 additions & 4 deletions gradle/develop.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,51 @@ import org.apache.tools.ant.taskdefs.condition.Os
import groovyx.net.http.RESTClient
import static groovyx.net.http.ContentType.*

def dashboardRelease = 'v0.9.0'
def vaultVersion = "0.6.4"

buildscript {
apply from: file('gradle/buildscript.gradle'), to: buildscript
}

task start() {
doLast {
logger.lifecycle("Starting reverse proxy, dashboard, Vault and MySQL followed by CMS")
}

finalizedBy 'startProxyAndDashboardInBackground'
}

task startProxyAndDashboardInBackground(type: SpawnProcessTask) {
command "${project.getRootDir().absolutePath}${File.separator}gradlew runDashboardAndReverseProxy --stacktrace"
ready 'express server listing on port 8000'
pidLockFileName '.proxy-dash.pid.lock'

finalizedBy 'startVaultAndMySQLInBackground'
}

task startVaultAndMySQLInBackground(type: SpawnProcessTask) {
command "${project.getRootDir().absolutePath}${File.separator}gradlew runVaultAndMySQL --stacktrace"
ready 'core: post-unseal setup complete'
pidLockFileName '.vault-sql.pid.lock'
}

task stop () {
finalizedBy 'stopProxyAndDashboardBackgroundThread', 'stopVaultAndMySQLBackgroundThread'
}

task stopProxyAndDashboardBackgroundThread(type: KillProcessTask) {
pidLockFileName '.proxy-dash.pid.lock'
}

task stopVaultAndMySQLBackgroundThread(type: KillProcessTask) {
pidLockFileName '.vault-sql.pid.lock'
}

task downloadDashboard() {
group 'local development'
description 'Downloads the dashboard artifact from github releases'

def dashboardRelease = 'v0.8.0'

doFirst {
project.buildDir.mkdirs()
}
Expand Down Expand Up @@ -76,7 +111,6 @@ node {
/**
* Determine which dist of Vault to use
*/
def vaultVersion = "0.6.4"
def vaultBinMap = [
"${Os.FAMILY_WINDOWS}": "https://releases.hashicorp.com/vault/${vaultVersion}/vault_${vaultVersion}_windows_amd64.zip",
"${Os.FAMILY_MAC}" : "https://releases.hashicorp.com/vault/${vaultVersion}/vault_${vaultVersion}_darwin_amd64.zip",
Expand Down Expand Up @@ -176,7 +210,7 @@ def getTokenFromVaultLog() {
/**
* Runs the CMS web server
*/
task runCMS(dependsOn: [antReplace, assemble]) {
task runCMS(dependsOn: [antReplace, assemble], ) {
group 'local development'
description 'Runs CMS assuming that the runVaultAndMySQL task has been executed and is running in a seperate ' +
'thread, configuring CMS automatically to integrate with the local in mem Vault'
Expand Down

0 comments on commit 1827fb5

Please sign in to comment.