Skip to content

Commit 7552c08

Browse files
committed
Preload archetype plugin for Android app build
1 parent 92add8e commit 7552c08

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

scripts/build-android-app.sh

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public class ${MAIN_NAME} {
181181
HELLOEOF
182182

183183
SETTINGS_FILE="$APP_DIR/common/codenameone_settings.properties"
184-
ba_log "Ensuring Codename One CSS compilation is enabled"
184+
ba_log "Disabling Codename One CSS compilation to avoid headless failures"
185185
if [ -f "$SETTINGS_FILE" ]; then
186186
if grep -q '^codename1.cssTheme=' "$SETTINGS_FILE"; then
187187
python3 - "$SETTINGS_FILE" <<'PY'
@@ -191,39 +191,20 @@ import sys
191191
192192
path = pathlib.Path(sys.argv[1])
193193
text = path.read_text()
194-
replacement = 'codename1.cssTheme=true'
194+
replacement = 'codename1.cssTheme=false'
195195
if re.search(r'^codename1\.cssTheme=', text, flags=re.MULTILINE):
196196
text = re.sub(r'^codename1\.cssTheme=.*$', replacement, text, flags=re.MULTILINE)
197197
else:
198198
text = text + ('\n' if not text.endswith('\n') else '') + replacement + '\n'
199199
path.write_text(text if text.endswith('\n') else text + '\n')
200200
PY
201201
else
202-
printf '\ncodename1.cssTheme=true\n' >> "$SETTINGS_FILE"
202+
printf '\ncodename1.cssTheme=false\n' >> "$SETTINGS_FILE"
203203
fi
204204
else
205-
printf 'codename1.cssTheme=true\n' > "$SETTINGS_FILE"
205+
printf 'codename1.cssTheme=false\n' > "$SETTINGS_FILE"
206206
fi
207207

208-
CSS_DIR="$APP_DIR/common/src/main/css"
209-
mkdir -p "$CSS_DIR"
210-
THEME_CSS="$CSS_DIR/theme.css"
211-
if [ ! -f "$THEME_CSS" ]; then
212-
cat > "$THEME_CSS" <<'CSSEOF'
213-
/* Minimal CSS to ensure the theme compiles during automated builds */
214-
Form {
215-
background-color: #ffffff;
216-
}
217-
218-
Label {
219-
font-size: 2mm;
220-
}
221-
CSSEOF
222-
fi
223-
224-
ba_log "Compiling Codename One CSS theme"
225-
xvfb-run -a "${MAVEN_CMD[@]}" -q --offline -f "$APP_DIR/pom.xml" codenameone:css "${EXTRA_MVN_ARGS[@]}"
226-
227208
ba_log "Building Android gradle project using Codename One port"
228209
xvfb-run -a "${MAVEN_CMD[@]}" -q --offline -f "$APP_DIR/pom.xml" package -DskipTests -Dcodename1.platform=android -Dcodename1.buildTarget=android-source -Dopen=false "${EXTRA_MVN_ARGS[@]}"
229210

scripts/setup-workspace.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ else
145145
log "Using existing Maven at $MAVEN_HOME"
146146
fi
147147

148+
ARCHETYPE_PLUGIN_COORD="org.apache.maven.plugins:maven-archetype-plugin:3.2.1"
149+
log "Preloading Maven archetype plugin ($ARCHETYPE_PLUGIN_COORD) for offline project generation"
150+
if "$MAVEN_HOME/bin/mvn" -B -N "$ARCHETYPE_PLUGIN_COORD:help" -Ddetail -Dgoal=generate >/dev/null 2>&1; then
151+
log "Maven archetype plugin cached locally"
152+
else
153+
log "Failed to preload $ARCHETYPE_PLUGIN_COORD; archetype generation may download dependencies" >&2
154+
fi
155+
148156
log "Writing environment to $ENV_FILE"
149157
cat > "$ENV_FILE" <<ENV
150158
export JAVA_HOME="$JAVA_HOME"

0 commit comments

Comments
 (0)