Merge pull request #534 from dzou/fix-gcp-sample-3.0.x
Fix the GCP Adapter for branch 3.0.x
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.function.adapter.gcp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.google.cloud.functions.Context;
|
||||
import com.google.cloud.functions.HttpFunction;
|
||||
@@ -27,7 +28,6 @@ import com.google.cloud.functions.RawBackgroundFunction;
|
||||
import org.springframework.boot.loader.JarLauncher;
|
||||
import org.springframework.boot.loader.archive.Archive;
|
||||
import org.springframework.boot.loader.jar.JarFile;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* The launcher class written at the top-level of the output JAR to be deployed to
|
||||
@@ -65,12 +65,14 @@ public class GcfJarLauncher extends JarLauncher implements HttpFunction, RawBack
|
||||
((RawBackgroundFunction) delegate).accept(json, context);
|
||||
}
|
||||
|
||||
private List<Archive> discoverClassPathAcrhives() throws Exception {
|
||||
List<Archive> classPathArchives = getClassPathArchives();
|
||||
if (CollectionUtils.isEmpty(classPathArchives)) {
|
||||
classPathArchives.add(this.getArchive());
|
||||
private Iterator<Archive> discoverClassPathAcrhives() throws Exception {
|
||||
Iterator<Archive> classPathArchives = getClassPathArchivesIterator();
|
||||
if (classPathArchives.hasNext()) {
|
||||
return classPathArchives;
|
||||
}
|
||||
else {
|
||||
return Collections.singleton(this.getArchive()).iterator();
|
||||
}
|
||||
return classPathArchives;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,15 @@
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>3.0.8.BUILD-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||
<version>3.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>${spring-cloud-function.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -46,7 +50,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||
<version>3.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>${spring-cloud-function.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
@@ -19,11 +19,15 @@
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>3.0.8.BUILD-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||
<version>3.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>${spring-cloud-function.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
@@ -74,7 +78,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||
<version>3.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>${spring-cloud-function.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
Reference in New Issue
Block a user