From f4dc5afcb99f7680672548a11db49c186c731317 Mon Sep 17 00:00:00 2001 From: Matt Morrissette Date: Mon, 12 Sep 2022 14:50:14 -0700 Subject: [PATCH] feat(PluginInfo): add podspec plugins support (#177) --- spec/PluginInfo/PluginInfo.spec.js | 3 +++ .../plugins/org.test.plugins.withcocoapods/plugin.xml | 4 ++++ src/PluginInfo/PluginInfo.js | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/spec/PluginInfo/PluginInfo.spec.js b/spec/PluginInfo/PluginInfo.spec.js index 458eb566..dc5d61e3 100644 --- a/spec/PluginInfo/PluginInfo.spec.js +++ b/spec/PluginInfo/PluginInfo.spec.js @@ -67,9 +67,12 @@ describe('PluginInfo', function () { expect(Object.keys(podSpec.declarations).length).toBe(2); expect(Object.keys(podSpec.sources).length).toBe(1); expect(Object.keys(podSpec.libraries).length).toBe(4); + expect(Object.keys(podSpec.plugins).length).toBe(2); expect(podSpec.declarations['use-frameworks']).toBe('true'); expect(podSpec.sources['https://github.com/CocoaPods/Specs.git'].source).toBe('https://github.com/CocoaPods/Specs.git'); expect(podSpec.libraries.AFNetworking.spec).toBe('~> 3.2'); expect(podSpec.libraries.Eureka['swift-version']).toBe('4.1'); + expect(podSpec.plugins['my-other-plugin'].name).toBe('my-other-plugin'); + expect(podSpec.plugins['cocoapods-art'].options).toBe(":sources => [ 'my.source.url' ]"); }); }); diff --git a/spec/fixtures/plugins/org.test.plugins.withcocoapods/plugin.xml b/spec/fixtures/plugins/org.test.plugins.withcocoapods/plugin.xml index 2f6b6233..04a5c3de 100644 --- a/spec/fixtures/plugins/org.test.plugins.withcocoapods/plugin.xml +++ b/spec/fixtures/plugins/org.test.plugins.withcocoapods/plugin.xml @@ -44,6 +44,10 @@ + + + + diff --git a/src/PluginInfo/PluginInfo.js b/src/PluginInfo/PluginInfo.js index d3606647..95b4416c 100644 --- a/src/PluginInfo/PluginInfo.js +++ b/src/PluginInfo/PluginInfo.js @@ -257,6 +257,10 @@ class PluginInfo { * * * + * + * + * + * * * * @param {string} platform @@ -265,6 +269,7 @@ class PluginInfo { return this._getTagsInPlatform('podspec', platform).map(tag => { const config = tag.find('config'); const pods = tag.find('pods'); + const pluginsTag = tag.find('plugins'); const sources = config && config.findall('source') .map(el => ({ source: el.attrib.url })) @@ -276,7 +281,11 @@ class PluginInfo { .map(t => t.attrib) .reduce((acc, val) => Object.assign(acc, { [val.name]: val }), {}); - return { declarations, sources, libraries }; + const plugins = pluginsTag && pluginsTag.findall('plugin') + .map(t => t.attrib) + .reduce((acc, val) => Object.assign(acc, { [val.name]: val }), {}); + + return { declarations, sources, libraries, plugins }; }); }