123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- maven { url 'http://mvn.revoltsoft.ru/' }
- maven { url 'https://plugins.gradle.org/m2/' }
- }
- dependencies {
- classpath 'gradle.plugin.com.dorongold.plugins:task-tree:1.5'
- }
- }
- repositories {
- mavenLocal()
- mavenCentral()
- maven { url 'http://mvn.revoltsoft.ru/' }
- }
- group = 'pro.doczilla'
- version = '1.0'
- buildDir = "${projectDir}/target"
- def srcDir = "src"
- ext.srcMainDir = "${srcDir}"
- ext.resolveGroups = ['pro.doczilla']
- def windows = org.apache.tools.ant.taskdefs.condition.Os.isFamily(org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS)
- ext.npmCmd = windows ? 'npm.cmd' : 'npm'
- ext.nodeCmd = windows ? 'node.exe' : 'node'
- def gitDefaults = [
- outerProtocol: 'http',
- adminPassword: '',
- gitHost: '', // excluding protocol
- commentsRepoUrl: '', // part after gitHost
- gitUsername: '',
- gitEmail: '',
- gitPassword: ''
- ].each {
- if (!project.hasProperty(it.key))
- ext[it.key] = it.value
- }
- apply plugin: 'eclipse'
- apply plugin: 'maven-publish'
- apply plugin: 'distribution'
- apply plugin: 'com.dorongold.task-tree'
- task copySources {
- copy {
- from file("${projectDir}/package.json")
- into file(buildDir)
- }
- copy {
- from file("${projectDir}/tsconfig.json")
- into file(buildDir)
- }
- copy {
- from file("${projectDir}/config.json")
- into file(buildDir)
- expand(outerProtocol: outerProtocol, commentsRepoUrl: commentsRepoUrl, adminPassword: adminPassword, gitHost: gitHost)
- }
- copy {
- from file(projectDir)
- include "*.tmpl"
- into file(buildDir)
- rename { fileName -> fileName.replace('.tmpl', '') }
- expand(outerProtocol: outerProtocol, commentsRepoUrl: commentsRepoUrl, gitUsername: gitUsername, gitEmail: gitEmail, gitPassword: gitPassword, gitHost: gitHost)
- }
- copy {
- from file("${projectDir}/src")
- into file("${buildDir}/src")
- }
- copy {
- from file("${projectDir}/node_scripts")
- into file("${buildDir}/node_scripts")
- }
- copy {
- from file("${projectDir}/static")
- into file("${buildDir}/static")
- }
- }
- task npmInstall(type: Exec) {
- dependsOn copySources
- workingDir buildDir
- commandLine npmCmd, 'install'
- }
- task buildTs(type: Exec) {
- dependsOn npmInstall
- workingDir buildDir
- executable npmCmd
- args = ['run', 'buildProd']
- }
- task run(type: Exec) {
- dependsOn assemble
- workingDir "${buildDir}/build"
- commandLine nodeCmd, 'index.js'
- }
- static def today() {
- return new Date().format('yyyyMMddHHmm')
- }
- distZip {
- archiveClassifier = today()
- }
- project.tasks.assemble.dependsOn project.tasks.buildTs
- project.tasks.distZip.dependsOn project.tasks.buildTs
- project.tasks.distTar.dependsOn project.tasks.buildTs
- project.tasks.installDist.dependsOn project.tasks.buildTs
- distributions {
- main {
- contents {
- from(buildDir) {
- include 'node_modules/**'
- }
- from("${buildDir}/build")
- }
- }
- }
- apply from: 'docker.gradle'
|