This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
The following commit(s) were added to refs/heads/main by this push:
new 47238b0f windows development compatibility changes (#1146)
47238b0f is described below
commit 47238b0fea85c8871909530bc654b5033ecc65a9
Author: Vidhya Sagar <[email protected]>
AuthorDate: Mon Feb 26 23:09:03 2024 +0800
windows development compatibility changes (#1146)
Co-authored-by: Vidhya Sagar <[email protected]>
---
change_version.sh | 9 +++-----
docs/DEV.md | 27 +++++++++++-----------
.../org/apache/camel/karavan/code/CodeService.java | 3 ++-
.../apache/camel/karavan/service/GitService.java | 9 ++++----
4 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/change_version.sh b/change_version.sh
index 9ab52ca7..e439e237 100755
--- a/change_version.sh
+++ b/change_version.sh
@@ -4,10 +4,7 @@ echo "Set Generator pom.xml version: $1";
mvn versions:set -DnewVersion=$1 -f karavan-generator
echo "Set Application pom.xml version: $1";
-mvn versions:set -DnewVersion=$1 -f karavan-web/karavan-app
-
-echo "Set Installer pom.xml version: $1";
-mvn versions:set -DnewVersion=$1 -f karavan-web/karavan-installer
+mvn versions:set -DnewVersion=$1 -f karavan-app
@@ -23,7 +20,7 @@ echo "Set Designer package.json version: $1";
npm version --new-version $1 --prefix karavan-designer
echo "Set Application package.json extension version: $1";
-npm version --new-version $1 --prefix karavan-web/karavan-app/src/main/webui/
+npm version --new-version $1 --prefix karavan-app/src/main/webui/
echo "Set VSCode extension package.json version: $1";
npm version --new-version $1 --prefix karavan-vscode
@@ -43,4 +40,4 @@ echo "Set Github Workflow App TAG version: $1";
sed -i.bak 's/TAG:.*/TAG: '"$1"'/g' .github/workflows/installer.yml
echo "Set application.properties karavan.version=$1";
-sed -i.bak 's/karavan.version.*/karavan.version='"$1"'/g'
karavan-web/karavan-app/src/main/resources/application.properties
\ No newline at end of file
+sed -i.bak 's/karavan.version.*/karavan.version='"$1"'/g'
karavan-app/src/main/resources/application.properties
\ No newline at end of file
diff --git a/docs/DEV.md b/docs/DEV.md
index e23a1da4..c092ffa0 100644
--- a/docs/DEV.md
+++ b/docs/DEV.md
@@ -5,12 +5,8 @@ Generate Camel Models and Api from Camel sources to Typescript
in karavan-core
Front-end Camel Models and Api
3. karavan-Designer
KaravanDesigner UI component
-4. karavan-web
-Karavan Cloud Application
- * karavan-app
- Karavan Application to be installed into Kubernetes
- * karavan-installer
- Karavan Installer to install into Kubernetes
+4. karavan-app
+Karavan Application to be installed into Kubernetes
5. karavan-vscode
VS Code extension based on Karavan Designer
@@ -28,7 +24,6 @@ npm install
3. Build Karavan app
```
-cd karavan-web
mvn clean package -f karavan-app -Dquarkus.profile=public
```
@@ -52,7 +47,7 @@ npm install -g @vscode/vsce
vsce package
```
-## To run karavan-web in the local machine for debugging
+## To run karavan-app in the local machine for debugging
#### Prerequisite
Docker Engine 24+
@@ -60,9 +55,9 @@ Docker Engine 24+
1. Make the following change in package.json line 5-12 (needed only for
Windows)
```
"scripts": {
- "copy-designer": "xcopy
..\\..\\..\\..\\..\\karavan-designer\\src\\designer src\\designer /E/H/Y",
- "copy-knowledgebase": "xcopy
..\\..\\..\\..\\..\\karavan-designer\\src\\knowledgebase src\\knowledgebase
/E/H/Y",
- "copy-topology": "xcopy
..\\..\\..\\..\\..\\karavan-designer\\src\\topology src\\topology /E/H/Y",
+ "copy-designer": "xcopy ..\\..\\..\\..\\karavan-designer\\src\\designer
src\\designer /E/H/Y",
+ "copy-knowledgebase": "xcopy
..\\..\\..\\..\\karavan-designer\\src\\knowledgebase src\\knowledgebase /E/H/Y",
+ "copy-topology": "xcopy ..\\..\\..\\..\\karavan-designer\\src\\topology
src\\topology /E/H/Y",
"copy-code": " npm run copy-designer && npm run copy-knowledgebase &&
npm run copy-topology",
"start": "set PORT=3003 && npm run copy-code && react-scripts start",
"build": "npm run copy-code && DISABLE_ESLINT_PLUGIN=true react-scripts
build"
@@ -72,14 +67,18 @@ Docker Engine 24+
2. Add local profile config to the application.properties
```
# Local
-%local.karavan.image-registry=localhost:5000
-%local.karavan.git-repository=http://localhost:3000/karavan/karavan.git
%local.karavan.image-registry-install=true
%local.karavan.git-install-gitea=true
%local.quarkus.http.host=localhost
```
-3. Run ./karavan-web/karavan-app in Quarkus Dev mode
+3. Update hosts.file with below entries
+```
+127.0.0.1 gitea # karavan local git server
+127.0.0.1 registry # karavan local image registry server
+```
+
+4. Run ./karavan-app in Quarkus Dev mode
```
mvn clean compile quarkus:dev -Dquarkus.profile=local,public
```
diff --git
a/karavan-app/src/main/java/org/apache/camel/karavan/code/CodeService.java
b/karavan-app/src/main/java/org/apache/camel/karavan/code/CodeService.java
index 3b2f9df9..89a536cd 100644
--- a/karavan-app/src/main/java/org/apache/camel/karavan/code/CodeService.java
+++ b/karavan-app/src/main/java/org/apache/camel/karavan/code/CodeService.java
@@ -180,8 +180,9 @@ public class CodeService {
public String getTemplateText(String fileName) {
try {
List<ProjectFile> files =
karavanCacheService.getProjectFiles(Project.Type.templates.name());
+ // replaceAll("\r\n", "\n")) has been add to eliminate the impact
of editing the template files from windows machine.
return files.stream().filter(f ->
f.getName().equalsIgnoreCase(fileName))
- .map(ProjectFile::getCode).findFirst().orElse(null);
+ .map(file-> file.getCode().replaceAll("\r\n",
"\n")).findFirst().orElse(null);
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
diff --git
a/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
b/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
index 0556cd8a..db329be3 100644
--- a/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
+++ b/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
@@ -52,6 +52,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
+import java.util.regex.Pattern;
@ApplicationScoped
public class GitService {
@@ -204,7 +205,7 @@ public class GitService {
LOGGER.info("Read projects from " + folder);
List<String> files = new ArrayList<>();
vertx.fileSystem().readDirBlocking(folder).forEach(path -> {
- String[] filenames = path.split(File.separator);
+ String[] filenames = path.split(Pattern.quote(File.separator));
String folderName = filenames[filenames.length - 1];
if (folderName.startsWith(".")) {
// skip hidden
@@ -222,7 +223,7 @@ public class GitService {
LOGGER.infof("Read files from %s/%s", repoFolder, projectFolder);
Map<String, String> files = new HashMap<>();
vertx.fileSystem().readDirBlocking(repoFolder + File.separator +
projectFolder).forEach(f -> {
- String[] filenames = f.split(File.separator);
+ String[] filenames = f.split(Pattern.quote(File.separator));
String filename = filenames[filenames.length - 1];
Path path = Paths.get(f);
if (!filename.startsWith(".") && !Files.isDirectory(path)) {
@@ -254,7 +255,7 @@ public class GitService {
Path path = Paths.get(folder, project.getProjectId());
LOGGER.info("Add deleted files to git index for project " +
project.getProjectId());
vertx.fileSystem().readDirBlocking(path.toString()).forEach(f -> {
- String[] filenames = f.split(File.separator);
+ String[] filenames = f.split(Pattern.quote(File.separator));
String filename = filenames[filenames.length - 1];
LOGGER.info("Checking file " + filename);
if (files.stream().filter(pf -> Objects.equals(pf.getName(),
filename)).count() == 0) {
@@ -405,7 +406,7 @@ public class GitService {
changes.stream().forEach(de -> {
String path = de.getNewPath();
if (path != null) {
- String[] parts = path.split(File.separator);
+ String[] parts =
path.split(Pattern.quote(File.separator));
if (parts.length > 0) {
files.add(parts[0]);
}