Skip to content

Commit

Permalink
Excavator: Upgrades Baseline to the latest version (#1216)
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot authored Nov 2, 2021
1 parent 1927cbf commit 25e14d5
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.3.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.0.0'
classpath 'com.gradle.publish:plugin-publish-plugin:0.16.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.25.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.31.0'
classpath 'de.undercouch:gradle-download-task:4.1.2'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.3'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.6.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RecommendedProductDependenciesPluginIntegrationSpec extends IntegrationSpe
def setup() {
buildFile << """
plugins {
id 'com.palantir.consistent-versions' version '1.28.0' apply false
id 'com.palantir.consistent-versions' version '2.0.0' apply false
}
apply plugin: 'java'
apply plugin: 'com.palantir.recommended-product-dependencies'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.palantir.gradle.dist.asset
import com.fasterxml.jackson.databind.ObjectMapper
import com.palantir.gradle.dist.GradleIntegrationSpec
import com.palantir.gradle.dist.Versions
import spock.lang.Ignore

class AssetDistributionPluginIntegrationSpec extends GradleIntegrationSpec {

Expand Down Expand Up @@ -149,6 +150,7 @@ class AssetDistributionPluginIntegrationSpec extends GradleIntegrationSpec {
* used. As 'compileOnly' dependencies are not included by Gradle TestKit per default, we need to extend the
* classpath for plugins under test in 'gradle-sls-packaging/build.gradle'.
*/
@Ignore // plugins{} block provides classpath isolation so sls-asset-distribution cannot load gcv types!
def 'dist project can be resolved through plain dependency when GCV is applied'() {
buildFile << """
plugins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ResolveProductDependenciesIntegrationSpec extends IntegrationSpec {
import ${ProductDependencies.class.getCanonicalName()}
import ${BaseDistributionExtension.class.getCanonicalName()}
def ext = project.extensions.create("base", BaseDistributionExtension, project)
def ext = project.extensions.create("distribution", BaseDistributionExtension, project)
ext.setProductDependenciesConfig(configurations.runtimeClasspath)
ProductDependencies.registerProductDependencyTasks(project, ext);
""".stripIndent()
Expand All @@ -50,13 +50,13 @@ class ResolveProductDependenciesIntegrationSpec extends IntegrationSpec {
def 'consumes declared product dependencies'() {
setup:
buildFile << """
base {
distribution {
${PDEP}
}
""".stripIndent()

when:
runTasks(':resolveProductDependencies')
runTasksSuccessfully(':resolveProductDependencies')

then:
def manifest = ObjectMappers.readProductDependencyManifest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class GcProfileIntegrationSpec extends GradleIntegrationSpec {
runTasks(':extractDistTarForTest')

then:
assert "touch-service-1.0.0/service/bin/init.sh start".execute(null, getProjectDir()).waitFor() == 0
execWithExitCode('touch-service-1.0.0/service/bin/init.sh', 'start') == 0
Awaitility.await("file created using ${gc}").until({
signalFile.exists()
})
Expand All @@ -85,4 +85,12 @@ class GcProfileIntegrationSpec extends GradleIntegrationSpec {
where:
gc << GcProfile.PROFILE_NAMES.keySet().toArray()
}

int execWithExitCode(String... tasks) {
ProcessBuilder pb = new ProcessBuilder().command(tasks).directory(projectDir).inheritIO()
pb.environment().put("JAVA_HOME", System.getProperty("java.home"))
Process proc = pb.start()
int result = proc.waitFor()
return result
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1181,24 +1181,30 @@ class JavaServiceDistributionPluginTests extends GradleIntegrationSpec {
}

int execWithExitCode(String... tasks) {
Process proc = new ProcessBuilder().command(tasks).directory(projectDir).start()
ProcessBuilder pb = new ProcessBuilder().command(tasks).directory(projectDir).inheritIO()
pb.environment().put("JAVA_HOME", System.getProperty("java.home"))
Process proc = pb.start()
int result = proc.waitFor()
return result
}

String execWithOutput(String... tasks) {
StringBuffer sout = new StringBuffer(), serr = new StringBuffer()
Process proc = new ProcessBuilder().command(tasks).directory(projectDir).start()
ProcessBuilder pb = new ProcessBuilder().command(tasks).directory(projectDir);
pb.environment().put("JAVA_HOME", System.getProperty("java.home"))
Process proc = pb.start()
proc.consumeProcessOutput(sout, serr)
int result = proc.waitFor()
int expected = 0
Assert.assertEquals(sprintf("Expected command '%s' to exit with '%d'", tasks.join(' '), expected), expected, result)
Assert.assertEquals(sprintf("Expected command '%s' to exit with '%d'\nstdout: %s\nstderr: %s",
tasks.join(' '), expected, sout, serr), expected, result)
return sout.toString()
}

String execAllowFail(String... tasks) {
new ProcessBuilder().command(tasks).directory(projectDir)
.start()
.waitFor()
void execAllowFail(String... tasks) {
ProcessBuilder pb = new ProcessBuilder().command(tasks).directory(projectDir)
.inheritIO()
pb.environment().put("JAVA_HOME", System.getProperty("java.home"))
pb.start().waitFor()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ class ConfigTarTaskIntegrationSpec extends IntegrationSpec {
private static createUntarBuildFile(buildFile, pluginType, artifactType, name) {
buildFile << """
apply plugin: 'com.palantir.sls-${pluginType}-distribution'
repositories {
mavenCentral()
}
distribution {
serviceName '${name}'
if ('${artifactType}' == 'service') {
Expand Down

0 comments on commit 25e14d5

Please sign in to comment.