-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
executable file
·130 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import org.apache.tools.ant.filters.ReplaceTokens
import java.text.SimpleDateFormat
import org.ajoberstar.grgit.*
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.7
targetCompatibility = 1.7
if (version == 'unspecified') {
version = getVersionName()
}
ext.repo = Grgit.open(project.file('.'))
configurations {
deployerJars
}
task wrapper(type: Wrapper) {
gradleVersion='2.1'
}
install {
repositories.mavenInstaller {
pom.version = project.version;
pom.artifactId = 'maptool-resources';
pom.groupId = 'net.rptools.maptool-resources';
}
}
uploadArchives {
repositories.mavenDeployer {
pom.version = project.version;
pom.artifactId = 'maptool-resources';
pom.groupId = 'net.rptools.maptool-resources';
configuration = configurations.deployerJars;
repository url: 'file://' + projectDir + '/../maven-repo'
}
}
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'org.ajoberstar:gradle-git:0.11.2'
}
}
dependencies {
deployerJars 'org.apache.maven.wagon:wagon-ssh:2.2'
}
ext.compileDate = new Date();
ext.yyyymmdd = (new SimpleDateFormat('yyyyMMDD')).format(ext.compileDate);
repositories {
mavenLocal()
mavenCentral()
maven {
url = 'http://maptool.craigs-stuff.net/repo/'
}
}
/*
* Gets the version name from the latest Git tag
*/
def getVersionName() {
if (project.hasProperty('buildVersion')) {
return buildVersion
} else {
def repo = Grgit.open(project.file('.'))
def tagName = repo.tag.list()[0].fullName.replace('refs/tags/', '')
def tagCommit = repo.tag.list()[0].commit.id
def headCommit = repo.head().id
def headAbbrvId = repo.head().abbreviatedId
if (tagCommit == headCommit) {
return tagName
} else {
println 'No version specified, please specify version with -Pversion=<version>'
throw org.gradle.api.InvalidUserDataException
}
}
}
task zipResources(type: Zip) {
from 'src/main/resources'
into ''
archiveName='default_images.zip'
destinationDir = new File(projectDir, 'build')
outputs.upToDateWhen {
false
}
}
task showBuildVersion() << {
println 'Build Version Number = ' + project.version
}
jar {
from 'build'
include 'default_images.zip'
manifest {
attributes 'Implementation-Title': 'maptool-resources',
'Implementation-Version': project.version,
'Class-Path'
}
}
jar.dependsOn += zipResources