Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/com/jfrog/ide/common/gradle/GradleDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ public List<File> generateDependenciesGraphAsJson(File workingDirectory, Log log
// Copy init script to the temp file
Files.copy(gradleInitScript, initScript, StandardCopyOption.REPLACE_EXISTING);

// Run "gradle generateDepTrees -q -I <path-to-init-script>" -Dcom.jfrog.depsTreeOutputFile=<path-to-output-file>
List<String> args = Lists.newArrayList("generateDepTrees", "-q", "-I", initScript.toString(),
// Run "gradle generateDepTrees --no-daemon -q -I <path-to-init-script>" -Dcom.jfrog.depsTreeOutputFile=<path-to-output-file>
// --no-daemon avoids sharing the Gradle daemon with the main build (prevents cache lock/contentions on CI).
List<String> args = Lists.newArrayList("generateDepTrees", "--no-daemon", "-q", "-I", initScript.toString(),
"-Dcom.jfrog.depsTreeOutputFile=" + outputFile.toString());
runCommand(workingDirectory, args, logger);
List<File> files = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

@Getter
public class ImpactPath {
@JsonProperty()
private String id;
@JsonProperty()
private String name;
@JsonProperty()
Expand All @@ -18,6 +20,13 @@ public class ImpactPath {
public ImpactPath() {
}

@SuppressWarnings("unused")
public ImpactPath(String dependencyId, String dependencyName, String dependencyVersion) {
this.id = dependencyId;
this.name = dependencyName;
this.version = dependencyVersion;
}

@SuppressWarnings("unused")
public ImpactPath(String dependencyName, String dependencyVersion) {
this.name = dependencyName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ private DepTree buildGradleDependencyTree(String projectPath) throws IOException
Map<String, String> env = new HashMap<>(System.getenv());
env.put("pluginLibDir", GradleDependencyNode.class.getProtectionDomain().getCodeSource().getLocation().getPath());

// Isolate Gradle cache to avoid CI failures: test's Gradle subprocess otherwise uses ~/.gradle,
// causing "Failed to create Jar file" (concurrent writes) and "Unable to create directory 'reports/profile'".
File gradleUserHome = new File(tempProject, ".gradle-test-cache");
if (!gradleUserHome.exists() && !gradleUserHome.mkdirs()) {
throw new IOException("Could not create isolated GRADLE_USER_HOME: " + gradleUserHome);
}
env.put("GRADLE_USER_HOME", gradleUserHome.getAbsolutePath());

Path projectDir = tempProject.toPath();
String descriptorFileName = "build.gradle";
if (projectPath.toLowerCase().contains("kotlin")) {
Expand Down
5 changes: 2 additions & 3 deletions src/test/resources/gradle/groovy/api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ configurations {

dependencies {
implementation project(':shared')
implementation module("commons-lang:commons-lang:2.4") {
dependency("commons-io:commons-io:1.2")
}
implementation 'commons-lang:commons-lang:2.4'
implementation 'commons-io:commons-io:1.2'
implementation group: 'org.apache.wicket', name: 'wicket', version: '1.3.7'

}
Expand Down
68 changes: 0 additions & 68 deletions src/test/resources/gradle/kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask

buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.jfrog.buildinfo", "build-info-extractor-gradle", "4.+")
}
configurations.classpath {
resolutionStrategy {
cacheDynamicVersionsFor(0, "seconds")
cacheChangingModulesFor(0, "seconds")
}
}
}

plugins {
java
`maven-publish`
Expand All @@ -28,8 +10,6 @@ fun javaProjects() = subprojects.filter {
val currentVersion: String by project

allprojects {
apply(plugin = "com.jfrog.artifactory")

group = "org.jfrog.test.gradle.publish"
version = currentVersion
status = "Integration"
Expand All @@ -39,16 +19,6 @@ allprojects {
}
}

tasks.named<ArtifactoryTask>("artifactoryPublish") {
skip = true
}

project("services") {
tasks.named<ArtifactoryTask>("artifactoryPublish") {
skip = true
}
}

configure(javaProjects()) {
apply(plugin = "java")
apply(plugin = "maven-publish")
Expand Down Expand Up @@ -90,43 +60,5 @@ project("api") {
}
}
}

tasks.named<ArtifactoryTask>("artifactoryPublish") {
publications(publishing.publications["ivyJava"])
}
}

configure<org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention> {
clientConfig.isIncludeEnvVars = true

setContextUrl("http://127.0.0.1:8081/artifactory")
publish {
repository {
setRepoKey("libs-snapshot-local") // The Artifactory repository key to publish to
setUsername(findProperty("artifactory_user")) // The publisher user name
setPassword(findProperty("artifactory_password")) // The publisher password
// This is an optional section for configuring Ivy publication (when publishIvy = true).
ivy {
setIvyLayout("[organization]/[module]/ivy-[revision].xml")
setArtifactLayout("[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
setMavenCompatible(true) // Convert any dots in an [organization] layout value to path separators, similar to Maven"s groupId-to-path conversion. True if not specified
}
}

defaults {
// Reference to Gradle publications defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publications("mavenJava")
setPublishArtifacts(true)
// Properties to be attached to the published artifacts.
setProperties(mapOf(
"qa.level" to "basic",
"dev.team" to "core"
))
setPublishPom(true) // Publish generated POM files to Artifactory (true by default)
setPublishIvy(true) // Publish generated Ivy descriptor files to Artifactory (true by default)
}
}
}

5 changes: 2 additions & 3 deletions src/test/resources/gradle/unresolvedGroovy/api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ configurations {

dependencies {
implementation project(':shared')
implementation module("commons-lang:commons-lang:2.4") {
dependency("commons-io:commons-io:1.2")
}
implementation 'commons-lang:commons-lang:2.4'
implementation 'commons-io:commons-io:1.2'
implementation group: 'org.apache.wicket', name: 'wicket', version: '1.3.7'

}
Expand Down
68 changes: 0 additions & 68 deletions src/test/resources/gradle/unresolvedKotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask

buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.jfrog.buildinfo", "build-info-extractor-gradle", "4.+")
}
configurations.classpath {
resolutionStrategy {
cacheDynamicVersionsFor(0, "seconds")
cacheChangingModulesFor(0, "seconds")
}
}
}

plugins {
java
`maven-publish`
Expand All @@ -28,8 +10,6 @@ fun javaProjects() = subprojects.filter {
val currentVersion: String by project

allprojects {
apply(plugin = "com.jfrog.artifactory")

group = "org.jfrog.test.gradle.publish"
version = currentVersion
status = "Integration"
Expand All @@ -39,16 +19,6 @@ allprojects {
}
}

tasks.named<ArtifactoryTask>("artifactoryPublish") {
skip = true
}

project("services") {
tasks.named<ArtifactoryTask>("artifactoryPublish") {
skip = true
}
}

configure(javaProjects()) {
apply(plugin = "java")
apply(plugin = "maven-publish")
Expand Down Expand Up @@ -90,43 +60,5 @@ project("api") {
}
}
}

tasks.named<ArtifactoryTask>("artifactoryPublish") {
publications(publishing.publications["ivyJava"])
}
}

configure<org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention> {
clientConfig.isIncludeEnvVars = true

setContextUrl("http://127.0.0.1:8081/artifactory")
publish {
repository {
setRepoKey("libs-snapshot-local") // The Artifactory repository key to publish to
setUsername(findProperty("artifactory_user")) // The publisher user name
setPassword(findProperty("artifactory_password")) // The publisher password
// This is an optional section for configuring Ivy publication (when publishIvy = true).
ivy {
setIvyLayout("[organization]/[module]/ivy-[revision].xml")
setArtifactLayout("[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
setMavenCompatible(true) // Convert any dots in an [organization] layout value to path separators, similar to Maven"s groupId-to-path conversion. True if not specified
}
}

defaults {
// Reference to Gradle publications defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publications("mavenJava")
setPublishArtifacts(true)
// Properties to be attached to the published artifacts.
setProperties(mapOf(
"qa.level" to "basic",
"dev.team" to "core"
))
setPublishPom(true) // Publish generated POM files to Artifactory (true by default)
setPublishIvy(true) // Publish generated Ivy descriptor files to Artifactory (true by default)
}
}
}

Loading