-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
a739626
commit ce5ac95
Showing
3 changed files
with
109 additions
and
70 deletions.
There are no files selected for viewing
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
144 changes: 89 additions & 55 deletions
144
build/org.eclipse.birt.releng.birtbuilder/extras/genReport.sh
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 |
---|---|---|
@@ -1,66 +1,100 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
################ USAGE OF REPORTRUNNER ######################### | ||
# org.eclipse.birt.report.engine.impl.ReportRunner Usage: | ||
# --mode/-m [ run | render | runrender] the default is runrender | ||
# for runrender mode: | ||
# we should add it in the end <design file> | ||
# --format/-f [ HTML | PDF ] | ||
# --output/-o <target file> | ||
# --htmlType/-t < HTML | ReportletNoCSS > | ||
# --locale/-l<locale> | ||
# --parameter/-p <"parameterName=parameterValue"> | ||
# --file/-F <parameter file> | ||
# --encoding/-e <target encoding> | ||
# Copyright (c) 2011, 2024, Actuate, Remain Software and others | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Eclipse Public License 2.0 which is available at | ||
# https://www.eclipse.org/legal/epl-2.0/. | ||
# | ||
# Locale: default is English | ||
# parameters in command line will overide parameters in parameter file | ||
# parameter name cannot include characters such as \' \'\, \'=\'\, \':\' | ||
# | ||
# For RUN mode: | ||
# we should add it in the end <design file> | ||
# --output/-o <target file> | ||
# --locale/-l<locale> | ||
# --parameter/-p <parameterName=parameterValue> | ||
# --file/-F <parameter file> | ||
# | ||
# Locale: default is English | ||
# parameters in command line will overide parameters in parameter file | ||
# parameter name cannot include characters such as \' \'\, \'=\'\, \':\' | ||
# | ||
# For RENDER mode: | ||
# we should add it in the end <design file> | ||
# --output/-o <target file> | ||
# --page/-p <pageNumber> | ||
# --locale/-l<locale> | ||
# | ||
# Locale: default is English | ||
################ END OF USAGE ######################### | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
# echo set common variables | ||
#export BIRT_HOME=BIRT-runtime_install_dir | ||
BIRT_HOME="" | ||
WORK_DIR=$PWD | ||
# class path : don't forget to add your connection drivers in the classpath directory | ||
BIRTCLASSPATH=$BIRT_HOME/ReportEngine/lib/* | ||
set -e | ||
|
||
# Get the directory of the script | ||
THIS_DIR=$(dirname "$(realpath "$0")") | ||
|
||
echo BIRT_HOME=$BIRT_HOME | ||
echo WORK_DIR=$WORK_DIR | ||
echo BIRTCLASSPATH=$BIRTCLASSPATH | ||
# Usage function | ||
usage() { | ||
echo | ||
echo "genReport.sh calls the BIRT ReportRunner" | ||
echo "example: ./genReport.sh -f PDF -o hello.pdf -p \"paramList=1\" -p \"paramInteger=123\" -p \"paramString=\\\"Hello,Birt\\\"\" samples/hello_world.rptdesign" | ||
echo "--help this help" | ||
echo | ||
echo "org.eclipse.birt.report.engine.impl.ReportRunner Usage:" | ||
echo "--mode/-m [ runrender | render | run ] the default is runrender" | ||
echo | ||
echo "For runrender mode:" | ||
echo " --help runrender" | ||
echo " --format/-f [ HTML | PDF ]" | ||
echo " --output/-o <target file>" | ||
echo " --htmlType/-t < HTML | ReportletNoCSS >" | ||
echo " --locale/-l <locale>" | ||
echo " --parameter/-p <\"parameterName=parameterValue\">" | ||
echo " --file/-F <parameter file>" | ||
echo " --encoding/-e <target encoding>" | ||
echo | ||
echo "Locale: default is English" | ||
echo "parameters in command line will override parameters in parameter file" | ||
echo "parameter name cannot include characters such as ' ', '=', ':'" | ||
echo | ||
echo "For RUN mode:" | ||
echo " --help run" | ||
echo " --output/-o <target file>" | ||
echo " --locale/-l <locale>" | ||
echo " --parameter/-p <\"parameterName=parameterValue\">" | ||
echo " --file/-F <parameter file>" | ||
echo | ||
echo "Locale: default is English" | ||
echo "parameters in command line will override parameters in parameter file" | ||
echo "parameter name cannot include characters such as ' ', '=', ':'" | ||
echo | ||
echo "For RENDER mode:" | ||
echo " --help render" | ||
echo " --output/-o <target file>" | ||
echo " --page/-p <pageNumber>" | ||
echo " --locale/-l <locale>" | ||
echo | ||
echo "Locale: default is English" | ||
} | ||
|
||
if [ "$BIRT_HOME" = "" ] | ||
# Run function | ||
run() { | ||
# Set common variables | ||
WORK_DIR="$THIS_DIR" | ||
|
||
then | ||
echo "BIRT_HOME must be set before ReportRunner can run"; | ||
else | ||
if [[ -d "$THIS_DIR/platform" ]]; then | ||
BIRT_HOME="$THIS_DIR/platform" | ||
fi | ||
|
||
if [[ -n "$BIRT_HOME" ]]; then | ||
echo "OSGI-Mode, BIRT_HOME=$BIRT_HOME" | ||
fi | ||
|
||
java_io_tmpdir=$WORK_DIR/tmpdir | ||
org_eclipse_datatools_workspacepath=$java_io_tmpdir/workspace_dtp | ||
mkdir -p $org_eclipse_datatools_workspacepath | ||
# Set temporary directories | ||
export java_io_tmpdir="$WORK_DIR/tmpdir" | ||
export org_eclipse_datatools_workspacepath="$java_io_tmpdir/workspace_dtp" | ||
|
||
# JAVA version >= 17 | ||
JAVACMD='java'; | ||
$JAVACMD -Djava.awt.headless=true -cp "$BIRTCLASSPATH" -DBIRT_HOME="$BIRT_HOME" -Dorg.eclipse.datatools_workspacepath="$org_eclipse_datatools_workspacepath" org.eclipse.birt.report.engine.api.ReportRunner ${1+"$@"} | ||
mkdir -p "$java_io_tmpdir" | ||
mkdir -p "$org_eclipse_datatools_workspacepath" | ||
|
||
# Set BIRT class path | ||
BIRTCLASSPATH="$THIS_DIR/lib/*" | ||
|
||
# Set Java command | ||
JAVACMD="java" | ||
|
||
# Execute the command | ||
echo "Java command=$JAVACMD -cp \"$BIRTCLASSPATH\" -Djava.awt.headless=true -DBIRT_HOME=$BIRT_HOME org.eclipse.birt.report.engine.api.ReportRunner $@" | ||
$JAVACMD -cp "$BIRTCLASSPATH" -DBIRT_HOME="$BIRT_HOME" org.eclipse.birt.report.engine.api.ReportRunner "$@" | ||
} | ||
|
||
# Handle arguments | ||
if [[ -z "$1" || ( "$1" == "--help" && -z "$2" ) ]]; then | ||
usage | ||
exit 0 | ||
else | ||
run "$@" | ||
fi | ||
|
||
exit 0 | ||
|
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