Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zaharchenko committed Dec 10, 2018
0 parents commit 07f9131
Show file tree
Hide file tree
Showing 49 changed files with 1,822 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.gradle
.studio
*.ipr
*.iml
*.iws
build/*
deploy/*
modules/*/build/*
out
test-run
247 changes: 247 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@

buildscript {
ext.cubaVersion = '6.10.4'
repositories {

mavenLocal()
maven {
url 'https://repo.cuba-platform.com/content/groups/work'
credentials {
username(rootProject.hasProperty('repoUser') ? rootProject['repoUser'] : 'cuba')
password(rootProject.hasProperty('repoPass') ? rootProject['repoPass'] : 'cuba123')
}
}

}
dependencies {
classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion"
}
}

def modulePrefix = 'grapejs'

def globalModule = project(":${modulePrefix}-global")
def coreModule = project(":${modulePrefix}-core")
def webModule = project(":${modulePrefix}-web")
def webThemesModule = project(":${modulePrefix}-web-themes")

def servletApi = 'javax.servlet:javax.servlet-api:3.1.0'


apply(plugin: 'idea')
apply(plugin: 'cuba')

cuba {
artifact {
group = 'com.haulmont.addon.grapesjs'
version = '0.1'
isSnapshot = true
}
tomcat {
dir = "$project.rootDir/deploy/tomcat"
}
}

dependencies {
appComponent("com.haulmont.cuba:cuba-global:$cubaVersion")

}

def hsql = 'org.hsqldb:hsqldb:2.2.9'

configure([globalModule, coreModule, webModule]) {
apply(plugin: 'java')
apply(plugin: 'maven')
apply(plugin: 'idea')
apply(plugin: 'cuba')

dependencies {
testCompile('junit:junit:4.12')
}

task sourceJar(type: Jar) {
from file('src')
classifier = 'sources'
}

artifacts {
archives sourceJar
}
}

configure(globalModule) {
entitiesEnhancing {
main {
enabled = true
}
}

jar {
manifest {
attributes('App-Component-Id': cuba.artifact.group)
attributes('App-Component-Version': cuba.artifact.version + (cuba.artifact.isSnapshot ? '-SNAPSHOT' : ''))
}
}


}

configure(coreModule) {

configurations {
jdbc
dbscripts
}

dependencies {
compile(globalModule)
provided(servletApi)
jdbc(hsql)
testRuntime(hsql)

}

task cleanConf(description: 'Cleans up conf directory') {
doLast {
def dir = new File(cuba.tomcat.dir, "/conf/${modulePrefix}-core")
if (dir.isDirectory()) {
ant.delete(includeemptydirs: true) {
fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
}
}
}
}

task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
appName = "${modulePrefix}-core"
appJars(modulePrefix + '-global', modulePrefix + '-core')
}

task createDb(dependsOn: assembleDbScripts, description: 'Creates local database', type: CubaDbCreation) {
dbms = 'hsql'
host = 'localhost'
dbName = 'grapesjs'
dbUser = 'sa'
dbPassword = ''
}

task updateDb(dependsOn: assembleDbScripts, description: 'Updates local database', type: CubaDbUpdate) {
dbms = 'hsql'
host = 'localhost'
dbName = 'grapesjs'
dbUser = 'sa'
dbPassword = ''
}
}

configure(webModule) {
configurations {
webcontent
}

dependencies {
provided(servletApi)
compile(globalModule)
// Webjars
compile('org.webjars.npm:grapesjs:0.14.43'){
exclude group: 'org.webjars.npm', module: 'keymaster'
}
compile('org.webjars.bower:keymaster:1.6.3')
compile('org.webjars.npm:toastr:2.1.4')
compile('org.webjars.npm:grapesjs-plugin-ckeditor:0.0.9')
compile('org.webjars.npm:grapesjs-custom-code:0.1.1')
compile('org.webjars.npm:grapesjs-tabs:0.1.2')
compile('org.webjars.npm:grapesjs-touch:0.1.1')
compile('org.webjars.npm:grapesjs-parser-postcss:0.1.1')
compile('org.webjars.npm:grapesjs-preset-webpage:0.1.10')
compile('org.webjars:grapesjs-ckeditor:4.11.1')
compile('org.webjars:ckeditor:4.11.1')

}

task webArchive(type: Zip) {
from file("$buildDir/web")
from file('web')
classifier = 'web'
}

artifacts {
archives webArchive
}

task deployConf(type: Copy) {
from file('src')
include "com/haulmont/addon/grapesjs/**"
into "$cuba.tomcat.dir/conf/${modulePrefix}"
}

task clearMessagesCache(type: CubaClearMessagesCache) {
appName = "${modulePrefix}"
}
deployConf.dependsOn clearMessagesCache

task cleanConf(description: 'Cleans up conf directory') {
doLast {
def dir = new File(cuba.tomcat.dir, "/conf/${modulePrefix}")
if (dir.isDirectory()) {
ant.delete(includeemptydirs: true) {
fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
}
}
}
}

task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
appName = "${modulePrefix}"
appJars(modulePrefix + '-global', modulePrefix + '-web')
}
task buildScssThemes(type: CubaWebScssThemeCreation)
task deployThemes(type: CubaDeployThemeTask, dependsOn: buildScssThemes)
assemble.dependsOn buildScssThemes
}

configure(webThemesModule) {
apply(plugin: 'java')
apply(plugin: 'maven')
apply(plugin: 'cuba')

appModuleType = 'web-themes'

buildDir = file('../build/scss-themes')

sourceSets {
main {
java {
srcDir '.'
}
resources {
srcDir '.'
}
}
}
}





task undeploy(type: Delete, dependsOn: ":${modulePrefix}-web:cleanConf") {
delete("$cuba.tomcat.dir/shared")
delete("$cuba.tomcat.dir/webapps/${modulePrefix}-core")
delete("$cuba.tomcat.dir/webapps/${modulePrefix}")
}

task restart(dependsOn: ['stop', ":${modulePrefix}-core:deploy", ":${modulePrefix}-web:deploy"], description: 'Redeploys applications and restarts local Tomcat') {
doLast {
ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') {
not {
socket(server: 'localhost', port: '8787')
}
}
start.execute()
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.3.1'
}
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
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
Loading

0 comments on commit 07f9131

Please sign in to comment.