jramosd / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
0 stars 0 forks source link

Mac: Use ant and appbundler instead of scripts #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

I've modified the "jcef_app" target within jcef.gyp to create an usable 
App-Bundle instead of a dummy-bundle.

Therefore I've added the third party tool "appbundler" to the directory 
"src/third_party/appbundler".
Please add the attached JAR archive to this directory manually because it's not 
included within the plain-text diff file.

The appbundler is triggered by Apaches ANT which is already available on Mac OS 
X machines.
The build targets for ANT are defined within the new file "src/build.xml".

So, now if you run "gclient runhooks" and open afterwards the Xcode project, 
please use the target "All (jcef project)" to build jcef.
This will (a) compile jcef (b) compile java using ANT and (c) create an 
app-bundle using the appbundler via ANT.
There is no need any more to use the shell-scripts out of "src/tools/".

The application jcef_app.app can be found in src/xcodebuild/Debug/ and can be 
started by double-clicking it or with the terminal command "open".

Original issue reported on code.google.com by k...@censhare.de on 15 Jan 2014 at 10:32

Attachments:

GoogleCodeExporter commented 9 years ago
Please update the wiki page BranchesAndBuildings as well. See attached patch

Original comment by k...@censhare.de on 15 Jan 2014 at 11:36

Attachments:

GoogleCodeExporter commented 9 years ago
One additional patch-file to avoid problems with Windows compatibility (there 
is a problem if the library path is corrected within CefContext.cpp).

 Please add 2014-01-15_03-moved_to_ant_app_bundle_creation.patch first and afterwards add this attached patch file. 

Original comment by k...@censhare.de on 17 Jan 2014 at 7:07

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch. A few questions:

1. 2014-01-15_03-moved_to_ant_app_bundle_creation.patch line 196:

-  const std::string& module_dir = GetJNIString(env, argPathToJavaDLL);
+  std::string module_dir = GetJNIString(env, argPathToJavaDLL);
+  std::size_t endPos = module_dir.find(':');
+  module_dir = module_dir.substr(0,endPos);

Can you explain why this is necessary?

2. 2014-01-15_03-moved_to_ant_app_bundle_creation.patch line 583:

+      export 
CLS_PATH="$OUT_PATH/jcef.jar:$OUT_PATH/jcef-tests.jar:$OUT_PATH/gluegen-rt.jar:$
OUT_PATH/gluegen-rt-natives-macosx-universal.jar:$OUT_PATH/jogl-all.jar:$OUT_PAT
H/jogl-all-natives-macosx-universal.jar"

Can we use a wildcard ($OUT_PATH/*) instead of specifying the full name of each 
jar file?

Original comment by magreenb...@gmail.com on 22 Jan 2014 at 3:28

GoogleCodeExporter commented 9 years ago
Thanks for reviewing the patch.
Regarding your questions:

1.)
The function Java_org_cef_CefContext_N_1Initialize is called by Java with
System.getProperty("java.library.path"); as value for the param 
argPathToJavaDLL.

According Java's definition, the property "java.library.path" can contain more
than one path to search for libraries. These paths are separated by the 
character
which is stored within the property "path.separator" (":" for UNIX and ";" for 
Windows).
(see 
http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#getProperties())

So if you use JCEF within great projects, you'll get soon or later problems by
interpreting the property value of "java.library.path" as only one path. Most 
of 
the big projects may have not only one lib-path to search in and so you'll get a
non valid path passed to the native world.

As a workaround of this problem I've added that "split" patch to the function, 
so
that only one (and not a bunch of paths) path is passed to "GetHeplerPath()", 
append to "settings.resources_dir_path" and append to 
"settings.locales_dir_path".

BUT: You're right. There are some problems with this patch:
(1) I forgot that there are different path separators on different systems
(2) Maybe not in every case the first path is that one which contains the jcef 
lib.
(3) Maybe the file for the patch isn't the best choice.

For that reason I've removed the patch from CefContext.cpp and added a more 
concrete
one to CefContext.java. The Java-Patch splits "java.library.path" by 
"path.separator"
and searches within the directory for the JCEF lib. If it contains it, the 
single
path is passed to the native world.

2.)
Yes you're right. Addressing several JARs within the same directory is nonsense.
So, I've reduced it to the wildcard pattern as suggested by you.

See attached patch-file for my changes.

Original comment by k...@censhare.de on 24 Jan 2014 at 11:06

Attachments:

GoogleCodeExporter commented 9 years ago
Added in revision 18 with minor style changes. Also updated the distrib scripts.

Original comment by magreenb...@gmail.com on 30 Jan 2014 at 5:16