forked from bndtools/bnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle
56 lines (52 loc) · 1.43 KB
/
settings.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
/*
* Master Gradle initialization script
*/
import aQute.bnd.osgi.Constants
/* Add bnd gradle plugin as a script dependency */
buildscript {
repositories {
mavenCentral()
maven {
url uri(bnd_repourl)
}
}
dependencies {
classpath bnd_plugin
}
/* Since the files in the repository change with each build, we need to recheck for changes */
configurations.classpath {
resolutionStrategy {
cacheChangingModulesFor 30, 'minutes'
cacheDynamicVersionsFor 30, 'minutes'
}
}
dependencies {
components {
all { ComponentMetadataDetails details ->
details.changing = true
}
}
}
/* Add bnd gradle plugin to buildscript classpath of rootProject */
def bndPlugin = files(configurations.classpath.files)
gradle.rootProject {
buildscript {
dependencies {
classpath bndPlugin
}
}
}
}
gradle.ext.bndWorkspaceConfigure = { workspace ->
/*
* Compute the build time stamp.
* If the git workspace is clean, the build time is the time of the head commit.
* If the git workspace is dirty, the build time is the current time.
*/
if ('git diff --no-ext-diff --quiet'.execute().waitFor() == 0) {
workspace.setProperty(Constants.TSTAMP, 'git show --no-patch --format=%ct000'.execute().text.trim())
} else {
workspace.setProperty(Constants.TSTAMP, Long.toString(System.currentTimeMillis()))
}
}
apply plugin: 'biz.aQute.bnd.workspace'