Skip to content

dbeaver/pro#5774 Correctly handle current working directory #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
10 changes: 6 additions & 4 deletions runGenerator.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

setlocal

set "MAVEN_ARGS=-Djdk.xml.maxGeneralEntitySizeLimit=2097152 -Djdk.xml.totalEntitySizeLimit=2097152"
set "GENERATOR_DIR=%~dp0"
set "WORKING_DIR="
cd %~dp0

:: Parse command line arguments
:parseArgs
if "%~1"=="" goto :checkDir
Expand All @@ -19,15 +21,15 @@ goto :parseArgs
:checkDir
if "%WORKING_DIR%"=="" (
echo No folder containing rcp_gen specified
exit /b 1
goto :end
)

echo Build generator
call ..\dbeaver-common\mvnw.cmd install -q -f "aggregate"
call %GENERATOR_DIR%..\dbeaver-common\mvnw.cmd install -T1C %MAVEN_ARGS% -q -f "%GENERATOR_DIR%aggregate"

echo Run generator
:: Run the Maven commands with the specified options
call ..\dbeaver-common\mvnw.cmd -f "pom.xml" package -T 1C -q exec:java -Dexec.args="-eclipse.version ${eclipse-version} -updateWorkspace -config %WORKING_DIR%osgi-app.properties -projectsFolder %WORKING_DIR%..\ -eclipse %WORKING_DIR%..\dbeaver-workspace\dependencies -output %WORKING_DIR%..\dbeaver-workspace/products/"
call %GENERATOR_DIR%..\dbeaver-common\mvnw.cmd -f "%GENERATOR_DIR%pom.xml" package -T1C %MAVEN_ARGS% -q exec:java -Dexec.args="-eclipse.version ${eclipse-version} -updateWorkspace -config %WORKING_DIR%osgi-app.properties -projectsFolder %WORKING_DIR%..\ -eclipse %WORKING_DIR%..\dbeaver-workspace\dependencies -output %WORKING_DIR%..\dbeaver-workspace\products"

:end
endlocal
37 changes: 20 additions & 17 deletions runGenerator.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
#!/bin/bash
#!/usr/bin/env sh

cd "$(dirname "$0")"
set -e

while getopts f: flag
do
case "${flag}" in
f) WORKING_DIR=${OPTARG};;
esac
done
echo "$WORKING_DIR"
if [ -z "$WORKING_DIR" ]; then
echo "No folder containing rcp_gen specified"
target_repo="$1"
if [ -z "$target_repo" ]; then
echo "target repository is not specified"
exit 1
fi
../dbeaver-common/mvnw install -q -f "aggregate"
# Run the Maven commands with the specified options
../dbeaver-common/mvnw -f "pom.xml" \
package \
-T 1C \

script_dir="$(realpath "$(dirname "$0")")"
repositories_root_dir="$(realpath "$script_dir/..")"

echo "Compiling workspace generator dependencies..."

"$repositories_root_dir/dbeaver-common/mvnw" install \
-T1C \
-q \
-f "$script_dir/aggregate"

"$repositories_root_dir/dbeaver-common/mvnw" package \
-T1C \
-q \
-f "$script_dir/pom.xml" \
exec:java \
-Dexec.args="-eclipse.version \${eclipse-version} -updateWorkspace -config $WORKING_DIR/osgi-app.properties -projectsFolder $WORKING_DIR/../ -eclipse $WORKING_DIR/../dbeaver-workspace/dependencies -output $WORKING_DIR/../dbeaver-workspace/products/"
-Dexec.args="-eclipse.version \${eclipse-version} -updateWorkspace -config $target_repo/osgi-app.properties -projectsFolder $repositories_root_dir -eclipse $repositories_root_dir/dbeaver-workspace/dependencies -output $repositories_root_dir/dbeaver-workspace/products/"
14 changes: 7 additions & 7 deletions src/main/java/org/jkiss/tools/rcplaunchconfig/EntryPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@
bundlesPaths
);
}
List<ResultInfo> executionResults = forkJoinPool.submit(() -> pathsManager.getProductsPathsAndWorkDirs().entrySet().parallelStream().map((productPath) -> {

Check warning on line 106 in src/main/java/org/jkiss/tools/rcplaunchconfig/EntryPoint.java

View workflow job for this annotation

GitHub Actions / Check / Lint

[checkstyle] reported by reviewdog 🐶 Line is longer than 140 characters (found 163). Raw Output: /github/workspace/./src/main/java/org/jkiss/tools/rcplaunchconfig/EntryPoint.java:106:0: warning: Line is longer than 140 characters (found 163). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
log.info("Starting generation for: %s" + productPath);
log.debug("Thread name %s used for %s".formatted(Thread.currentThread().getName(), productPath));
log.info("Starting generation for {}", productPath);
log.debug("Thread name {} used for {}", Thread.currentThread().getName(), productPath);
try {
Result result = new Result();
result.setWorkDir(productPath.getValue());
Expand All @@ -125,15 +125,15 @@
try {
Files.createDirectories(resultPath.getParent());
} catch (Throwable throwable) {
log.debug("Error creating target parent directories for %s".formatted(resultPath));
log.debug("Error creating target parent directories for {}", resultPath);
}
try {
FileUtils.removeAllFromDir(resultPath);
} catch (Throwable e) {
log.debug("Error deleting target folder for %s".formatted(resultPath), e);
log.debug("Error deleting target folder for {}", resultPath, e);
}
log.info("Product generation for %s completed".formatted(result.getProductId()));
log.debug("Thread %s finished execution".formatted(Thread.currentThread().getName()));
log.info("Product generation for {} completed", result.getProductId());
log.debug("Thread {} finished execution", Thread.currentThread().getName());
dependencyGraph.printDependencyTree(root);
return new ResultInfo(productPath, result, resultPath);
} catch (XMLStreamException | IOException e) {
Expand Down Expand Up @@ -168,7 +168,7 @@
}
{

log.info("Starting to load test bundles for %s...".formatted(result.getProductName()));
log.info("Starting to load test bundles for {}...", result.getProductName());
PluginResolver.resolveTestBundlesAndLibraries(result, result.getProductGraph());
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,7 @@ private void appendLibraryInfo(
boolean isLibrary) {
resolvedBundles.add(new Pair<>(bundleInfo.getBundleName(), new Version(bundleInfo.getBundleVersion())));
if (bundleInfo.getPath() == null) {
log.error("Error appending library info to non existing module %s, should not happen"
.formatted(bundleInfo.getBundleName()));
log.error("Error appending library info to non existing module {}, should not happen", bundleInfo.getBundleName());
return;
}
if (bundleInfo.getPath().toFile().isDirectory()) {
Expand Down
Loading