Skip to content

Commit 89c6dd2

Browse files
author
Fred Simon
committed
Fixed issue with GString in matrix params
Changed wrapper to Gradle 0.9.2 Removed repo-init.gradle and made init.gradle the default Made init.gradle download latest snapshot of Artifactory plugin Removed Wharf specific switch in gradlew scripts Made the artifactory convention configuration unique (no diff CI or no CI)
1 parent 86a8d01 commit 89c6dd2

File tree

8 files changed

+46
-93
lines changed

8 files changed

+46
-93
lines changed

Diff for: README.txt

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2-
* How to build
3-
gradle --init-script buildSrc/repo-init.gradle -S build
2+
* How to build (with gradle 0.9.2 or above)
3+
gradle -I init.gradle -S build
4+
5+
or with the wrapper in *nix
6+
./gradlew -I init.gradle -S build
7+
and wrapper in Windows
8+
gradlew.bat -I init.gradle -S build
49

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

+22-17
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@
3535
import org.gradle.api.logging.LogLevel;
3636
import org.gradle.api.logging.Logger;
3737
import org.gradle.api.logging.Logging;
38-
import org.gradle.api.tasks.InputFile;
39-
import org.gradle.api.tasks.InputFiles;
40-
import org.gradle.api.tasks.Optional;
41-
import org.gradle.api.tasks.TaskAction;
42-
import org.gradle.api.tasks.TaskContainer;
43-
import org.gradle.api.tasks.Upload;
38+
import org.gradle.api.tasks.*;
4439
import org.gradle.util.ConfigureUtil;
4540
import org.jfrog.build.api.Build;
4641
import org.jfrog.build.api.util.FileChecksumCalculator;
@@ -81,21 +76,29 @@ public class BuildInfoRecorderTask extends DefaultTask {
8176
@Optional
8277
private Set<Configuration> publishConfigurations = Sets.newHashSet();
8378

79+
@Input
80+
private final Multimap<String, String> properties = HashMultimap.create();
81+
8482
private boolean lastInGraph = false;
85-
private final Multimap<String, String> props = HashMultimap.create();
83+
8684
private Map<String, String> propsToAdd;
8785

8886
public void setLastInGraph(boolean lastInGraph) {
8987
this.lastInGraph = lastInGraph;
9088
}
9189

9290
public void setProperties(Map<String, String> props) {
93-
if (props == null) {
91+
if (props == null || props.isEmpty()) {
9492
return;
9593
}
9694
for (Map.Entry<String, String> entry : props.entrySet()) {
97-
if (StringUtils.isNotBlank(entry.getKey())) {
98-
this.props.put(entry.getKey(), entry.getValue());
95+
String key = entry.getKey();
96+
if (StringUtils.isNotBlank(key)) {
97+
String value = entry.getValue();
98+
if (value != null) {
99+
// Make sure all GString are now Java Strings
100+
this.properties.put(key.toString(), value.toString());
101+
}
99102
}
100103
}
101104
}
@@ -267,7 +270,7 @@ private void uploadDescriptorsAndArtifacts(Set<GradleDeployDetails> allDeployabl
267270
Map<String, String> params = clientConf.publisher.getMatrixParams();
268271
for (Map.Entry<String, String> entry : params.entrySet()) {
269272
if (StringUtils.isNotBlank(entry.getKey())) {
270-
props.put(entry.getKey(), entry.getValue());
273+
properties.put(entry.getKey(), entry.getValue());
271274
}
272275
}
273276
Set<GradleDeployDetails> deployDetailsFromProject = getDeployArtifactsProject();
@@ -486,13 +489,15 @@ private Set<GradleDeployDetails> getDeployArtifactsProject() {
486489
private Map<String, String> getPropsToAdd() {
487490
if (this.propsToAdd == null) {
488491
this.propsToAdd = Maps.newHashMap();
489-
for (Map.Entry<String, String> entry : props.entries()) {
490-
if (!this.propsToAdd.containsKey(entry.getKey())) {
491-
this.propsToAdd.put(entry.getKey(), entry.getValue());
492+
for (Map.Entry<String, String> entry : properties.entries()) {
493+
// Make sure all GString are now Java Strings
494+
String key = entry.getKey().toString();
495+
String value = entry.getValue().toString();
496+
if (!this.propsToAdd.containsKey(key)) {
497+
this.propsToAdd.put(key, value);
492498
} else {
493-
String value = this.propsToAdd.get(entry.getKey());
494-
value = value + ", " + entry.getValue();
495-
this.propsToAdd.put(entry.getKey(), value);
499+
value = this.propsToAdd.get(key) + ", " + value;
500+
this.propsToAdd.put(key, value);
496501
}
497502
}
498503
ArtifactoryClientConfiguration configuration = getArtifactoryClientConfiguration(getProject());

Diff for: build.gradle

+11-18
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,20 @@ baseProjectNames = ['build-info-api', 'build-info-client', 'build-info-extractor
2424

2525
allprojects {
2626
apply plugin: 'idea'
27-
//apply plugin: 'artifactory'
27+
if (!ciBuild()) {
28+
apply plugin: 'artifactory'
29+
}
2830
group = 'org.jfrog.buildinfo'
2931
}
3032

31-
if (!ciBuild()) {
32-
artifactory {
33-
contextUrl = 'http://repo.jfrog.org/artifactory'
34-
projectPublish {
35-
publishConfigs('archives', 'published')
36-
}
37-
resolve {
38-
repoKey = 'gradle'
39-
}
33+
artifactory {
34+
contextUrl = 'http://repo.jfrog.org/artifactory'
35+
projectPublish {
36+
publishConfigs('archives', 'published')
37+
properties = ['build.status': "$it.project.status".toString()]
4038
}
41-
} else {
42-
artifactory {
43-
projectPublish {
44-
publishConfigs('archives', 'published')
45-
}
39+
resolve {
40+
repoKey = 'gradle'
4641
}
4742
}
4843

@@ -62,9 +57,7 @@ subprojects {
6257
buildInfoVersion = new Version(rootProject, baseProjectNames)
6358

6459
configurations {
65-
published {
66-
extendsFrom archives
67-
}
60+
published
6861
}
6962

7063
dependencies {

Diff for: buildSrc/repo-init.gradle

-49
This file was deleted.

Diff for: gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=http\://repo.jfrog.org/artifactory/distributions/org/gradle/gradle-0.9.1-20110224063219-bin.zip
6+
distributionUrl=http\://repo.gradle.org/gradle/distributions/gradle-0.9.2-bin.zip

Diff for: gradlew

-2
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,4 @@ GRADLE_APP_BASE_NAME=`basename "$0"`
144144
-Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
145145
-Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
146146
$STARTER_MAIN_CLASS \
147-
--wharf \
148-
--init-script "$REPO_INIT_SCRIPT" \
149147
"$@"

Diff for: gradlew.bat

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,11 @@ set CMD_LINE_ARGS=%$
103103
set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
104104
set CLASSPATH=%DIRNAME%\gradle\wrapper\gradle-wrapper.jar
105105
set WRAPPER_PROPERTIES=%DIRNAME%\gradle\wrapper\gradle-wrapper.properties
106-
set REPO_INIT_SCRIPT=%DIRNAME%\buildSrc\repo-init.gradle
107106
set JAVA_EXE=%JAVA_HOME%\bin\java.exe
108107

109108
set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%"
110109

111-
"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% --wharf --init-script %REPO_INIT_SCRIPT% %CMD_LINE_ARGS%
110+
"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS%
112111

113112
:end
114113
@rem End local scope for the variables with windows NT shell

Diff for: init.gradle

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
def artifactoryPluginUrl = 'http://repo.jfrog.org/artifactory/libs-releases/org/jfrog/buildinfo/build-info-extractor-gradle/2.0.0/build-info-extractor-gradle-2.0.0-uber.jar'
1+
String pluginVersion='2.0.x-20110503.140016-63'
2+
def artifactoryPluginUrl = "http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org/jfrog/buildinfo/build-info-extractor-gradle/2.0.x-SNAPSHOT/build-info-extractor-gradle-$pluginVersion-uber.jar"
3+
//def artifactoryPluginUrl = "http://repo.jfrog.org/artifactory/libs-releases/org/jfrog/buildinfo/build-info-extractor-gradle/$pluginVersion/build-info-extractor-gradle-$pluginVersion-uber.jar"
24

3-
def file = new File(gradle.gradleUserHomeDir, 'artifactory-tmp/artifactory-uber.jar')
5+
def file = new File(gradle.gradleUserHomeDir, "plugins/artifactory-$pluginVersion-uber.jar")
46
if (!file.exists()) {
57
file.parentFile.mkdirs()
68
println "Downloading the latest Artifactory plugin to '$file.absolutePath'..."

0 commit comments

Comments
 (0)