Skip to content

Commit

Permalink
On MacOS for lambda, allow creating native linux elf AND run IT tests…
Browse files Browse the repository at this point in the history
… against native Mach-O
  • Loading branch information
matusfaro committed Nov 26, 2023
1 parent 4087518 commit 81da403
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 41 deletions.
9 changes: 6 additions & 3 deletions dataspray-authorizer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
<id>lambda-native</id>
<phase>${lambda-native.phase}</phase>
</execution>
<execution>
<id>lambda-native-it</id>
<phase>${lambda-native-it.phase}</phase>
</execution>
</executions>
</plugin>
Expand Down
5 changes: 2 additions & 3 deletions dataspray-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
<id>cli</id>
<phase>compile</phase>
</execution>
</executions>
</plugin>
Expand Down
22 changes: 5 additions & 17 deletions dataspray-package/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,12 @@
<artifactItems>
<artifactItem>
<groupId>io.dataspray</groupId>
<artifactId>dataspray-site-landing</artifactId>
<artifactId>dataspray-site</artifactId>
<classifier>static-site</classifier>
<version>${project.version}</version>
<type>tar.gz</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/static-site-landing/</outputDirectory>
<includes>**</includes>
</artifactItem>
<artifactItem>
<groupId>io.dataspray</groupId>
<artifactId>dataspray-site-dashboard</artifactId>
<classifier>static-site</classifier>
<version>${project.version}</version>
<type>tar.gz</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/static-site-dashboard/</outputDirectory>
<outputDirectory>${project.build.directory}/static-site/</outputDirectory>
<includes>**</includes>
</artifactItem>
<artifactItem>
Expand All @@ -197,9 +187,8 @@
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
<id>jar</id>
<phase>compile</phase>
</execution>
</executions>
</plugin>
Expand All @@ -221,8 +210,7 @@
<argument>${project.build.directory}/code-authorizer/function.zip</argument>
<argument>${project.build.directory}/code-control/function.zip</argument>
<argument>${project.build.directory}/code-ingest/function.zip</argument>
<argument>${project.build.directory}/static-site-landing</argument>
<argument>${project.build.directory}/static-site-dashboard</argument>
<argument>${project.build.directory}/static-site</argument>
</arguments>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
quarkus.package.type=jar
quarkus.package.type=jar
9 changes: 6 additions & 3 deletions dataspray-stream-control/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,12 @@
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
<id>lambda-native</id>
<phase>${lambda-native.phase}</phase>
</execution>
<execution>
<id>lambda-native-it</id>
<phase>${lambda-native-it.phase}</phase>
</execution>
</executions>
</plugin>
Expand Down
9 changes: 6 additions & 3 deletions dataspray-stream-ingest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,12 @@
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
<id>lambda-native</id>
<phase>${lambda-native.phase}</phase>
</execution>
<execution>
<id>lambda-native-it</id>
<phase>${lambda-native-it.phase}</phase>
</execution>
</executions>
</plugin>
Expand Down
102 changes: 91 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<junit.version>5.8.2</junit.version>
<projectlombok.version>1.18.30</projectlombok.version>
<quarkus.version>3.5.0</quarkus.version>
<!-- If changed, update aws.sdk.version -->
<quarkus.version>3.5.3</quarkus.version>
<aws.sdk.version>2.21.17</aws.sdk.version>
<!-- If changed, also change in .node-version and .nvmrc -->
<node.version>v18.16.1</node.version>
<pnpm.version>v8.6.10</pnpm.version>
<slf4j.version>2.0.7</slf4j.version>
<logback.version>1.2.9</logback.version>
<jackson.version>2.15.3</jackson.version>
<aws.sdk.version>2.21.29</aws.sdk.version>
<!--
Keep in sync with cdk version used in aws-cdk-maven-plugin (aws.cdk.4j.version)
https://github.com/datasprayio/aws-cdk-4j/blob/master/pom.xml#L55
Expand All @@ -57,6 +58,12 @@
<aws.cdk.4j.version>2.2.4</aws.cdk.4j.version>
<sqlite4java>1.0.392</sqlite4java>

<lambda-native.phase>package</lambda-native.phase>
<lambda-native.container-build>false</lambda-native.container-build>
<lambda-native-it.phase>none</lambda-native-it.phase>
<lambda-native-it.finalName>${project.build.finalName}-it</lambda-native-it.finalName>
<failsafe.native-image-path>${project.build.finalName}</failsafe.native-image-path>

<skipTests/>
<skipITs/>
<argLine/>
Expand All @@ -78,8 +85,7 @@
<module>dataspray-authorizer</module>
<module>dataspray-stream-control</module>
<module>dataspray-stream-ingest</module>
<module>dataspray-site-landing</module>
<module>dataspray-site-dashboard</module>
<module>dataspray-site</module>
<module>dataspray-package</module>
</modules>

Expand Down Expand Up @@ -125,13 +131,7 @@
</dependency>
<dependency>
<groupId>io.dataspray</groupId>
<artifactId>dataspray-site-landing</artifactId>
<classifier>open-next</classifier>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.dataspray</groupId>
<artifactId>dataspray-site-dashboard</artifactId>
<artifactId>dataspray-site</artifactId>
<classifier>open-next</classifier>
<version>${project.version}</version>
</dependency>
Expand Down Expand Up @@ -648,6 +648,7 @@
<useFile>false</useFile>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<native.image.path>${failsafe.native-image-path}</native.image.path>
</systemPropertyVariables>
</configuration>
</plugin>
Expand Down Expand Up @@ -686,6 +687,51 @@
<configuration>
<javaVersion>${java.version}</javaVersion>
</configuration>
<executions>
<execution>
<!-- Regular jar file -->
<id>jar</id>
<phase>none</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<!-- Build a Quarkus CLI -->
<id>cli</id>
<phase>none</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<!-- Lambda native image -->
<id>lambda-native</id>
<phase>${lambda-native.phase}</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<systemProperties>
<quarkus.native.container-build>${lambda-native.container-build}
</quarkus.native.container-build>
</systemProperties>
</configuration>
</execution>
<execution>
<!-- Lambda native image for testing only -->
<!-- In case the lambda-native is cross-compiled, using this to run ITs -->
<id>lambda-native-it</id>
<phase>${lambda-native.phase}</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<skip>${skipITs}${skipTests}</skip>
<finalName>${lambda-native-it.finalName}</finalName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.skife.maven</groupId>
Expand All @@ -707,4 +753,38 @@
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>macos</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<!--
On MacOS, we need to build a linux executable rather than Mach-O
in order to deploy it to AWS Lambda.
https://quarkus.io/guides/maven-tooling#build-a-container-friendly-executable
This means our integration tests will fail as it can't run Mach-O.
https://github.com/quarkusio/quarkus/issues/24860
Instead let's build both, test against Mach-O, and package up the linux executable.
-->
<!-- Delay creating as we won't be using this in ITs -->
<lambda-native.phase>verify</lambda-native.phase>
<!-- Run this instead to use it in integration tests -->
<lambda-native-it.phase>package</lambda-native-it.phase>
<!-- Build linux executable using Docker container -->
<lambda-native.container-build>true</lambda-native.container-build>
<!-- Run IT against separate native executable -->
<native.image.path.it>runner-it</native.image.path.it>
<!-- Run the build of native executable for testing -->
<lambda-native-it.skip>false</lambda-native-it.skip>
<failsafe.native-image-path>${lambda-native-it.finalName}</failsafe.native-image-path>
</properties>
</profile>
</profiles>
</project>

0 comments on commit 81da403

Please sign in to comment.