From 73b9d97e6d54057b72ebfff98e9de5dadf703e82 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 9 Aug 2019 15:44:07 +0800 Subject: [PATCH] assets bundle --- Android/app/build.gradle | 5 ----- Android/app/src/main/assets/demo | 1 + .../java/com/github/penfeizhou/doricdemo/MainActivity.java | 2 +- Android/doric/build.gradle | 5 ----- Android/doric/src/main/assets/bundle | 1 + .../com/github/penfeizhou/doric/utils/DoricConstant.java | 4 ++-- 6 files changed, 5 insertions(+), 13 deletions(-) create mode 120000 Android/app/src/main/assets/demo create mode 120000 Android/doric/src/main/assets/bundle diff --git a/Android/app/build.gradle b/Android/app/build.gradle index db16d9ce..53d4c1d1 100644 --- a/Android/app/build.gradle +++ b/Android/app/build.gradle @@ -16,11 +16,6 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } - sourceSets { - main { - assets.srcDirs = [project.rootDir.getParent() + "/js-framework/demo"] - } - } } dependencies { diff --git a/Android/app/src/main/assets/demo b/Android/app/src/main/assets/demo new file mode 120000 index 00000000..2175ce05 --- /dev/null +++ b/Android/app/src/main/assets/demo @@ -0,0 +1 @@ +../../../../../js-framework/demo \ No newline at end of file diff --git a/Android/app/src/main/java/com/github/penfeizhou/doricdemo/MainActivity.java b/Android/app/src/main/java/com/github/penfeizhou/doricdemo/MainActivity.java index c051824a..77fafcbe 100644 --- a/Android/app/src/main/java/com/github/penfeizhou/doricdemo/MainActivity.java +++ b/Android/app/src/main/java/com/github/penfeizhou/doricdemo/MainActivity.java @@ -19,7 +19,7 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - DoricContext doricContext = DoricContext.create(this, DoricUtils.readAssetFile("demo.js"), "demo"); + DoricContext doricContext = DoricContext.create(this, DoricUtils.readAssetFile("demo/demo.js"), "demo"); doricContext.callEntity("__init__", new JSONBuilder() .put("width", ViewGroup.LayoutParams.MATCH_PARENT) .put("height", ViewGroup.LayoutParams.MATCH_PARENT)); diff --git a/Android/doric/build.gradle b/Android/doric/build.gradle index ead263ba..5f4cff86 100644 --- a/Android/doric/build.gradle +++ b/Android/doric/build.gradle @@ -21,11 +21,6 @@ android { consumerProguardFiles 'proguard-rules.pro' } } - sourceSets { - main { - assets.srcDirs = [project.rootDir.getParent() + "/js-framework/bundle"] - } - } } afterEvaluate { diff --git a/Android/doric/src/main/assets/bundle b/Android/doric/src/main/assets/bundle new file mode 120000 index 00000000..bc33c95e --- /dev/null +++ b/Android/doric/src/main/assets/bundle @@ -0,0 +1 @@ +../../../../../js-framework/bundle \ No newline at end of file diff --git a/Android/doric/src/main/java/com/github/penfeizhou/doric/utils/DoricConstant.java b/Android/doric/src/main/java/com/github/penfeizhou/doric/utils/DoricConstant.java index 7b91511e..a90c9701 100644 --- a/Android/doric/src/main/java/com/github/penfeizhou/doric/utils/DoricConstant.java +++ b/Android/doric/src/main/java/com/github/penfeizhou/doric/utils/DoricConstant.java @@ -6,8 +6,8 @@ package com.github.penfeizhou.doric.utils; * @CreateDate: 2019-07-18 */ public class DoricConstant { - public static final String DORIC_BUNDLE_SANDBOX = "doric-sandbox.js"; - public static final String DORIC_BUNDLE_LIB = "doric-lib.js"; + public static final String DORIC_BUNDLE_SANDBOX = "bundle/doric-sandbox.js"; + public static final String DORIC_BUNDLE_LIB = "bundle/doric-lib.js"; public static final String DORIC_MODULE_LIB = "./index";