diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml
deleted file mode 100644
index 215e0243a..000000000
--- a/.github/workflows/check_and_commit.yml
+++ /dev/null
@@ -1,136 +0,0 @@
-name: Check and Commit
-
-on:
- workflow_call:
-
-jobs:
- duplicate_samples_and_publish_dependencies:
- name: Duplicate Samples And Publish Dependencies
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- projectPath:
- - src/UnitySampleProject
- testMode:
- - PlayMode
- steps:
- - uses: actions/checkout@v4
- with:
- lfs: true
- ssh-key: ${{ secrets.DEPLOY_KEY }}
- - name: Configure Git
- run: |
- git config user.email $git_email
- git config user.name "${{ github.actor }}"
- env:
- git_email: "${{ github.actor }}@users.noreply.github.com"
- - name: Duplicate Web3 Unity Samples
- run: |
- export SOURCE_PATH=
- export DESTINATION_DIRECTORY=
- export DESTINATION_PATH=
-
- while IFS= read -r entry || [ -n "$entry" ];
- do
- source_prefix="source:"
- display_name_prefix="display_name:"
- destination_prefix="destination:"
-
- entry=$(echo "$entry" | sed -e 's/^[[:space:]]*//')
-
- if [[ $entry = $source_prefix* ]]
- then
- SOURCE_PATH=${entry#"$source_prefix"}
- elif [[ $entry = $display_name_prefix* ]]
- then
- DESTINATION_DIRECTORY=${entry#"$display_name_prefix"}
- SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY"
- elif [[ $entry = $destination_prefix* ]]
- then
- DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}"
- rm -rf "$DESTINATION_PATH"
- mkdir -p "$DESTINATION_PATH"
- cp -r "$SOURCE_PATH/." "$DESTINATION_PATH"
- git add "$DESTINATION_PATH." -f
- fi
- done < "${GITHUB_WORKSPACE}/scripts/data/duplicate_samples.txt"
- - name: update submodules
- # clone submodules
- run: |
- git submodule update --init
- shell: bash
- - name: Setup .NET
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: 6.0.x
- - name: Publish Solution DLLs
- run: |
- dotnet publish src/ChainSafe.Gaming.Unity/ChainSafe.Gaming.Unity.csproj -c Release /property:Unity=true
- - name: Move DLLs to Unity Packages
- run: |
-
- export PUBLISH_PATH="${GITHUB_WORKSPACE}/${{ vars.PUBLISH_PATH }}"
-
- echo -e "DLLs Generated\n$(ls "$PUBLISH_PATH")"
-
- export DLL_META_FILE_TEMPLATE="${{ vars.DLL_META_FILE_TEMPLATE }}"
-
- export PACKAGE_LIB_PATH=
-
- while IFS= read -r entry || [ -n "$entry" ];
- do
- if [[ $entry == *: ]]
- then
- PACKAGE_LIB_PATH="${GITHUB_WORKSPACE}/${entry%:}"
- if [ -d "$PACKAGE_LIB_PATH" ]; then
- rm -rf "$PACKAGE_LIB_PATH"*.dll
- rm -rf "$PACKAGE_LIB_PATH"*.pdb
- else
- mkdir -p "$PACKAGE_LIB_PATH"
- fi
- else
- export DEPENDENCY=$(echo "$entry" | tr -d '\t' | tr -d ' ')
- cp "$PUBLISH_PATH/$DEPENDENCY".dll $PACKAGE_LIB_PATH
- if ! [ -f "$PACKAGE_LIB_PATH$DEPENDENCY.dll.meta" ]; then
- echo -e "${DLL_META_FILE_TEMPLATE/"[[assetGuid]]"/"$(uuidgen | tr -d '-')"}" >> "$PACKAGE_LIB_PATH$DEPENDENCY.dll.meta"
- fi
- fi
- git add "$PACKAGE_LIB_PATH." -f
- done < "${GITHUB_WORKSPACE}/scripts/data/published_dependencies.txt"
- - uses: actions/cache@v2
- with:
- path: ${{ matrix.projectPath }}/Library
- key: Library-${{ matrix.projectPath }}
- restore-keys: |
- Library-
- - uses: game-ci/unity-test-runner@v3
- id: tests
- env:
- UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
- with:
- projectPath: ${{ matrix.projectPath }}
- customImage: 'unityci/editor:ubuntu-2022.3.26f1-linux-il2cpp-3.1.0'
- testMode: ${{ matrix.testMode }}
- artifactsPath: ${{ matrix.testMode }}-artifacts
- githubToken: ${{ secrets.GITHUB_TOKEN }}
- checkName: ${{ matrix.testMode }} Test Results
- coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;'
- - uses: actions/upload-artifact@v3
- if: always()
- with:
- name: Test results for ${{ matrix.testMode }}
- path: ${{ steps.tests.outputs.artifactsPath }}
- - uses: actions/upload-artifact@v3
- if: always()
- with:
- name: Coverage results for ${{ matrix.testMode }}
- path: ${{ steps.tests.outputs.coveragePath }}
- - name: Commit and Push changes
- run: |
- git diff-index --cached --quiet HEAD || git commit -m 'Auto Commit [skip ci]
- - Duplicate Packages Samples
- - Publish DLL Dependencies'
- git push -f origin HEAD:$branch
- env:
- branch: ${{ github.head_ref || github.ref_name }}
\ No newline at end of file
diff --git a/.github/workflows/duplicate_samples.yaml b/.github/workflows/duplicate_samples.yaml
new file mode 100644
index 000000000..011db5ce7
--- /dev/null
+++ b/.github/workflows/duplicate_samples.yaml
@@ -0,0 +1,27 @@
+name: Duplicate Samples
+
+on:
+ workflow_call:
+ workflow_dispatch:
+ inputs:
+ arguments:
+ required: false
+ description: 'Run Arguments'
+ type: string
+ configuration:
+ required: true
+ description: 'Run Configuration'
+ default: 'Release'
+ type: choice
+ options:
+ - Release
+ - Debug
+
+jobs:
+ setup:
+ name: Duplicate Samples 🪞
+ uses: ChainSafe/web3.unity/.github/workflows/setup.yaml@main
+ with:
+ arguments: "-duplicate_samples ${{ github.event.inputs.arguments || '-git:enabled' }} -c ${{ github.event.inputs.configuration || 'Release' }}"
+ secrets: inherit
+
\ No newline at end of file
diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml
index 6a7966e1b..056546591 100644
--- a/.github/workflows/pull_request_checks.yml
+++ b/.github/workflows/pull_request_checks.yml
@@ -5,16 +5,25 @@ on:
jobs:
web3_tests:
- name: Web3 Tests
+ name: Web3 tests 🕸
if: ${{ github.event.action == 'ready_for_review' || github.event.label.name == 'ready-to-merge'}}
uses: ChainSafe/web3.unity/.github/workflows/test.yaml@main
analyze_code:
- name: Analyze Code
+ name: Analyze 🧐
uses: ChainSafe/web3.unity/.github/workflows/codeql.yml@main
- needs: [ web3_tests ]
- unity_tests:
- name: Unity Tests
+ sync_dependencies:
+ name: Sync Dependencies 🔄
if: ${{ github.base_ref == 'main' }}
- uses: ChainSafe/web3.unity/.github/workflows/check_and_commit.yml@main
- needs: [ analyze_code ]
+ uses: ChainSafe/web3.unity/.github/workflows/sync_dependencies.yaml@main
+ needs: [ web3_tests , analyze_code ]
+ secrets: inherit
+ duplicate_samples:
+ name: Duplicate Samples 🪞
+ uses: ChainSafe/web3.unity/.github/workflows/duplicate_samples.yaml@main
+ needs: [ sync_dependencies ]
+ secrets: inherit
+ unity_tests:
+ name: Unity Tests 🧪
+ uses: ChainSafe/web3.unity/.github/workflows/unity_tests.yml@main
+ needs: [ sync_dependencies ]
secrets: inherit
\ No newline at end of file
diff --git a/.github/workflows/push_checks.yml b/.github/workflows/push_checks.yml
deleted file mode 100644
index 5cd430cf3..000000000
--- a/.github/workflows/push_checks.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-name: Post Push Checks and Commits
-
-on:
- push:
- branches: [ dev ]
-
-jobs:
- check_and_commit:
- name: Check and Commit
- uses: ChainSafe/web3.unity/.github/workflows/check_and_commit.yml@main
- secrets: inherit
\ No newline at end of file
diff --git a/.github/workflows/push_checks_dev.yml b/.github/workflows/push_checks_dev.yml
new file mode 100644
index 000000000..0362af54e
--- /dev/null
+++ b/.github/workflows/push_checks_dev.yml
@@ -0,0 +1,21 @@
+name: Post Push Checks and Commits
+
+on:
+ push:
+ branches: [ dev ]
+
+jobs:
+ sync_dependencies:
+ name: Sync Dependencies 🔄
+ uses: ChainSafe/web3.unity/.github/workflows/sync_dependencies.yaml@main
+ secrets: inherit
+ duplicate_samples:
+ name: Duplicate Samples 🪞
+ uses: ChainSafe/web3.unity/.github/workflows/duplicate_samples.yaml@main
+ needs: [ sync_dependencies ]
+ secrets: inherit
+ unity_tests:
+ name: Unity Tests 🧪
+ uses: ChainSafe/web3.unity/.github/workflows/unity_tests.yml@main
+ needs: [ sync_dependencies ]
+ secrets: inherit
\ No newline at end of file
diff --git a/.github/workflows/push_checks_main.yml b/.github/workflows/push_checks_main.yml
new file mode 100644
index 000000000..f6aebda25
--- /dev/null
+++ b/.github/workflows/push_checks_main.yml
@@ -0,0 +1,13 @@
+name: Post Push Checks
+
+on:
+ push:
+ branches: [ main ]
+
+jobs:
+ sync_branches:
+ name: Sync Branches ♾️
+ uses: ChainSafe/web3.unity/.github/workflows/sync_branches.yaml@main
+ with:
+ branch: dev
+ secrets: inherit
\ No newline at end of file
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 1e3691889..a73bb718c 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -10,30 +10,22 @@ on:
description: 'Version Release Notes'
required: true
-env:
- git_email: "${{ github.actor }}@users.noreply.github.com"
- git_actor: "${{ github.actor }}"
-
jobs:
setup:
name: Setup job
+ uses: ChainSafe/web3.unity/.github/workflows/setup.yaml@main
+ with:
+ arguments: "-release:${{ github.event.inputs.version }}"
+ secrets: inherit
+ release:
+ name: Release job
runs-on: ubuntu-latest
+ needs: [ setup ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
- lfs: true
- ssh-key: ${{ secrets.DEPLOY_KEY }}
-
- - name: Setup .NET
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: 8.0.x
-
- - name: Run
- run: |
- cd Setup
- dotnet run -release:${{ github.event.inputs.version }} Setup/Setup.csproj
+ lfs: true
- name: Create Release
id: create_release
uses: actions/create-release@v1
diff --git a/.github/workflows/setup.yaml b/.github/workflows/setup.yaml
new file mode 100644
index 000000000..5cd086a04
--- /dev/null
+++ b/.github/workflows/setup.yaml
@@ -0,0 +1,48 @@
+name: Setup ⚙️
+
+on:
+ workflow_call:
+ inputs:
+ arguments:
+ required: true
+ type: string
+ workflow_dispatch:
+ inputs:
+ arguments:
+ required: true
+ description: 'Arguments to pass to the setup script'
+ type: string
+env:
+ git_email: "${{ github.actor }}@users.noreply.github.com"
+ git_actor: "${{ github.actor }}"
+
+jobs:
+ setup:
+ name: Setup job
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.head_ref || github.ref_name }}
+ lfs: true
+ ssh-key: ${{ secrets.DEPLOY_KEY }}
+ - name: update submodules
+ run: |
+ git submodule update --init
+ shell: bash
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 8.0.x
+
+ - name: Run
+ run: |
+ cd Setup
+ dotnet run ${{ inputs.arguments || github.event.inputs.arguments }} Setup/Setup.csproj
+ git reset --hard
+ - name: Cache
+ uses: actions/cache/save@v4
+ with:
+ path: .git
+ key: ${{ runner.os }}-git
\ No newline at end of file
diff --git a/.github/workflows/sync_branches.yaml b/.github/workflows/sync_branches.yaml
new file mode 100644
index 000000000..08897c156
--- /dev/null
+++ b/.github/workflows/sync_branches.yaml
@@ -0,0 +1,37 @@
+name: Sync Branches
+
+on:
+ workflow_call:
+ inputs:
+ branch:
+ required: true
+ type: string
+ workflow_dispatch:
+ inputs:
+ branch:
+ required: true
+ description: "Branch to Sync"
+ type: string
+
+jobs:
+ setup:
+ name: Sync Branches ♾️
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.head_ref || github.ref_name }}
+ lfs: true
+ ssh-key: ${{ secrets.DEPLOY_KEY }}
+ - name: Sync Branches
+ run: |
+ git config user.email $git_email
+ git config user.name $git_actor
+ git fetch origin ${{ github.event.inputs.branch }}
+ git merge main --allow-unrelated-histories
+ git push
+ shell: bash
+ env:
+ git_email: "${{ github.actor }}@users.noreply.github.com"
+ git_actor: "${{ github.actor }}"
\ No newline at end of file
diff --git a/.github/workflows/sync_dependencies.yaml b/.github/workflows/sync_dependencies.yaml
new file mode 100644
index 000000000..af96dfa70
--- /dev/null
+++ b/.github/workflows/sync_dependencies.yaml
@@ -0,0 +1,27 @@
+name: Sync Dependencies
+
+on:
+ workflow_call:
+ workflow_dispatch:
+ inputs:
+ arguments:
+ required: false
+ description: 'Run Arguments'
+ type: string
+ configuration:
+ required: true
+ description: 'Run Configuration'
+ default: 'Release'
+ type: choice
+ options:
+ - Release
+ - Debug
+
+jobs:
+ setup:
+ name: Sync Dependencies 🔄
+ uses: ChainSafe/web3.unity/.github/workflows/setup.yaml@main
+ with:
+ arguments: "-sync_dependencies ${{ github.event.inputs.arguments || '-git:enabled' }} -c ${{ github.event.inputs.configuration || 'Release' }}"
+ secrets: inherit
+
\ No newline at end of file
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 2a4ed695f..d84cd6527 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -5,7 +5,7 @@ on:
jobs:
check:
- name: Web3 tests job 🕸️
+ name: Web3 tests 🕸️
runs-on: ubuntu-latest
strategy:
matrix:
diff --git a/.github/workflows/unity_tests.yml b/.github/workflows/unity_tests.yml
new file mode 100644
index 000000000..ac48950fb
--- /dev/null
+++ b/.github/workflows/unity_tests.yml
@@ -0,0 +1,56 @@
+name: Unity Tests
+
+on:
+ workflow_call:
+ workflow_dispatch:
+
+jobs:
+ unity_tests:
+ name: Unity Tests 🧪
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ projectPath:
+ - src/UnitySampleProject
+ testMode:
+ - PlayMode
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ lfs: true
+ - name: update submodules
+ run: |
+ git submodule update --init
+ shell: bash
+ - uses: actions/cache@v2
+ with:
+ path: ${{ matrix.projectPath }}/Library
+ key: Library-${{ matrix.projectPath }}
+ restore-keys: |
+ Library-
+ - uses: game-ci/unity-test-runner@v4
+ id: tests
+ env:
+ UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
+ UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
+ UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
+ with:
+ projectPath: ${{ matrix.projectPath }}
+ testMode: ${{ matrix.testMode }}
+ scopedRegistryUrl: https://package.openupm.com
+ registryScopes: 'io.chainsafe.web3-unity, com.nethereum.unity'
+ artifactsPath: ${{ matrix.testMode }}-artifacts
+ githubToken: ${{ secrets.GITHUB_TOKEN }}
+ checkName: ${{ matrix.testMode }} Test Results
+ coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;'
+ - uses: actions/upload-artifact@v3
+ if: always()
+ with:
+ name: Test results for ${{ matrix.testMode }}
+ path: ${{ steps.tests.outputs.artifactsPath }}
+ - uses: actions/upload-artifact@v3
+ if: always()
+ with:
+ name: Coverage results for ${{ matrix.testMode }}
+ path: ${{ steps.tests.outputs.coveragePath }}
\ No newline at end of file
diff --git a/Packages/io.chainsafe.web3-unity/Tests/Runtime/Erc20Tests.cs b/Packages/io.chainsafe.web3-unity/Tests/Runtime/Erc20Tests.cs
index 8b70621b0..11e64ba33 100644
--- a/Packages/io.chainsafe.web3-unity/Tests/Runtime/Erc20Tests.cs
+++ b/Packages/io.chainsafe.web3-unity/Tests/Runtime/Erc20Tests.cs
@@ -39,7 +39,7 @@ public IEnumerator TestNativeBalanceOf()
{
var getNativeBalanceOf = web3.RpcProvider.GetBalance(Account);
yield return new WaitUntil(() => getNativeBalanceOf.IsCompleted);
- Assert.AreEqual(new HexBigInteger(510000000000000000), new HexBigInteger(getNativeBalanceOf.Result));
+ Assert.AreEqual(new HexBigInteger(0), new HexBigInteger(getNativeBalanceOf.Result));
}
[UnityTest]
diff --git a/Setup/DuplicateSamples.cs b/Setup/DuplicateSamples.cs
new file mode 100644
index 000000000..8ad287a49
--- /dev/null
+++ b/Setup/DuplicateSamples.cs
@@ -0,0 +1,48 @@
+using System;
+using System.IO;
+using Setup.Utils;
+
+namespace Setup;
+
+///
+/// Duplicates samples in Sample Project into package samples.
+///
+public class DuplicateSamples : IRunnable
+{
+ private readonly Package[] _packages;
+
+ public int Order => 1;
+
+ public DuplicateSamples()
+ {
+ _packages = Setup.Packages.ToArray();
+ }
+
+ public void Run()
+ {
+ foreach (Package package in _packages)
+ {
+ if (package.HasSamples())
+ {
+ string path = Path.Combine(Setup.SampleProjectPath, "Assets/Samples", package.DisplayName);
+
+ foreach (var sample in package.Samples)
+ {
+ string source = Path.Combine(path, package.Version, sample.DisplayName);
+
+ string destination = Path.Combine(package.Path, sample.Path);
+
+ Utilities.CopyDirectory(source, destination);
+
+ Console.WriteLine($"Duplicated Sample {package.Name} - {sample.DisplayName} from {source} to {destination}");
+
+ Git.Add(destination);
+ }
+ }
+ }
+
+ Git.CommitAndPush("Duplicated Samples");
+
+ Console.WriteLine("Duplicated Samples Successfully!");
+ }
+}
\ No newline at end of file
diff --git a/Setup/Git.cs b/Setup/Git.cs
index b3b862d2c..d8f97a260 100644
--- a/Setup/Git.cs
+++ b/Setup/Git.cs
@@ -1,3 +1,6 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
using Setup.Utils;
namespace Setup;
@@ -8,10 +11,27 @@ namespace Setup;
public static class Git
{
private static bool _configured;
+
+ public static bool Enabled { get; private set; } = true;
+
+ public static void Configure(string configuration)
+ {
+ switch (configuration)
+ {
+ case "enabled":
+ Enabled = true;
+ break;
+ case "disabled":
+ Enabled = false;
+ break;
+ default:
+ throw new Exception($"-git can't configure {configuration}");
+ }
+ }
public static void Add(string path)
{
- $"git add \"{path}\" -f".RunWithBash();
+ $"git add \"{path}\" -f".Run();
}
public static void Commit(string message, string[] tags = null)
@@ -20,8 +40,9 @@ public static void Commit(string message, string[] tags = null)
{
Configure();
}
-
- $"git commit -m \"{message} [skip ci]\"".RunWithBash();
+
+ // Checks if there are any changes to commit before committing
+ $"git diff-index --cached --quiet HEAD || git commit -m \"{message} [skip ci]\"".Run();
if (tags != null)
{
@@ -37,7 +58,7 @@ public static void Commit(string message, string[] tags = null)
public static void Push(string[] tags = null)
{
- "git push -f".RunWithBash();
+ "git push -f".Run();
if (tags != null)
{
@@ -45,7 +66,7 @@ public static void Push(string[] tags = null)
{
if (!string.IsNullOrEmpty(tag))
{
- $"git push origin \"{tag}\"".RunWithBash();
+ $"git push origin \"{tag}\"".Run();
}
}
}
@@ -60,13 +81,13 @@ public static void CommitAndPush(string message, string[] tags = null)
public static void Tag(string tag)
{
- $"git tag \"{tag}\"".RunWithBash();
+ $"git tag \"{tag}\"".Run();
}
private static void Configure()
{
- "git config user.email $git_email".RunWithBash();
- "git config user.name $git_actor".RunWithBash();
+ "git config user.email $git_email".Run();
+ "git config user.name $git_actor".Run();
_configured = true;
}
diff --git a/Setup/Package.cs b/Setup/Package.cs
index c1152242a..1d0fc1622 100644
--- a/Setup/Package.cs
+++ b/Setup/Package.cs
@@ -23,6 +23,9 @@ public class Package
[JsonProperty("name"), JsonIgnoreSerialization]
public string Name { get; private set; }
+ [JsonProperty("displayName"), JsonIgnoreSerialization]
+ public string DisplayName { get; private set; }
+
[JsonProperty("version")]
public string Version { get; private set; }
@@ -35,6 +38,12 @@ public class Package
[JsonProperty("samples", NullValueHandling = NullValueHandling.Ignore), JsonIgnoreSerialization]
public Sample[] Samples { get; private set; }
+ ///
+ /// Path of package.json file.
+ ///
+ [JsonIgnore]
+ public string FilePath { get; private set; }
+
// For Json Deserialize.
public Package()
{
@@ -44,6 +53,8 @@ public Package()
public Package(string path)
{
Path = path;
+
+ FilePath = System.IO.Path.Combine(path, "package.json");
}
///
@@ -80,7 +91,7 @@ public void SetVersion(string version)
///
public void Save()
{
- string json = File.ReadAllText(Path);
+ string json = File.ReadAllText(FilePath);
JObject jObject = JObject.Parse(json);
@@ -89,12 +100,20 @@ public void Save()
new JsonSerializerSettings { ContractResolver = new JsonPropertiesResolver() })),
new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Merge });
- File.WriteAllText(Path, jObject.ToString(Formatting.Indented));
+ File.WriteAllText(FilePath, jObject.ToString(Formatting.Indented));
+ }
+
+ public bool HasSamples()
+ {
+ return Samples != null && Samples.Length > 0;
}
}
public struct Sample
{
+ [JsonProperty("displayName")]
+ public string DisplayName { get; private set; }
+
[JsonProperty("path")]
public string Path { get; private set; }
}
diff --git a/Setup/Release.cs b/Setup/Release.cs
index dbaf0e55b..5a8f40331 100644
--- a/Setup/Release.cs
+++ b/Setup/Release.cs
@@ -1,23 +1,27 @@
using System.Collections.Generic;
+using System.IO;
+using Setup.Utils;
namespace Setup;
///
/// Release.
///
-public class Release
+public class Release : IRunnable
{
private readonly Package[] _packages;
private readonly string _version;
+ public int Order => 2;
+
public Release(string version)
{
_packages = Setup.Packages.ToArray();
_version = version;
}
-
+
///
/// Bumps the version and makes a release.
/// Commit and push with package.json versions bumped.
@@ -31,6 +35,8 @@ public void Run()
foreach (Package package in _packages)
{
+ string previousVersion = package.Version;
+
package.SetVersion(_version);
package.Save();
@@ -38,6 +44,22 @@ public void Run()
Git.Add(package.Path);
tags.Add($"{package.Name}/{_version}");
+
+ // Move samples to new directory with new version
+ if (package.HasSamples())
+ {
+ string path = Path.Combine(Setup.SampleProjectPath, "Assets/Samples", package.DisplayName);
+
+ string source = Path.Combine(path, previousVersion);
+
+ string destination = Path.Combine(path, _version);
+
+ Directory.Move(source, destination);
+
+ File.Move($"{source}.meta", $"{destination}.meta");
+
+ Git.Add(path);
+ }
}
Git.CommitAndPush($"Release {_version}", tags.ToArray());
diff --git a/Setup/Setup.cs b/Setup/Setup.cs
index a8226e9d9..28d96e9d2 100644
--- a/Setup/Setup.cs
+++ b/Setup/Setup.cs
@@ -1,17 +1,37 @@
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using Newtonsoft.Json;
+using Setup.Utils;
namespace Setup
{
internal class Setup
{
+ public const string SampleProjectPath = "../src/UnitySampleProject";
+
public static readonly List Packages = new List();
- // dotnet run -release:3.0.0 -duplicate_samples -publish_dependencies;
+ // dotnet run -release:3.0.0 -duplicate_samples -sync_dependencies;
static void Main(string[] args)
{
- // Initialize packages from file.
+ InitializePackages();
+
+ List runnableList = GetRunnableList(args);
+
+ runnableList = runnableList.OrderBy(r => r.Order).ToList();
+
+ foreach (IRunnable runnable in runnableList)
+ {
+ runnable.Run();
+ }
+ }
+
+ ///
+ /// Initialize packages from packages.json in root of this project.
+ ///
+ private static void InitializePackages()
+ {
string json = File.ReadAllText("packages.json");
string[] paths = JsonConvert.DeserializeObject(json);
@@ -22,13 +42,22 @@ static void Main(string[] args)
Package package = new Package(path);
- JsonConvert.PopulateObject(File.ReadAllText(path), package);
+ JsonConvert.PopulateObject(File.ReadAllText(package.FilePath), package);
Packages.Add(package);
}
+ }
+
+ ///
+ /// Get runnable list based on passed arguments.
+ ///
+ /// Arguments passed.
+ /// Runnable List.
+ private static List GetRunnableList(string[] args)
+ {
+ List runnableList = new List();
// Parse arguments and Run operations based on that.
- // TODO: use runnable and runner to run multiple operations sort orders.
foreach (var arg in args)
{
switch (arg)
@@ -36,14 +65,29 @@ static void Main(string[] args)
case not null when arg.StartsWith("-release"):
string version = arg.Split(":")[1];
-
- Release release = new Release(version);
-
- release.Run();
-
+ runnableList.AddRunnable(new Release(version));
break;
+
+ case "-duplicate_samples":
+ runnableList.AddRunnable(new DuplicateSamples());
+ break;
+
+ case "-sync_dependencies":
+ runnableList.AddRunnable(new SyncDependencies());
+ break;
+
+ case not null when arg.StartsWith("-git"):
+
+ string configuration = arg.Split(":")[1];
+ Git.Configure(configuration);
+ continue;
+
+ default:
+ continue;
}
}
+
+ return runnableList;
}
}
}
\ No newline at end of file
diff --git a/Setup/Setup.csproj b/Setup/Setup.csproj
index b35ce995f..e567b1161 100644
--- a/Setup/Setup.csproj
+++ b/Setup/Setup.csproj
@@ -6,7 +6,9 @@
+
+
-
+
diff --git a/Setup/SyncDependencies.cs b/Setup/SyncDependencies.cs
new file mode 100644
index 000000000..9ce014f48
--- /dev/null
+++ b/Setup/SyncDependencies.cs
@@ -0,0 +1,80 @@
+using System;
+using System.IO;
+using Newtonsoft.Json;
+using Setup.Utils;
+
+namespace Setup;
+
+public class SyncDependencies : IRunnable
+{
+ public int Order => 0;
+
+ private readonly Dependency[] _dependencies;
+
+ private const string ProjectPath = "../src/ChainSafe.Gaming.Unity/";
+
+ public SyncDependencies()
+ {
+ _dependencies = JsonConvert.DeserializeObject(File.ReadAllText("dependencies.json"));
+ }
+
+ public void Run()
+ {
+#if DEBUG
+ string configuration = "Debug";
+#else
+ string configuration = "Release";
+#endif
+ $"dotnet publish \"{ProjectPath}ChainSafe.Gaming.Unity.csproj\" -c {configuration} /property:Unity=true".Run();
+
+ string source = Path.Combine(ProjectPath, "bin", configuration, "netstandard2.1", "publish");
+
+ foreach (Dependency dependency in _dependencies)
+ {
+ string[] namespaces = dependency.Namespaces;
+
+ string destination = Path.Combine("../", dependency.Path);
+
+ // Remove previous dependencies first
+ if (Directory.Exists(destination))
+ {
+ DirectoryInfo directory = new DirectoryInfo(destination);
+
+ foreach (var file in directory.GetFiles())
+ {
+ if (file.Extension == ".dll" || file.Extension == ".pdb")
+ {
+ file.Delete();
+ }
+ }
+ }
+
+ else
+ {
+ Directory.CreateDirectory(destination);
+ }
+
+ Console.WriteLine($"Copying Dependencies to {destination}...");
+
+ foreach (string name in namespaces)
+ {
+ File.Copy(Path.Combine(source, $"{name}.dll"), Path.Combine(destination, $"{name}.dll"), true);
+#if DEBUG
+ string filePath = Path.Combine(source, $"{name}.pdb");
+
+ if (File.Exists(filePath))
+ {
+ File.Copy(filePath, Path.Combine(destination, $"{name}.pdb"), true);
+ }
+#endif
+ Console.WriteLine(name);
+ }
+
+ Git.Add(destination);
+ }
+
+ Git.CommitAndPush("Sync Dependencies");
+
+ Console.WriteLine("Dependencies Synced Successfully!");
+ }
+}
\ No newline at end of file
diff --git a/Setup/Utils/Dependency.cs b/Setup/Utils/Dependency.cs
new file mode 100644
index 000000000..f6eb099d1
--- /dev/null
+++ b/Setup/Utils/Dependency.cs
@@ -0,0 +1,12 @@
+using Newtonsoft.Json;
+
+namespace Setup.Utils;
+
+public struct Dependency
+{
+ [JsonProperty("path")]
+ public string Path { get; private set; }
+
+ [JsonProperty("namespaces")]
+ public string[] Namespaces { get; private set; }
+}
\ No newline at end of file
diff --git a/Setup/Utils/IRunnable.cs b/Setup/Utils/IRunnable.cs
new file mode 100644
index 000000000..34aebe23e
--- /dev/null
+++ b/Setup/Utils/IRunnable.cs
@@ -0,0 +1,14 @@
+namespace Setup.Utils;
+
+///
+/// Runnable objects added to run queue.
+///
+public interface IRunnable
+{
+ ///
+ /// Run order.
+ ///
+ public int Order { get; }
+
+ public void Run();
+}
\ No newline at end of file
diff --git a/Setup/Utils/Utilities.cs b/Setup/Utils/Utilities.cs
new file mode 100644
index 000000000..aab767060
--- /dev/null
+++ b/Setup/Utils/Utilities.cs
@@ -0,0 +1,144 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Management.Automation;
+using System.Runtime.InteropServices;
+
+namespace Setup.Utils;
+
+public static class Utilities
+{
+ public static void Run(this string command)
+ {
+ if (!Git.Enabled)
+ {
+ if (command.ToLower().StartsWith("git"))
+ {
+ Console.WriteLine($"Git disabled skipping command: {command}");
+
+ return;
+ }
+ }
+
+ // Tried switch statement couldn't find a way to make it work
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ command.RunWithBash();
+ }
+
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ command.RunWithPowershell();
+ }
+
+ else
+ {
+ throw new Exception($"[Unsupported OS] Can't run command: {command}");
+ }
+ }
+
+ public static void RunWithPowershell(this string command)
+ {
+ using (PowerShell powerShell = PowerShell.Create())
+ {
+ var result = powerShell.AddScript($"{command} | Out-String").Invoke();
+
+ // Output
+ foreach (var line in result)
+ {
+ Console.WriteLine(line.ToString());
+ }
+
+ if (powerShell.HadErrors)
+ {
+ throw new Exception($"Error executing powershell command: {command}");
+ }
+ }
+ }
+
+ ///
+ /// Runs commands with bash.
+ ///
+ /// Command to run.
+ /// If command fails.
+ public static void RunWithBash( this string command)
+ {
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ Console.WriteLine($"Skipping bash command \"{command}\" on non-linux platform.");
+
+ return;
+ }
+
+ command = command.Replace( "\"", "\\\"" );
+
+ Process process = new Process()
+ {
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = "/bin/bash",
+ Arguments = $"-c \"{command}\"",
+ RedirectStandardOutput = true,
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ }
+ };
+
+ process.Start();
+
+ string result = process.StandardOutput.ReadToEnd();
+
+ process.WaitForExit();
+
+ foreach (string line in result.Split('\n'))
+ {
+ Console.WriteLine(line);
+ }
+
+ if (process.ExitCode != 0)
+ {
+ throw new Exception($"Error executing bash command: {command} Exit Code: {process.ExitCode}");
+ }
+ }
+
+ public static void AddRunnable(this List runnableList, IRunnable runnable)
+ {
+ if (runnableList.Contains(runnable))
+ {
+ throw new Exception($"Duplicate command {runnable.GetType().Name}");
+ }
+
+ runnableList.Add(runnable);
+ }
+
+ public static void CopyDirectory(string source, string destination, bool copyAsNew = true, bool overwriteFile = true)
+ {
+ DirectoryInfo sourceDirectory = new DirectoryInfo(source);
+
+ DirectoryInfo destinationDirectory = new DirectoryInfo(destination);
+
+ if (copyAsNew)
+ {
+ if (destinationDirectory.Exists)
+ {
+ destinationDirectory.Delete(true);
+ }
+
+ Directory.CreateDirectory(destination);
+ }
+
+ DirectoryInfo[] subDirectories = sourceDirectory.GetDirectories();
+
+ foreach (FileInfo file in sourceDirectory.GetFiles())
+ {
+ file.CopyTo(Path.Combine(destination, file.Name), overwriteFile);
+ }
+
+ // Copy Recursively
+ foreach (DirectoryInfo directory in subDirectories)
+ {
+ CopyDirectory(directory.FullName, Path.Combine(destination, directory.Name));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Setup/Utils/Utils.cs b/Setup/Utils/Utils.cs
deleted file mode 100644
index 7895d41d0..000000000
--- a/Setup/Utils/Utils.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Diagnostics;
-
-namespace Setup.Utils;
-
-public static class Utils
-{
- ///
- /// Runs commands with bash.
- ///
- /// Command to run.
- /// If command fails.
- public static void RunWithBash( this string command)
- {
- command = command.Replace( "\"", "\\\"" );
-
- Process process = new Process()
- {
- StartInfo = new ProcessStartInfo
- {
- FileName = "/bin/bash",
- Arguments = $"-c \"{command}\"",
- RedirectStandardOutput = true,
- UseShellExecute = false,
- CreateNoWindow = true,
- }
- };
-
- process.Start();
-
- string result = process.StandardOutput.ReadToEnd();
-
- process.WaitForExit();
-
- foreach (string line in result.Split('\n'))
- {
- Console.WriteLine(line);
- }
-
- if (process.ExitCode != 0)
- {
- throw new Exception($"Error executing bash command {command}");
- }
- }
-}
\ No newline at end of file
diff --git a/Setup/dependencies.json b/Setup/dependencies.json
new file mode 100644
index 000000000..0ca9b64ca
--- /dev/null
+++ b/Setup/dependencies.json
@@ -0,0 +1,98 @@
+[
+ {
+ "path":"Packages/io.chainsafe.web3-unity/Runtime/Libraries/",
+ "namespaces":
+ [
+ "ADRaffy.ENSNormalize",
+ "Nethereum.Model",
+ "BouncyCastle.Crypto",
+ "Nethereum.RLP",
+ "ChainSafe.Gaming.Debugging",
+ "Nethereum.RPC",
+ "Nethereum.RPC.Reactive",
+ "Nethereum.JsonRpc.WebSocketClient",
+ "ChainSafe.Gaming.Gelato",
+ "ChainSafe.Gaming.SygmaClient",
+ "Nethereum.Signer.EIP712",
+ "ChainSafe.Gaming.InProcessSigner",
+ "Nethereum.Signer",
+ "ChainSafe.Gaming.InProcessTransactionExecutor",
+ "Nethereum.Util",
+ "ChainSafe.Gaming.Unity.ThirdParty",
+ "Nethereum.Web3",
+ "ChainSafe.Gaming.Unity",
+ "System.Buffers",
+ "ChainSafe.Gaming.WalletConnect",
+ "System.Memory",
+ "ChainSafe.Gaming",
+ "System.Numerics.Vectors",
+ "Microsoft.Bcl.AsyncInterfaces",
+ "System.Reactive",
+ "Microsoft.Extensions.DependencyInjection.Abstractions",
+ "System.Runtime.CompilerServices.Unsafe",
+ "Microsoft.Extensions.DependencyInjection",
+ "System.Runtime.InteropServices.WindowsRuntime",
+ "Microsoft.Extensions.Logging.Abstractions",
+ "System.Security.Cryptography.Cng",
+ "Microsoft.IdentityModel.Abstractions",
+ "System.Text.Encodings.Web",
+ "Microsoft.IdentityModel.Logging",
+ "System.Text.Json",
+ "Microsoft.IdentityModel.Tokens",
+ "System.Threading.Channels",
+ "NBitcoin",
+ "System.Threading.Tasks.Extensions",
+ "Nethereum.ABI",
+ "WalletConnectSharp.Auth",
+ "Nethereum.Accounts",
+ "WalletConnectSharp.Common",
+ "WalletConnectSharp.Events",
+ "Nethereum.BlockchainProcessing",
+ "WalletConnectSharp.Core",
+ "Nethereum.Contracts",
+ "WalletConnectSharp.Crypto",
+ "Nethereum.Hex",
+ "Nethereum.JsonRpc.Client",
+ "WalletConnectSharp.Network.Websocket",
+ "WalletConnectSharp.Network",
+ "Nethereum.JsonRpc.RpcClient",
+ "WalletConnectSharp.Sign",
+ "Nethereum.KeyStore",
+ "WalletConnectSharp.Storage",
+ "Nethereum.Merkle.Patricia",
+ "WalletConnectSharp.Web3Wallet",
+ "Nethereum.Merkle",
+ "Websocket.Client",
+ "Nethereum.Siwe.Core",
+ "Nethereum.Siwe",
+ "Nethereum.UI",
+ "ChainSafe.Gaming.Unity.MetaMask",
+ "ChainSafe.Gaming.Marketplace",
+ "ChainSafe.Gaming.Unity.EthereumWindow"
+ ]
+ },
+ {
+ "path":"Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/",
+ "namespaces":
+ [
+ "Chainsafe.Gaming.Chainlink",
+ "ChainSafe.Gaming.Lootboxes.Chainlink"
+ ]
+ },
+ {
+ "path":"Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/",
+ "namespaces":
+ [
+ "ChainSafe.Gaming.HyperPlay"
+ ]
+ },
+ {
+ "path":"Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/",
+ "namespaces":
+ [
+ "ChainSafe.Gaming.Mud",
+ "Nethereum.Mud",
+ "Nethereum.Mud.Contracts"
+ ]
+ }
+]
\ No newline at end of file
diff --git a/Setup/packages.json b/Setup/packages.json
index 4aa46954f..b67f39928 100644
--- a/Setup/packages.json
+++ b/Setup/packages.json
@@ -1,9 +1,9 @@
[
- "Packages/io.chainsafe.web3-unity/package.json",
- "Packages/io.chainsafe.web3-unity.hyperplay/package.json",
- "Packages/io.chainsafe.web3-unity.lootboxes/package.json",
- "Packages/io.chainsafe.web3-unity.marketplace/package.json",
- "Packages/io.chainsafe.web3-unity.mud/package.json",
- "Packages/io.chainsafe.web3-unity.ramp/package.json",
- "Packages/io.chainsafe.web3-unity.web3auth/package.json"
+ "Packages/io.chainsafe.web3-unity",
+ "Packages/io.chainsafe.web3-unity.hyperplay",
+ "Packages/io.chainsafe.web3-unity.lootboxes",
+ "Packages/io.chainsafe.web3-unity.marketplace",
+ "Packages/io.chainsafe.web3-unity.mud",
+ "Packages/io.chainsafe.web3-unity.ramp",
+ "Packages/io.chainsafe.web3-unity.web3auth"
]
\ No newline at end of file
diff --git a/scripts/data/duplicate_samples.txt b/scripts/data/duplicate_samples.txt
deleted file mode 100644
index 5ff46cb8c..000000000
--- a/scripts/data/duplicate_samples.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-source:src/UnitySampleProject/Assets/Samples/web3.unity SDK
- display_name:Web3.Unity Samples
- destination:Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/
-source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes
- display_name:Lootboxes Samples
- destination:Packages/io.chainsafe.web3-unity.lootboxes/Samples~/Web3.Unity Chainlink Lootboxes/
-source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Ramp
- display_name:Ramp Samples
- destination:Packages/io.chainsafe.web3-unity.ramp/Samples~/Web3.Unity Ramp/
-source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Marketplace
- display_name:Marketplace Samples
- destination:Packages/io.chainsafe.web3-unity.marketplace/Samples~/Web3.Unity Marketplace/
-source:src/UnitySampleProject/Assets/Samples/web3.unity SDK MUD
- display_name:Marketplace Samples
- destination:Packages/io.chainsafe.web3-unity.mud/Samples~/Web3.Unity MUD/
\ No newline at end of file
diff --git a/scripts/data/published_dependencies.txt b/scripts/data/published_dependencies.txt
deleted file mode 100644
index 44cf01d1f..000000000
--- a/scripts/data/published_dependencies.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-Packages/io.chainsafe.web3-unity/Runtime/Libraries/:
- ADRaffy.ENSNormalize
- Nethereum.Model
- BouncyCastle.Crypto
- Nethereum.RLP
- ChainSafe.Gaming.Debugging
- Nethereum.RPC
- Nethereum.RPC.Reactive
- Nethereum.JsonRpc.WebSocketClient
- ChainSafe.Gaming.Gelato
- ChainSafe.Gaming.SygmaClient
- Nethereum.Signer.EIP712
- ChainSafe.Gaming.InProcessSigner
- Nethereum.Signer
- ChainSafe.Gaming.InProcessTransactionExecutor
- Nethereum.Util
- ChainSafe.Gaming.Unity.ThirdParty
- Nethereum.Web3
- ChainSafe.Gaming.Unity
- System.Buffers
- ChainSafe.Gaming.WalletConnect
- System.Memory
- ChainSafe.Gaming
- System.Numerics.Vectors
- Microsoft.Bcl.AsyncInterfaces
- System.Reactive
- Microsoft.Extensions.DependencyInjection.Abstractions
- System.Runtime.CompilerServices.Unsafe
- Microsoft.Extensions.DependencyInjection
- System.Runtime.InteropServices.WindowsRuntime
- Microsoft.Extensions.Logging.Abstractions
- System.Security.Cryptography.Cng
- Microsoft.IdentityModel.Abstractions
- System.Text.Encodings.Web
- Microsoft.IdentityModel.Logging
- System.Text.Json
- Microsoft.IdentityModel.Tokens
- System.Threading.Channels
- NBitcoin
- System.Threading.Tasks.Extensions
- Nethereum.ABI
- WalletConnectSharp.Auth
- Nethereum.Accounts
- WalletConnectSharp.Common
- WalletConnectSharp.Events
- Nethereum.BlockchainProcessing
- WalletConnectSharp.Core
- Nethereum.Contracts
- WalletConnectSharp.Crypto
- Nethereum.Hex
- Nethereum.JsonRpc.Client
- WalletConnectSharp.Network.Websocket
- WalletConnectSharp.Network
- Nethereum.JsonRpc.RpcClient
- WalletConnectSharp.Sign
- Nethereum.KeyStore
- WalletConnectSharp.Storage
- Nethereum.Merkle.Patricia
- WalletConnectSharp.Web3Wallet
- Nethereum.Merkle
- Websocket.Client
- Nethereum.Siwe.Core
- Nethereum.Siwe
- Nethereum.UI
- ChainSafe.Gaming.Unity.MetaMask
- ChainSafe.Gaming.Marketplace
- ChainSafe.Gaming.Unity.EthereumWindow
-Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/:
- Chainsafe.Gaming.Chainlink
- ChainSafe.Gaming.Lootboxes.Chainlink
-Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/:
- ChainSafe.Gaming.HyperPlay
-Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/:
- ChainSafe.Gaming.Mud
- Nethereum.Mud
- Nethereum.Mud.Contracts
\ No newline at end of file
diff --git a/scripts/debug-publish-to-unity-package.bat b/scripts/debug-publish-to-unity-package.bat
deleted file mode 100644
index 1d40e8c45..000000000
--- a/scripts/debug-publish-to-unity-package.bat
+++ /dev/null
@@ -1,56 +0,0 @@
-@echo off
-
-SET SCRIPT_DIR=%~dp0
-
-setlocal enabledelayedexpansion
-
-echo Building project...
-pushd "%SCRIPT_DIR%\..\src\ChainSafe.Gaming.Unity"
-
-rem Publish the project
-dotnet publish ChainSafe.Gaming.Unity.csproj -c Debug /property:Unity=true
-
-IF %ERRORLEVEL% NEQ 0 (
- echo Execution failed
- exit /b %ERRORLEVEL%
-)
-
-set PUBLISH_PATH=bin\Debug\netstandard2.1\publish
-
-rem List generated DLLs
-echo DLLs Generated
-dir /b "%PUBLISH_PATH%"
-
-set PACKAGE_LIB_PATH=
-
-rem Read and process each line from the dependencies file
-for /f "usebackq tokens=*" %%A in ("%SCRIPT_DIR%\data\published_dependencies.txt") do (
-
- set entry=%%A
-
- rem Check if the line ends with a colon
- if "!entry:~-1!" == ":" (
- set "PACKAGE_LIB_PATH=%SCRIPT_DIR%..\!entry:~0,-1!"
- if exist "!PACKAGE_LIB_PATH!\" (
- del /q "!PACKAGE_LIB_PATH!\*.dll"
- del /q "!PACKAGE_LIB_PATH!\*.pdb"
- ) else (
- mkdir "!PACKAGE_LIB_PATH!"
- )
-
- echo Copying to !PACKAGE_LIB_PATH!...
- ) else (
- set "DEPENDENCY=!entry: =!"
- copy /y "%PUBLISH_PATH%\!DEPENDENCY!.dll" "!PACKAGE_LIB_PATH!"
- copy /y "%PUBLISH_PATH%\!DEPENDENCY!.pdb" "!PACKAGE_LIB_PATH!"
- )
-)
-
-popd
-
-rem Restore solution
-pushd "..\"
-dotnet restore
-popd
-
-echo Done
\ No newline at end of file
diff --git a/scripts/debug-publish-to-unity-package.sh b/scripts/debug-publish-to-unity-package.sh
deleted file mode 100755
index 89a449766..000000000
--- a/scripts/debug-publish-to-unity-package.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /usr/bin/env sh
-
-set -e
-
-scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
-
-echo Publishing project...
-
-pushd "$scripts_dir"/../src/ChainSafe.Gaming.Unity
-
-dotnet publish ChainSafe.Gaming.Unity.csproj -c Debug /property:Unity=true
-
-export PUBLISH_PATH="bin/Debug/netstandard2.1/publish"
-
-echo -e "DLLs Generated\n$(ls "$PUBLISH_PATH")"
-
-export PACKAGE_LIB_PATH=
-
-while IFS= read -r entry || [ -n "$entry" ];
-do
- entry=$(echo "$entry" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
- if [[ $entry == *: ]]
- then
- PACKAGE_LIB_PATH="$scripts_dir/../${entry%:}"
- if [ -d "$PACKAGE_LIB_PATH" ]; then
- rm -rf "$PACKAGE_LIB_PATH"/*.dll
- rm -rf "$PACKAGE_LIB_PATH"/*.pdb
- else
- mkdir -p "$PACKAGE_LIB_PATH"
- fi
- echo "Copying to $PACKAGE_LIB_PATH..."
- else
- export DEPENDENCY=$(echo "$entry" | tr -d '\t' | tr -d ' ')
- cp -fr "$PUBLISH_PATH/$DEPENDENCY".dll $PACKAGE_LIB_PATH
-
- if [ -f "$PUBLISH_PATH/$DEPENDENCY".pdb ]; then
- cp -fr "$PUBLISH_PATH/$DEPENDENCY".pdb $PACKAGE_LIB_PATH
- fi
- fi
-done < "$scripts_dir/data/published_dependencies.txt"
-
-popd
-
-echo Done
\ No newline at end of file
diff --git a/scripts/publish-to-unity-package.bat b/scripts/publish-to-unity-package.bat
deleted file mode 100644
index 83a99385c..000000000
--- a/scripts/publish-to-unity-package.bat
+++ /dev/null
@@ -1,44 +0,0 @@
-@echo off
-SET SCRIPT_DIR=%~dp0
-
-setlocal enabledelayedexpansion
-
-echo Building project...
-pushd "%SCRIPT_DIR%\..\src\ChainSafe.Gaming.Unity"
-
-rem Publish the project
-dotnet publish ChainSafe.Gaming.Unity.csproj -c Release /property:Unity=true
-
-set PUBLISH_PATH=bin\Release\netstandard2.1\publish
-
-rem List generated DLLs
-echo DLLs Generated
-dir /b "%PUBLISH_PATH%"
-
-set PACKAGE_LIB_PATH=
-
-rem Read and process each line from the dependencies file
-for /f "usebackq tokens=*" %%A in ("%SCRIPT_DIR%\data\published_dependencies.txt") do (
-
- set entry=%%A
-
- rem Check if the line ends with a colon
- if "!entry:~-1!" == ":" (
- set "PACKAGE_LIB_PATH=%SCRIPT_DIR%..\!entry:~0,-1!"
- if exist "!PACKAGE_LIB_PATH!\" (
- del /q "!PACKAGE_LIB_PATH!\*.dll"
- del /q "!PACKAGE_LIB_PATH!\*.pdb"
- ) else (
- mkdir "!PACKAGE_LIB_PATH!"
- )
-
- echo Copying to !PACKAGE_LIB_PATH!...
- ) else (
- set "DEPENDENCY=!entry: =!"
- copy /y "%PUBLISH_PATH%\!DEPENDENCY!.dll" "!PACKAGE_LIB_PATH!"
- )
-)
-
-popd
-
-echo Done
\ No newline at end of file
diff --git a/scripts/publish-to-unity-package.sh b/scripts/publish-to-unity-package.sh
deleted file mode 100755
index 150615f04..000000000
--- a/scripts/publish-to-unity-package.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /usr/bin/env sh
-
-set -e
-
-scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
-
-echo Publishing project...
-
-pushd "$scripts_dir"/../src/ChainSafe.Gaming.Unity
-
-dotnet publish ChainSafe.Gaming.Unity.csproj -c Release /property:Unity=true
-
-export PUBLISH_PATH="bin/Release/netstandard2.1/publish"
-
-echo -e "DLLs Generated\n$(ls "$PUBLISH_PATH")"
-
-export PACKAGE_LIB_PATH=
-
-while IFS= read -r entry || [ -n "$entry" ];
-do
- entry=$(echo "$entry" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
- if [[ $entry == *: ]]
- then
- PACKAGE_LIB_PATH="$scripts_dir/../${entry%:}"
- if [ -d "$PACKAGE_LIB_PATH" ]; then
- rm -rf "$PACKAGE_LIB_PATH"/*.dll
- rm -rf "$PACKAGE_LIB_PATH"/*.pdb
- else
- mkdir -p "$PACKAGE_LIB_PATH"
- fi
- echo "Copying to $PACKAGE_LIB_PATH..."
- else
- export DEPENDENCY=$(echo "$entry" | tr -d '\t' | tr -d ' ')
- cp -fr "$PUBLISH_PATH/$DEPENDENCY".dll $PACKAGE_LIB_PATH
- fi
-done < "$scripts_dir/data/published_dependencies.txt"
-
-popd
-
-echo Done
\ No newline at end of file
diff --git a/scripts/publish.bat b/scripts/publish.bat
deleted file mode 100644
index 9a0ca8895..000000000
--- a/scripts/publish.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-dotnet publish -c release /property:Unity=true
-
-pushd ..\..
-dotnet restore
-popd
\ No newline at end of file
diff --git a/scripts/publish.sh b/scripts/publish.sh
deleted file mode 100644
index 01ea93249..000000000
--- a/scripts/publish.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /usr/bin/env sh
-scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
-
-pushd "$scripts_dir"/../
-dotnet publish -c release /property:Unity=true
-
-pushd ../..
-dotnet restore
-
-popd
-popd
\ No newline at end of file
diff --git a/scripts/release-web3-auth.sh b/scripts/release-web3-auth.sh
deleted file mode 100644
index 2ed33b5e5..000000000
--- a/scripts/release-web3-auth.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /usr/bin/env sh
-
-scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
-source "$scripts_dir"/setup.sh
-
-git add "$scripts_dir"/../Packages/io.chainsafe.web3-unity.web3auth/.
-
-MESSAGE="release-v$1"
-
-git commit -m "$MESSAGE"
-git tag -a "io.chainsafe.web3-unity.web3auth/$1" -m "$MESSAGE"
-git push
\ No newline at end of file
diff --git a/scripts/release-web3-unity.sh b/scripts/release-web3-unity.sh
deleted file mode 100644
index 0e6d971af..000000000
--- a/scripts/release-web3-unity.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /usr/bin/env sh
-
-scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
-source "$scripts_dir"/setup.sh
-
-git add "$scripts_dir"/../Packages/io.chainsafe.web3-unity/.
-
-git add "$scripts_dir"/../Packages/io.chainsafe.web3-unity/Runtime/Libraries/. -f
-
-MESSAGE="release-v$1"
-
-git commit -m "$MESSAGE"
-git tag -a "io.chainsafe.web3-unity/$1" -m "$MESSAGE"
-git push
\ No newline at end of file
diff --git a/scripts/setup.bat b/scripts/setup.bat
index 663aa2483..f94a29e1c 100644
--- a/scripts/setup.bat
+++ b/scripts/setup.bat
@@ -3,12 +3,17 @@
SET SCRIPT_DIR=%~dp0
REM Change to the directory where the script resides, then navigate to the parent.
-pushd "%SCRIPT_DIR%\.."
+pushd "%SCRIPT_DIR%\..\Setup"
REM clone submodules
git submodule update --init
-REM publish DLLs to unity package
-"%SCRIPT_DIR%\publish-to-unity-package.bat"
+if "%1"=="" (
+ set "config=Release"
+) else (
+ set "config=%1"
+)
+
+dotnet run -sync_dependencies -git:disabled -c %config% Setup.csproj
popd
diff --git a/scripts/setup.sh b/scripts/setup.sh
index c7e53008c..f1ef9469c 100755
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -1,11 +1,12 @@
#! /usr/bin/env sh
scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
-pushd "$scripts_dir"/../
# clone submodules
git submodule update --init
-popd
+
+pushd "$scripts_dir"/../Setup
# publish DLLs to unity package
-source "$scripts_dir"/publish-to-unity-package.sh
+dotnet run -sync_dependencies -git:disabled -c ${1:-Release} Setup.csproj
+popd
\ No newline at end of file
diff --git a/src/UnitySampleProject/ProjectSettings/EditorBuildSettings.asset b/src/UnitySampleProject/ProjectSettings/EditorBuildSettings.asset
index 93c806863..e7b189653 100644
--- a/src/UnitySampleProject/ProjectSettings/EditorBuildSettings.asset
+++ b/src/UnitySampleProject/ProjectSettings/EditorBuildSettings.asset
@@ -6,6 +6,6 @@ EditorBuildSettings:
serializedVersion: 2
m_Scenes:
- enabled: 1
- path: Assets/Samples/web3.unity SDK/3.0.0/Web3.Unity Samples/Scenes/SampleMain.unity
+ path: Assets/Samples/web3.unity SDK/3.0.1/Web3.Unity Samples/Scenes/SampleMain.unity
guid: 516f54f8261cf44459691b7adc25e055
m_configObjects: {}