Compile Eclipse.

xiaoxiao2021-03-06  113

Download the Eclipse source package from www.eclipse.org to decompress. Found that Eclipse's source code directory and the final compiled directory results are basically in the root directory, it is also a plugins subdirectory and a featureS subdirectory, the only lack is that startup.jar and Eclipse.exe. I saw the build instruction in www.eclipse.org and found that the compilation is very simple, and Ant is also used (fortunately, Ant, ^ _ ^). There is a build.bat script, requiring several parameters in different platforms, are the -OS operating system, -ws window system, -arch CPU architecture, and then build script selection different build.xml files based on these parameters. Then call Ant to do compilation. The specific parameters can view the compilation help documentation of Eclipse, which I use Windows XP, so the compilation parameter is build -os win32 -ws win32 -arch x86. It should be noted that the Ant_home path to start compiling, simple practice is, start menu -> run, type set ant_path = d: /apache-ant-1.6.0. I suggest that it is best to set the Ant's bin directory to the path environment variable, because each plugin of Eclipse itself has a build.xml file, most of which can be directly compiled directly into Ant directly in its directory, If you modify some of the partial code of a component, you can simply knock an Ant to observe the result without need to return to the root directory to do full compilation. It should be said that the compilation process of Eclipse itself is not too slow. I have 15 minutes on my P4 2.8 / 1G RAM machine. But if I changed some files of a plug-in, then I returned to the root directory to make some compile, I found that it is almost the time spent with the complete compilation, because many plugins that have not changed have been recompiled and packaged. This makes me feel very uncomfortable. I don't know why there will be this design, it seems to analyze the Eclipse's build script. After completing compilation, it will find a TMP subdirectory in the root directory. Here is 3 directories, plugins, features, and a directory that varies from the platform, which is called setup.x86 under my system. Plugins placed all compiled plugins, and under Features stores this Feature. Under the win32.win32.x86, it is just that the Eclipse.exe and Startup.exe files required to run Eclipse. I tried to copy the two files into the TMP directory, then double-click Eclipse.exe, which is very difficult. Eclipse Splash actually appeared, and then the entire program started, everything OK.

In order to have a rational understanding of the entire compilation process, I followed the compilation process of the entire Eclipse, in fact, it is to observe the call relationship between multiple Builk.xml. 1. The build.xml file of the root directory has a Target called Allelements, its script is as follows: Obviously, first compiled is build.xml under org.xml under org.eclipse.sdk under the Features directory File, and the target Target is build.jar (understanding this property to read Eclipse_src / build.xml).

All these rows of scripts are: execute Ant Build.jar 2. in the features / org.eclipse.sdk directory, then analyze the scripts corresponding to Build.jar in the org.eclipse.sdk / build.xml file, Along the build.jar's Depend, tracking the goal of all.features, everything is clear < Ant Antfile = "build.xml" DIR = "../ org.eclipse.platform /" target = "$ {target}" /> Obviously, this Target means to compile the two feature files under Features.

Moreover, here can actually see the hierarchical relationship of Eclipse plug-ins. SDK calls Platform, JDT, PDE's own build.xml, apparently, these three plugins constitute SDK. 3. The remaining tracking steps are the same as the front, and the Platform calls all the build.xml of the plug-in that makes the Platform, and the jdt calls the build.xml of the plugin that makes up the JDT, see an example, in features / org.eclipse.platform / build.xml Next line: ... Calling of other plugins Obviously, each plugin in a Plugins directory is compiled in this way. 4. Look at the build.xml file of a specific plugin, a section in org.eclipse.core.Runtime / build.xml, describe the entire compiler, of course, the packaged part is in another target: / / Delete Temporary Directory Create a temporary directory // Compile all .java files, source code The directory is specified in the subsequent .

// Package // Delete temporary directory The analysis of Eclipse is finally completed, and I also released my previous doubts. When the Eclipse source root directory is knocked into the build command, compile the "compile" Target to Eclipse_src / build.xml. The first thing that is the first thing to perform "init" and "clean" two Targets, and then call Allelements, the following script is: So, it can be said that Eclipse is no part of the concept, the only thing to think is to enter you want to recompile Plugin, execution: Ant Clean Ant Build.jar Game over!

转载请注明原文地址:https://www.9cbs.com/read-98406.html

New Post(0)