Skip to content

Commit

Permalink
fix(asset-bundle): fix "add manifest data" logic
Browse files Browse the repository at this point in the history
change RABType,SABType->manifest->dependencyRelation type;
  • Loading branch information
yyc-git committed Apr 16, 2019
1 parent 01d4a57 commit 9cdd2e0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
33 changes: 24 additions & 9 deletions src/asset_bundle/all/manifest/ManifestDataSystem.re
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ module All = {
|}
];

let buildManifestData = (dependencyRelation, arrayBuffer, buildManifestFunc) =>
let buildManifestData =
(dependencyRelation, (abRelativePath, arrayBuffer), buildManifestFunc) =>
_getHashId(arrayBuffer)
|> then_(hashId =>
buildManifestFunc(hashId, dependencyRelation) |> resolve
buildManifestFunc(
hashId,
dependencyRelation
|> WonderCommonlib.ImmutableHashMapService.get(abRelativePath)
|> Js.Option.getWithDefault(
WonderCommonlib.ArrayService.createEmpty(),
),
)
|> resolve
)
|> Most.fromPromise;

Expand Down Expand Up @@ -83,10 +92,12 @@ module All = {
};

module SAB = {
let addManifestData = (dependencyRelation, sab) => {
let addManifestData = (dependencyRelation, (sabRelativePath, sab)) => {
let manifestJsonUint8Array =
All.buildManifestData(
dependencyRelation, sab, (hashId, dependencyRelation) =>
dependencyRelation,
(sabRelativePath, sab),
(hashId, dependencyRelation) =>
({hashId, dependencyRelation}: SABType.manifest)
)
|> GenerateABUtils.buildJsonUint8Array;
Expand All @@ -100,10 +111,12 @@ module SAB = {
};

module RAB = {
let addManifestData = (dependencyRelation, rab) => {
let addManifestData = (dependencyRelation, (rabRelativePath, rab)) => {
let manifestJsonUint8Array =
All.buildManifestData(
dependencyRelation, rab, (hashId, dependencyRelation) =>
dependencyRelation,
(rabRelativePath, rab),
(hashId, dependencyRelation) =>
({hashId, dependencyRelation}: RABType.manifest)
)
|> GenerateABUtils.buildJsonUint8Array;
Expand All @@ -119,8 +132,10 @@ module RAB = {
let addManifestData =
(
dependencyRelation: DependencyDataType.dependencyRelation,
(sabArr, rabArr),
(sabDataArr, rabDataArr),
) => (
sabArr |> Js.Array.map(sab => RAB.addManifestData(dependencyRelation, sab)),
rabArr |> Js.Array.map(rab => RAB.addManifestData(dependencyRelation, rab)),
sabDataArr
|> Js.Array.map(data => SAB.addManifestData(dependencyRelation, data)),
rabDataArr
|> Js.Array.map(data => RAB.addManifestData(dependencyRelation, data)),
);
5 changes: 1 addition & 4 deletions src/asset_bundle/rab/data/RABType.re
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ type resourceAssetBundleContent = {

type manifest = {
hashId: string,
dependencyRelation:
WonderCommonlib.ImmutableHashMapService.t(
array(AllABType.abRelativePath),
),
dependencyRelation: array(AllABType.abRelativePath),
};

type materialComponent = int;
Expand Down
5 changes: 1 addition & 4 deletions src/asset_bundle/sab/data/SABType.re
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ type sceneAssetBundleContent = WDType.wd;

type manifest = {
hashId: string,
dependencyRelation:
WonderCommonlib.ImmutableHashMapService.t(
array(AllABType.abRelativePath),
),
dependencyRelation: array(AllABType.abRelativePath),
};

0 comments on commit 9cdd2e0

Please sign in to comment.