From ad9c48d66ad8f85f3f609a787bebc3f7f1946568 Mon Sep 17 00:00:00 2001 From: Jesse de Wit Date: Fri, 10 Nov 2023 11:13:48 +0100 Subject: [PATCH] make it easier to use local packages --- .github/workflows/main.yml | 15 +++++++++++++-- .gitignore | 4 +--- snippets/csharp/README.md | 17 +++++++++++++++++ snippets/csharp/Snippets.csproj | 4 ---- snippets/dart_snippets/.gitignore | 1 + snippets/dart_snippets/README.md | 8 ++++++-- snippets/dart_snippets/analysis_options.yaml | 6 +++--- snippets/dart_snippets/pubspec.yaml | 2 +- snippets/react-native/.gitignore | 1 + snippets/rust/.gitignore | 1 + snippets/rust/README.md | 3 +++ 11 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 snippets/csharp/README.md create mode 100644 snippets/react-native/.gitignore create mode 100644 snippets/rust/.gitignore create mode 100644 snippets/rust/README.md diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f24ade1..5cd677f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -111,7 +111,7 @@ jobs: - uses: actions/download-artifact@v3 with: name: breez-sdk-flutter-${{ needs.setup.outputs.package-version }} - path: breez-sdk-flutter + path: snippets/dart_snippets/packages/breez-sdk-flutter - name: pub-get working-directory: snippets/dart_snippets @@ -140,7 +140,18 @@ jobs: uses: actions/download-artifact@v3 with: name: Breez.Sdk.${{ needs.setup.outputs.package-version }}.nupkg - path: packages + path: . + + - name: Create nuget package source + working-directory: snippets/csharp + run: | + mkdir packages + nuget add ../../Breez.Sdk.${{ needs.setup.outputs.package-version }}.nupkg -Source ./packages + + - name: Add nuget dependency + working-directory: snippets/csharp + run: | + dotnet add package Breez.Sdk -s ./packages - name: Build the csharp project working-directory: snippets/csharp diff --git a/.gitignore b/.gitignore index 1d7ee03..e857aae 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,4 @@ book .DS_Store .idea -# Sub-projects with code snippets -snippets/react-native/node_modules -snippets/rust/target \ No newline at end of file +*.nupkg \ No newline at end of file diff --git a/snippets/csharp/README.md b/snippets/csharp/README.md new file mode 100644 index 0000000..4e9e1f1 --- /dev/null +++ b/snippets/csharp/README.md @@ -0,0 +1,17 @@ +## Steps to compile the snippets locally +1. Build a C# package + - By running the publish-all-platforms CI in the breez-sdk repository (use dummy binaries) + - or by downloading from nuget https://www.nuget.org/packages/Breez.Sdk +2. Place it in the root folder + +From the `snippets/csharp` folder run the following command (replace the version): +```bash +nuget add ../../Breez.Sdk.1.0.0.nupkg -Source ./packages +``` + +Add a package reference to your local nuget package: +```bash +dotnet add package Breez.Sdk -s ./packages +``` + +Happy coding \ No newline at end of file diff --git a/snippets/csharp/Snippets.csproj b/snippets/csharp/Snippets.csproj index 3b8a99e..0f1ffca 100644 --- a/snippets/csharp/Snippets.csproj +++ b/snippets/csharp/Snippets.csproj @@ -6,10 +6,6 @@ enable - - $(RestoreSources);../../packages;https://api.nuget.org/v3/index.json - - diff --git a/snippets/dart_snippets/.gitignore b/snippets/dart_snippets/.gitignore index 3a85790..474c03e 100644 --- a/snippets/dart_snippets/.gitignore +++ b/snippets/dart_snippets/.gitignore @@ -1,3 +1,4 @@ # https://dart.dev/guides/libraries/private-files # Created by `dart pub` .dart_tool/ +packages/ \ No newline at end of file diff --git a/snippets/dart_snippets/README.md b/snippets/dart_snippets/README.md index 3816eca..d1786c4 100644 --- a/snippets/dart_snippets/README.md +++ b/snippets/dart_snippets/README.md @@ -1,2 +1,6 @@ -A sample command-line application with an entrypoint in `bin/`, library code -in `lib/`, and example unit test in `test/`. +## Steps to compile the snippets locally +1. Build a flutter package + - By running the publish-all-platforms CI in the breez-sdk repository (use dummy binaries) + - or by cloning https://github.com/breez/breez-sdk-flutter +2. Place the files in the folder `snippets/dart-snippets/packages/breez-sdk-flutter` +3. happy coding \ No newline at end of file diff --git a/snippets/dart_snippets/analysis_options.yaml b/snippets/dart_snippets/analysis_options.yaml index dee8927..6dd972f 100644 --- a/snippets/dart_snippets/analysis_options.yaml +++ b/snippets/dart_snippets/analysis_options.yaml @@ -19,9 +19,9 @@ include: package:lints/recommended.yaml # rules: # - camel_case_types -# analyzer: -# exclude: -# - path/to/excluded/files/** +analyzer: + exclude: + - packages/** # For more information about the core and recommended set of lints, see # https://dart.dev/go/core-lints diff --git a/snippets/dart_snippets/pubspec.yaml b/snippets/dart_snippets/pubspec.yaml index d39cb6f..5ebe8d4 100644 --- a/snippets/dart_snippets/pubspec.yaml +++ b/snippets/dart_snippets/pubspec.yaml @@ -8,7 +8,7 @@ environment: dependencies: breez_sdk: - path: ../../breez-sdk-flutter + path: ./packages/breez-sdk-flutter dev_dependencies: lints: ^2.0.0 diff --git a/snippets/react-native/.gitignore b/snippets/react-native/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/snippets/react-native/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/snippets/rust/.gitignore b/snippets/rust/.gitignore new file mode 100644 index 0000000..1de5659 --- /dev/null +++ b/snippets/rust/.gitignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/snippets/rust/README.md b/snippets/rust/README.md new file mode 100644 index 0000000..fba8fe4 --- /dev/null +++ b/snippets/rust/README.md @@ -0,0 +1,3 @@ +## Steps to compile the snippets locally +1. Update the `rev` in Cargo.toml to the commit you want to use. +2. happy coding \ No newline at end of file