Skip to content

Commit 2534384

Browse files
author
tomerc
committed
refactored build script, changed versions to maven SNAPSHOTS, removed dead code from version.groovy
1 parent 494719e commit 2534384

File tree

4 files changed

+68
-51
lines changed

4 files changed

+68
-51
lines changed

Diff for: build-info-extractor-gradle/src/main/groovy/org/jfrog/build/ArtifactoryPlugin.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ class ArtifactoryPlugin implements Plugin<Project> {
123123
And default install task for project ${project.path} is not an Upload task""")
124124
}
125125
buildInfoTask.mavenDescriptor = new File(project.getRepositories().getMavenPomDir(), "pom-default.xml")
126-
buildInfoTask.mavenPom = project.getRepositories().mavenDeployer().getPom()
127126
buildInfoTask.dependsOn(installTask)
128127
} else {
129128
buildInfoTask.mavenDescriptor = null

Diff for: build.gradle

+47-19
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ subprojects {
4747
testCompile group: 'org.testng', name: 'testng', version: '5.12.1'
4848
}
4949

50+
// From the install task of the maven plugin (an upload task), take the RepositoryHandler (repositories) and for the
51+
// MavenResolver (mavenInstaller) take the pomFilterContainer (pom) and configure the maven project
5052
configure(install.repositories.mavenInstaller) {
5153
pom.project {
54+
url 'http://wiki.jfrog.org/confluence/display/RTF/Build+Integration'
5255
licenses {
5356
license {
5457
name 'The Apache Software License, Version 2.0'
@@ -63,17 +66,9 @@ subprojects {
6366
archive 'http://forums.jfrog.org/Artifactory-Users-f2377369.html'
6467
}
6568
}
66-
developers {
67-
developer {
68-
id 'tomerc'
69-
name 'Tomer Cohen'
70-
email 'tomerc at jfrog dot org'
71-
}
72-
developer {
73-
id 'freds'
74-
name 'Frederic Simon'
75-
email 'frederic dot simon at jfrog dot org'
76-
}
69+
issueManagement {
70+
system 'jira'
71+
url 'http://issues.jfrog.org/jira/browse/BI'
7772
}
7873
}
7974
}
@@ -82,6 +77,7 @@ subprojects {
8277
classifier = 'sources'
8378
}
8479

80+
// Add the published artifact of sourceJar task to the list of published artifacts for the archives configuration
8581
artifacts {
8682
archives sourceJar
8783
}
@@ -96,11 +92,12 @@ configure(baseProjects()) {
9692
test.useTestNG()
9793
}
9894

95+
// Create configurations for the extractor projects
9996
configure(extractorProjects()) {
10097
configurations {
10198
tools
10299
uberJar {
103-
description = 'All jar that should be included in the Uber Jar'
100+
description = 'All jars that should be included in the Uber Jar'
104101
transitive = true
105102
}
106103
compile {
@@ -113,11 +110,12 @@ configure(extractorProjects()) {
113110
}
114111

115112
task jarAll(type: Jar, dependsOn: jar) {
116-
inputs.files jar.archivePath
113+
//Add the directory of the archive as the input files for this task
117114
classifier = 'uber'
118115
doLast {
119116
project.ant {
120117
taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask", classpath: configurations.tools.asPath
118+
//Zip the project's jar (jar.archivePath) and the dependencies defined for the uberJar conf into archivePath (with classifier)
121119
jarjar(jarfile: archivePath) {
122120
zipfileset(src: jar.archivePath)
123121
configurations.uberJar.files.each {jarjarFile ->
@@ -128,11 +126,21 @@ configure(extractorProjects()) {
128126
}
129127
}
130128

129+
// Add the published artifact of the jarAll task to the list of published artifacts for the archives configuration
131130
artifacts {
132131
archives jarAll
133132
}
133+
134+
// Treat the uberJar conf as a maven compile scope so that uberJar depenedncies are transformed into compile-scope
135+
// dependencies in generated extractor poms
136+
configure(install.repositories.mavenInstaller) {
137+
pom.scopeMappings.addMapping(MavenPlugin.COMPILE_PRIORITY + 1, configurations.uberJar, "compile")
138+
}
134139
}
135140

141+
// Declare the root project to build its children first
142+
dependsOnChildren()
143+
136144
project('build-info-api') {
137145
description = 'JFrog Build-Info API'
138146
}
@@ -159,7 +167,6 @@ project('build-info-extractor-ivy') {
159167
description = 'JFrog Build-Info Ivy Extractor'
160168
dependencies {
161169
uberJar project(':build-info-extractor')
162-
compile project(':build-info-extractor')
163170
uberJar "org.slf4j:slf4j-api:1.5.8"
164171
uberJar "org.aspectj:aspectjweaver:1.6.9"
165172
compile("com.google.code.findbugs:jsr305:1.3.9") {
@@ -172,6 +179,14 @@ project('build-info-extractor-ivy') {
172179
provided: true
173180
}
174181
}
182+
configure(install.repositories.mavenInstaller) {
183+
pom.project {
184+
issueManagement {
185+
system 'jira'
186+
url 'http://issues.jfrog.org/jira/browse/IAP'
187+
}
188+
}
189+
}
175190
}
176191

177192
project('build-info-extractor-gradle') {
@@ -182,7 +197,6 @@ project('build-info-extractor-gradle') {
182197
dependencies {
183198
compile gradleApi()
184199
uberJar project(':build-info-extractor')
185-
compile project(':build-info-extractor')
186200
compile("org.codehaus.plexus:plexus-component-annotations:1.5.4") {
187201
provided: true
188202
}
@@ -202,6 +216,15 @@ project('build-info-extractor-gradle') {
202216
filter(ReplaceTokens, tokens: ['fullVersion': version.toString(), 'buildInfoVersion': buildInfoVersion.toString()])
203217
}
204218
}
219+
220+
configure(install.repositories.mavenInstaller) {
221+
pom.project {
222+
issueManagement {
223+
system 'jira'
224+
url 'http://issues.jfrog.org/jira/browse/GAP'
225+
}
226+
}
227+
}
205228
}
206229

207230
project('build-info-extractor-maven3') {
@@ -210,7 +233,6 @@ project('build-info-extractor-maven3') {
210233

211234
dependencies {
212235
uberJar project(':build-info-extractor')
213-
compile project(':build-info-extractor')
214236
compile("org.codehaus.plexus:plexus-component-annotations:1.5.4") {
215237
provided: true
216238
}
@@ -220,6 +242,12 @@ project('build-info-extractor-maven3') {
220242

221243
testCompile "org.easymock:easymockclassextension:2.5.2"
222244
}
223-
}
224-
225-
dependsOnChildren()
245+
configure(install.repositories.mavenInstaller) {
246+
pom.project {
247+
issueManagement {
248+
system 'jira'
249+
url 'http://issues.jfrog.org/jira/browse/MAP'
250+
}
251+
}
252+
}
253+
}

Diff for: buildSrc/src/main/groovy/org/jfrog/build/Version.groovy

+13-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package org.jfrog.build
22

33
import org.gradle.api.GradleException
44
import org.gradle.api.Project
5-
65
import java.text.SimpleDateFormat
76

87
class Version {
@@ -47,32 +46,23 @@ class Version {
4746
timestampFile.createNewFile()
4847
}
4948
buildTime = new Date(timestampFile.lastModified())
50-
if (!release)
51-
this.versionNumber += "-" + getTimestamp()
52-
/*
53-
project.gradle.taskGraph.whenReady {graph ->
54-
if (graph.hasTask(':releaseVersion')) {
55-
release = true
56-
} else {
57-
this.versionNumber += "-" + getTimestamp()
58-
release = false
49+
if (!release) {
50+
def ts = new SimpleDateFormat('yyyyMMddHHmmssZ').format(buildTime)
51+
this.versionNumber += "-" + ts
52+
/*
53+
project.gradle.taskGraph.whenReady {graph ->
54+
if (graph.hasTask(':releaseVersion')) {
55+
release = true
56+
} else {
57+
this.versionNumber += "-" + getTimestamp()
58+
release = false
59+
}
5960
}
60-
}
61-
*/
61+
*/
62+
}
6263
}
6364

6465
String toString() {
6566
versionNumber
6667
}
67-
68-
String getTimestamp() {
69-
new SimpleDateFormat('yyyyMMddHHmmssZ').format(buildTime)
70-
}
71-
72-
boolean isRelease() {
73-
if (release == null) {
74-
throw new GradleException("Can't determine whether this is a release build before the task graph is populated")
75-
}
76-
return release
77-
}
7868
}

Diff for: gradle.properties

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
build-info-version=1.4.9
2-
build-info-release=false
3-
build-info-extractor-ivy-version=1.0.5
4-
build-info-extractor-ivy-release=false
5-
build-info-extractor-gradle-version=1.0.6
6-
build-info-extractor-gradle-release=false
7-
build-info-extractor-maven3-version=1.0.4
8-
build-info-extractor-maven3-release=false
1+
build-info-version=1.4.x-SNAPSHOT
2+
build-info-release=true
3+
build-info-extractor-ivy-version=1.0-SNAPSHOT
4+
build-info-extractor-ivy-release=true
5+
build-info-extractor-gradle-version=1.0.x-SNAPSHOT
6+
build-info-extractor-gradle-release=true
7+
build-info-extractor-maven3-version=1.0.x-SNAPSHOT
8+
build-info-extractor-maven3-release=true

0 commit comments

Comments
 (0)