8000 Add JRE dependency to Java components by lizard-boy · Pull Request #11 · grepdemos/localstack · GitHub
[go: up one dir, main page]

Skip to content

Add JRE dependency to Java components #11

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 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add Java dependency to StepFunctions legacy
  • Loading branch information
viren-nadkarni committed Sep 12, 2024
commit ea21461a9cc1e43bf52c018b6ab6b2201f63b433
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import logging
import os
import threading
from typing import Any, Dict

from localstack import config
from localstack.services.stepfunctions.packages import stepfunctions_local_package
from localstack.packages.java import java_package
from localstack.services.stepfunctions.packages import SFN_JAVA_VERSION, stepfunctions_local_package
from localstack.utils.aws import aws_stack
from localstack.utils.net import get_free_tcp_port, port_can_be_bound
from localstack.utils.run import ShellCommandThread
Expand Down Expand Up @@ -42,11 +44,17 @@ def do_start_thread(self) -> FuncThread:
return t

def generate_env_vars(self) -> Dict[str, Any]:
java_home = java_package.get_installer(SFN_JAVA_VERSION).get_java_home()

path = f"{java_home}/bin:{os.getenv('PATH')}"

return {
"EDGE_PORT": config.GATEWAY_LISTEN[0].port,
"EDGE_PORT_HTTP": config.GATEWAY_LISTEN[0].port,
"DATA_DIR": config.dirs.data,
"JAVA_HOME": java_home,
"PORT": self._port,
"PATH": path,
}

def generate_shell_command(self) -> str:
Expand Down
6 changes: 6 additions & 0 deletions localstack-core/localstack/services/stepfunctions/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from localstack.constants import ARTIFACTS_REPO, MAVEN_REPO_URL
from localstack.packages import InstallTarget, Package, PackageInstaller
from localstack.packages.core import ExecutableInstaller
from localstack.packages.java import java_package
from localstack.utils.archives import add_file_to_jar, untar, update_jar_manifest
from localstack.utils.files import file_exists_not_empty, mkdir, new_tmp_file, rm_rf
from localstack.utils.http import download
Expand All @@ -18,6 +19,8 @@
URL_ASPECTJWEAVER = f"{MAVEN_REPO_URL}/org/aspectj/aspectjweaver/1.9.7/aspectjweaver-1.9.7.jar"
JAR_URLS = [URL_ASPECTJRT, URL_ASPECTJWEAVER]

SFN_JAVA_VERSION = "11"

SFN_PATCH_URL_PREFIX = (
f"{ARTIFACTS_REPO}/raw/ac84739adc87ff4b5553478f6849134bcd259672/stepfunctions-local-patch"
)
Expand Down Expand Up @@ -77,6 +80,9 @@ class StepFunctionsLocalPackageInstaller(ExecutableInstaller):
def _get_install_marker_path(self, install_dir: str) -> str:
return os.path.join(install_dir, "StepFunctionsLocal.jar")

def _prepare_installation(self, target: InstallTarget) -> None:
java_package.get_installer(SFN_JAVA_VERSION).install()

def _install(self, target: InstallTarget) -> None:
"""
The StepFunctionsLocal JAR files are downloaded using the artifacts in DockerHub (because AWS only provides an
Expand Down
0