Split fxjs build rules into fxjs/BUILD.gn.

Change-Id: I7d9d5bb14a4a2b11afeab0da25bad35322560d3b
Reviewed-on: https://pdfium-review.googlesource.com/c/43942
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 7de811e..5227fcb 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -191,8 +191,8 @@
     ":fxcodec",
     ":fxcrt",
     ":fxge",
-    ":fxjs",
     ":pwl",
+    "fxjs",
     "third_party:pdfium_base",
     "third_party:skia_shared",
   ]
@@ -918,6 +918,7 @@
   configs += [ ":pdfium_core_config" ]
   visibility += [
     "fxbarcode:*",
+    "fxjs:*",
     "xfa/*",
     "third_party:*",
   ]
@@ -1197,440 +1198,6 @@
   ]
 }
 
-jumbo_source_set("fxjs") {
-  sources = [
-    "fxjs/cjs_event_context_stub.cpp",
-    "fxjs/cjs_event_context_stub.h",
-    "fxjs/cjs_runtimestub.cpp",
-    "fxjs/cjs_runtimestub.h",
-    "fxjs/ijs_event_context.h",
-    "fxjs/ijs_runtime.cpp",
-    "fxjs/ijs_runtime.h",
-  ]
-  configs += [ ":pdfium_core_config" ]
-  deps = [
-    ":fxcrt",
-  ]
-
-  if (pdf_enable_v8) {
-    sources += [
-      "fxjs/cfx_v8.cpp",
-      "fxjs/cfx_v8.h",
-      "fxjs/cfxjs_engine.cpp",
-      "fxjs/cfxjs_engine.h",
-      "fxjs/cjs_annot.cpp",
-      "fxjs/cjs_annot.h",
-      "fxjs/cjs_app.cpp",
-      "fxjs/cjs_app.h",
-      "fxjs/cjs_border.cpp",
-      "fxjs/cjs_border.h",
-      "fxjs/cjs_color.cpp",
-      "fxjs/cjs_color.h",
-      "fxjs/cjs_console.cpp",
-      "fxjs/cjs_console.h",
-      "fxjs/cjs_delaydata.cpp",
-      "fxjs/cjs_delaydata.h",
-      "fxjs/cjs_display.cpp",
-      "fxjs/cjs_display.h",
-      "fxjs/cjs_document.cpp",
-      "fxjs/cjs_document.h",
-      "fxjs/cjs_event.cpp",
-      "fxjs/cjs_event.h",
-      "fxjs/cjs_event_context.cpp",
-      "fxjs/cjs_event_context.h",
-      "fxjs/cjs_eventhandler.cpp",
-      "fxjs/cjs_eventhandler.h",
-      "fxjs/cjs_field.cpp",
-      "fxjs/cjs_field.h",
-      "fxjs/cjs_font.cpp",
-      "fxjs/cjs_font.h",
-      "fxjs/cjs_global.cpp",
-      "fxjs/cjs_global.h",
-      "fxjs/cjs_globalarrays.cpp",
-      "fxjs/cjs_globalarrays.h",
-      "fxjs/cjs_globalconsts.cpp",
-      "fxjs/cjs_globalconsts.h",
-      "fxjs/cjs_globaldata.cpp",
-      "fxjs/cjs_globaldata.h",
-      "fxjs/cjs_globalvariablearray.cpp",
-      "fxjs/cjs_globalvariablearray.h",
-      "fxjs/cjs_highlight.cpp",
-      "fxjs/cjs_highlight.h",
-      "fxjs/cjs_icon.cpp",
-      "fxjs/cjs_icon.h",
-      "fxjs/cjs_keyvalue.cpp",
-      "fxjs/cjs_keyvalue.h",
-      "fxjs/cjs_object.cpp",
-      "fxjs/cjs_object.h",
-      "fxjs/cjs_position.cpp",
-      "fxjs/cjs_position.h",
-      "fxjs/cjs_printparamsobj.cpp",
-      "fxjs/cjs_printparamsobj.h",
-      "fxjs/cjs_publicmethods.cpp",
-      "fxjs/cjs_publicmethods.h",
-      "fxjs/cjs_report.cpp",
-      "fxjs/cjs_report.h",
-      "fxjs/cjs_result.cpp",
-      "fxjs/cjs_result.h",
-      "fxjs/cjs_runtime.cpp",
-      "fxjs/cjs_runtime.h",
-      "fxjs/cjs_scalehow.cpp",
-      "fxjs/cjs_scalehow.h",
-      "fxjs/cjs_scalewhen.cpp",
-      "fxjs/cjs_scalewhen.h",
-      "fxjs/cjs_style.cpp",
-      "fxjs/cjs_style.h",
-      "fxjs/cjs_timerobj.cpp",
-      "fxjs/cjs_timerobj.h",
-      "fxjs/cjs_util.cpp",
-      "fxjs/cjs_util.h",
-      "fxjs/cjs_zoomtype.cpp",
-      "fxjs/cjs_zoomtype.h",
-      "fxjs/global_timer.cpp",
-      "fxjs/global_timer.h",
-      "fxjs/js_define.cpp",
-      "fxjs/js_define.h",
-      "fxjs/js_resources.cpp",
-      "fxjs/js_resources.h",
-      "fxjs/jse_define.h",
-    ]
-    deps += [
-      ":fxcrt",
-      "//v8",
-      "//v8:v8_libplatform",
-    ]
-    configs += [ "//v8:external_startup_data" ]
-    public_deps = [
-      "//v8",
-    ]
-
-    if (pdf_enable_xfa) {
-      sources += [
-        "fxjs/cfxjse_arguments.cpp",
-        "fxjs/cfxjse_arguments.h",
-        "fxjs/cfxjse_class.cpp",
-        "fxjs/cfxjse_class.h",
-        "fxjs/cfxjse_context.cpp",
-        "fxjs/cfxjse_context.h",
-        "fxjs/cfxjse_engine.cpp",
-        "fxjs/cfxjse_engine.h",
-        "fxjs/cfxjse_formcalc_context.cpp",
-        "fxjs/cfxjse_formcalc_context.h",
-        "fxjs/cfxjse_isolatetracker.cpp",
-        "fxjs/cfxjse_isolatetracker.h",
-        "fxjs/cfxjse_resolveprocessor.cpp",
-        "fxjs/cfxjse_resolveprocessor.h",
-        "fxjs/cfxjse_runtimedata.cpp",
-        "fxjs/cfxjse_runtimedata.h",
-        "fxjs/cfxjse_value.cpp",
-        "fxjs/cfxjse_value.h",
-        "fxjs/fxjse.cpp",
-        "fxjs/fxjse.h",
-        "fxjs/xfa/cjx_arc.cpp",
-        "fxjs/xfa/cjx_arc.h",
-        "fxjs/xfa/cjx_area.cpp",
-        "fxjs/xfa/cjx_area.h",
-        "fxjs/xfa/cjx_assist.cpp",
-        "fxjs/xfa/cjx_assist.h",
-        "fxjs/xfa/cjx_barcode.cpp",
-        "fxjs/xfa/cjx_barcode.h",
-        "fxjs/xfa/cjx_bind.cpp",
-        "fxjs/xfa/cjx_bind.h",
-        "fxjs/xfa/cjx_binditems.cpp",
-        "fxjs/xfa/cjx_binditems.h",
-        "fxjs/xfa/cjx_bookend.cpp",
-        "fxjs/xfa/cjx_bookend.h",
-        "fxjs/xfa/cjx_boolean.cpp",
-        "fxjs/xfa/cjx_boolean.h",
-        "fxjs/xfa/cjx_border.cpp",
-        "fxjs/xfa/cjx_border.h",
-        "fxjs/xfa/cjx_break.cpp",
-        "fxjs/xfa/cjx_break.h",
-        "fxjs/xfa/cjx_breakafter.cpp",
-        "fxjs/xfa/cjx_breakafter.h",
-        "fxjs/xfa/cjx_breakbefore.cpp",
-        "fxjs/xfa/cjx_breakbefore.h",
-        "fxjs/xfa/cjx_button.cpp",
-        "fxjs/xfa/cjx_button.h",
-        "fxjs/xfa/cjx_calculate.cpp",
-        "fxjs/xfa/cjx_calculate.h",
-        "fxjs/xfa/cjx_caption.cpp",
-        "fxjs/xfa/cjx_caption.h",
-        "fxjs/xfa/cjx_certificate.cpp",
-        "fxjs/xfa/cjx_certificate.h",
-        "fxjs/xfa/cjx_certificates.cpp",
-        "fxjs/xfa/cjx_certificates.h",
-        "fxjs/xfa/cjx_checkbutton.cpp",
-        "fxjs/xfa/cjx_checkbutton.h",
-        "fxjs/xfa/cjx_choicelist.cpp",
-        "fxjs/xfa/cjx_choicelist.h",
-        "fxjs/xfa/cjx_color.cpp",
-        "fxjs/xfa/cjx_color.h",
-        "fxjs/xfa/cjx_comb.cpp",
-        "fxjs/xfa/cjx_comb.h",
-        "fxjs/xfa/cjx_command.cpp",
-        "fxjs/xfa/cjx_command.h",
-        "fxjs/xfa/cjx_connect.cpp",
-        "fxjs/xfa/cjx_connect.h",
-        "fxjs/xfa/cjx_connectstring.cpp",
-        "fxjs/xfa/cjx_connectstring.h",
-        "fxjs/xfa/cjx_container.cpp",
-        "fxjs/xfa/cjx_container.h",
-        "fxjs/xfa/cjx_content.cpp",
-        "fxjs/xfa/cjx_content.h",
-        "fxjs/xfa/cjx_contentarea.cpp",
-        "fxjs/xfa/cjx_contentarea.h",
-        "fxjs/xfa/cjx_corner.cpp",
-        "fxjs/xfa/cjx_corner.h",
-        "fxjs/xfa/cjx_datavalue.cpp",
-        "fxjs/xfa/cjx_datavalue.h",
-        "fxjs/xfa/cjx_datawindow.cpp",
-        "fxjs/xfa/cjx_datawindow.h",
-        "fxjs/xfa/cjx_date.cpp",
-        "fxjs/xfa/cjx_date.h",
-        "fxjs/xfa/cjx_datetime.cpp",
-        "fxjs/xfa/cjx_datetime.h",
-        "fxjs/xfa/cjx_datetimeedit.cpp",
-        "fxjs/xfa/cjx_datetimeedit.h",
-        "fxjs/xfa/cjx_decimal.cpp",
-        "fxjs/xfa/cjx_decimal.h",
-        "fxjs/xfa/cjx_defaultui.cpp",
-        "fxjs/xfa/cjx_defaultui.h",
-        "fxjs/xfa/cjx_delete.cpp",
-        "fxjs/xfa/cjx_delete.h",
-        "fxjs/xfa/cjx_delta.cpp",
-        "fxjs/xfa/cjx_delta.h",
-        "fxjs/xfa/cjx_deltas.cpp",
-        "fxjs/xfa/cjx_deltas.h",
-        "fxjs/xfa/cjx_desc.cpp",
-        "fxjs/xfa/cjx_desc.h",
-        "fxjs/xfa/cjx_digestmethod.cpp",
-        "fxjs/xfa/cjx_digestmethod.h",
-        "fxjs/xfa/cjx_digestmethods.cpp",
-        "fxjs/xfa/cjx_digestmethods.h",
-        "fxjs/xfa/cjx_draw.cpp",
-        "fxjs/xfa/cjx_draw.h",
-        "fxjs/xfa/cjx_edge.cpp",
-        "fxjs/xfa/cjx_edge.h",
-        "fxjs/xfa/cjx_encoding.cpp",
-        "fxjs/xfa/cjx_encoding.h",
-        "fxjs/xfa/cjx_encodings.cpp",
-        "fxjs/xfa/cjx_encodings.h",
-        "fxjs/xfa/cjx_encrypt.cpp",
-        "fxjs/xfa/cjx_encrypt.h",
-        "fxjs/xfa/cjx_event.cpp",
-        "fxjs/xfa/cjx_event.h",
-        "fxjs/xfa/cjx_eventpseudomodel.cpp",
-        "fxjs/xfa/cjx_eventpseudomodel.h",
-        "fxjs/xfa/cjx_exclgroup.cpp",
-        "fxjs/xfa/cjx_exclgroup.h",
-        "fxjs/xfa/cjx_exdata.cpp",
-        "fxjs/xfa/cjx_exdata.h",
-        "fxjs/xfa/cjx_execute.cpp",
-        "fxjs/xfa/cjx_execute.h",
-        "fxjs/xfa/cjx_exobject.cpp",
-        "fxjs/xfa/cjx_exobject.h",
-        "fxjs/xfa/cjx_extras.cpp",
-        "fxjs/xfa/cjx_extras.h",
-        "fxjs/xfa/cjx_field.cpp",
-        "fxjs/xfa/cjx_field.h",
-        "fxjs/xfa/cjx_fill.cpp",
-        "fxjs/xfa/cjx_fill.h",
-        "fxjs/xfa/cjx_filter.cpp",
-        "fxjs/xfa/cjx_filter.h",
-        "fxjs/xfa/cjx_float.cpp",
-        "fxjs/xfa/cjx_float.h",
-        "fxjs/xfa/cjx_font.cpp",
-        "fxjs/xfa/cjx_font.h",
-        "fxjs/xfa/cjx_form.cpp",
-        "fxjs/xfa/cjx_form.h",
-        "fxjs/xfa/cjx_format.cpp",
-        "fxjs/xfa/cjx_format.h",
-        "fxjs/xfa/cjx_handler.cpp",
-        "fxjs/xfa/cjx_handler.h",
-        "fxjs/xfa/cjx_hostpseudomodel.cpp",
-        "fxjs/xfa/cjx_hostpseudomodel.h",
-        "fxjs/xfa/cjx_image.cpp",
-        "fxjs/xfa/cjx_image.h",
-        "fxjs/xfa/cjx_imageedit.cpp",
-        "fxjs/xfa/cjx_imageedit.h",
-        "fxjs/xfa/cjx_insert.cpp",
-        "fxjs/xfa/cjx_insert.h",
-        "fxjs/xfa/cjx_instancemanager.cpp",
-        "fxjs/xfa/cjx_instancemanager.h",
-        "fxjs/xfa/cjx_integer.cpp",
-        "fxjs/xfa/cjx_integer.h",
-        "fxjs/xfa/cjx_issuers.cpp",
-        "fxjs/xfa/cjx_issuers.h",
-        "fxjs/xfa/cjx_items.cpp",
-        "fxjs/xfa/cjx_items.h",
-        "fxjs/xfa/cjx_keep.cpp",
-        "fxjs/xfa/cjx_keep.h",
-        "fxjs/xfa/cjx_keyusage.cpp",
-        "fxjs/xfa/cjx_keyusage.h",
-        "fxjs/xfa/cjx_layoutpseudomodel.cpp",
-        "fxjs/xfa/cjx_layoutpseudomodel.h",
-        "fxjs/xfa/cjx_line.cpp",
-        "fxjs/xfa/cjx_line.h",
-        "fxjs/xfa/cjx_linear.cpp",
-        "fxjs/xfa/cjx_linear.h",
-        "fxjs/xfa/cjx_list.cpp",
-        "fxjs/xfa/cjx_list.h",
-        "fxjs/xfa/cjx_logpseudomodel.cpp",
-        "fxjs/xfa/cjx_logpseudomodel.h",
-        "fxjs/xfa/cjx_manifest.cpp",
-        "fxjs/xfa/cjx_manifest.h",
-        "fxjs/xfa/cjx_map.cpp",
-        "fxjs/xfa/cjx_map.h",
-        "fxjs/xfa/cjx_margin.cpp",
-        "fxjs/xfa/cjx_margin.h",
-        "fxjs/xfa/cjx_mdp.cpp",
-        "fxjs/xfa/cjx_mdp.h",
-        "fxjs/xfa/cjx_medium.cpp",
-        "fxjs/xfa/cjx_medium.h",
-        "fxjs/xfa/cjx_message.cpp",
-        "fxjs/xfa/cjx_message.h",
-        "fxjs/xfa/cjx_model.cpp",
-        "fxjs/xfa/cjx_model.h",
-        "fxjs/xfa/cjx_node.cpp",
-        "fxjs/xfa/cjx_node.h",
-        "fxjs/xfa/cjx_numericedit.cpp",
-        "fxjs/xfa/cjx_numericedit.h",
-        "fxjs/xfa/cjx_object.cpp",
-        "fxjs/xfa/cjx_object.h",
-        "fxjs/xfa/cjx_occur.cpp",
-        "fxjs/xfa/cjx_occur.h",
-        "fxjs/xfa/cjx_oid.cpp",
-        "fxjs/xfa/cjx_oid.h",
-        "fxjs/xfa/cjx_oids.cpp",
-        "fxjs/xfa/cjx_oids.h",
-        "fxjs/xfa/cjx_operation.cpp",
-        "fxjs/xfa/cjx_operation.h",
-        "fxjs/xfa/cjx_overflow.cpp",
-        "fxjs/xfa/cjx_overflow.h",
-        "fxjs/xfa/cjx_packet.cpp",
-        "fxjs/xfa/cjx_packet.h",
-        "fxjs/xfa/cjx_pagearea.cpp",
-        "fxjs/xfa/cjx_pagearea.h",
-        "fxjs/xfa/cjx_pageset.cpp",
-        "fxjs/xfa/cjx_pageset.h",
-        "fxjs/xfa/cjx_para.cpp",
-        "fxjs/xfa/cjx_para.h",
-        "fxjs/xfa/cjx_password.cpp",
-        "fxjs/xfa/cjx_password.h",
-        "fxjs/xfa/cjx_passwordedit.cpp",
-        "fxjs/xfa/cjx_passwordedit.h",
-        "fxjs/xfa/cjx_pattern.cpp",
-        "fxjs/xfa/cjx_pattern.h",
-        "fxjs/xfa/cjx_picture.cpp",
-        "fxjs/xfa/cjx_picture.h",
-        "fxjs/xfa/cjx_query.cpp",
-        "fxjs/xfa/cjx_query.h",
-        "fxjs/xfa/cjx_radial.cpp",
-        "fxjs/xfa/cjx_radial.h",
-        "fxjs/xfa/cjx_reason.cpp",
-        "fxjs/xfa/cjx_reason.h",
-        "fxjs/xfa/cjx_reasons.cpp",
-        "fxjs/xfa/cjx_reasons.h",
-        "fxjs/xfa/cjx_recordset.cpp",
-        "fxjs/xfa/cjx_recordset.h",
-        "fxjs/xfa/cjx_rectangle.cpp",
-        "fxjs/xfa/cjx_rectangle.h",
-        "fxjs/xfa/cjx_ref.cpp",
-        "fxjs/xfa/cjx_ref.h",
-        "fxjs/xfa/cjx_rootelement.cpp",
-        "fxjs/xfa/cjx_rootelement.h",
-        "fxjs/xfa/cjx_script.cpp",
-        "fxjs/xfa/cjx_script.h",
-        "fxjs/xfa/cjx_select.cpp",
-        "fxjs/xfa/cjx_select.h",
-        "fxjs/xfa/cjx_setproperty.cpp",
-        "fxjs/xfa/cjx_setproperty.h",
-        "fxjs/xfa/cjx_signature.cpp",
-        "fxjs/xfa/cjx_signature.h",
-        "fxjs/xfa/cjx_signatureproperties.cpp",
-        "fxjs/xfa/cjx_signatureproperties.h",
-        "fxjs/xfa/cjx_signaturepseudomodel.cpp",
-        "fxjs/xfa/cjx_signaturepseudomodel.h",
-        "fxjs/xfa/cjx_signdata.cpp",
-        "fxjs/xfa/cjx_signdata.h",
-        "fxjs/xfa/cjx_signing.cpp",
-        "fxjs/xfa/cjx_signing.h",
-        "fxjs/xfa/cjx_soapaction.cpp",
-        "fxjs/xfa/cjx_soapaction.h",
-        "fxjs/xfa/cjx_soapaddress.cpp",
-        "fxjs/xfa/cjx_soapaddress.h",
-        "fxjs/xfa/cjx_solid.cpp",
-        "fxjs/xfa/cjx_solid.h",
-        "fxjs/xfa/cjx_source.cpp",
-        "fxjs/xfa/cjx_source.h",
-        "fxjs/xfa/cjx_sourceset.cpp",
-        "fxjs/xfa/cjx_sourceset.h",
-        "fxjs/xfa/cjx_speak.cpp",
-        "fxjs/xfa/cjx_speak.h",
-        "fxjs/xfa/cjx_stipple.cpp",
-        "fxjs/xfa/cjx_stipple.h",
-        "fxjs/xfa/cjx_subform.cpp",
-        "fxjs/xfa/cjx_subform.h",
-        "fxjs/xfa/cjx_subformset.cpp",
-        "fxjs/xfa/cjx_subformset.h",
-        "fxjs/xfa/cjx_subjectdn.cpp",
-        "fxjs/xfa/cjx_subjectdn.h",
-        "fxjs/xfa/cjx_subjectdns.cpp",
-        "fxjs/xfa/cjx_subjectdns.h",
-        "fxjs/xfa/cjx_submit.cpp",
-        "fxjs/xfa/cjx_submit.h",
-        "fxjs/xfa/cjx_template.cpp",
-        "fxjs/xfa/cjx_template.h",
-        "fxjs/xfa/cjx_text.cpp",
-        "fxjs/xfa/cjx_text.h",
-        "fxjs/xfa/cjx_textedit.cpp",
-        "fxjs/xfa/cjx_textedit.h",
-        "fxjs/xfa/cjx_textnode.cpp",
-        "fxjs/xfa/cjx_textnode.h",
-        "fxjs/xfa/cjx_time.cpp",
-        "fxjs/xfa/cjx_time.h",
-        "fxjs/xfa/cjx_timestamp.cpp",
-        "fxjs/xfa/cjx_timestamp.h",
-        "fxjs/xfa/cjx_tooltip.cpp",
-        "fxjs/xfa/cjx_tooltip.h",
-        "fxjs/xfa/cjx_traversal.cpp",
-        "fxjs/xfa/cjx_traversal.h",
-        "fxjs/xfa/cjx_traverse.cpp",
-        "fxjs/xfa/cjx_traverse.h",
-        "fxjs/xfa/cjx_tree.cpp",
-        "fxjs/xfa/cjx_tree.h",
-        "fxjs/xfa/cjx_treelist.cpp",
-        "fxjs/xfa/cjx_treelist.h",
-        "fxjs/xfa/cjx_ui.cpp",
-        "fxjs/xfa/cjx_ui.h",
-        "fxjs/xfa/cjx_update.cpp",
-        "fxjs/xfa/cjx_update.h",
-        "fxjs/xfa/cjx_uri.cpp",
-        "fxjs/xfa/cjx_uri.h",
-        "fxjs/xfa/cjx_user.cpp",
-        "fxjs/xfa/cjx_user.h",
-        "fxjs/xfa/cjx_validate.cpp",
-        "fxjs/xfa/cjx_validate.h",
-        "fxjs/xfa/cjx_value.cpp",
-        "fxjs/xfa/cjx_value.h",
-        "fxjs/xfa/cjx_variables.cpp",
-        "fxjs/xfa/cjx_variables.h",
-        "fxjs/xfa/cjx_wsdladdress.cpp",
-        "fxjs/xfa/cjx_wsdladdress.h",
-        "fxjs/xfa/cjx_wsdlconnection.cpp",
-        "fxjs/xfa/cjx_wsdlconnection.h",
-        "fxjs/xfa/cjx_xfa.cpp",
-        "fxjs/xfa/cjx_xfa.h",
-        "fxjs/xfa/cjx_xmlconnection.cpp",
-        "fxjs/xfa/cjx_xmlconnection.h",
-        "fxjs/xfa/cjx_xsdconnection.cpp",
-        "fxjs/xfa/cjx_xsdconnection.h",
-      ]
-    }
-  }
-}
-
 jumbo_source_set("formfiller") {
   sources = [
     "fpdfsdk/formfiller/cba_fontmap.cpp",
@@ -1676,7 +1243,7 @@
     ]
     deps = [
       ":fxcrt",
-      ":fxjs",
+      "fxjs",
       "xfa",
     ]
     configs += [ ":pdfium_core_config" ]
@@ -1815,7 +1382,7 @@
       "fxjs/cjs_publicmethods_unittest.cpp",
       "fxjs/cjs_util_unittest.cpp",
     ]
-    deps += [ ":fxjs" ]
+    deps += [ "fxjs" ]
     configs += [ "//v8:external_startup_data" ]
   }
   configs += [ ":pdfium_core_config" ]
@@ -1889,7 +1456,7 @@
       "testing/js_embedder_test.cpp",
       "testing/js_embedder_test.h",
     ]
-    deps += [ ":fxjs" ]
+    deps += [ "fxjs" ]
     configs += [ "//v8:external_startup_data" ]
   }
   if (pdf_enable_xfa) {
diff --git a/fxjs/BUILD.gn b/fxjs/BUILD.gn
new file mode 100644
index 0000000..d885117
--- /dev/null
+++ b/fxjs/BUILD.gn
@@ -0,0 +1,440 @@
+# Copyright 2018 The PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/jumbo.gni")
+import("../pdfium.gni")
+
+jumbo_source_set("fxjs") {
+  sources = [
+    "cjs_event_context_stub.cpp",
+    "cjs_event_context_stub.h",
+    "cjs_runtimestub.cpp",
+    "cjs_runtimestub.h",
+    "ijs_event_context.h",
+    "ijs_runtime.cpp",
+    "ijs_runtime.h",
+  ]
+  configs += [ "../:pdfium_core_config" ]
+  deps = [
+    "../:fxcrt",
+  ]
+  visibility = [ "../*" ]
+
+  if (pdf_enable_v8) {
+    sources += [
+      "cfx_v8.cpp",
+      "cfx_v8.h",
+      "cfxjs_engine.cpp",
+      "cfxjs_engine.h",
+      "cjs_annot.cpp",
+      "cjs_annot.h",
+      "cjs_app.cpp",
+      "cjs_app.h",
+      "cjs_border.cpp",
+      "cjs_border.h",
+      "cjs_color.cpp",
+      "cjs_color.h",
+      "cjs_console.cpp",
+      "cjs_console.h",
+      "cjs_delaydata.cpp",
+      "cjs_delaydata.h",
+      "cjs_display.cpp",
+      "cjs_display.h",
+      "cjs_document.cpp",
+      "cjs_document.h",
+      "cjs_event.cpp",
+      "cjs_event.h",
+      "cjs_event_context.cpp",
+      "cjs_event_context.h",
+      "cjs_eventhandler.cpp",
+      "cjs_eventhandler.h",
+      "cjs_field.cpp",
+      "cjs_field.h",
+      "cjs_font.cpp",
+      "cjs_font.h",
+      "cjs_global.cpp",
+      "cjs_global.h",
+      "cjs_globalarrays.cpp",
+      "cjs_globalarrays.h",
+      "cjs_globalconsts.cpp",
+      "cjs_globalconsts.h",
+      "cjs_globaldata.cpp",
+      "cjs_globaldata.h",
+      "cjs_globalvariablearray.cpp",
+      "cjs_globalvariablearray.h",
+      "cjs_highlight.cpp",
+      "cjs_highlight.h",
+      "cjs_icon.cpp",
+      "cjs_icon.h",
+      "cjs_keyvalue.cpp",
+      "cjs_keyvalue.h",
+      "cjs_object.cpp",
+      "cjs_object.h",
+      "cjs_position.cpp",
+      "cjs_position.h",
+      "cjs_printparamsobj.cpp",
+      "cjs_printparamsobj.h",
+      "cjs_publicmethods.cpp",
+      "cjs_publicmethods.h",
+      "cjs_report.cpp",
+      "cjs_report.h",
+      "cjs_result.cpp",
+      "cjs_result.h",
+      "cjs_runtime.cpp",
+      "cjs_runtime.h",
+      "cjs_scalehow.cpp",
+      "cjs_scalehow.h",
+      "cjs_scalewhen.cpp",
+      "cjs_scalewhen.h",
+      "cjs_style.cpp",
+      "cjs_style.h",
+      "cjs_timerobj.cpp",
+      "cjs_timerobj.h",
+      "cjs_util.cpp",
+      "cjs_util.h",
+      "cjs_zoomtype.cpp",
+      "cjs_zoomtype.h",
+      "global_timer.cpp",
+      "global_timer.h",
+      "js_define.cpp",
+      "js_define.h",
+      "js_resources.cpp",
+      "js_resources.h",
+      "jse_define.h",
+    ]
+    deps += [
+      "//v8",
+      "//v8:v8_libplatform",
+    ]
+    configs += [ "//v8:external_startup_data" ]
+    public_deps = [
+      "//v8",
+    ]
+
+    if (pdf_enable_xfa) {
+      sources += [
+        "cfxjse_arguments.cpp",
+        "cfxjse_arguments.h",
+        "cfxjse_class.cpp",
+        "cfxjse_class.h",
+        "cfxjse_context.cpp",
+        "cfxjse_context.h",
+        "cfxjse_engine.cpp",
+        "cfxjse_engine.h",
+        "cfxjse_formcalc_context.cpp",
+        "cfxjse_formcalc_context.h",
+        "cfxjse_isolatetracker.cpp",
+        "cfxjse_isolatetracker.h",
+        "cfxjse_resolveprocessor.cpp",
+        "cfxjse_resolveprocessor.h",
+        "cfxjse_runtimedata.cpp",
+        "cfxjse_runtimedata.h",
+        "cfxjse_value.cpp",
+        "cfxjse_value.h",
+        "fxjse.cpp",
+        "fxjse.h",
+        "xfa/cjx_arc.cpp",
+        "xfa/cjx_arc.h",
+        "xfa/cjx_area.cpp",
+        "xfa/cjx_area.h",
+        "xfa/cjx_assist.cpp",
+        "xfa/cjx_assist.h",
+        "xfa/cjx_barcode.cpp",
+        "xfa/cjx_barcode.h",
+        "xfa/cjx_bind.cpp",
+        "xfa/cjx_bind.h",
+        "xfa/cjx_binditems.cpp",
+        "xfa/cjx_binditems.h",
+        "xfa/cjx_bookend.cpp",
+        "xfa/cjx_bookend.h",
+        "xfa/cjx_boolean.cpp",
+        "xfa/cjx_boolean.h",
+        "xfa/cjx_border.cpp",
+        "xfa/cjx_border.h",
+        "xfa/cjx_break.cpp",
+        "xfa/cjx_break.h",
+        "xfa/cjx_breakafter.cpp",
+        "xfa/cjx_breakafter.h",
+        "xfa/cjx_breakbefore.cpp",
+        "xfa/cjx_breakbefore.h",
+        "xfa/cjx_button.cpp",
+        "xfa/cjx_button.h",
+        "xfa/cjx_calculate.cpp",
+        "xfa/cjx_calculate.h",
+        "xfa/cjx_caption.cpp",
+        "xfa/cjx_caption.h",
+        "xfa/cjx_certificate.cpp",
+        "xfa/cjx_certificate.h",
+        "xfa/cjx_certificates.cpp",
+        "xfa/cjx_certificates.h",
+        "xfa/cjx_checkbutton.cpp",
+        "xfa/cjx_checkbutton.h",
+        "xfa/cjx_choicelist.cpp",
+        "xfa/cjx_choicelist.h",
+        "xfa/cjx_color.cpp",
+        "xfa/cjx_color.h",
+        "xfa/cjx_comb.cpp",
+        "xfa/cjx_comb.h",
+        "xfa/cjx_command.cpp",
+        "xfa/cjx_command.h",
+        "xfa/cjx_connect.cpp",
+        "xfa/cjx_connect.h",
+        "xfa/cjx_connectstring.cpp",
+        "xfa/cjx_connectstring.h",
+        "xfa/cjx_container.cpp",
+        "xfa/cjx_container.h",
+        "xfa/cjx_content.cpp",
+        "xfa/cjx_content.h",
+        "xfa/cjx_contentarea.cpp",
+        "xfa/cjx_contentarea.h",
+        "xfa/cjx_corner.cpp",
+        "xfa/cjx_corner.h",
+        "xfa/cjx_datavalue.cpp",
+        "xfa/cjx_datavalue.h",
+        "xfa/cjx_datawindow.cpp",
+        "xfa/cjx_datawindow.h",
+        "xfa/cjx_date.cpp",
+        "xfa/cjx_date.h",
+        "xfa/cjx_datetime.cpp",
+        "xfa/cjx_datetime.h",
+        "xfa/cjx_datetimeedit.cpp",
+        "xfa/cjx_datetimeedit.h",
+        "xfa/cjx_decimal.cpp",
+        "xfa/cjx_decimal.h",
+        "xfa/cjx_defaultui.cpp",
+        "xfa/cjx_defaultui.h",
+        "xfa/cjx_delete.cpp",
+        "xfa/cjx_delete.h",
+        "xfa/cjx_delta.cpp",
+        "xfa/cjx_delta.h",
+        "xfa/cjx_deltas.cpp",
+        "xfa/cjx_deltas.h",
+        "xfa/cjx_desc.cpp",
+        "xfa/cjx_desc.h",
+        "xfa/cjx_digestmethod.cpp",
+        "xfa/cjx_digestmethod.h",
+        "xfa/cjx_digestmethods.cpp",
+        "xfa/cjx_digestmethods.h",
+        "xfa/cjx_draw.cpp",
+        "xfa/cjx_draw.h",
+        "xfa/cjx_edge.cpp",
+        "xfa/cjx_edge.h",
+        "xfa/cjx_encoding.cpp",
+        "xfa/cjx_encoding.h",
+        "xfa/cjx_encodings.cpp",
+        "xfa/cjx_encodings.h",
+        "xfa/cjx_encrypt.cpp",
+        "xfa/cjx_encrypt.h",
+        "xfa/cjx_event.cpp",
+        "xfa/cjx_event.h",
+        "xfa/cjx_eventpseudomodel.cpp",
+        "xfa/cjx_eventpseudomodel.h",
+        "xfa/cjx_exclgroup.cpp",
+        "xfa/cjx_exclgroup.h",
+        "xfa/cjx_exdata.cpp",
+        "xfa/cjx_exdata.h",
+        "xfa/cjx_execute.cpp",
+        "xfa/cjx_execute.h",
+        "xfa/cjx_exobject.cpp",
+        "xfa/cjx_exobject.h",
+        "xfa/cjx_extras.cpp",
+        "xfa/cjx_extras.h",
+        "xfa/cjx_field.cpp",
+        "xfa/cjx_field.h",
+        "xfa/cjx_fill.cpp",
+        "xfa/cjx_fill.h",
+        "xfa/cjx_filter.cpp",
+        "xfa/cjx_filter.h",
+        "xfa/cjx_float.cpp",
+        "xfa/cjx_float.h",
+        "xfa/cjx_font.cpp",
+        "xfa/cjx_font.h",
+        "xfa/cjx_form.cpp",
+        "xfa/cjx_form.h",
+        "xfa/cjx_format.cpp",
+        "xfa/cjx_format.h",
+        "xfa/cjx_handler.cpp",
+        "xfa/cjx_handler.h",
+        "xfa/cjx_hostpseudomodel.cpp",
+        "xfa/cjx_hostpseudomodel.h",
+        "xfa/cjx_image.cpp",
+        "xfa/cjx_image.h",
+        "xfa/cjx_imageedit.cpp",
+        "xfa/cjx_imageedit.h",
+        "xfa/cjx_insert.cpp",
+        "xfa/cjx_insert.h",
+        "xfa/cjx_instancemanager.cpp",
+        "xfa/cjx_instancemanager.h",
+        "xfa/cjx_integer.cpp",
+        "xfa/cjx_integer.h",
+        "xfa/cjx_issuers.cpp",
+        "xfa/cjx_issuers.h",
+        "xfa/cjx_items.cpp",
+        "xfa/cjx_items.h",
+        "xfa/cjx_keep.cpp",
+        "xfa/cjx_keep.h",
+        "xfa/cjx_keyusage.cpp",
+        "xfa/cjx_keyusage.h",
+        "xfa/cjx_layoutpseudomodel.cpp",
+        "xfa/cjx_layoutpseudomodel.h",
+        "xfa/cjx_line.cpp",
+        "xfa/cjx_line.h",
+        "xfa/cjx_linear.cpp",
+        "xfa/cjx_linear.h",
+        "xfa/cjx_list.cpp",
+        "xfa/cjx_list.h",
+        "xfa/cjx_logpseudomodel.cpp",
+        "xfa/cjx_logpseudomodel.h",
+        "xfa/cjx_manifest.cpp",
+        "xfa/cjx_manifest.h",
+        "xfa/cjx_map.cpp",
+        "xfa/cjx_map.h",
+        "xfa/cjx_margin.cpp",
+        "xfa/cjx_margin.h",
+        "xfa/cjx_mdp.cpp",
+        "xfa/cjx_mdp.h",
+        "xfa/cjx_medium.cpp",
+        "xfa/cjx_medium.h",
+        "xfa/cjx_message.cpp",
+        "xfa/cjx_message.h",
+        "xfa/cjx_model.cpp",
+        "xfa/cjx_model.h",
+        "xfa/cjx_node.cpp",
+        "xfa/cjx_node.h",
+        "xfa/cjx_numericedit.cpp",
+        "xfa/cjx_numericedit.h",
+        "xfa/cjx_object.cpp",
+        "xfa/cjx_object.h",
+        "xfa/cjx_occur.cpp",
+        "xfa/cjx_occur.h",
+        "xfa/cjx_oid.cpp",
+        "xfa/cjx_oid.h",
+        "xfa/cjx_oids.cpp",
+        "xfa/cjx_oids.h",
+        "xfa/cjx_operation.cpp",
+        "xfa/cjx_operation.h",
+        "xfa/cjx_overflow.cpp",
+        "xfa/cjx_overflow.h",
+        "xfa/cjx_packet.cpp",
+        "xfa/cjx_packet.h",
+        "xfa/cjx_pagearea.cpp",
+        "xfa/cjx_pagearea.h",
+        "xfa/cjx_pageset.cpp",
+        "xfa/cjx_pageset.h",
+        "xfa/cjx_para.cpp",
+        "xfa/cjx_para.h",
+        "xfa/cjx_password.cpp",
+        "xfa/cjx_password.h",
+        "xfa/cjx_passwordedit.cpp",
+        "xfa/cjx_passwordedit.h",
+        "xfa/cjx_pattern.cpp",
+        "xfa/cjx_pattern.h",
+        "xfa/cjx_picture.cpp",
+        "xfa/cjx_picture.h",
+        "xfa/cjx_query.cpp",
+        "xfa/cjx_query.h",
+        "xfa/cjx_radial.cpp",
+        "xfa/cjx_radial.h",
+        "xfa/cjx_reason.cpp",
+        "xfa/cjx_reason.h",
+        "xfa/cjx_reasons.cpp",
+        "xfa/cjx_reasons.h",
+        "xfa/cjx_recordset.cpp",
+        "xfa/cjx_recordset.h",
+        "xfa/cjx_rectangle.cpp",
+        "xfa/cjx_rectangle.h",
+        "xfa/cjx_ref.cpp",
+        "xfa/cjx_ref.h",
+        "xfa/cjx_rootelement.cpp",
+        "xfa/cjx_rootelement.h",
+        "xfa/cjx_script.cpp",
+        "xfa/cjx_script.h",
+        "xfa/cjx_select.cpp",
+        "xfa/cjx_select.h",
+        "xfa/cjx_setproperty.cpp",
+        "xfa/cjx_setproperty.h",
+        "xfa/cjx_signature.cpp",
+        "xfa/cjx_signature.h",
+        "xfa/cjx_signatureproperties.cpp",
+        "xfa/cjx_signatureproperties.h",
+        "xfa/cjx_signaturepseudomodel.cpp",
+        "xfa/cjx_signaturepseudomodel.h",
+        "xfa/cjx_signdata.cpp",
+        "xfa/cjx_signdata.h",
+        "xfa/cjx_signing.cpp",
+        "xfa/cjx_signing.h",
+        "xfa/cjx_soapaction.cpp",
+        "xfa/cjx_soapaction.h",
+        "xfa/cjx_soapaddress.cpp",
+        "xfa/cjx_soapaddress.h",
+        "xfa/cjx_solid.cpp",
+        "xfa/cjx_solid.h",
+        "xfa/cjx_source.cpp",
+        "xfa/cjx_source.h",
+        "xfa/cjx_sourceset.cpp",
+        "xfa/cjx_sourceset.h",
+        "xfa/cjx_speak.cpp",
+        "xfa/cjx_speak.h",
+        "xfa/cjx_stipple.cpp",
+        "xfa/cjx_stipple.h",
+        "xfa/cjx_subform.cpp",
+        "xfa/cjx_subform.h",
+        "xfa/cjx_subformset.cpp",
+        "xfa/cjx_subformset.h",
+        "xfa/cjx_subjectdn.cpp",
+        "xfa/cjx_subjectdn.h",
+        "xfa/cjx_subjectdns.cpp",
+        "xfa/cjx_subjectdns.h",
+        "xfa/cjx_submit.cpp",
+        "xfa/cjx_submit.h",
+        "xfa/cjx_template.cpp",
+        "xfa/cjx_template.h",
+        "xfa/cjx_text.cpp",
+        "xfa/cjx_text.h",
+        "xfa/cjx_textedit.cpp",
+        "xfa/cjx_textedit.h",
+        "xfa/cjx_textnode.cpp",
+        "xfa/cjx_textnode.h",
+        "xfa/cjx_time.cpp",
+        "xfa/cjx_time.h",
+        "xfa/cjx_timestamp.cpp",
+        "xfa/cjx_timestamp.h",
+        "xfa/cjx_tooltip.cpp",
+        "xfa/cjx_tooltip.h",
+        "xfa/cjx_traversal.cpp",
+        "xfa/cjx_traversal.h",
+        "xfa/cjx_traverse.cpp",
+        "xfa/cjx_traverse.h",
+        "xfa/cjx_tree.cpp",
+        "xfa/cjx_tree.h",
+        "xfa/cjx_treelist.cpp",
+        "xfa/cjx_treelist.h",
+        "xfa/cjx_ui.cpp",
+        "xfa/cjx_ui.h",
+        "xfa/cjx_update.cpp",
+        "xfa/cjx_update.h",
+        "xfa/cjx_uri.cpp",
+        "xfa/cjx_uri.h",
+        "xfa/cjx_user.cpp",
+        "xfa/cjx_user.h",
+        "xfa/cjx_validate.cpp",
+        "xfa/cjx_validate.h",
+        "xfa/cjx_value.cpp",
+        "xfa/cjx_value.h",
+        "xfa/cjx_variables.cpp",
+        "xfa/cjx_variables.h",
+        "xfa/cjx_wsdladdress.cpp",
+        "xfa/cjx_wsdladdress.h",
+        "xfa/cjx_wsdlconnection.cpp",
+        "xfa/cjx_wsdlconnection.h",
+        "xfa/cjx_xfa.cpp",
+        "xfa/cjx_xfa.h",
+        "xfa/cjx_xmlconnection.cpp",
+        "xfa/cjx_xmlconnection.h",
+        "xfa/cjx_xsdconnection.cpp",
+        "xfa/cjx_xsdconnection.h",
+      ]
+    }
+  }
+}
diff --git a/xfa/fxfa/BUILD.gn b/xfa/fxfa/BUILD.gn
index c6e4b98..a2c2f5c 100644
--- a/xfa/fxfa/BUILD.gn
+++ b/xfa/fxfa/BUILD.gn
@@ -100,7 +100,7 @@
   ]
   deps = [
     "../../:fxcrt",
-    "../../:fxjs",
+    "../../fxjs",
     "../fde",
     "../fgas",
   ]
diff --git a/xfa/fxfa/parser/BUILD.gn b/xfa/fxfa/parser/BUILD.gn
index 6391e0d..faf618e 100644
--- a/xfa/fxfa/parser/BUILD.gn
+++ b/xfa/fxfa/parser/BUILD.gn
@@ -700,7 +700,7 @@
   ]
   deps = [
     "../../../:fxcrt",
-    "../../../:fxjs",
+    "../../../fxjs",
     "../../fde",
     "../../fgas",
     "../../fxfa",