-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
109 lines (99 loc) · 2.67 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
Gradle root build file
Project: HSPyLib
Created: 1st July, 2020
*/
plugins {
id 'idea'
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
}
idea {
module {
settings {
rootModuleType = 'PYTHON_MODULE'
}
excludeDirs += file('.idea')
excludeDirs += file('.gradle')
excludeDirs += file('.vscode')
excludeDirs += file('.run')
excludeDirs += file('run-configs')
excludeDirs += file('devel')
}
}
apply from: "${rootDir}/gradle/idea.gradle"
/* Project extension properties */
ext {
buildTools = "${buildTools}".split(",")
buildToolsFile = new File("${project.projectDir}/buildTools.txt")
modulesDir = "${project.projectDir}/modules/"
gradleDir = "${project.projectDir}/gradle"
verbose = findProperty('verbose') ?: false
startTime = System.currentTimeMillis()
}
configurations {
modules
}
dependencies {
file('modules').eachDir { dir ->
project("$dir.name")
}
}
subprojects {
tasks.withType(Exec) {
doFirst {
println ">>> ${commandLine}"
}
}
project.afterEvaluate {
assert project.ext.has("sourceRoot")
assert project.ext.has("pythonPath")
def srcRoot = project.ext.sourceRoot.replaceAll("${rootProject.rootDir}/".toString(), "")
def pythonPath = project.ext.pythonPath.replaceAll("${project.ext.sourceRoot}/".toString(), "")
println "> SourceRoot: $srcRoot"
println "> PythonPath: $pythonPath"
}
}
/* List project modules */
task listModules(type: Task) {
group = 'Build'
description = 'List project modules'
doLast {
println("\nListing " + project.name + " modules ...")
println("Modules Dir: " + modulesDir + "\n")
subprojects.forEach {
println(sprintf(
"Module: %-12s Version: %-10s Source: %s",
it.name, it.app_version, it.sourceRoot.replaceAll(modulesDir, '')
))
}
}
}
/* Download and extract the yorevs/py-gradle project ZIP */
tasks.register('pyGradleUpdate') {
group = 'pygradle'
description = 'Download and extract the py-gradle project ZIP'
doLast {
def outFile = "${gradleDir}/py-gradle.zip"
def url = "https://github.com/yorevs/py-gradle/archive/master.zip"
println "Downloading the py-gradle project"
println " From: ${url}"
println " Into: ${outFile}"
mkdir gradleDir
delete fileTree(gradleDir).matching {
include "**/*.gradle"
}
exec {
commandLine 'curl', '-L', '-o', "${outFile}", url
}
copy {
from zipTree("${outFile}")
into "${gradleDir}"
}
copy {
from "${gradleDir}/py-gradle-master/src/main/gradle"
into "${gradleDir}"
include '**/*.gradle'
}
delete "${gradleDir}/py-gradle-master", "${outFile}"
}
}