DoricContext auto release in iOS

This commit is contained in:
pengfei.zhou 2019-07-29 14:51:35 +08:00
parent 2a53b24aff
commit 0371cde9d1
28 changed files with 630 additions and 537 deletions

View File

@ -37,7 +37,7 @@ public class DoricConstant {
"\nreturn __module.exports;" + "\nreturn __module.exports;" +
"},this,[{exports:{}}])" + "},this,[{exports:{}}])" +
"])"; "])";
public static final String TEMPLATE_CONTEXT_DESTROY = "doric.jsRelease(\"%s\")"; public static final String TEMPLATE_CONTEXT_DESTROY = "doric.jsReleaseContext(\"%s\")";
public static final String GLOBAL_DORIC = "doric"; public static final String GLOBAL_DORIC = "doric";
public static final String DORIC_CONTEXT_RELEASE = "jsReleaseContext"; public static final String DORIC_CONTEXT_RELEASE = "jsReleaseContext";
public static final String DORIC_CONTEXT_INVOKE = "jsCallEntityMethod"; public static final String DORIC_CONTEXT_INVOKE = "jsCallEntityMethod";

View File

@ -183,10 +183,12 @@
buildConfigurationList = E2334B1722E9D2070098A085 /* Build configuration list for PBXNativeTarget "Example" */; buildConfigurationList = E2334B1722E9D2070098A085 /* Build configuration list for PBXNativeTarget "Example" */;
buildPhases = ( buildPhases = (
6E772F4B0C7FEA8FDCAFEE9D /* [CP] Check Pods Manifest.lock */, 6E772F4B0C7FEA8FDCAFEE9D /* [CP] Check Pods Manifest.lock */,
E24A030C22EED0D500AB4631 /* Package JS Bundle */,
E2334AE722E9D2060098A085 /* Sources */, E2334AE722E9D2060098A085 /* Sources */,
E2334AE822E9D2060098A085 /* Frameworks */, E2334AE822E9D2060098A085 /* Frameworks */,
E2334AE922E9D2060098A085 /* Resources */, E2334AE922E9D2060098A085 /* Resources */,
84B12DF7F23F86261235972D /* [CP] Copy Pods Resources */, 84B12DF7F23F86261235972D /* [CP] Copy Pods Resources */,
AFECB95878D653D7859D0BAA /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
@ -205,6 +207,8 @@
E2334AFF22E9D2070098A085 /* Sources */, E2334AFF22E9D2070098A085 /* Sources */,
E2334B0022E9D2070098A085 /* Frameworks */, E2334B0022E9D2070098A085 /* Frameworks */,
E2334B0122E9D2070098A085 /* Resources */, E2334B0122E9D2070098A085 /* Resources */,
6B0C6186EBC80B57492B378C /* [CP] Embed Pods Frameworks */,
201D5010FB42BAD5A6B1F9B9 /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
@ -224,6 +228,8 @@
E2334B0A22E9D2070098A085 /* Sources */, E2334B0A22E9D2070098A085 /* Sources */,
E2334B0B22E9D2070098A085 /* Frameworks */, E2334B0B22E9D2070098A085 /* Frameworks */,
E2334B0C22E9D2070098A085 /* Resources */, E2334B0C22E9D2070098A085 /* Resources */,
255B0B73BF07A701C99282B2 /* [CP] Embed Pods Frameworks */,
7066EAB219B45442D9174E79 /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
@ -306,6 +312,44 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
201D5010FB42BAD5A6B1F9B9 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExampleTests/Pods-ExampleTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
255B0B73BF07A701C99282B2 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExampleUITests/Pods-ExampleUITests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
686371D167B9D901F89DC1C0 /* [CP] Check Pods Manifest.lock */ = { 686371D167B9D901F89DC1C0 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -328,6 +372,25 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
6B0C6186EBC80B57492B378C /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExampleTests/Pods-ExampleTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
6E772F4B0C7FEA8FDCAFEE9D /* [CP] Check Pods Manifest.lock */ = { 6E772F4B0C7FEA8FDCAFEE9D /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -350,6 +413,25 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
7066EAB219B45442D9174E79 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExampleUITests/Pods-ExampleUITests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
7838EFF4B3F4AE2F1D4D7E29 /* [CP] Check Pods Manifest.lock */ = { 7838EFF4B3F4AE2F1D4D7E29 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -380,15 +462,57 @@
inputFileListPaths = ( inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-input-files.xcfilelist", "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-input-files.xcfilelist",
); );
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh",
);
name = "[CP] Copy Pods Resources"; name = "[CP] Copy Pods Resources";
outputFileListPaths = ( outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-output-files.xcfilelist", "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-output-files.xcfilelist",
); );
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
AFECB95878D653D7859D0BAA /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E24A030C22EED0D500AB4631 /* Package JS Bundle */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Package JS Bundle";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\nexport NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\" # This loads nvm\n[ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\" # This loads nvm bash_completion\n\ncd ../../js-framework && npm run build\n";
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */

View File

@ -8,9 +8,9 @@
#import "ViewController.h" #import "ViewController.h"
#import "UIView+Doric.h" #import "UIView+Doric.h"
#import "DoricJSCoreExecutor.h"
#import "DoricUtil.h" #import "DoricUtil.h"
#import "DoricContext.h" #import "DoricContext.h"
#import "DoricNativePlugin.h"
@interface ViewController () @interface ViewController ()

View File

@ -6,11 +6,11 @@ DEPENDENCIES:
EXTERNAL SOURCES: EXTERNAL SOURCES:
Doric: Doric:
:path: "../" :path: ../
SPEC CHECKSUMS: SPEC CHECKSUMS:
Doric: 302e4bcf98fb021ca88a5cd986afde45c7cf6320 Doric: a407e9d834e48de2465c21719f37d5f827ebb289
PODFILE CHECKSUM: 012563d71439e7e33e976dca3b59664ed56cee39 PODFILE CHECKSUM: 012563d71439e7e33e976dca3b59664ed56cee39
COCOAPODS: 1.7.5 COCOAPODS: 1.4.0

View File

@ -0,0 +1 @@
../../../../../Pod/Classes/DoricComponent.h

View File

@ -0,0 +1 @@
../../../../../Pod/Classes/DoricContextManager.h

View File

@ -0,0 +1 @@
../../../../../Pod/Classes/DoricNativePlugin.h

View File

@ -0,0 +1 @@
../../../../../Pod/Classes/DoricComponent.h

View File

@ -0,0 +1 @@
../../../../../Pod/Classes/DoricContextManager.h

View File

@ -0,0 +1 @@
../../../../../Pod/Classes/DoricNativePlugin.h

View File

@ -6,11 +6,11 @@ DEPENDENCIES:
EXTERNAL SOURCES: EXTERNAL SOURCES:
Doric: Doric:
:path: "../" :path: ../
SPEC CHECKSUMS: SPEC CHECKSUMS:
Doric: 302e4bcf98fb021ca88a5cd986afde45c7cf6320 Doric: a407e9d834e48de2465c21719f37d5f827ebb289
PODFILE CHECKSUM: 012563d71439e7e33e976dca3b59664ed56cee39 PODFILE CHECKSUM: 012563d71439e7e33e976dca3b59664ed56cee39
COCOAPODS: 1.7.5 COCOAPODS: 1.4.0

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Doric CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Doric
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Doric" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric" HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Doric" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric"
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT} PODS_ROOT = ${SRCROOT}

View File

@ -1,18 +1,5 @@
#!/bin/sh #!/bin/sh
set -e set -e
set -u
set -o pipefail
function on_error {
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
}
trap 'on_error $LINENO' ERR
if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
# If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
# resources to, so exit 0 (signalling the script phase was successful).
exit 0
fi
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
@ -25,7 +12,7 @@ XCASSET_FILES=()
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
case "${TARGETED_DEVICE_FAMILY:-}" in case "${TARGETED_DEVICE_FAMILY}" in
1,2) 1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;; ;;
@ -113,7 +100,7 @@ if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
fi fi
rm -f "$RESOURCES_TO_COPY" rm -f "$RESOURCES_TO_COPY"
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
then then
# Find all other xcassets (this unfortunately includes those of path pods and other targets). # Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
@ -123,9 +110,5 @@ then
fi fi
done <<<"$OTHER_XCASSETS" done <<<"$OTHER_XCASSETS"
if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
else
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist"
fi
fi fi

View File

@ -1,6 +1,7 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric" HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Doric" LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Doric"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Doric"
OTHER_LDFLAGS = $(inherited) -ObjC -l"Doric" OTHER_LDFLAGS = $(inherited) -ObjC -l"Doric"
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)

View File

@ -1,6 +1,7 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric" HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Doric" LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Doric"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Doric"
OTHER_LDFLAGS = $(inherited) -ObjC -l"Doric" OTHER_LDFLAGS = $(inherited) -ObjC -l"Doric"
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)

View File

@ -1,5 +1,8 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric" HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Doric"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Doric"
OTHER_LDFLAGS = $(inherited) -ObjC
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -1,5 +1,8 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric" HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Doric"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Doric"
OTHER_LDFLAGS = $(inherited) -ObjC
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -1,5 +1,8 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric" HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Doric"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Doric"
OTHER_LDFLAGS = $(inherited) -ObjC
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -1,5 +1,8 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric" HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Doric"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Doric"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Doric"
OTHER_LDFLAGS = $(inherited) -ObjC
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -43,18 +43,22 @@ - (id)getResult {
return self.result; return self.result;
} }
- (void)setResultCallback:(DoricResultCallback)callback exceptionCallback:(DoricExceptionCallback)exceptionCallback { - (void)setResultCallback:(DoricResultCallback)callback {
self.resultCallback = callback; _resultCallback = callback;
self.exceptionCallback = exceptionCallback; if(self.result && ![self.result isKindOfClass: [NSException class]]){
callback(self.result);
}
}
- (void)setExceptionCallback:(DoricExceptionCallback)exceptionCallback {
_exceptionCallback = exceptionCallback;
if([self.result isKindOfClass: [NSException class]]){ if([self.result isKindOfClass: [NSException class]]){
self.exceptionCallback(self.result); exceptionCallback(self.result);
}else if(self.result){
self.resultCallback(self.result);
} }
} }
- (void)setFinishCallback:(DoricFinishCallback)callback { - (void)setFinishCallback:(DoricFinishCallback)callback {
self.finishCallback = callback; _finishCallback = callback;
if(self.result){ if(self.result){
callback(); callback();
} }

View File

@ -6,10 +6,14 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "DoricContext.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface DoricComponent : NSObject @interface DoricComponent : NSObject
@property (nonatomic,strong) DoricContext *doricContext;
- (instancetype)initWithContext:(DoricContext *)doricContext;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -9,4 +9,11 @@
@implementation DoricComponent @implementation DoricComponent
- (instancetype)initWithContext:(DoricContext *)doricContext {
if(self = [super init]){
_doricContext = doricContext;
}
return self;
}
@end @end

View File

@ -39,7 +39,7 @@
"},this,[{exports:{}}])" "},this,[{exports:{}}])"
"])"; "])";
NSString * const TEMPLATE_CONTEXT_DESTROY = @"doric.jsRelease(\"%@\""; NSString * const TEMPLATE_CONTEXT_DESTROY = @"doric.jsReleaseContext(\"%@\")";
NSString * const GLOBAL_DORIC = @"doric"; NSString * const GLOBAL_DORIC = @"doric";

View File

@ -10,17 +10,14 @@
@implementation DoricContext @implementation DoricContext
- (instancetype)init { - (instancetype)initWithScript:(NSString *)script source:(NSString *)source {
if(self = [super init]){ if(self = [super init]){
_driver = [DoricDriver instance]; _driver = [DoricDriver instance];
[[DoricContextManager instance] createContext:self script:script source:source];
} }
return self; return self;
} }
- (instancetype)initWithScript:(NSString *)script source:(NSString *)source {
return [[DoricContextManager instance] createContext:script source:source];
}
- (void)dealloc { - (void)dealloc {
[[DoricContextManager instance] destroyContext:self]; [[DoricContextManager instance] destroyContext:self];
} }

View File

@ -11,11 +11,11 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface DoricContextManager : NSObject @interface DoricContextManager : NSObject
+ (instancetype) instance; + (instancetype)instance;
- (DoricContext *)createContext:(NSString *)script source:(NSString *)source; - (void)createContext:(DoricContext *)context script:(NSString *)script source:(NSString *)source;
- (void) destroyContext:(DoricContext *)context; - (void)destroyContext:(DoricContext *)context;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -35,17 +35,17 @@ + (instancetype)instance{
return _instance; return _instance;
} }
- (DoricContext *)createContext:(NSString *)script source:(NSString *)source { - (void)createContext:(DoricContext *)context script:(NSString *)script source:(NSString *)source {
DoricContext *doricContext = [[DoricContext alloc] init]; context.contextId = [NSString stringWithFormat:@"%ld", (long)self.counter++];
doricContext.contextId = [NSString stringWithFormat:@"%ld", (long)self.counter++]; [context.driver createContext:context.contextId script:script source:source];
[doricContext.driver createContext:doricContext.contextId script:script source:source];
dispatch_sync(self.mapQueue, ^(){ dispatch_sync(self.mapQueue, ^(){
[self.doricContextMap setValue:doricContext forKey:doricContext.contextId]; NSValue *value = [NSValue valueWithNonretainedObject:context];
[self.doricContextMap setValue:value forKey:context.contextId];
}); });
return doricContext;
} }
- (void) destroyContext:(DoricContext *)context {
- (void)destroyContext:(DoricContext *)context {
NSString *contextId = context.contextId; NSString *contextId = context.contextId;
[[context.driver destroyContext:contextId] setFinishCallback:^(){ [[context.driver destroyContext:contextId] setFinishCallback:^(){
dispatch_sync(self.mapQueue, ^(){ dispatch_sync(self.mapQueue, ^(){

View File

@ -6,10 +6,10 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "DoricComponent.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface DoricNativePlugin : NSObject @interface DoricNativePlugin : DoricComponent
@end @end