diff --git a/doric-android/app/src/main/java/pub/doric/demo/DemoActivity.java b/doric-android/app/src/main/java/pub/doric/demo/DemoActivity.java deleted file mode 100644 index 1ec7b59a..00000000 --- a/doric-android/app/src/main/java/pub/doric/demo/DemoActivity.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright [2019] [Doric.Pub] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package pub.doric.demo; - -import android.os.Bundle; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; - -import pub.doric.DoricContext; -import pub.doric.DoricPanel; -import pub.doric.utils.DoricUtils; - -/** - * @Description: pub.doric.demo - * @Author: pengfei.zhou - * @CreateDate: 2019-11-19 - */ -public class DemoActivity extends AppCompatActivity { - private DoricContext doricContext; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - String source = getIntent().getStringExtra("source"); - DoricPanel doricPanel = new DoricPanel(this); - addContentView(doricPanel, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT)); - doricPanel.config(DoricUtils.readAssetFile("demo/" + source), source); - doricContext = doricPanel.getDoricContext(); - } -} diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/LocalServer.java b/doric-android/devkit/src/main/java/pub/doric/devkit/LocalServer.java deleted file mode 100644 index a85417f6..00000000 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/LocalServer.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright [2019] [Doric.Pub] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package pub.doric.devkit; - -import android.content.Context; -import android.content.res.AssetManager; -import android.net.Uri; -import android.util.Log; -import android.webkit.MimeTypeMap; - -import com.github.pengfeizhou.jscore.JSONBuilder; - -import org.json.JSONArray; -import org.json.JSONObject; - -import java.io.IOException; -import java.io.InputStream; -import java.net.Inet4Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import fi.iki.elonen.NanoHTTPD; -import pub.doric.DoricContext; -import pub.doric.DoricContextManager; - -/** - * @Description: com.github.penfeizhou.doricdemo - * @Author: pengfei.zhou - * @CreateDate: 2019-08-03 - */ -public class LocalServer extends NanoHTTPD { - private final Context context; - private Map commandMap = new HashMap<>(); - - public LocalServer(Context context, int port) { - super(port); - this.context = context; - commandMap.put("allContexts", new APICommand() { - @Override - public String name() { - return "allContexts"; - } - - @Override - public Object exec(IHTTPSession session) { - Collection ret = DoricContextManager.aliveContexts(); - JSONArray jsonArray = new JSONArray(); - for (DoricContext doricContext : ret) { - JSONBuilder jsonBuilder = new JSONBuilder(); - jsonBuilder.put("source", doricContext.getSource()); - jsonBuilder.put("id", doricContext.getContextId()); - jsonArray.put(jsonBuilder.toJSONObject()); - } - return jsonArray; - } - }); - commandMap.put("context", new APICommand() { - @Override - public String name() { - return "context"; - } - - @Override - public Object exec(IHTTPSession session) { - String id = session.getParms().get("id"); - DoricContext doricContext = DoricContextManager.getContext(id); - if (doricContext != null) { - return new JSONBuilder() - .put("id", doricContext.getContextId()) - .put("source", doricContext.getSource()) - .put("script", doricContext.getScript()) - .toJSONObject(); - } - return "{}"; - } - }); - commandMap.put("reload", new APICommand() { - @Override - public String name() { - return "reload"; - } - - @Override - public Object exec(IHTTPSession session) { - Map files = new HashMap<>(); - try { - session.parseBody(files); - } catch (Exception e) { - e.printStackTrace(); - } - String id = session.getParms().get("id"); - DoricContext doricContext = DoricContextManager.getContext(id); - if (doricContext != null) { - try { - JSONObject jsonObject = new JSONObject(files.get("postData")); - doricContext.reload(jsonObject.optString("script")); - } catch (Exception e) { - e.printStackTrace(); - } - return "success"; - } - return "fail"; - } - }); - - } - - private static String getIpAddressString() { - try { - for (Enumeration enNetI = NetworkInterface - .getNetworkInterfaces(); enNetI.hasMoreElements(); ) { - NetworkInterface netI = enNetI.nextElement(); - for (Enumeration enumIpAddr = netI - .getInetAddresses(); enumIpAddr.hasMoreElements(); ) { - InetAddress inetAddress = enumIpAddr.nextElement(); - if (inetAddress instanceof Inet4Address && !inetAddress.isLoopbackAddress()) { - return inetAddress.getHostAddress(); - } - } - } - } catch (SocketException e) { - e.printStackTrace(); - } - return "0.0.0.0"; - } - - @Override - public void start() throws IOException { - super.start(); - Log.d("Debugger", String.format("Open http://%s:8910/index.html to start debug", getIpAddressString())); - } - - @Override - public Response serve(IHTTPSession session) { - Uri uri = Uri.parse(session.getUri()); - List segments = uri.getPathSegments(); - if (segments.size() > 1 && "api".equals(segments.get(0))) { - String cmd = segments.get(1); - APICommand apiCommand = commandMap.get(cmd); - if (apiCommand != null) { - Object ret = apiCommand.exec(session); - return NanoHTTPD.newFixedLengthResponse(Response.Status.OK, "application/json", ret.toString()); - } - } - String fileName = session.getUri().substring(1); - AssetManager assetManager = context.getAssets(); - try { - InputStream inputStream = assetManager.open("debugger/" + fileName); - String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileName.substring(fileName.lastIndexOf(".") + 1)); - return NanoHTTPD.newFixedLengthResponse(Response.Status.OK, mimeType, inputStream, inputStream.available()); - } catch (IOException e) { - e.printStackTrace(); - } - return NanoHTTPD.newFixedLengthResponse(Response.Status.OK, "text/html", "HelloWorld"); - } - - public interface APICommand { - String name(); - - Object exec(IHTTPSession session); - } -} diff --git a/doric-demo/package-lock.json b/doric-demo/package-lock.json index 36c4f6a8..dec74dcf 100644 --- a/doric-demo/package-lock.json +++ b/doric-demo/package-lock.json @@ -62,117 +62,6 @@ "tslib": "^1.10.0", "typescript": "^3.7.3", "ws": "^7.2.1" - }, - "dependencies": { - "@rollup/plugin-node-resolve": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-6.0.0.tgz", - "integrity": "sha512-GqWz1CfXOsqpeVMcoM315+O7zMxpRsmhWyhJoxLFHVSp9S64/u02i7len/FnbTNbmgYs+sZyilasijH8UiuboQ==", - "requires": { - "@rollup/pluginutils": "^3.0.0", - "@types/resolve": "0.0.8", - "builtin-modules": "^3.1.0", - "is-module": "^1.0.0", - "resolve": "^1.11.1" - } - }, - "@rollup/pluginutils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.0.tgz", - "integrity": "sha512-qBbGQQaUUiId/lBU9VMeYlVLOoRNvz1fV8HWY5tiGDpI2gdPZHbmOfCjzSdXPhdq3XOfyWvXEBlIPbnM3+9ogQ==", - "requires": { - "estree-walker": "^0.6.1" - } - }, - "@types/estree": { - "version": "0.0.40", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.40.tgz", - "integrity": "sha512-p3KZgMto/JyxosKGmnLDJ/dG5wf+qTRMUjHJcspC2oQKa4jP7mz+tv0ND56lLBu3ojHlhzY33Ol+khLyNmilkA==" - }, - "@types/node": { - "version": "12.12.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.21.tgz", - "integrity": "sha512-8sRGhbpU+ck1n0PGAUgVrWrWdjSW2aqNeyC15W88GRsMpSwzv6RJGlLhE7s2RhVSOdyDmxbqlWSeThq4/7xqlA==" - }, - "@types/resolve": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", - "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", - "requires": { - "@types/node": "*" - } - }, - "@types/ws": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.4.tgz", - "integrity": "sha512-PpPrX7SZW9re6+Ha8ojZG4Se8AZXgf0GK6zmfqEuCsY49LFDNXO3SByp44X3dFEqtB73lkCDAdUazhAjVPiNwg==", - "requires": { - "@types/node": "*" - } - }, - "acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==" - }, - "builtin-modules": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", - "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==" - }, - "estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==" - }, - "is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=" - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" - }, - "reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" - }, - "resolve": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz", - "integrity": "sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==", - "requires": { - "path-parse": "^1.0.6" - } - }, - "rollup": { - "version": "1.27.13", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.13.tgz", - "integrity": "sha512-hDi7M07MpmNSDE8YVwGVFA8L7n8jTLJ4lG65nMAijAyqBe//rtu4JdxjUBE7JqXfdpqxqDTbCDys9WcqdpsQvw==", - "requires": { - "@types/estree": "*", - "@types/node": "*", - "acorn": "^7.1.0" - } - }, - "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" - }, - "typescript": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz", - "integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==" - }, - "ws": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz", - "integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A==" - } } }, "estree-walker": { diff --git a/doric-iOS/Doric.podspec b/doric-iOS/Doric.podspec deleted file mode 100644 index 8eb2cf33..00000000 --- a/doric-iOS/Doric.podspec +++ /dev/null @@ -1,48 +0,0 @@ -# -# Be sure to run `pod lib lint Doric.podspec' to ensure this is a -# valid spec before submitting. -# -# Any lines starting with a # are optional, but their use is encouraged -# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html -# - -Pod::Spec.new do |s| - s.name = 'Doric' - s.version = '0.1.0' - s.summary = 'A short description of Doric.' - -# This description is used to generate tags and improve search results. -# * Think: What does it do? Why did you write it? What is the focus? -# * Try to keep it short, snappy and to the point. -# * Write the description between the DESC delimiters below. -# * Finally, don't worry about the indent, CocoaPods strips it! - - s.description = <<-DESC -TODO: Add long description of the pod here. - DESC - - s.homepage = 'https://github.com/doric-pub/doric' - # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' - s.license = { :type => 'Apache-2.0', :file => 'LICENSE' } - s.author = { 'pengfei.zhou' => 'pengfeizhou@foxmail.com' } - s.source = { :git => 'git@github.com:penfeizhou/doric.git', :tag => s.version.to_s } - # s.social_media_url = 'https://twitter.com/' - - s.ios.deployment_target = '8.0' - - s.source_files = 'Pod/Classes/**/*' - s.resource = "Pod/Assets/*.js" - s.resource_bundles = { - 'Doric' => ['Pod/Assets/**/*'] - } - - s.public_header_files = 'Pod/Classes/**/*.h' - # s.frameworks = 'UIKit', 'MapKit' - # s.dependency 'AFNetworking', '~> 2.3' - # s.dependency 'SDWebImage', '~> 5.0' - s.dependency 'YYWebImage', '~>1.0.5' - s.dependency 'YYImage/WebP' - s.dependency 'SocketRocket', '~> 0.5.1' - s.dependency 'GCDWebServer', '~> 3.0' - s.dependency 'YYCache', '~> 1.0.4' -end diff --git a/doric-iOS/Example/Example.xcodeproj/project.pbxproj b/doric-iOS/Example/Example.xcodeproj/project.pbxproj index a9b47a06..caebe0ec 100644 --- a/doric-iOS/Example/Example.xcodeproj/project.pbxproj +++ b/doric-iOS/Example/Example.xcodeproj/project.pbxproj @@ -7,8 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 26047AF7D618FF60281DC778 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92C4B99C431BD381198935DE /* Pods_Example.framework */; }; - C6AF7EB0B40D76A46B2BB384 /* Pods_ExampleUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF50786B1D1793EC3228133B /* Pods_ExampleUITests.framework */; }; + A1E221FB2DCA40D85C4D9520 /* libPods-ExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F233ACD236542275AED3DE0 /* libPods-ExampleTests.a */; }; + CC537F4B9F59400BA5B4FF8F /* libPods-Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DEE8411A69609CC9C86063CC /* libPods-Example.a */; }; D751D4B065D8D4FA6594B5EE /* DemoVC.m in Sources */ = {isa = PBXBuildFile; fileRef = D751D19E97EF4EDD7588FEBE /* DemoVC.m */; }; D751D4FCC0A2322211DE3D55 /* QRScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D751DA399F1ADB6D34563B5D /* QRScanViewController.m */; }; D751DDB012BAF476A252CD93 /* DemoLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = D751D2175D09F2C10691FB81 /* DemoLibrary.m */; }; @@ -21,7 +21,7 @@ E2334B0822E9D2070098A085 /* ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E2334B0722E9D2070098A085 /* ExampleTests.m */; }; E2334B1322E9D2070098A085 /* ExampleUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = E2334B1222E9D2070098A085 /* ExampleUITests.m */; }; E2F4481723839AC500073C7F /* demo in Resources */ = {isa = PBXBuildFile; fileRef = E2F4481623839AC500073C7F /* demo */; }; - E778063CA90E2DD797D11D7C /* Pods_ExampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00A2FF6380A526AB267988ED /* Pods_ExampleTests.framework */; }; + ED1C348399AB9D786E6D0FD4 /* libPods-ExampleUITests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E7A7F41AFE5065A452873298 /* libPods-ExampleUITests.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,14 +42,12 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 00A2FF6380A526AB267988ED /* Pods_ExampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ExampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 016E930415B91D826F9FFF47 /* Pods-ExampleUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleUITests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleUITests/Pods-ExampleUITests.debug.xcconfig"; sourceTree = ""; }; 3D75F592D76A665674B31A66 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; + 4F233ACD236542275AED3DE0 /* libPods-ExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 8231E841CCAF382F85C9F576 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; - 92C4B99C431BD381198935DE /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B93423722F2E06DC238CDD18 /* Pods-ExampleUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleUITests/Pods-ExampleUITests.release.xcconfig"; sourceTree = ""; }; B93D4DB00FD244178B7CE7C4 /* Pods-ExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleTests/Pods-ExampleTests.release.xcconfig"; sourceTree = ""; }; - BF50786B1D1793EC3228133B /* Pods_ExampleUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ExampleUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D751D18AD6496F4A9BE1AB45 /* QRScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QRScanViewController.h; sourceTree = ""; }; D751D19E97EF4EDD7588FEBE /* DemoVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoVC.m; sourceTree = ""; }; D751D2175D09F2C10691FB81 /* DemoLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoLibrary.m; sourceTree = ""; }; @@ -57,6 +55,7 @@ D751DB0CB3009E12990F661E /* DemoLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoLibrary.h; sourceTree = ""; }; D751DDEC114E037231257E64 /* DemoVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoVC.h; sourceTree = ""; }; D91241144B5A3356A3C60644 /* Pods-ExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleTests/Pods-ExampleTests.debug.xcconfig"; sourceTree = ""; }; + DEE8411A69609CC9C86063CC /* libPods-Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; E2334AEB22E9D2060098A085 /* Doric Playground.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Doric Playground.app"; sourceTree = BUILT_PRODUCTS_DIR; }; E2334AEE22E9D2060098A085 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; E2334AEF22E9D2060098A085 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -74,6 +73,7 @@ E2334B1222E9D2070098A085 /* ExampleUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExampleUITests.m; sourceTree = ""; }; E2334B1422E9D2070098A085 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E2F4481623839AC500073C7F /* demo */ = {isa = PBXFileReference; lastKnownFileType = folder; path = demo; sourceTree = ""; }; + E7A7F41AFE5065A452873298 /* libPods-ExampleUITests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ExampleUITests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -81,7 +81,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 26047AF7D618FF60281DC778 /* Pods_Example.framework in Frameworks */, + CC537F4B9F59400BA5B4FF8F /* libPods-Example.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -89,7 +89,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E778063CA90E2DD797D11D7C /* Pods_ExampleTests.framework in Frameworks */, + A1E221FB2DCA40D85C4D9520 /* libPods-ExampleTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -97,7 +97,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C6AF7EB0B40D76A46B2BB384 /* Pods_ExampleUITests.framework in Frameworks */, + ED1C348399AB9D786E6D0FD4 /* libPods-ExampleUITests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -120,9 +120,9 @@ D80A9B07B39AD04027CAE17B /* Frameworks */ = { isa = PBXGroup; children = ( - 92C4B99C431BD381198935DE /* Pods_Example.framework */, - 00A2FF6380A526AB267988ED /* Pods_ExampleTests.framework */, - BF50786B1D1793EC3228133B /* Pods_ExampleUITests.framework */, + DEE8411A69609CC9C86063CC /* libPods-Example.a */, + 4F233ACD236542275AED3DE0 /* libPods-ExampleTests.a */, + E7A7F41AFE5065A452873298 /* libPods-ExampleUITests.a */, ); name = Frameworks; sourceTree = ""; @@ -202,7 +202,6 @@ E2334AE722E9D2060098A085 /* Sources */, E2334AE822E9D2060098A085 /* Frameworks */, E2334AE922E9D2060098A085 /* Resources */, - 223E53E328880489770F8C93 /* [CP] Embed Pods Frameworks */, EEF1C3B3FE5FE92E603C3B08 /* [CP] Copy Pods Resources */, ); buildRules = ( @@ -222,8 +221,6 @@ E2334AFF22E9D2070098A085 /* Sources */, E2334B0022E9D2070098A085 /* Frameworks */, E2334B0122E9D2070098A085 /* Resources */, - 9908F148F5F00DD2EB349A08 /* [CP] Embed Pods Frameworks */, - 17E0A19B8E5C4C4883C8AB85 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -243,8 +240,6 @@ E2334B0A22E9D2070098A085 /* Sources */, E2334B0B22E9D2070098A085 /* Frameworks */, E2334B0C22E9D2070098A085 /* Resources */, - 5FE5475A2ECF1794CBF57C61 /* [CP] Embed Pods Frameworks */, - C09BD0B68592DA6641E3B65D /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -349,55 +344,6 @@ 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; }; - 17E0A19B8E5C4C4883C8AB85 /* [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; - }; - 223E53E328880489770F8C93 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/DoricCore/DoricCore.framework", - "${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework", - "${BUILT_PRODUCTS_DIR}/YYCache/YYCache.framework", - "${BUILT_PRODUCTS_DIR}/YYImage/YYImage.framework", - "${BUILT_PRODUCTS_DIR}/YYWebImage/YYWebImage.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DoricCore.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYCache.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYImage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYWebImage.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 48D050F720D3A879060292A8 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -420,44 +366,6 @@ 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; }; - 5FE5475A2ECF1794CBF57C61 /* [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; - }; - 9908F148F5F00DD2EB349A08 /* [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; - }; BE34CD8291B20D26F2ADE3E1 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -480,25 +388,6 @@ 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; }; - C09BD0B68592DA6641E3B65D /* [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; - }; E24A030C22EED0D500AB4631 /* Package JS Bundle */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -523,17 +412,15 @@ files = ( ); inputFileListPaths = ( - ); - inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/doric-iOS/Example/Podfile b/doric-iOS/Example/Podfile index 86f37ee2..8b916cc6 100644 --- a/doric-iOS/Example/Podfile +++ b/doric-iOS/Example/Podfile @@ -3,7 +3,7 @@ target 'Example' do - pod 'Doric', :path => '../' + pod 'DoricCore', :path => '../' target 'ExampleTests' do inherit! :search_paths # Pods for testing diff --git a/doric-iOS/Pod/Assets/dist b/doric-iOS/Pod/Assets/dist deleted file mode 120000 index 9018f703..00000000 --- a/doric-iOS/Pod/Assets/dist +++ /dev/null @@ -1 +0,0 @@ -../../../debugger/dist \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/Dev/DoricLocalServer.h b/doric-iOS/Pod/Classes/Dev/DoricLocalServer.h deleted file mode 100644 index b1ae18f9..00000000 --- a/doric-iOS/Pod/Classes/Dev/DoricLocalServer.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright [2019] [Doric.Pub] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// -// DoricLocalServer.h -// Doric -// -// Created by pengfei.zhou on 2019/8/14. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface DoricLocalServer : NSObject -- (void)startWithPort:(NSUInteger)port; -@end - -NS_ASSUME_NONNULL_END diff --git a/doric-iOS/Pod/Classes/Dev/DoricLocalServer.m b/doric-iOS/Pod/Classes/Dev/DoricLocalServer.m deleted file mode 100644 index 8fa1454f..00000000 --- a/doric-iOS/Pod/Classes/Dev/DoricLocalServer.m +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright [2019] [Doric.Pub] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// -// DoricLocalServer.m -// Doric -// -// Created by pengfei.zhou on 2019/8/14. -// - -#import "DoricLocalServer.h" -#import "GCDWebServer.h" -#import "GCDWebServerDataResponse.h" -#import "DoricUtil.h" -#import "DoricContextManager.h" - -#include -#include -#include - -typedef id (^ServerHandler)(GCDWebServerRequest *request); - -@interface DoricLocalServer () -@property(nonatomic, strong) GCDWebServer *server; -@property(nonatomic, strong) NSMutableDictionary *handlers; -@end - -@implementation DoricLocalServer - -- (instancetype)init { - if (self = [super init]) { - _server = [[GCDWebServer alloc] init]; - _handlers = [[NSMutableDictionary alloc] init]; - [self configurate]; - } - return self; -} - -- (NSString *)localIPAddress { - NSString *localIP = nil; - struct ifaddrs *addrs; - if (getifaddrs(&addrs) == 0) { - const struct ifaddrs *cursor = addrs; - while (cursor != NULL) { - if (cursor->ifa_addr->sa_family == AF_INET && (cursor->ifa_flags & IFF_LOOPBACK) == 0) { - //NSString *name = [NSString stringWithUTF8String:cursor->ifa_name]; - //if ([name isEqualToString:@"en0"]) // Wi-Fi adapter - { - localIP = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *) cursor->ifa_addr)->sin_addr)]; - break; - } - } - cursor = cursor->ifa_next; - } - freeifaddrs(addrs); - } - return localIP; -} - -- (GCDWebServerResponse *)handleRequest:(GCDWebServerRequest *)request { - if ([request.path hasPrefix:@"/api/"]) { - NSString *command = [request.path substringFromIndex:@"/api/".length]; - ServerHandler handler = [self.handlers objectForKey:command]; - if (handler) { - id dic = handler(request); - return [GCDWebServerDataResponse responseWithJSONObject:dic]; - } - return [GCDWebServerDataResponse responseWithHTML:@"

It's a API request.

"]; - } - NSBundle *bundle = DoricBundle(); - NSString *filePath = [NSString stringWithFormat:@"%@/dist%@", bundle.bundlePath, request.path]; - NSData *data = [NSData dataWithContentsOfFile:filePath]; - NSURL *url = [NSURL fileURLWithPath:filePath]; - NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url]; - NSHTTPURLResponse *response; - [NSURLConnection sendSynchronousRequest:req returningResponse:&response error:nil]; - return [GCDWebServerDataResponse responseWithData:data contentType:response.MIMEType]; -} - -- (void)configurate { - __weak typeof(self) _self = self; - [self.server addDefaultHandlerForMethod:@"GET" - requestClass:[GCDWebServerRequest class] - processBlock:^GCDWebServerResponse *(GCDWebServerRequest *request) { - __strong typeof(_self) self = _self; - return [self handleRequest:request]; - }]; - [self.handlers setObject:^id(GCDWebServerRequest *request) { - NSMutableArray *array = [[NSMutableArray alloc] init]; - - for (NSValue *value in [[DoricContextManager instance] aliveContexts]) { - DoricContext *context = value.nonretainedObjectValue; - [array addObject:@{ - @"source": context.source, - @"id": context.contextId, - }]; - } - return array; - } - forKey:@"allContexts"]; - - [self.handlers setObject:^id(GCDWebServerRequest *request) { - NSString *contextId = [request.query objectForKey:@"id"]; - DoricContext *context = [[DoricContextManager instance] getContext:contextId]; - return @{ - @"id": context.contextId, - @"source": context.source, - @"script": context.script - }; - } - forKey:@"context"]; -} - -- (void)startWithPort:(NSUInteger)port { - [self.server startWithPort:port bonjourName:nil]; - DoricLog(@"Start Server At %@:%d", [self localIPAddress], port); -} -@end