All Downloads are FREE. Search and download functionalities are using the official Maven repository.

daevil.daevil.script.nix.bash.JteJavaResolverGenerated Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package daevil.daevil.script.nix.bash;
public final class JteJavaResolverGenerated {
	public static final String JTE_NAME = "daevil/script/nix/bash/JavaResolver.jte";
	public static final int[] JTE_LINE_INFO = {0,0,0,0,2,58,59,59,60,60,61,61,62,109};
	public static void render(gg.jte.TemplateOutput jteOutput, gg.jte.html.HtmlInterceptor jteHtmlInterceptor, String baseUrl, String prompt) {
		jteOutput.writeContent("\n# If $JVM_JAVA_HOME is specified it will override JAVA_HOME and Java will not automatically be installed\n#set -x\n\nJVM_MAJOR_VERSION_DEFAULT=8\nJVM_RELEASE_DEFAULT=latest\nJVM_IMPL_DEFAULT=hotspot\nJVM_TYPE_DEFAULT=jdk\nset -e\nif [ `getconf LONG_BIT` = \"64\" ]; then\n    JVM_ARCH_DEFAULT=x64\nelse\n    JVM_ARCH_DEFAULT=x32\nfi\nJVM_OS_DEFAULT=\"linux\"\ncase \"${OSTYPE}\" in\ndarwin*)  JVM_OS_DEFAULT=\"mac\" ;;\nesac\n\n# Check for environment JVM version and release variables, otherwise specify the default.\nif [ -z \"$JVM_MAJOR_VERSION\" ]; then\n\tJVM_MAJOR_VERSION=${JVM_MAJOR_VERSION_DEFAULT}\nfi\nif [ -z \"$JVM_RELEASE\" ]; then\n\tJVM_RELEASE=${JVM_RELEASE_DEFAULT} # latest, jdk8u192-b12, ...\nfi\nif [ -z \"$JVM_TYPE\" ]; then\n\tJVM_TYPE=${JVM_TYPE_DEFAULT} # jdk, jre\nfi\nif [ -z \"$JVM_IMPL\" ]; then\n\tJVM_IMPL=${JVM_IMPL_DEFAULT} # hotspot, openj9\nfi\nif [ -z \"$JVM_OS\" ]; then\n\tJVM_OS=${JVM_OS_DEFAULT} # windows, linux, mac\nfi\nif [ -z \"$JVM_ARCH\" ]; then\n\tJVM_ARCH=${JVM_ARCH_DEFAULT} # x64, x32, ppc64, s390x, ppc64le, aarch64\nfi\nif [ -z \"$JVM_HEAP\" ]; then\n\tJVM_HEAP=normal # normal, large\nfi\n\n# Check for environment variables for where to store the JVM, otherwise specify the default.\nif [ -z \"$JVM_DIR\" ]; then\n\tJVM_DIR=\"${PROJECT_ROOT}/gradle/jvm/${JVM_MAJOR_VERSION}/${JVM_TYPE}${JVM_RELEASE}\"\nfi\nif [ -z \"$JVM_INFO_FILE\" ]; then\n\tJVM_INFO_FILE=\"/tmp/jvm_info_${JVM_RELEASE}.json\"\nfi\nif [ -z \"$JVM_ARCHIVE\" ]; then\n\tJVM_ARCHIVE=\"/tmp/jvm_${JVM_RELEASE}.tar.gz\"\nfi\n# Check for environment variable defining different http client, otherwise use curl\nif [ -z \"$HTTP_CLIENT\" ]; then\n\tHTTP_CLIENT=\"curl -sS -f -L -o\"\nfi\n");
		jteOutput.writeContent("\n");
		daevil.daevil.script.nix.bash.function.Jtesha256url_unarchiveGenerated.render(jteOutput, jteHtmlInterceptor);
		jteOutput.writeContent("\n");
		daevil.daevil.script.nix.bash.function.Jtestring_replaceGenerated.render(jteOutput, jteHtmlInterceptor);
		jteOutput.writeContent("\n");
		daevil.daevil.script.nix.bash.function.Jtefile_ageGenerated.render(jteOutput, jteHtmlInterceptor);
		jteOutput.writeContent("\n");
		jteOutput.writeContent("\njvm_install() {\n\techo \"Requesting Java ${JVM_MAJOR_VERSION} ${JVM_RELEASE} release\"\n\tneedsJvmInfo=true\n\tif [ -f \"${JVM_INFO_FILE}\" ]; then\n\t\tfileAge=$(file_age \"${JVM_INFO_FILE}\")\n\t\tif [ \"$fileAge\" -lt 86400 ]; then\n\t\t\tneedsJvmInfo=false\n\t\t\techo \"${JVM_INFO_FILE} is less than 24 hours old, not re-downloading\"\n\t\tfi\n\tfi\n\tif [ \"$needsJvmInfo\" = \"true\" ]; then\n\t\tjvmInfoURL=\"https://api.adoptopenjdk.net/v2/info/releases/openjdk${JVM_MAJOR_VERSION}?openjdk_impl=${JVM_IMPL}&arch=${JVM_ARCH}&os=${JVM_OS}&type=${JVM_TYPE}&release=${JVM_RELEASE}\"\n\t\turl_file \"${jvmInfoURL}\" \"${JVM_INFO_FILE}\"\n\tfi\n\treleaseName=$(grep -Po '\"release_name\":.*?[^\\\\]\",' \"${JVM_INFO_FILE}\" | awk -F'\"' '{print $4}')\n\tbinaryURL=$(grep -Po '\"binary_link\":.*?[^\\\\]\",' \"${JVM_INFO_FILE}\" | awk -F'\"' '{print $4}')\n\tshaURL=$(grep -Po '\"checksum_link\":.*?[^\\\\]\",' \"${JVM_INFO_FILE}\" | awk -F'\"' '{print $4}')\n\tneedsJvmDownload=true\n\tif [ \"$JVM_RELEASE\" = \"latest\" ]; then\n\t\tJVM_DIR=$(string_replace \"${JVM_DIR}\" \"latest\" \"${releaseName}\")\n\tfi\n\tif [ -f \"${JVM_DIR}/bin/java\" ] && [ -x \"${JVM_DIR}/bin/java\" ]; then\n\t\tneedsJvmDownload=false\n\t\techo \"${JVM_DIR} exists, not re-downloading\"\n\tfi\n\tif [ \"$needsJvmDownload\" = \"true\" ]; then\n\t\techo \"Downloading ${binaryURL}\"\n\t\tshaurl_unarchive \"${binaryURL}\" \"${shaURL}\" \"${JVM_ARCHIVE}\" \"${JVM_DIR}\"\n\tfi\n\texport JAVA_HOME=${JVM_DIR}\n\techo \"Java ${JVM_TYPE} ${JVM_MAJOR_VERSION} ${releaseName} - JAVA_HOME: ${JVM_DIR}\"\n}\n\nif [ -z \"$JVM_JAVA_HOME\" ]; then\n\tif [ -f \"${JVM_DIR}/bin/java\" ] && [ -x \"${JVM_DIR}/bin/java\" ]; then\n\t\tJAVA_HOME=${JVM_DIR}\n\telse\n\t\techo \"${JVM_DIR} does not exist!  Getting JVM...\"\n\t\tjvm_install\n\tfi\nelse\n\techo \"Using JVM_JAVA_HOME: $JVM_JAVA_HOME\"\n\tJAVA_HOME=$JVM_JAVA_HOME\nfi\nexport JAVA_HOME\nexport javacmd=${JAVA_HOME}/bin/java\n");
	}
	public static void renderMap(gg.jte.TemplateOutput jteOutput, gg.jte.html.HtmlInterceptor jteHtmlInterceptor, java.util.Map params) {
		String baseUrl = (String)params.get("baseUrl");
		String prompt = (String)params.get("prompt");
		render(jteOutput, jteHtmlInterceptor, baseUrl, prompt);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy