[PyTorchEdge] Move all serialize/deserialize files to a separate target (#66805)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66805

{F672465642}

DGW:
```
buck query 'allpaths(//xplat/caffe2:torch_mobile_core, //xplat/caffe2:torch_mobile_interpreter)' --output-format dot_compact | pastry
bunnylol dgw paste_id

```

Test Plan:
buck builds to pass

```
buck build fbsource//fbandroid/mode/opt @//fbandroid/mode/messenger //fbandroid/apps/messenger:messenger_staticdi_dextr_splitarsc_dlstr_xzs_for_perftest_redex_optimizedtestableresources_postprocessed_resign //fbandroid/apps/messenger:messenger_staticdi_dextr_splitarsc_dlstr_xzs_for_perftest#unstripped_native_libraries

buck build //xplat/caffe2:torch_mobile_coreAndroid#android-armv7,shared

buck build //xplat/caffe2:torch_commonAndroid#android-armv7,shared

```

DGW:
```
buck query 'allpaths(//xplat/caffe2/fb/runtime:only_flatbuffer_test, //xplat/caffe2:miniz)' --output-format dot_compact | pastry
P464671429: https://www.internalfb.com/intern/paste/P464671429/

bunnylol dgw P464671429
```

loader is decoupled from miniz

```
buck query 'allpaths(//xplat/caffe2/fb/runtime:flatbuffer_loader, //xplat/caffe2:miniz)' --output-format dot_compactdigraph result_graph {
}
```

Reviewed By: iseeyuan

Differential Revision: D31532862

fbshipit-source-id: 51e6880e78e1cafe20c8d90e98037edc3c1b6b11
diff --git a/tools/build_variables.bzl b/tools/build_variables.bzl
index b0ad675..bffc796 100644
--- a/tools/build_variables.bzl
+++ b/tools/build_variables.bzl
@@ -114,11 +114,14 @@
     "torch/csrc/jit/runtime/vararg_functions.cpp",
     "torch/csrc/jit/mobile/promoted_prim_ops.cpp",
     "torch/csrc/jit/mobile/prim_ops_registery.cpp",
+]
+
+torch_unpickler_common = [
     "torch/csrc/jit/serialization/import_read.cpp",
     "torch/csrc/jit/serialization/unpickler.cpp",
 ]
 
-libtorch_sources_common = core_sources_common
+libtorch_sources_common = sorted(core_sources_common + torch_unpickler_common)
 
 # The profilers are not needed in the lite interpreter build.
 libtorch_profiler_sources = [
@@ -365,6 +368,7 @@
 
 libtorch_core_sources = sorted(
     core_sources_common +
+    torch_unpickler_common +
     core_sources_full +
     core_trainer_sources +
     libtorch_profiler_sources +
@@ -495,7 +499,12 @@
 ]
 
 # TODO: core_trainer_sources is not necessary for libtorch lite
-libtorch_lite_cmake_sources = sorted(core_trainer_sources + core_sources_common + torch_mobile_core)
+libtorch_lite_cmake_sources = sorted(
+    core_trainer_sources +
+    core_sources_common +
+    torch_unpickler_common +
+    torch_mobile_core,
+)
 
 libtorch_cmake_sources = libtorch_core_sources + libtorch_core_jit_sources