JaroslavTulach: /* Checklist */ - 2015-05-29 06:13:49

Checklist

←Older revision Revision as of 06:13, 29 May 2015
Line 66: Line 66:
* Encode resources from a [[JAR]] into [[JavaScript]]. Probably via [[wikipedia:base64]] (also done in [[Bck2Brwsr 0.9]])
* Encode resources from a [[JAR]] into [[JavaScript]]. Probably via [[wikipedia:base64]] (also done in [[Bck2Brwsr 0.9]])
* Modify [[Maven]] task to process single [[JAR]] in a batch - can [[Bck2BrwsrLibraries|precompile libraries]] since [[Bck2Brwsr 0.12]]
* Modify [[Maven]] task to process single [[JAR]] in a batch - can [[Bck2BrwsrLibraries|precompile libraries]] since [[Bck2Brwsr 0.12]]
 +
 +
== Conclusion ==
 +
 +
The way [[Bck2BrwsrLibraries]] work shows one can have modularity in a single classloader (as [[Bck2Brwsr]] loads all classes in a system {{JDK|java/lang|ClassLoader}}). Yet, it is possible to isolate non-public packages between individual modules and achieve sufficient level of [[modular]] encapsulation. In addition to that one can build such kind of new modularity on top of existing concepts ([[NetBeans Runtime Container]] and/or [[OSGi]] manifest metadata), increase interoperability between those systems and reuse their existing tooling.
 +
 +
Will [[Jigsaw]] follow [[Bck2Brwsr]]'s success?
[[Category:Bck2Brwsr]]
[[Category:Bck2Brwsr]]

JaroslavTulach at 04:13, 29 May 2015 - 2015-05-29 04:13:26

←Older revision Revision as of 04:13, 29 May 2015
Line 1: Line 1:
-
In contrast to other efforts that try to bring [[Java]] [[Bck2Brwsr|back to browser]], the [[Bck2Brwsr]] [[VM]] supports per [[JAR]] file compilation, including obfuscation (via [[wikipedia:Closure_compiler#Closure_Compiler|Closure compiler]]). This keeps the dynamic nature of [[Java]], when you compile units independently and then link them into final application on application start. [[I]] believe this is way better than classic static obfuscation mode when whole application is converted into a gigantic static [[JavaScript]] (like [[GWT]] and currently also [[TeaVM]] does).
+
In contrast to other efforts that try to bring [[Java]] [[Bck2Brwsr|back to browser]], the [[Bck2Brwsr]] [[VM]] supports per [[JAR]] ahead of time compilation, including obfuscation (via [[wikipedia:Closure_compiler#Closure_Compiler|Closure compiler]]). This keeps the dynamic nature of [[Java]], when you compile units independently and then link them into final application on application start. [[I]] believe this is way better than classic static obfuscation mode when whole application is converted into a gigantic static [[JavaScript]] (like [[GWT]] and currently also [[TeaVM]] does).
== Exported Packages ==
== Exported Packages ==

JaroslavTulach: /* Design */ - 2015-05-29 04:04:12

Design

←Older revision Revision as of 04:04, 29 May 2015
Line 26: Line 26:
Browsers are optimized for consuming [[JavaScript]] (compressed by [[GZip]]). We tried to use [[ZIP]], but it was not the most effective solution. That is why our current [[Maven]] archetype generates alternative .js file for per [[JAR]] file. If the [[JavaScript]] file is found, let [[bck2brwsr]] use it. If not, [[Bck2Brwsr]] downloads and uses the [[JAR]] file.
Browsers are optimized for consuming [[JavaScript]] (compressed by [[GZip]]). We tried to use [[ZIP]], but it was not the most effective solution. That is why our current [[Maven]] archetype generates alternative .js file for per [[JAR]] file. If the [[JavaScript]] file is found, let [[bck2brwsr]] use it. If not, [[Bck2Brwsr]] downloads and uses the [[JAR]] file.
-
There is a special '''@Exported''' annotation one can use to annotate packages, classes, methods. This exported elements need to stick to fixed identifier. In addition to that the [[Maven]] plugin recognizes [[OSGi]] manifest and exports all public classes in packages exported via ''Export-Package'' manifest header.
+
There is a special '''@Exported''' annotation one can use to annotate packages, classes, methods. This exported elements need to stick to fixed identifier. In addition to that the [[Maven]] plugin recognizes [[OSGi]] manifest and exports all public classes in packages exported via ''Export-Package'' manifest header as well as ''OpenIDE-Module-Public-Packages'' header.
As much calls as possible inside a library is done with obfuscated names. Private, package private methods are obfuscated (unless '''@Exported'''). Classes in non-exported packages can have everything obfuscated (unless implement exported symbol). Exported classes generate [[JavaScript]] of following form:
As much calls as possible inside a library is done with obfuscated names. Private, package private methods are obfuscated (unless '''@Exported'''). Classes in non-exported packages can have everything obfuscated (unless implement exported symbol). Exported classes generate [[JavaScript]] of following form:

JaroslavTulach: /* Design */ - 2015-05-29 04:03:36

Design

←Older revision Revision as of 04:03, 29 May 2015
Line 24: Line 24:
== Design ==
== Design ==
-
Browsers are optimized for consuming [[JavaScript]] (compressed by [[GZip]]). We tried to use [[ZIP]], but it was not the most effective solution. That is why our current [[Maven]] archetype generates alternative .js file for per [[JAR]] file. If the [[JavaScript]] file is found, let [[bck2brwsr]] use it. If not, let [Bck2Brwsr]] downloads and uses the [[JAR]] file.
+
Browsers are optimized for consuming [[JavaScript]] (compressed by [[GZip]]). We tried to use [[ZIP]], but it was not the most effective solution. That is why our current [[Maven]] archetype generates alternative .js file for per [[JAR]] file. If the [[JavaScript]] file is found, let [[bck2brwsr]] use it. If not, [[Bck2Brwsr]] downloads and uses the [[JAR]] file.
There is a special '''@Exported''' annotation one can use to annotate packages, classes, methods. This exported elements need to stick to fixed identifier. In addition to that the [[Maven]] plugin recognizes [[OSGi]] manifest and exports all public classes in packages exported via ''Export-Package'' manifest header.
There is a special '''@Exported''' annotation one can use to annotate packages, classes, methods. This exported elements need to stick to fixed identifier. In addition to that the [[Maven]] plugin recognizes [[OSGi]] manifest and exports all public classes in packages exported via ''Export-Package'' manifest header.

JaroslavTulach: /* Design */ - 2015-05-29 04:03:22

Design

←Older revision Revision as of 04:03, 29 May 2015
Line 24: Line 24:
== Design ==
== Design ==
-
Browsers are optimized for consuming [[JavaScript]] (compressed by [[GZip]]). We tried to use [[ZIP]], but it was not the most effective solution. That is why our current [[Maven]] archetype generates alternative .js file for per [[JAR]] file. If the [[JavaScript]] file is found, let [[bck2brwsr]] use it. If not, let [bck2brwsr]] downloads and use the [[JAR]] file.
+
Browsers are optimized for consuming [[JavaScript]] (compressed by [[GZip]]). We tried to use [[ZIP]], but it was not the most effective solution. That is why our current [[Maven]] archetype generates alternative .js file for per [[JAR]] file. If the [[JavaScript]] file is found, let [[bck2brwsr]] use it. If not, let [Bck2Brwsr]] downloads and uses the [[JAR]] file.
There is a special '''@Exported''' annotation one can use to annotate packages, classes, methods. This exported elements need to stick to fixed identifier. In addition to that the [[Maven]] plugin recognizes [[OSGi]] manifest and exports all public classes in packages exported via ''Export-Package'' manifest header.
There is a special '''@Exported''' annotation one can use to annotate packages, classes, methods. This exported elements need to stick to fixed identifier. In addition to that the [[Maven]] plugin recognizes [[OSGi]] manifest and exports all public classes in packages exported via ''Export-Package'' manifest header.

JaroslavTulach: /* Fast and Parallel Downloading */ - 2015-05-29 04:02:47

Fast and Parallel Downloading

←Older revision Revision as of 04:02, 29 May 2015
Line 20: Line 20:
the [[VM]] loads appropriate 'library1.js' & co. on background and in parallel. Once they are all available specified application class is loaded and its method is invoked.
the [[VM]] loads appropriate 'library1.js' & co. on background and in parallel. Once they are all available specified application class is loaded and its method is invoked.
-
Per library obfuscation is a way to minimize download time, as popular libraries can be hosted on a single website and shared between different applications. Then browsers can cache them and minimize the time needed to start [[Bck2Brwsr]] any application. [[Bck2Brwsr]] [[Maven]] archetype does not automate this currently, however.
+
[[ObfuscatePerLibrary|Per library obfuscation]] is a way to minimize download time, as popular libraries can be hosted on a single website and shared between different applications. Then browsers can cache them and minimize the time needed to start [[Bck2Brwsr]] any application. [[Bck2Brwsr]] [[Maven]] archetype does not automate usage of such central repository of [[Bck2BrwsrLibraries]] (as of May 2015).
== Design ==
== Design ==

JaroslavTulach: /* Faster Compilation */ - 2015-05-29 04:00:52

Faster Compilation

←Older revision Revision as of 04:00, 29 May 2015
Line 9: Line 9:
== Faster Compilation ==
== Faster Compilation ==
-
Per library obfuscation may also speed up compilation. Your libraries can be compiled just once and when you build your application you can re-use them and compile only classes of your application. This is possible now when invoking the [[Bck2Brwsr]] compiler manually (see ahead-of-time section in [[Bck2BrwsrJavadoc]]), but the preconfigured [[Maven]] plugin still compiles the whole application as of Oct 2014.
+
Per library obfuscation may also speed up compilation. Your libraries can be [[Bck2BrwsrLibraries|compiled just once]] and when you build your application you can re-use them and compile only classes of your application. This is possible now when invoking the [[Bck2Brwsr]] compiler manually (see ahead-of-time section in [[Bck2BrwsrJavadoc]]), and you can also configure your project to prepare [[Bck2BrwsrLibraries]] for others.
== Fast and Parallel Downloading ==
== Fast and Parallel Downloading ==

JaroslavTulach at 03:57, 29 May 2015 - 2015-05-29 03:57:48

←Older revision Revision as of 03:57, 29 May 2015
Line 1: Line 1:
-
In contrast to other efforts that try to bring [[Java]] [[Bck2Brwsr|back to browser]], the [[Bck2Brwsr]] [[VM]] supports per [[JAR]] file compilation, including obfuscation (via [[wikipedia:Closure_compiler#Closure_Compiler|Closure compiler]]). This keeps the dynamic nature of [[Java]], when you compile units independently and them link them into final application on application start. [[I]] believe this is way better than classic static obfuscation mode when whole application is converted into a gigantic static [[JavaScript]] (like [[GWT]] and currently also [[TeaVM]] does).
+
In contrast to other efforts that try to bring [[Java]] [[Bck2Brwsr|back to browser]], the [[Bck2Brwsr]] [[VM]] supports per [[JAR]] file compilation, including obfuscation (via [[wikipedia:Closure_compiler#Closure_Compiler|Closure compiler]]). This keeps the dynamic nature of [[Java]], when you compile units independently and then link them into final application on application start. [[I]] believe this is way better than classic static obfuscation mode when whole application is converted into a gigantic static [[JavaScript]] (like [[GWT]] and currently also [[TeaVM]] does).
== Exported Packages ==
== Exported Packages ==

JaroslavTulach: /* TODO */ - 2015-01-02 15:28:56

TODO

←Older revision Revision as of 15:28, 2 January 2015
Line 61: Line 61:
As soon as one does var vm = bck2brwsr(...) all the provided libraries will be loaded.
As soon as one does var vm = bck2brwsr(...) all the provided libraries will be loaded.
-
=== TODO ===
+
=== Checklist ===
-
* Introduce '''@Exported''' [[annotation]] and modify obfuscation to also mange package private members (Ľubo)
+
* Introduce '''@Exported''' [[annotation]] and modify obfuscation to also mange package private members (integrated in [[Bck2Brwsr 0.9]])
-
* Encode resources from a [[JAR]] into [[JavaScript]]. Probably via [[wikipedia:base64]] (Jarda)
+
* Encode resources from a [[JAR]] into [[JavaScript]]. Probably via [[wikipedia:base64]] (also done in [[Bck2Brwsr 0.9]])
-
* Modify [[Maven]] task to process single [[JAR]] in a batch
+
* Modify [[Maven]] task to process single [[JAR]] in a batch - can [[Bck2BrwsrLibraries|precompile libraries]] since [[Bck2Brwsr 0.12]]
[[Category:Bck2Brwsr]]
[[Category:Bck2Brwsr]]

JaroslavTulach: /* Exported Packages */ - 2014-11-29 13:04:40

Exported Packages

←Older revision Revision as of 13:04, 29 November 2014
Line 3: Line 3:
== Exported Packages ==
== Exported Packages ==
-
Right now [[Bck2brwsr]] requires presence of [[OSGi]] headers in manifest. Only packages enumerated in ''Export-Package'' get exported and can be used by other [[JAR]] files. All other classes remain internal to the [[JAR]] file - they can be used from other classes in the [[JAR]], but are hidden externally. This allows us to use full obfuscation mode for these classes - e.g. completely rename their class, method or field names. This leads to much shorter code and faster download times.
+
Right now [[Bck2brwsr]] requires presence of [[OSGi]] headers in manifest. Only packages enumerated in ''Export-Package'' get exported and can be used by other [[JAR]] files (since [[Bck2Brwsr 0.12]] also [[NetBeans]] specific ''OpenIDE-Module-Public-Packages'' tag is recognized). All other classes remain internal to the [[JAR]] file - they can be used from other classes in the [[JAR]], but are hidden externally. This allows us to use full obfuscation mode for these classes - e.g. completely rename their class, method or field names. This leads to much shorter code and faster download times.
 +
 
 +
In case one needs to use a non-[[OSGi]] library [[JAR]], there is a simple way to create an [[OSGiWrapper]] around it.
== Faster Compilation ==
== Faster Compilation ==