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;
|
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.Context;
|
||||||
import com.google.cloud.functions.HttpFunction;
|
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.JarLauncher;
|
||||||
import org.springframework.boot.loader.archive.Archive;
|
import org.springframework.boot.loader.archive.Archive;
|
||||||
import org.springframework.boot.loader.jar.JarFile;
|
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
|
* 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);
|
((RawBackgroundFunction) delegate).accept(json, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Archive> discoverClassPathAcrhives() throws Exception {
|
private Iterator<Archive> discoverClassPathAcrhives() throws Exception {
|
||||||
List<Archive> classPathArchives = getClassPathArchives();
|
Iterator<Archive> classPathArchives = getClassPathArchivesIterator();
|
||||||
if (CollectionUtils.isEmpty(classPathArchives)) {
|
if (classPathArchives.hasNext()) {
|
||||||
classPathArchives.add(this.getArchive());
|
return classPathArchives;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Collections.singleton(this.getArchive()).iterator();
|
||||||
}
|
}
|
||||||
return classPathArchives;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,15 @@
|
|||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<spring-cloud-function.version>3.0.8.BUILD-SNAPSHOT</spring-cloud-function.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||||
<version>3.1.0.BUILD-SNAPSHOT</version>
|
<version>${spring-cloud-function.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -46,7 +50,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||||
<version>3.1.0.BUILD-SNAPSHOT</version>
|
<version>${spring-cloud-function.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -19,11 +19,15 @@
|
|||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<spring-cloud-function.version>3.0.8.BUILD-SNAPSHOT</spring-cloud-function.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||||
<version>3.1.0.BUILD-SNAPSHOT</version>
|
<version>${spring-cloud-function.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
@@ -74,7 +78,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||||
<version>3.1.0.BUILD-SNAPSHOT</version>
|
<version>${spring-cloud-function.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
Reference in New Issue
Block a user