diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..003c3e1 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: [soumyamahunt] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/config/package-lock.json b/.github/config/package-lock.json index db4aaa5..59d6a29 100644 --- a/.github/config/package-lock.json +++ b/.github/config/package-lock.json @@ -9,25 +9,26 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@actions/core": "1.6.0", - "conventional-changelog-conventionalcommits": "^4.6.3", - "semver": "^7.3.5" + "@actions/core": "1.10.0", + "conventional-changelog-conventionalcommits": "^5.0.0", + "semver": "^7.5.0" } }, "node_modules/@actions/core": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", - "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", + "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", "dependencies": { - "@actions/http-client": "^1.0.11" + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" } }, "node_modules/@actions/http-client": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", - "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", + "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", "dependencies": { - "tunnel": "0.0.6" + "tunnel": "^0.0.6" } }, "node_modules/array-ify": { @@ -45,9 +46,9 @@ } }, "node_modules/conventional-changelog-conventionalcommits": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.3.tgz", - "integrity": "sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-5.0.0.tgz", + "integrity": "sha512-lCDbA+ZqVFQGUj7h9QBKoIpLhl8iihkO0nCTyRNzuXtcd7ubODpYB04IFy31JloiJgG0Uovu8ot8oxRzn7Nwtw==", "dependencies": { "compare-func": "^2.0.0", "lodash": "^4.17.15", @@ -102,9 +103,9 @@ } }, "node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -123,6 +124,14 @@ "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -131,19 +140,20 @@ }, "dependencies": { "@actions/core": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", - "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", + "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", "requires": { - "@actions/http-client": "^1.0.11" + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" } }, "@actions/http-client": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", - "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", + "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", "requires": { - "tunnel": "0.0.6" + "tunnel": "^0.0.6" } }, "array-ify": { @@ -161,9 +171,9 @@ } }, "conventional-changelog-conventionalcommits": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.3.tgz", - "integrity": "sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-5.0.0.tgz", + "integrity": "sha512-lCDbA+ZqVFQGUj7h9QBKoIpLhl8iihkO0nCTyRNzuXtcd7ubODpYB04IFy31JloiJgG0Uovu8ot8oxRzn7Nwtw==", "requires": { "compare-func": "^2.0.0", "lodash": "^4.17.15", @@ -202,9 +212,9 @@ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "requires": { "lru-cache": "^6.0.0" } @@ -214,6 +224,11 @@ "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", diff --git a/.github/config/package.json b/.github/config/package.json index 7240f7b..6be79d0 100644 --- a/.github/config/package.json +++ b/.github/config/package.json @@ -6,11 +6,11 @@ "license": "MIT", "author": { "name": "Soumya Ranjan Mahunt", - "email": "devsoumyamahunt@gmail.com" + "email": "soumya.mahunt@gmail.com" }, "dependencies": { - "@actions/core": "1.6.0", - "conventional-changelog-conventionalcommits": "^4.6.3", - "semver": "^7.3.5" + "@actions/core": "1.10.0", + "conventional-changelog-conventionalcommits": "^5.0.0", + "semver": "^7.5.0" } } diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..a4af1d6 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,36 @@ +name: "CodeQL" + +on: + workflow_call: + schedule: + - cron: '0 0 * * *' + +concurrency: + group: scan-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + matrix: + language: [ 'javascript', 'ruby' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cc354e5..5ccaf09 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,20 +13,29 @@ on: inputs: release: description: Create release - required: false + required: false type: boolean env: RUBY_VER: 2.6 -concurrency: - group: ${{ github.ref }} +concurrency: + group: ci/cd-${{ github.ref }} cancel-in-progress: true jobs: + analyze: + name: Analyze + if: github.event_name != 'workflow_dispatch' + uses: ./.github/workflows/codeql-analysis.yml + permissions: + actions: read + contents: read + security-events: write + ci: name: Run Tests - runs-on: ubuntu-latest + runs-on: macos-latest outputs: release: ${{ steps.check_version_bump.outputs.release_type != '' }} @@ -48,7 +57,7 @@ jobs: run: bundle exec rake specs - name: Install Flutter - uses: subosito/flutter-action@v2.3.0 + uses: subosito/flutter-action@v2.10.0 - name: Setup Flutter for ios run: | @@ -59,7 +68,7 @@ jobs: - name: Check version bump id: check_version_bump - uses: mathieudutour/github-tag-action@v6.0 + uses: mathieudutour/github-tag-action@v6.1 with: github_token: ${{ github.token }} default_bump: false @@ -68,7 +77,7 @@ jobs: cd: name: Build and Publish if: (github.event_name == 'push' && needs.ci.outputs.release == 'true') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true') - needs: ci + needs: [ci, analyze] runs-on: ubuntu-latest steps: @@ -103,7 +112,7 @@ jobs: github-token: ${{ github.token }} git-message: 'chore(CHANGELOG): update for {version}' git-user-name: ${{ github.actor }} - git-user-email: devsoumyamahunt@gmail.com + git-user-email: soumya.mahunt@gmail.com skip-version-file: true release-count: 0 pre-changelog-generation: '.github/config/pre_changelog_hook.js' diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..8626583 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "castwide.solargraph", + "rebornix.ruby" + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 56d3451..67e47e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,59 +1,103 @@ +### [0.6.1](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.6.0...v0.6.1) (2022-05-03) + + +### 🛠 Dependency + +* bump cocoapods-downloader from 1.5.1 to 1.6.3 ([#5](https://github.com/DartBuild/cocoapods-embed-flutter/issues/5)) ([8067f06](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8067f062ab268fcc588e60c5cf54c3fe4da1d3e2)) +* bump nokogiri from 1.13.3 to 1.13.4 ([#7](https://github.com/DartBuild/cocoapods-embed-flutter/issues/7)) ([975638e](https://github.com/DartBuild/cocoapods-embed-flutter/commit/975638ecda2fc65f4141d1e0a37f08a775692984)) + + +### 💡 Continuous Integration + +* add codeql scanning ([3120c44](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3120c446adf3bce9b80fe07a0d57ca79d7adfe7e)) +* **Deps:** bump @actions/core from 1.6.0 to 1.7.0 in /.github/config ([#8](https://github.com/DartBuild/cocoapods-embed-flutter/issues/8)) ([a3861ad](https://github.com/DartBuild/cocoapods-embed-flutter/commit/a3861ad7223c5d9a2021b15359d158a7c9ea2705)) +* **Deps:** bump semver from 7.3.5 to 7.3.7 in /.github/config ([#9](https://github.com/DartBuild/cocoapods-embed-flutter/issues/9)) ([36f2599](https://github.com/DartBuild/cocoapods-embed-flutter/commit/36f2599074c2a4e13bbd07680cc0cb208fe7ee97)) +* **Deps:** bump subosito/flutter-action from 2.3.0 to 2.4.0 ([#10](https://github.com/DartBuild/cocoapods-embed-flutter/issues/10)) ([2e6c1c1](https://github.com/DartBuild/cocoapods-embed-flutter/commit/2e6c1c108bc4dc44e25844d13fd0bb86639bba2e)) +* **Runners:** added self hosted macos runner ([3371c29](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3371c294ea34f2fa123e4ebb6ae368311e5dfb8b)) + + +### 🐎 Performance Improvements + +* allow concurrent `flutter pub get` ([ef5bc8a](https://github.com/DartBuild/cocoapods-embed-flutter/commit/ef5bc8a7daa0eada810210e481f0be708182192c)) + +## [0.6.0](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.5.3...v0.6.0) (2022-03-27) + + +### 📚 Documentation + +* **README:** add pub.dev limitation ([f42de7c](https://github.com/DartBuild/cocoapods-embed-flutter/commit/f42de7c908d65661bb12e8becc6fc6941295d19a)) + + +### 🛠 Dependency + +* bump cocoapods from 1.11.2 to 1.11.3 ([#4](https://github.com/DartBuild/cocoapods-embed-flutter/issues/4)) ([8cec1cb](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8cec1cbe4c18dd20d155d5b1b8824ae7910a11c3)) + + +### 💄 Styles + +* add vscode extensions recommendation ([db4bdb5](https://github.com/DartBuild/cocoapods-embed-flutter/commit/db4bdb58765851cabfdf16254678301b149faceb)) + + +### 🚀 Features + +* allow specifying different path for remote sources ([56178ed](https://github.com/DartBuild/cocoapods-embed-flutter/commit/56178ed645a476e19b77377c246ce90de582b5ef)) + ### [0.5.3](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.5.2...v0.5.3) (2022-03-18) ### 📚 Documentation -* **README:** add limitations ([9133edc](https://github.com/DartBuild/cocoapods-embed-flutter/commit/9133edc006973892b2e55ef13a30f6ae8e8b7ad4)) +* **README:** add limitations ([8830ead](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8830eadfbb46ddbce83a2bf329bc04fa3cfe2583)) ### [0.5.2](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.5.1...v0.5.2) (2022-03-12) ### 📚 Documentation -* add helpful links and badges ([4ab6983](https://github.com/DartBuild/cocoapods-embed-flutter/commit/4ab69837d5057a0049e1533a00c6209556aec5b0)) +* add helpful links and badges ([8fb5253](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8fb52531d66782525ae10a36bd7c1a5a062c02a4)) ### 💡 Continuous Integration -* **Deps:** bump actions/checkout from 2 to 3 ([#2](https://github.com/DartBuild/cocoapods-embed-flutter/issues/2)) ([3d1ca07](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3d1ca0732a87e04561bc68ba1bbfc337173cd783)) -* **Deps:** bump actions/setup-node from 2 to 3 ([#3](https://github.com/DartBuild/cocoapods-embed-flutter/issues/3)) ([efd8f1a](https://github.com/DartBuild/cocoapods-embed-flutter/commit/efd8f1a82ce8ca6cd12adc1e5ca943a316a44b03)) +* **Deps:** bump actions/checkout from 2 to 3 ([#2](https://github.com/DartBuild/cocoapods-embed-flutter/issues/2)) ([7fddfd6](https://github.com/DartBuild/cocoapods-embed-flutter/commit/7fddfd663a74e6390cddcee979b211e55daf18bb)) +* **Deps:** bump actions/setup-node from 2 to 3 ([#3](https://github.com/DartBuild/cocoapods-embed-flutter/issues/3)) ([0af3476](https://github.com/DartBuild/cocoapods-embed-flutter/commit/0af34765e384d87fc257a9ddef2015faff393bad)) ### [0.5.1](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.5.0...v0.5.1) (2022-03-11) ### 📚 Documentation -* add code documentation ([87c06fd](https://github.com/DartBuild/cocoapods-embed-flutter/commit/87c06fd45d3c63a94cda6ce3ae00a200f412bb2a)) +* add code documentation ([dd8d3da](https://github.com/DartBuild/cocoapods-embed-flutter/commit/dd8d3dafc3da6d68fa365d5580e89fc460cf9d94)) -## [0.5.0](https://github.com/DartBuild/cocoapods-embed-flutter/compare/3358c2b251f51154010990b95b7eaa741049d707...v0.5.0) (2022-03-11) +## [0.5.0](https://github.com/DartBuild/cocoapods-embed-flutter/compare/1ad9f80188b2fa296933af35e6902ffcd6db001e...v0.5.0) (2022-03-11) ### 🚀 Features -* add all remotes supported by `cocoapods-downloader` ([019d4c5](https://github.com/DartBuild/cocoapods-embed-flutter/commit/019d4c5298eaf52061fbcf6f264102419bc7e51e)) -* allow local flutter module to be declared dependency ([3358c2b](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3358c2b251f51154010990b95b7eaa741049d707)) +* add all remotes supported by `cocoapods-downloader` ([e01ea82](https://github.com/DartBuild/cocoapods-embed-flutter/commit/e01ea8212d71b10a78390c187b5e8f351a09114b)) +* allow local flutter module to be declared dependency ([1ad9f80](https://github.com/DartBuild/cocoapods-embed-flutter/commit/1ad9f80188b2fa296933af35e6902ffcd6db001e)) ### ✅ Tests -* add app info tests ([2d3f341](https://github.com/DartBuild/cocoapods-embed-flutter/commit/2d3f341299344a16262952bd24306cff479ff74b)) +* add app info tests ([269cb54](https://github.com/DartBuild/cocoapods-embed-flutter/commit/269cb5439c2a6912346187b2612de6b38345b738)) ### 💡 Continuous Integration -* add dependabot config ([918b9e6](https://github.com/DartBuild/cocoapods-embed-flutter/commit/918b9e6c1680b91401184289c394f5ba93a80f43)) -* add flutter setup task ([2d7ff61](https://github.com/DartBuild/cocoapods-embed-flutter/commit/2d7ff61a1d71b4db4ca10f49a2e03738f9f711aa)) -* add publish to cocoapods repo task ([7e620f2](https://github.com/DartBuild/cocoapods-embed-flutter/commit/7e620f24a5b13b126221645b6ec61f5f55b75ea5)) -* fix bundle install on older macos ([f5e4843](https://github.com/DartBuild/cocoapods-embed-flutter/commit/f5e484334dfd2d40a132e627524505485a295195)) -* fix bundler error on linux ([0e3e4eb](https://github.com/DartBuild/cocoapods-embed-flutter/commit/0e3e4eb505f72564e9b271f0e999ac7af38686a3)) -* fix depandabot config spec violation ([aeaab36](https://github.com/DartBuild/cocoapods-embed-flutter/commit/aeaab365f3552848e86b25f2d6b26f79fabe86e0)) -* fix pod install ([508d695](https://github.com/DartBuild/cocoapods-embed-flutter/commit/508d6956313ec8f81f36adf9b1c95d5a4eebbbbb)) -* setup CI/CD pipeline ([c6fdfca](https://github.com/DartBuild/cocoapods-embed-flutter/commit/c6fdfcac64c7e57a4dc3d4ae2cb517bf745cb6b6)) -* setup flutter for ios ([9228bdb](https://github.com/DartBuild/cocoapods-embed-flutter/commit/9228bdbcf673a302d41089d1226d4caf54399265)) +* add dependabot config ([67099bd](https://github.com/DartBuild/cocoapods-embed-flutter/commit/67099bd490fbce0879e4aa6ddd93839847ff7e87)) +* add flutter setup task ([d5aeda3](https://github.com/DartBuild/cocoapods-embed-flutter/commit/d5aeda30817f81ed6ef2f1e9e21f8e2b8f415e20)) +* add publish to cocoapods repo task ([8bbac4d](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8bbac4d24ed5a1e862a2531067aa8a62c5072849)) +* fix bundle install on older macos ([70522ea](https://github.com/DartBuild/cocoapods-embed-flutter/commit/70522eaa46a07c872e727c4f6c774d0444d516cc)) +* fix bundler error on linux ([a18435a](https://github.com/DartBuild/cocoapods-embed-flutter/commit/a18435a4efca56e62c70367b810fe1dc48cce5cf)) +* fix depandabot config spec violation ([7846c67](https://github.com/DartBuild/cocoapods-embed-flutter/commit/7846c67856a1ec7df92275ae887a80ba3413f4d8)) +* fix pod install ([61954c9](https://github.com/DartBuild/cocoapods-embed-flutter/commit/61954c912c6609a375920fccf8bbbf2d6aaa5e0e)) +* setup CI/CD pipeline ([3e20bc9](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3e20bc9d41be80b3a95077e1c7df8e6f0f83d6b7)) +* setup flutter for ios ([d76deb2](https://github.com/DartBuild/cocoapods-embed-flutter/commit/d76deb220e3c0e60303b1b5676bbac24e7dc407f)) ### 📚 Documentation -* add code level documentation ([e064192](https://github.com/DartBuild/cocoapods-embed-flutter/commit/e0641922527a814c6635d31b93470367792db084)) -* **README:** add usage details ([8935bce](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8935bce01387748e503b0d0f0b64a2573f557bce)) +* add code level documentation ([f3c04ed](https://github.com/DartBuild/cocoapods-embed-flutter/commit/f3c04ed6fddab8901511530014282006beb11e8f)) +* **README:** add usage details ([52852ae](https://github.com/DartBuild/cocoapods-embed-flutter/commit/52852aed76005285a8059bd1adb580a169d7463f)) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index f9f35eb..66d718c 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at devsoumyamahunt@gmail.com. All +reported by contacting the project team at soumya.mahunt@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. diff --git a/Gemfile b/Gemfile index a8777c8..131685f 100644 --- a/Gemfile +++ b/Gemfile @@ -4,13 +4,10 @@ source 'https://rubygems.org' gemspec group :development do - gem 'cocoapods' - gem 'cocoapods-plugins' - gem 'github_api' - gem 'mocha' gem 'bacon' gem 'mocha-on-bacon' gem 'prettybacon' gem 'solargraph' + gem 'github_api' end diff --git a/Gemfile.lock b/Gemfile.lock index a82fcfa..65acd67 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,24 +1,25 @@ PATH remote: . specs: - cocoapods-embed-flutter (0.5.3) + cocoapods-embed-flutter (0.6.1) cocoapods + concurrent-ruby fileutils yaml GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.5) + CFPropertyList (3.0.6) rexml - activesupport (6.1.5) + activesupport (6.1.7.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) @@ -26,17 +27,17 @@ GEM atomos (0.1.3) backport (1.2.0) bacon (1.2.0) - benchmark (0.2.0) + benchmark (0.2.1) claide (1.1.0) - cocoapods (1.11.2) + cocoapods (1.12.1) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.11.2) + cocoapods-core (= 1.12.1) cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.4.0, < 2.0) + cocoapods-downloader (>= 1.6.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.4.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) @@ -44,10 +45,10 @@ GEM gh_inspector (~> 1.0) molinillo (~> 0.8.0) nap (~> 1.0) - ruby-macho (>= 1.0, < 3.0) + ruby-macho (>= 2.3.0, < 3.0) xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.11.2) - activesupport (>= 5.0, < 7) + cocoapods-core (1.12.1) + activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) concurrent-ruby (~> 1.1) @@ -57,7 +58,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.5.1) + cocoapods-downloader (1.6.3) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -66,13 +67,13 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.9) + concurrent-ruby (1.2.2) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.5.0) e2mmap (0.1.0) escape (0.0.4) - ethon (0.15.0) + ethon (0.16.0) ffi (>= 1.15.0) faraday (1.10.0) faraday-em_http (~> 1.0) @@ -98,7 +99,7 @@ GEM faraday-rack (1.0.0) faraday-retry (1.0.3) ffi (1.15.5) - fileutils (1.6.0) + fileutils (1.7.1) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) @@ -110,17 +111,18 @@ GEM oauth2 (~> 1.0) hashie (3.6.0) httpclient (2.8.3) - i18n (1.10.0) + i18n (1.12.0) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.4) - json (2.6.1) + jaro_winkler (1.5.6) + json (2.6.3) jwt (2.3.0) - kramdown (2.3.1) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - minitest (5.15.0) - mocha (1.13.0) + minitest (5.18.0) + mocha (2.0.2) + ruby2_keywords (>= 0.0.5) mocha-on-bacon (0.2.3) mocha (>= 0.13.0) molinillo (0.8.0) @@ -130,81 +132,82 @@ GEM nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) - nokogiri (1.13.3-arm64-darwin) + nokogiri (1.13.10-arm64-darwin) racc (~> 1.4) - nokogiri (1.13.3-x86_64-darwin) + nokogiri (1.13.10-x86_64-darwin) racc (~> 1.4) - nokogiri (1.13.3-x86_64-linux) + nokogiri (1.13.10-x86_64-linux) racc (~> 1.4) - oauth2 (1.4.9) + oauth2 (1.4.11) faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) - rack (>= 1.2, < 3) - parallel (1.21.0) - parser (3.1.1.0) + rack (>= 1.2, < 4) + parallel (1.23.0) + parser (3.2.2.1) ast (~> 2.4.1) prettybacon (0.0.2) bacon (~> 1.2) - public_suffix (4.0.6) - racc (1.6.0) - rack (2.2.3) + public_suffix (4.0.7) + racc (1.6.2) + rack (3.0.6.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.2.1) + rbs (2.8.4) + regexp_parser (2.8.0) reverse_markdown (2.1.1) nokogiri rexml (3.2.5) - rubocop (1.26.0) + rubocop (1.50.2) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.16.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.16.0) - parser (>= 3.1.1.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) ruby-macho (2.5.1) - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - solargraph (0.44.3) + solargraph (0.49.0) backport (~> 1.2) benchmark - bundler (>= 1.17.2) + bundler (~> 2.0) diff-lcs (~> 1.4) e2mmap jaro_winkler (~> 1.5) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.1) parser (~> 3.0) - reverse_markdown (>= 1.0.5, < 3) - rubocop (>= 0.52) + rbs (~> 2.0) + reverse_markdown (~> 2.0) + rubocop (~> 1.38) thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) - thor (1.2.1) + thor (1.2.2) thread_safe (0.3.6) - tilt (2.0.10) + tilt (2.1.0) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.1.0) - webrick (1.7.0) - xcodeproj (1.21.0) + unicode-display_width (2.4.2) + xcodeproj (1.22.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) - yaml (0.2.0) - yard (0.9.27) - webrick (~> 1.7.0) - zeitwerk (2.5.4) + yaml (0.2.1) + yard (0.9.34) + zeitwerk (2.6.7) PLATFORMS universal-darwin-21 @@ -214,9 +217,7 @@ PLATFORMS DEPENDENCIES bacon bundler - cocoapods cocoapods-embed-flutter! - cocoapods-plugins github_api mocha mocha-on-bacon diff --git a/README.md b/README.md index a497a04..384e29b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ -# cocoapods-embed-flutter +# CocoaPods Embed Flutter [![CI/CD](https://github.com/DartBuild/cocoapods-embed-flutter/actions/workflows/main.yml/badge.svg?branch=main&event=push)](https://github.com/DartBuild/cocoapods-embed-flutter/actions/workflows/main.yml) [![Gem Version](https://badge.fury.io/rb/cocoapods-embed-flutter.svg)](http://badge.fury.io/rb/cocoapods-embed-flutter) -[![Code Climate](https://codeclimate.com/github/DartBuild/cocoapods-embed-flutter.png)](https://codeclimate.com/github/DartBuild/cocoapods-embed-flutter) +[![Maintainability](https://api.codeclimate.com/v1/badges/3cb2cbd6e1c2b600e1f5/maintainability)](https://codeclimate.com/github/DartBuild/cocoapods-embed-flutter/maintainability) +[![CodeQL](https://github.com/DartBuild/cocoapods-embed-flutter/actions/workflows/codeql-analysis.yml/badge.svg?branch=main&event=schedule)](https://github.com/DartBuild/cocoapods-embed-flutter/actions/workflows/codeql-analysis.yml) Straight forward way of declaring flutter modules as dependency for targets, just like cocoapods does with pods. @@ -30,6 +31,7 @@ plugin 'cocoapods-embed-flutter' pub 'flutter_module', :path => '../' ``` + *`:path` can be path pointing to `pubspec.yaml` or to the directory containing `pubspec.yaml` or to the directory containg flutter module.* ### Embedding module from a repository. @@ -40,8 +42,15 @@ pub 'flutter_module', :git => 'https://github.com/gowalla/flutter_module.git', : pub 'flutter_module', :git => 'https://github.com/gowalla/flutter_module.git', :commit => '082f8319af' ``` +*flutter module project should be at the root of repository, if that's not the case add additional `:path` attribute for relative path to flutter project in repository. `:path` follows [these](#path_desc) restictions.* + +```rb +pub 'flutter_module', :git => 'https://github.com/gowalla/flutter_module.git', :tag => '0.7.0', :path => 'relative path/to/project' +``` + ## Limitations +- Modules hosted in [pub.dev](https://pub.dev/) are not supported, only local modules and modules in remote sources like git are supported. - You won't be able to add more than one flutter module to a single target. Currently flutter only supports one module per target. - No caching is done for external sources, every time you run `pod install` flutter module will be downloaded each time. diff --git a/Rakefile b/Rakefile index 8188adf..f7a27f1 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,16 @@ def specs(dir) FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ') end +def setup_project(pod_install = false) + system('bundle install', exception: true) + Bundler.with_unbundled_env do + Dir.chdir('example/ios_app') do |path| + system('bundle install', exception: true) + system('bundle exec pod install', exception: true) if pod_install + end + end +end + desc 'Runs all the specs' task :specs do sh "bundle exec bacon #{specs('**')}" @@ -11,23 +21,12 @@ end desc 'Setup example project' task :demo do - system('bundle install', exception: true) - Bundler.with_unbundled_env do - Dir.chdir('example/ios_app') do |path| - system('bundle install', exception: true) - system('bundle exec pod install', exception: true) - end - end + setup_project(true) end desc 'Update lock files' task :update do - system('bundle install', exception: true) - Bundler.with_unbundled_env do - Dir.chdir('example/ios_app') do |path| - system('bundle install', exception: true) - end - end + setup_project end desc 'Publish to cocoapods plugins if not present' diff --git a/cocoapods-embed-flutter.gemspec b/cocoapods-embed-flutter.gemspec index 75c5bc9..2ecb5c4 100644 --- a/cocoapods-embed-flutter.gemspec +++ b/cocoapods-embed-flutter.gemspec @@ -4,15 +4,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'cocoapods-embed-flutter/gem_version.rb' Gem::Specification.new do |spec| - repo = 'DartBuild/cocoapods-embed-flutter' - repo_url = "https://github.com/#{repo}" + repo = 'DartBuild/cocoapods-embed-flutter' + github = 'https://github.com' + repo_url = "#{github}/#{repo}" + doc_url = 'https://www.rubydoc.info/gems/cocoapods-embed-flutter' spec.name = 'cocoapods-embed-flutter' spec.version = CocoapodsEmbedFlutter::VERSION spec.homepage = repo_url spec.license = 'MIT' spec.authors = ['Soumya Ranjan Mahunt'] - spec.email = ['devsoumyamahunt@gmail.com'] + spec.email = ['soumya.mahunt@gmail.com'] spec.summary = %q{Embed flutter modules in iOS projects.} spec.description = <<-EOF Straight forward way of declaring flutter modules as dependency for targets, @@ -27,6 +29,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'yaml' spec.add_runtime_dependency 'fileutils' spec.add_runtime_dependency 'cocoapods' + spec.add_runtime_dependency 'concurrent-ruby' spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' @@ -34,8 +37,10 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.6' spec.metadata = { 'bug_tracker_uri' => "#{repo_url}/issues", - 'changelog_uri' => "#{repo_url}/blob/main/CHANGELOG.md", - 'source_code_uri' => repo_url, - 'github_repo' => "git@github.com:#{repo}.git" + 'changelog_uri' => "#{repo_url}/blob/v#{spec.version}/CHANGELOG.md", + 'documentation_uri' => "#{doc_url}/#{spec.version}", + 'source_code_uri' => "#{repo_url}/tree/v#{spec.version}", + 'github_repo' => "git@github.com:#{repo}.git", + 'funding_uri' => "#{github}/sponsors/soumyamahunt" } end diff --git a/example/flutter_module/pubspec.lock b/example/flutter_module/pubspec.lock index 7e78bae..5605564 100644 --- a/example/flutter_module/pubspec.lock +++ b/example/flutter_module/pubspec.lock @@ -42,7 +42,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" cupertino_icons: dependency: "direct main" description: @@ -56,7 +56,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" flutter: dependency: "direct main" description: flutter @@ -94,7 +94,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" meta: dependency: transitive description: @@ -108,7 +108,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" sky_engine: dependency: transitive description: flutter @@ -120,7 +120,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -155,20 +155,13 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.8" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.9" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" sdks: - dart: ">=2.16.1 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" diff --git a/example/ios_app/Gemfile.lock b/example/ios_app/Gemfile.lock index f0dce25..f17ee58 100644 --- a/example/ios_app/Gemfile.lock +++ b/example/ios_app/Gemfile.lock @@ -1,8 +1,9 @@ PATH remote: ../.. specs: - cocoapods-embed-flutter (0.5.3) + cocoapods-embed-flutter (0.6.1) cocoapods + concurrent-ruby fileutils yaml @@ -11,7 +12,7 @@ GEM specs: CFPropertyList (3.0.5) rexml - activesupport (6.1.5) + activesupport (6.1.7.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -53,7 +54,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.5.1) + cocoapods-downloader (1.6.3) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -62,7 +63,7 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.9) + concurrent-ruby (1.2.2) escape (0.0.4) ethon (0.15.0) ffi (>= 1.15.0) @@ -72,10 +73,10 @@ GEM fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.10.0) + i18n (1.12.0) concurrent-ruby (~> 1.0) json (2.6.1) - minitest (5.15.0) + minitest (5.18.0) molinillo (0.8.0) nanaimo (0.3.0) nap (1.1.0) @@ -85,7 +86,7 @@ GEM ruby-macho (2.5.1) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) xcodeproj (1.21.0) CFPropertyList (>= 2.3.3, < 4.0) @@ -95,7 +96,7 @@ GEM nanaimo (~> 0.3.0) rexml (~> 3.2.4) yaml (0.2.0) - zeitwerk (2.5.4) + zeitwerk (2.6.7) PLATFORMS universal-darwin-21 diff --git a/example/ios_app/Podfile.lock b/example/ios_app/Podfile.lock index c2fd642..f93edf1 100644 --- a/example/ios_app/Podfile.lock +++ b/example/ios_app/Podfile.lock @@ -21,7 +21,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: bdfa2e8fe0e2880a2c6a58a0b1a8675c262a07af flutter_module: d1e1ff44505640bd9aa37f23f63380c646272be4 - FlutterPluginRegistrant: 2afd5ea46d3a949472c9b7da6462d8fbf7d8b16e + FlutterPluginRegistrant: d3a0fbc12bc47787a12fcc919193f3959aa7d5ad PODFILE CHECKSUM: 63b6421f4bf00554065d89d2308ed2deb78332fc diff --git a/lib/cocoapods-embed-flutter/flutter/dependency.rb b/lib/cocoapods-embed-flutter/flutter/dependency.rb index 97a13f6..1a087d5 100644 --- a/lib/cocoapods-embed-flutter/flutter/dependency.rb +++ b/lib/cocoapods-embed-flutter/flutter/dependency.rb @@ -27,10 +27,10 @@ class Dependency # @param [String, Hash] requirements # the requirements for dependency as declred in `pubspec` # - # @param [Spec] parent_specification + # @param [Spec] parent_spec # the parent specification where dependency declared # - # @param [Boolean] is_dev_dependency + # @param [Boolean] dev_dependency # Whether the dependency only required during development # def initialize(name, requirements, parent_spec, dev_dependency = false) @@ -48,10 +48,10 @@ def initialize(name, requirements, parent_spec, dev_dependency = false) # @param [Hash] hash declared in `dependencies` or `dev_dependencies` # section in `pubspec.yaml` file # - # @param [Spec] parent_specification + # @param [Spec] parent_spec # the parent specification where dependency declared # - # @param [Boolean] is_dev_dependency + # @param [Boolean] dev_dependency # Whether the dependency only required during development # # @return [Array] dependencies from hash declared in `dependencies` @@ -74,14 +74,29 @@ def spec Spec.find(name, File.expand_path(path, File.dirname(parent_spec.defined_in_file))) end - # Install this dependency for the parent project. + # Concurrently install this dependency for the parent project. # - # @return [void] + # @return [Concurrent::Promises::Future, Nil] + # {Nil} if not a local dependency, otherwise + # returns future for {#spec}'s {Spec#pub_get pub_get} task. # def install - spec.setup if local? + spec.pub_get if local? end + # Allows accessing top level values in + # {https://dart.dev/tools/pub/dependencies dependency requirements}, + # if {#requirements} type is {Hash}, i.e. path, git etc. + # + # @param [Symbol] m + # top level key value to access, i.e. path, git etc. + # + # @return depending on accessed value type in {#requirements}. + # + # @raise [NoMethodError] if no method or custom attribute exists by + # the attribute name in {#requirements} or {#requirements} + # is not a {Hash}. + # def method_missing(m, *args, &block) if requirements.is_a?(Hash) && requirements.include?(m.to_s) return requirements[m.to_s] diff --git a/lib/cocoapods-embed-flutter/flutter/downloader.rb b/lib/cocoapods-embed-flutter/flutter/downloader.rb index c213845..f412333 100644 --- a/lib/cocoapods-embed-flutter/flutter/downloader.rb +++ b/lib/cocoapods-embed-flutter/flutter/downloader.rb @@ -3,6 +3,9 @@ module Flutter module Pub + # The Downloader modules name-spaces all the classes and methods + # for downloading and caching remote Flutter projects. + # module Downloader # Downloads a package from the given `request` to the given `target` location. # diff --git a/lib/cocoapods-embed-flutter/flutter/external_sources.rb b/lib/cocoapods-embed-flutter/flutter/external_sources.rb index ffae435..52fc0ba 100644 --- a/lib/cocoapods-embed-flutter/flutter/external_sources.rb +++ b/lib/cocoapods-embed-flutter/flutter/external_sources.rb @@ -38,12 +38,12 @@ def self.fetchWithNameAndOptions(name, options) options = options.last if options.is_a?(Array) raise StandardError, "No options specified for flutter module: '#{name}'." unless options.is_a?(Hash) - if options.key?(:path) - path = options[:path] - elsif SOURCE_KEYS.keys.any? { |key| options.key?(key) } + if SOURCE_KEYS.keys.any? { |key| options.key?(key) } source = DownloaderSource.new(name, options, Pod::Config.instance.podfile_path) source.fetch(Pod::Config.instance.sandbox) - path = source.normalized_pupspec_path + path = source.normalized_pubspec_path + elsif options.key?(:path) + path = options[:path] else raise StandardError, "Invalid flutter module: '#{name}'." end @@ -54,8 +54,8 @@ def self.fetchWithNameAndOptions(name, options) # Provides support for fetching a specification file from a source handled # by the downloader. Supports all the options of the downloader # - # @note The pubspec must be in the root of the repository - # or in directory with the name provided + # @note The pubspec must be in the root of the repository + # or in directory with the name provided # class DownloaderSource # @return [String] the name of the Package described by this external source. @@ -116,8 +116,8 @@ def fetch(sandbox) # @return [String] a string representation of the source suitable for UI. # def description - strategy = Pod::Downloader.strategy_from_options(params) - options = params.dup + strategy = Pod::Downloader.strategy_from_options(download_params) + options = download_params.dup url = options.delete(strategy) result = "from `#{url}`" options.each do |key, value| @@ -137,7 +137,7 @@ def description # @note If the declared path is expanded only if the represents a path # relative to the file system. # - def normalized_pupspec_path(declared_path) + def normalized_pubspec_path(declared_path) Spec.find_file(name, declared_path) end @@ -147,8 +147,9 @@ def normalized_pupspec_path(declared_path) # @return [String] The uri of the pubspec appending the name of the file # and expanding it if necessary. # - def normalized_pupspec_path - Spec.find_file(name, target) + def normalized_pubspec_path + search_path = params[:path].nil? ? target : File.expand_path(params[:path], target) + Spec.find_file(name, search_path) end private @@ -203,10 +204,16 @@ def pre_download(sandbox) def download_request Pod::Downloader::Request.new( :name => name, - :params => params, + :params => download_params, ) end + # @return [Hash] the options for remote source download. + # + def download_params + params.select { |key, value| !key.equal?(:path) } + end + # @return [String] the path where this flutter project # will be downloaded relative paths. # diff --git a/lib/cocoapods-embed-flutter/flutter/pubspec.rb b/lib/cocoapods-embed-flutter/flutter/pubspec.rb index 65d648f..02d7685 100644 --- a/lib/cocoapods-embed-flutter/flutter/pubspec.rb +++ b/lib/cocoapods-embed-flutter/flutter/pubspec.rb @@ -1,5 +1,8 @@ require 'cocoapods-embed-flutter/flutter' require 'yaml' +require 'open3' +require 'concurrent' +require 'cocoapods' module Flutter module Pub @@ -43,7 +46,8 @@ def self.find_file(name, path) if File.basename(path) == Pub::SPEC_FILE return path - elsif Dir.exists?(File.expand_path(name, path)) && File.exists?(File.expand_path(Pub::SPEC_FILE, File.expand_path(name, path))) + elsif Dir.exists?(File.expand_path(name, path)) && + File.exists?(File.expand_path(Pub::SPEC_FILE, File.expand_path(name, path))) return File.expand_path(Pub::SPEC_FILE, File.expand_path(name, path)) elsif File.exists?(File.expand_path(Pub::SPEC_FILE, path)) return File.expand_path(Pub::SPEC_FILE, path) @@ -88,7 +92,7 @@ def project_path end # @return [String] the path to the flutter project - # dependencies cache file. + # dependencies cache file. # def package_cache_path File.join(project_path, Pub::TOOL_DIR, Pub::CACHE_FILE) @@ -101,7 +105,7 @@ def pod_helper_path end # @return [Array] the list of all the projects this - # specification depends upon and are included in app release. + # specification depends upon and are included in app release. # def dependencies return [] unless @data.include?('dependencies') @@ -123,37 +127,66 @@ def all_dependencies dependencies + dev_dependencies end - # @return [Boolean] If the flutter project for this specification - # has all its dependencies installed. + # Runs `flutter pub get` on project directory concurrently. # - def setup? - File.exists?(package_cache_path) && (!module? || File.exists?(pod_helper_path)) + # @return [Concurrent::Promises::Future, Nil] + # {Nil} if `pub get` running/completed, otherwise + # runs `flutter pub get` task in background + # and returns its future. + # + def pub_get + future = @@current_pubgets[self] + return nil if !future.nil? + future = Concurrent::Promises.future do + stdout, stderr, status = Open3.capture3('flutter pub get', :chdir => self.project_path) + :result + end + @@current_pubgets[self] = future + return Concurrent::Promises.zip(future, *all_dependencies.map(&:install).compact) end - # Sets up the project installing all specified dependencies. + # See if two {Spec} instances refer to the same pubspecs. # - # @return [void] + # @return [Boolean] whether or not the two {Spec} instances refer to the + # same projects. # - def setup - return if setup? - pup_get - all_dependencies.each(&:install) + def ==(other) + self.class === other && + other.defined_in_file == defined_in_file && + other.instance_variable_get(:@data) == @data end - # Runs `flutter pub get` on project directory. - # - # @return [void] + # @return [Fixnum] A hash identical for equals objects. # - def pup_get - Dir.chdir(project_path) { |path| system('flutter pub get', exception: true) } + def hash + [defined_in_file, @data].hash end + alias eql? == + + # Allows accessing top level values in `pubspec.yaml`, + # i.e. name, description, version etc. + # + # @param [Symbol] m + # top level key value to access, + # i.e. name, description etc. + # + # @return depending on accessed value type in `pubspec.yaml`. + # + # @raise [NoMethodError] if no method or custom attribute exists by + # the attribute name in pubspec. + # def method_missing(m, *args, &block) if @data.include?(m.to_s) return @data[m.to_s] end super.method_missing(m, *args, &block) end + + private + + # A hash containing all `pub get` promises. + @@current_pubgets = {} end end end \ No newline at end of file diff --git a/lib/cocoapods-embed-flutter/gem_version.rb b/lib/cocoapods-embed-flutter/gem_version.rb index f8ee677..c1085de 100644 --- a/lib/cocoapods-embed-flutter/gem_version.rb +++ b/lib/cocoapods-embed-flutter/gem_version.rb @@ -4,5 +4,5 @@ module CocoapodsEmbedFlutter # The version of the cocoapods-embed-flutter. # - VERSION = '0.5.3'.freeze + VERSION = '0.6.1'.freeze end diff --git a/lib/cocoapods-embed-flutter/src/pub.rb b/lib/cocoapods-embed-flutter/src/pub.rb index 64218bf..06babc6 100644 --- a/lib/cocoapods-embed-flutter/src/pub.rb +++ b/lib/cocoapods-embed-flutter/src/pub.rb @@ -99,7 +99,10 @@ module DSL # pub 'flutter_module', :git => 'https://github.com/octokit/flutter_module.git', :commit => '082f8319af' # # The flutter module or its `pubspec` file is expected to be in the - # root of the repository. + # root of the repository, if that's not the case specify relative path + # to flutter project in repository. + # + # pub 'flutter_module', :git => 'https://github.com/octokit/flutter_module.git', :tag => '0.7.0', :path => 'custom/flutter_module' # # # @note This method allow a nil name and the raises to be more @@ -109,7 +112,10 @@ module DSL # def pub(name = nil, *requirements) pubspec = Flutter::Pub::ExternalSources.fetchWithNameAndOptions(name, requirements) - pubspec.setup + Pod::UI.titled_section("Installing flutter dependencies for #{name}...", :verbose_prefix => '-> ') do + future = pubspec.pub_get + future.value! if !future.nil? + end raise StandardError, "Invalid flutter module: '#{name}'." unless File.exists?(pubspec.pod_helper_path) install_flutter_pods_for_pubspec(pubspec) end