Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .ci/container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

# Install basics and tools
RUN apt-get update && apt-get install -y \
curl \
wget \
gnupg \
ca-certificates \
git \
unzip \
zip \
python3 \
python3-pip \
xvfb \
libgl1-mesa-dri \
libxtst6 \
libxxf86vm1 \
ant \
maven \
libncurses6 \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*

# Setup Azul Repo
RUN curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list

# Install JDKs 11, 17, 21, 25
RUN apt-get update && apt-get install -y \
zulu11-jdk \
zulu17-jdk \
zulu21-jdk \
zulu25-jdk \
&& rm -rf /var/lib/apt/lists/*

# Install ZuluFX 8 (Tarball)
# URL for Zulu 8 + FX (x64 Linux)
# Using a fixed version to ensure reproducibility.
RUN mkdir -p /usr/lib/jvm/zulu8-fx && \
curl -L "https://cdn.azul.com/zulu/bin/zulu8.82.0.21-ca-fx-jdk8.0.432-linux_x64.tar.gz" -o /tmp/zulu8.tar.gz && \
tar -xzf /tmp/zulu8.tar.gz -C /usr/lib/jvm/zulu8-fx --strip-components=1 && \
rm /tmp/zulu8.tar.gz

# Clone cn1-binaries
RUN git clone --depth=1 https://github.com/codenameone/cn1-binaries /opt/cn1-binaries

# Set Environment Variables for JDKs (Paths for apt installed JDKs usually symlinked to /usr/lib/jvm/zulu-XX-amd64)
ENV JAVA8_HOME=/usr/lib/jvm/zulu8-fx
ENV JDK8_HOME=/usr/lib/jvm/zulu8-fx
ENV JAVA11_HOME=/usr/lib/jvm/zulu11-ca-amd64
ENV JDK11_HOME=/usr/lib/jvm/zulu11-ca-amd64
ENV JAVA17_HOME=/usr/lib/jvm/zulu17-ca-amd64
ENV JDK17_HOME=/usr/lib/jvm/zulu17-ca-amd64
ENV JAVA21_HOME=/usr/lib/jvm/zulu21-ca-amd64
ENV JDK21_HOME=/usr/lib/jvm/zulu21-ca-amd64
ENV JAVA25_HOME=/usr/lib/jvm/zulu25-ca-amd64
ENV JDK25_HOME=/usr/lib/jvm/zulu25-ca-amd64

# Install Android SDK
ENV ANDROID_HOME=/opt/android-sdk
ENV ANDROID_SDK_ROOT=/opt/android-sdk
ENV CMDLINE_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip"

RUN mkdir -p ${ANDROID_HOME}/cmdline-tools && \
wget -q ${CMDLINE_TOOLS_URL} -O /tmp/cmdline-tools.zip && \
unzip -q /tmp/cmdline-tools.zip -d ${ANDROID_HOME}/cmdline-tools && \
mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest && \
rm /tmp/cmdline-tools.zip

ENV PATH=${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/emulator:${PATH}

# Accept licenses and install packages
# Note: sdkmanager requires Java 11+ to run. We use JAVA17_HOME for this step.
# We dynamically locate Zulu 17 to ensure the correct path is used.
RUN export JAVA17_REAL=$(find /usr/lib/jvm -maxdepth 1 -name "zulu*17*" -type d | head -n 1) && \
echo "Using JDK 17 at: $JAVA17_REAL" && \
yes | JAVA_HOME=$JAVA17_REAL sdkmanager --licenses && \
JAVA_HOME=$JAVA17_REAL sdkmanager "platform-tools" "platforms;android-31" "build-tools;31.0.0"

# Set Default JAVA_HOME to Java 8 (as per user requirement for builds)
ENV JAVA_HOME=/usr/lib/jvm/zulu8-fx
ENV PATH=$JAVA_HOME/bin:$PATH

ENV CN1_BINARIES=/opt/cn1-binaries

# Verify installations
RUN java -version && \
$JAVA11_HOME/bin/java -version && \
$JAVA17_HOME/bin/java -version && \
$JAVA21_HOME/bin/java -version && \
$JAVA25_HOME/bin/java -version && \
ant -version && \
mvn -version && \
python3 --version && \
JAVA_HOME=${JAVA17_HOME} sdkmanager --version
9 changes: 2 additions & 7 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ jobs:
build-linux-jdk8:

runs-on: ubuntu-latest
container:
image: ghcr.io/codenameone/codenameone/ci-container:latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 1.8
java-package: jdk
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install xvfb
- name: Build with Maven
run: |
cd maven
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build CI Container

on:
push:
paths:
- '.ci/container/**'
- '.github/workflows/build-container.yml'
workflow_dispatch:

env:
REGISTRY: ghcr.io

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Downcase Image Name
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}/ci-container" >> ${GITHUB_ENV}

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .ci/container
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
21 changes: 5 additions & 16 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ jobs:
build-linux-jdk8-fx:

runs-on: ubuntu-latest
container:
image: ghcr.io/codenameone/codenameone/ci-container:latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 1.8
java-package: jdk+fx
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
Expand All @@ -57,15 +54,10 @@ jobs:
cd maven
mvn clean verify -DunitTests=true -pl core-unittests -am -Dmaven.javadoc.skip=true -Plocal-dev-javase
cd ..
- name: Prepare Codename One binaries for Maven plugin tests
run: |
set -euo pipefail
rm -rf maven/target/cn1-binaries
git clone --depth=1 --filter=blob:none https://github.com/codenameone/cn1-binaries maven/target/cn1-binaries
- name: Run Maven plugin tests
working-directory: maven
env:
CN1_BINARIES: ${{ github.workspace }}/maven/target/cn1-binaries
CN1_BINARIES: /opt/cn1-binaries
run: |
mvn -B -Dmaven.javadoc.skip=true \
-DunitTests=true \
Expand Down Expand Up @@ -211,12 +203,9 @@ jobs:
script: |
const { publishQualityComment } = require('./.github/scripts/publish-quality-comment.js');
await publishQualityComment({ github, context, core });
- name: Install dependencies
- name: Link cn1-binaries
run: |
sudo apt-get update && sudo apt-get install xvfb
wget https://github.com/codenameone/cn1-binaries/archive/refs/heads/master.zip
unzip master.zip -d ..
mv ../cn1-binaries-master ../cn1-binaries
ln -sf $CN1_BINARIES ../cn1-binaries
- name: Build with Ant
run: xvfb-run ant test-javase
- name: Build CLDC11 JAR
Expand Down
21 changes: 7 additions & 14 deletions .github/workflows/scripts-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,20 @@ jobs:
pull-requests: write
issues: write
runs-on: ubuntu-latest
container:
image: ghcr.io/codenameone/codenameone/ci-container:latest
options: --privileged -v /dev/kvm:/dev/kvm
env:
GITHUB_TOKEN: ${{ secrets.CN1SS_GH_TOKEN }}
GH_TOKEN: ${{ secrets.CN1SS_GH_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Free Disk Space
if: matrix.id != 'default'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android/sdk/ndk
sudo rm -rf /opt/ghc
sudo rm -rf /usr/share/swift
- name: Setup JDK
if: matrix.id != 'default'
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'zulu'
- name: Set JDK_HOME
if: matrix.id != 'default'
run: echo "JDK_HOME=${JAVA_HOME}" >> $GITHUB_ENV
run: echo "JDK_HOME=/usr/lib/jvm/zulu-${{ matrix.java_version }}-amd64" >> $GITHUB_ENV
- name: Set JDK_HOME (Default)
if: matrix.id == 'default'
run: echo "JDK_HOME=${JDK8_HOME}" >> $GITHUB_ENV
- name: Configure CN1SS options
if: matrix.id != 'default'
run: |
Expand Down
62 changes: 36 additions & 26 deletions scripts/setup-workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ ENV_DIR="$DOWNLOAD_DIR/tools"
mkdir -p "$DOWNLOAD_DIR"
mkdir -p "$ENV_DIR"
CN1_BINARIES_PARENT="$(cd .. && pwd -P)"
CN1_BINARIES="${CN1_BINARIES_PARENT%/}/cn1-binaries"
mkdir -p "$CN1_BINARIES_PARENT"
CN1_BINARIES="${CN1_BINARIES:-${CN1_BINARIES_PARENT%/}/cn1-binaries}"
if [[ "$CN1_BINARIES" != /* ]]; then
CN1_BINARIES="$(cd "${CN1_BINARIES%/*}" && pwd -P)/${CN1_BINARIES##*/}"
fi
mkdir -p "$(dirname "$CN1_BINARIES")"

ENV_FILE="$ENV_DIR/env.sh"

Expand Down Expand Up @@ -183,36 +186,43 @@ log "Maven version:"; "$MAVEN_HOME/bin/mvn" -version
PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH"

log "Preparing cn1-binaries checkout"
if [ -d "$CN1_BINARIES/.git" ]; then
if [ "${CN1_SKIP_BINARIES_UPDATE:-0}" = "1" ]; then
log "Skipping cn1-binaries update as requested"
elif [ -d "$CN1_BINARIES/.git" ]; then
log "Found existing cn1-binaries repository at $CN1_BINARIES"
if git -C "$CN1_BINARIES" remote get-url origin >/dev/null 2>&1; then
if git -C "$CN1_BINARIES" fetch --depth=1 origin; then
remote_head=$(git -C "$CN1_BINARIES" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null || true)
if [ -z "$remote_head" ]; then
current_branch=$(git -C "$CN1_BINARIES" rev-parse --abbrev-ref HEAD 2>/dev/null || true)
if [ -n "$current_branch" ] && [ "$current_branch" != "HEAD" ]; then
remote_head="origin/$current_branch"
else
remote_head="origin/master"
fi
fi
if ! git -C "$CN1_BINARIES" rev-parse --verify "$remote_head" >/dev/null 2>&1; then
if git -C "$CN1_BINARIES" rev-parse --verify origin/main >/dev/null 2>&1; then
remote_head="origin/main"
elif git -C "$CN1_BINARIES" rev-parse --verify origin/master >/dev/null 2>&1; then
remote_head="origin/master"
# Check if directory is writable before attempting update
if [ -w "$CN1_BINARIES" ] && [ -w "$CN1_BINARIES/.git" ]; then
if git -C "$CN1_BINARIES" fetch --depth=1 origin; then
remote_head=$(git -C "$CN1_BINARIES" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null || true)
if [ -z "$remote_head" ]; then
current_branch=$(git -C "$CN1_BINARIES" rev-parse --abbrev-ref HEAD 2>/dev/null || true)
if [ -n "$current_branch" ] && [ "$current_branch" != "HEAD" ]; then
remote_head="origin/$current_branch"
else
remote_head="origin/master"
fi
fi
if ! git -C "$CN1_BINARIES" rev-parse --verify "$remote_head" >/dev/null 2>&1; then
if git -C "$CN1_BINARIES" rev-parse --verify origin/main >/dev/null 2>&1; then
remote_head="origin/main"
elif git -C "$CN1_BINARIES" rev-parse --verify origin/master >/dev/null 2>&1; then
remote_head="origin/master"
else
log "Unable to determine remote head for cached cn1-binaries; removing checkout"
rm -rf "$CN1_BINARIES"
fi
fi
if [ -d "$CN1_BINARIES/.git" ]; then
log "Updating cn1-binaries to $remote_head"
git -C "$CN1_BINARIES" reset --hard "$remote_head"
fi
else
log "Unable to determine remote head for cached cn1-binaries; removing checkout"
log "Failed to fetch updates for cached cn1-binaries; removing checkout"
rm -rf "$CN1_BINARIES"
fi
fi
if [ -d "$CN1_BINARIES/.git" ]; then
log "Updating cn1-binaries to $remote_head"
git -C "$CN1_BINARIES" reset --hard "$remote_head"
fi
else
log "Failed to fetch updates for cached cn1-binaries; removing checkout"
rm -rf "$CN1_BINARIES"
log "cn1-binaries directory is not writable. Skipping update."
fi
else
log "Cached cn1-binaries checkout missing origin remote; removing"
Expand Down
16 changes: 8 additions & 8 deletions vm/ByteCodeTranslator/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ dist.jar=${dist.dir}/ByteCodeTranslator.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.asm-5.0.3.jar=../../../cn1-binaries/vm/asm-5.0.3.jar
file.reference.asm-commons-5.0.3.jar=../../../cn1-binaries/vm/asm-commons-5.0.3.jar
file.reference.asm-tree-5.0.3.jar=../../../cn1-binaries/vm/asm-tree-5.0.3.jar
file.reference.asm-5.0.3.jar=../../../cn1-binaries/vm/asm-9.8.jar
file.reference.asm-commons-5.0.3.jar=../../../cn1-binaries/vm/asm-commons-9.8.jar
file.reference.asm-tree-5.0.3.jar=../../../cn1-binaries/vm/asm-tree-9.8.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.asm-5.0.3.jar}:\
${file.reference.asm-commons-5.0.3.jar}:\
${file.reference.asm-tree-5.0.3.jar}
${file.reference.asm-9.8.jar}:\
${file.reference.asm-commons-9.8.jar}:\
${file.reference.asm-tree-9.8.jar}
Comment on lines 37 to 40

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fix mismatched ASM property names in ByteCodeTranslator classpath

The javac.classpath now references ${file.reference.asm-9.8.jar}, ${file.reference.asm-commons-9.8.jar}, and ${file.reference.asm-tree-9.8.jar}, but the only defined properties remain file.reference.asm-5.0.3.jar, file.reference.asm-commons-5.0.3.jar, and file.reference.asm-tree-5.0.3.jar. In Ant/NetBeans builds the undefined properties resolve to empty strings, so the ASM JARs drop out of the classpath and ByteCodeTranslator will fail to compile with missing ASM classes. Please align the property names with the new 9.8 JARs or update the classpath to use the existing definitions.

Useful? React with 👍 / 👎.

# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=false
javac.processorpath=\
${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
Expand Down