/
build.gradle
175 lines (152 loc) · 4.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
final REPOSITORY_URL = 'https://github.com/GinVavilon/gradle-android-eclipse'
final VCS_URL = 'https://github.com/GinVavilon/gradle-android-eclipse.git'
final GROUP_ID = 'com.github.ginvavilon'
final ARTIFACT_ID = 'android-eclipse'
final VERSION = '0.8.3'
final DESCRIPTION = 'Plugin for generation files for eclipse in android project'
final NAME = 'Android-Eclipse'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'org.eclipse.jgit:org.eclipse.jgit:4.2.0.+'
}
}
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
def getGitTag(){
try{
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Repository repository = builder.findGitDir(projectDir)
.readEnvironment()
.build();
Git git=Git.wrap(repository)
RevWalk walk = new RevWalk(repository);
def tagName = git.describe().call()
def tag = walk.parseTag(repository.getTags().get(tagName).objectId)
return tag
} catch (e){
return null
}
}
def gitTag = getGitTag();
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'nexus'
apply plugin: 'com.jfrog.bintray'
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile gradleApi()
compile localGroovy()
compile 'com.android.tools.build:gradle:1.2.0'
}
configurations {
mavenDeployer
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
uploadArchives {
repositories.mavenDeployer {
pom.groupId = GROUP_ID
pom.artifactId = ARTIFACT_ID
pom.version = VERSION
}
}
modifyPom {
project {
name NAME
description DESCRIPTION
url REPOSITORY_URL
inceptionYear '2016'
scm {
url REPOSITORY_URL
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'ginVavilon'
name 'Vladimir Baraznovsky'
email 'ginVavilon@gmail.com'
}
}
}
}
publishing {
publications {
AndroidEclipsePublication(MavenPublication) {
from components.java
groupId GROUP_ID
artifactId ARTIFACT_ID
version VERSION
artifact sourcesJar
artifact javadocJar
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name NAME
description DESCRIPTION
inceptionYear '2016'
url REPOSITORY_URL
scm {
url REPOSITORY_URL
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'ginVavilon'
name 'Vladimir Baraznovsky'
email 'ginVavilon@gmail.com'
}
}
}
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['AndroidEclipsePublication']
pkg {
repo = 'maven'
name = NAME
userOrg = user
licenses = ['Apache-2.0']
vcsUrl = VCS_URL
labels = ['android', 'eclipse', 'gradle']
publicDownloadNumbers = true
publish = true
version {
name = VERSION
desc = gitTag?.fullMessage
vcsTag = gitTag?.tagName
released = gitTag?.taggerIdent?.when?.format("yyyy-MM-dd'T'HH:mm:ss.SSSZZ")
attributes = ['gradle-plugin': 'android-eclipse']
}
}
}