-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
tests/spread/rockcraft/plugin-jlink/bare-build-2404/rockcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: bare-build-2004 | ||
base: bare | ||
build-base: [email protected] | ||
|
||
# Remaining contents will come from "parts.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: base-2404 | ||
base: [email protected] | ||
|
||
# Remaining contents will come from "parts.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.yourcompany</groupId> | ||
<artifactId>helloworld</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<name>helloworld</name> | ||
<!-- FIXME change it to the project's website --> | ||
<url>http://www.example.com</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> | ||
<plugins> | ||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.1.0</version> | ||
</plugin> | ||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.5.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.8.2</version> | ||
</plugin> | ||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.7.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.0.0</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
13 changes: 13 additions & 0 deletions
13
...pread/rockcraft/plugin-jlink/helloworld/src/main/java/com/yourcompany/helloworld/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.yourcompany.helloworld; | ||
|
||
/** | ||
* Hello world! | ||
* | ||
*/ | ||
public class App | ||
{ | ||
public static void main( String[] args ) | ||
{ | ||
System.out.println( "Hello World!" ); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...d/rockcraft/plugin-jlink/helloworld/src/test/java/com/yourcompany/helloworld/AppTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.yourcompany.helloworld; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* Unit test for simple App. | ||
*/ | ||
public class AppTest | ||
{ | ||
/** | ||
* Rigorous Test :-) | ||
*/ | ||
@Test | ||
public void shouldAnswerWithTrue() | ||
{ | ||
assertTrue( true ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
# Actual parts definition for the rockcraft + python cases that we are testing. | ||
# (this gets appended to all rockcraft.yaml files in the subdirectories in the | ||
# main task.yaml). | ||
|
||
version: '0.1' | ||
summary: A rock that bundles a Java project. | ||
description: A rock that bundles a Java project. | ||
license: GPL-3.0 | ||
platforms: | ||
amd64: | ||
|
||
parts: | ||
helloworld: | ||
source: helloworld | ||
source-type: local | ||
build-packages: | ||
- openjdk-21-jdk | ||
- maven | ||
plugin: nil | ||
build-environment: | ||
- JAVA_HOME: "/usr/lib/jvm/java-21-openjdk-${CRAFT_TARGET_ARCH}" | ||
override-build: | | ||
mvn package | ||
mkdir -p ${CRAFT_PART_INSTALL}/jars | ||
cp ${CRAFT_PART_BUILD}/target/*.jar ${CRAFT_PART_INSTALL}/jars | ||
craftctl default | ||
deps: | ||
plugin: nil | ||
source: https://github.com/vpa1977/chisel-releases | ||
source-type: git | ||
source-branch: 24.04-openjdk-21-jre-headless | ||
override-build: | | ||
chisel cut --release ./ --root ${CRAFT_PART_INSTALL} libc6_libs \ | ||
libgcc-s1_libs \ | ||
libstdc++6_libs \ | ||
zlib1g_libs \ | ||
libnss3_libs \ | ||
base-files_base | ||
craftctl default | ||
runtime: | ||
after: | ||
- helloworld | ||
- deps | ||
plugin: jlink | ||
jlink-jars: | ||
- jars/helloworld-1.0-SNAPSHOT.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
summary: JLink plugin tests | ||
environment: | ||
SCENARIO/base_2404: base-2404 | ||
SCENARIO/bare_build_2004: bare-build-2404 | ||
execute: | | ||
SCENARIO_DIR="${SCENARIO}" | ||
ROCK_FILE="${SCENARIO}_0.1_amd64.rock" | ||
IMAGE="${SCENARIO}:0.1" | ||
# change into the scenario's directory | ||
cd ${SCENARIO_DIR} | ||
# add the parts definition, common to all scenarios | ||
cat ../parts.yaml >> rockcraft.yaml | ||
# copy the source of the project we're building (also shared) | ||
cp -r ../helloworld . | ||
# Build the rock & load it into docker | ||
run_rockcraft pack | ||
test -f ${ROCK_FILE} | ||
sudo rockcraft.skopeo --insecure-policy copy oci-archive:${ROCK_FILE} docker-daemon:${IMAGE} | ||
docker images | ||
rm ${ROCK_FILE} | ||
# Run the packaged project | ||
docker run --rm $IMAGE exec /usr/bin/java -jar jars/helloworld-1.0-SNAPSHOT.jar | MATCH "Hello World!" | ||
docker system prune -a -f |