In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to use source code to analyze Compile, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Bin/compile
The entry is: bin/compile, which is similar to the detect script: you need a build directory to instantiate the buildpack object and call its compile interface.
Note: there seems to be only one parameter in this script, but the second parameter is actually required at run time: the application cache directory, when downloading JDK
Compile method
Compilempilecompile first calls component_detection, probes the support for containers and JRE,framework, and then calls the compilation of JRE, the compilation of each framework, and the compilation of containers.
Ruby code
Def compile
Puts BUILDPACK_MESSAGE% @ buildpack_version
Container = component_detection ('container', @ containers, true) .first
Fail'No container can run this application' unless container
Component_detection ('JRE', @ jres, true) .first.compile
Component_detection ('framework', @ frameworks, false) .each (&: compile) # calls the compilation of each framework
Container.compile
End
Component_detection returns component, for example, component_detection of JRE returns JavaBuildpack::Jre::OpenJdkJRE.
Compilation of JRE
JRE compilation calls JavaBuildpack::Jre::OpenJdkJRE 's compile, and JavaBuildpack::Jre::OpenJdkJRE inherits from OpenJDKLike, so it can be traced back to OpenJDKLike's compile.
Ruby code
Def compile
Download_tar
@ droplet.copy_resources
End
You can see that the compilation did two things:
Download the package of Jdk and copy resources, that is, copy the files under resources/open_jdk_jre
Compilation of Tomcat
The compilation of the container calls JavaBuildpack::Container::Tomcat 's compile, which is defined in its parent class: JavaBuildpack::Component::ModularComponent
Java code
Def compile
@ sub_components.each (&: compile)
End
That is, to invoke the compilation of its subcomponents, including: TomcatInstance,TomcatLifecycleSupport,TomcatLoggingSupport,TomcatAccessLoggingSupport,TomcatRedisStore,TomcatInsightSupport.
Compile method of TomcatInstance
The compile method does three things:
1. Download tomcat's package
two。 Link the user application root directory in the webapps/WEB-INF/ROOT of tomcat
3. Link the jar package to WEB-INF/lib
Ruby code
Def compile
Download (@ version, @ uri) {| file | expand file}
Link_to (@ application.root.children, root)
@ droplet.additional_libraries
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.