Skip to content

Commit

Permalink
Merge pull request #3828 from s2quake/chore/move-path
Browse files Browse the repository at this point in the history
Refactor: Move files to the following paths: src, test, tools
  • Loading branch information
s2quake authored Jun 25, 2024
2 parents d99e816 + d6f74a9 commit 901ecb2
Show file tree
Hide file tree
Showing 869 changed files with 318 additions and 277 deletions.
12 changes: 8 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ commands:
steps:
- checkout
- concat_files:
glob: "*/*.csproj"
glob: "{src,test,tools}/*/*.csproj"
to: .combined-package-files.txt
- restore_cache:
keys:
Expand Down Expand Up @@ -105,14 +105,18 @@ commands:
root: .
paths:
- <<parameters.collect_tests_to>>
- "*/bin/"
- "*/obj/"
- "src/*/bin/"
- "src/*/obj/"
- "test/*/bin/"
- "test/*/obj/"
- "tools/*/bin/"
- "tools/*/obj/"

mono_build_base:
steps:
- checkout
- concat_files:
glob: "*/*.csproj"
glob: "{src,test,tools}/*/*.csproj"
to: .combined-package-files.txt
- restore_cache:
keys:
Expand Down
40 changes: 20 additions & 20 deletions .github/bin/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
# shellcheck disable=SC2034
solution="Libplanet"
projects=(
"Libplanet"
"Libplanet.Action"
"Libplanet.Common"
"Libplanet.Crypto"
"Libplanet.Crypto.Secp256k1"
"Libplanet.Mocks"
"Libplanet.Net"
"Libplanet.Store"
"Libplanet.Store.Remote"
"Libplanet.Stun"
"Libplanet.Types"
"Libplanet.RocksDBStore"
"Libplanet.Analyzers"
"Libplanet.Tools"
"Libplanet.Explorer"
"Libplanet.Explorer.Executable"
"Libplanet.Explorer.Cocona"
"Libplanet.Extensions.Cocona"
"src/Libplanet"
"src/Libplanet.Action"
"src/Libplanet.Common"
"src/Libplanet.Crypto"
"src/Libplanet.Crypto.Secp256k1"
"src/Libplanet.Net"
"src/Libplanet.Store"
"src/Libplanet.Store.Remote"
"src/Libplanet.Stun"
"src/Libplanet.Types"
"src/Libplanet.RocksDBStore"
"test/Libplanet.Mocks"
"tools/Libplanet.Analyzers"
"tools/Libplanet.Tools"
"tools/Libplanet.Explorer"
"tools/Libplanet.Explorer.Executable"
"tools/Libplanet.Explorer.Cocona"
"tools/Libplanet.Extensions.Cocona"
)
configuration=Release
executables=(
"Libplanet.Tools"
"Libplanet.Explorer.Executable"
"tools/Libplanet.Tools"
"tools/Libplanet.Explorer.Executable"
)
npm_packages=(
"@planetarium/cli"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
dotnet-version: 6.0.x
- name: Run benchmark
run: dotnet run --project Libplanet.Benchmarks -c Release -- --exporters json --filter '*'
run: dotnet run --project tools/Libplanet.Benchmarks -c Release -- --exporters json --filter '*'

- name: Compare benchmark result
uses: planetarium/github-action-benchmark@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/yarn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ jobs:
- if: runner.os != 'Windows'
run: |
set -ev
cd Libplanet.Tools/
cd tools/Libplanet.Tools/
bin/npm-test.sh "$LATEST_VERSION"
env:
LATEST_VERSION: ${{ steps.latest-tag.outputs.tag }}
- if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
cd Libplanet.Tools\
cd tools\Libplanet.Tools\
pwsh `
-ExecutionPolicy Bypass `
-File bin\npm-test.ps1 `
Expand Down
2 changes: 1 addition & 1 deletion @planetarium/cli
4 changes: 2 additions & 2 deletions @planetarium/tx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"scripts": {
"build": "yarn && nanobundle build",
"prepack": "yarn && yarn build",
"dev": "yarn && dotnet build ../../Libplanet.Tools && vitest",
"test": "yarn && yarn run -T tsc -p tsconfig.json && dotnet build ../../Libplanet.Tools && vitest run",
"dev": "yarn && dotnet build ../../tools/Libplanet.Tools && vitest",
"test": "yarn && yarn run -T tsc -p tsconfig.json && dotnet build ../../tools/Libplanet.Tools && vitest run",
"coverage": "yarn && vitest run --coverage"
},
"repository": {
Expand Down
24 changes: 12 additions & 12 deletions @planetarium/tx/test/tx/signed.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { encodeSignedTx, signTx } from "../../src/tx/signed";
import { type UnsignedTx } from "../../src/tx/unsigned";
import { account1, address1 } from "./fixtures";
import { join } from "node:path";
import { RecordView, encode } from "@planetarium/bencodex";
import { execa } from "execa";
import { join } from "node:path";
import { describe, expect, test } from "vitest";
import { encodeSignedTx, signTx } from "../../src/tx/signed";
import { type UnsignedTx } from "../../src/tx/unsigned";
import { account1, address1 } from "./fixtures";

describe("signTx", () => {
test("UnsignedTx", async () => {
Expand All @@ -30,28 +30,28 @@ describe("signTx", () => {
minters: [
Buffer.from(
"47d082a115c63e7b58b1532d20e631538eafadde",
"hex",
"hex"
),
],
ticker: "NCG",
},
"text",
"text"
),
1000n,
],
recipient: Buffer.from(
"5a533067D0cBa77490268b26195EdB10B990143D",
"hex",
"hex"
),
sender: Buffer.from(
"111CB8E18c6D70f5032000c5739c5ac36E793EDB",
"hex",
"hex"
),
},
"text",
"text"
),
},
"text",
"text"
),
],
};
Expand All @@ -64,13 +64,13 @@ describe("signTx", () => {
"run",
"--no-build",
"--project",
join(__dirname, "..", "..", "..", "..", "Libplanet.Tools"),
join(__dirname, "..", "..", "..", "..", "tools", "Libplanet.Tools"),
"--",
"tx",
"analyze",
"-",
],
{ input: payload },
{ input: payload }
);
expect(JSON.parse(stdout)).toStrictEqual({
id: "49a645bb80fa96757009615ec33bc15a2e90e9121877de9f14de35b7d657a118",
Expand Down
22 changes: 11 additions & 11 deletions @planetarium/tx/test/tx/unsigned.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { encodeUnsignedTx } from "../../src/tx/unsigned";
import { key1 } from "./fixtures";
import { join } from "node:path";
import { RecordView, encode } from "@planetarium/bencodex";
import { execa } from "execa";
import { join } from "node:path";
import { expect, test } from "vitest";
import { encodeUnsignedTx } from "../../src/tx/unsigned";
import { key1 } from "./fixtures";

test("encodeUnsignedTx", async () => {
const encoded = encodeUnsignedTx({
Expand All @@ -28,25 +28,25 @@ test("encodeUnsignedTx", async () => {
new Uint8Array(
Buffer.from(
"47d082a115c63e7b58b1532d20e631538eafadde",
"hex",
),
"hex"
)
),
],
ticker: "NCG",
},
"text",
"text"
),
1000n,
],
recipient: new Uint8Array(
Buffer.from("5a533067D0cBa77490268b26195EdB10B990143D", "hex"),
Buffer.from("5a533067D0cBa77490268b26195EdB10B990143D", "hex")
),
sender: new Uint8Array(
Buffer.from("111CB8E18c6D70f5032000c5739c5ac36E793EDB", "hex"),
Buffer.from("111CB8E18c6D70f5032000c5739c5ac36E793EDB", "hex")
),
},
},
"text",
"text"
),
],
});
Expand All @@ -57,7 +57,7 @@ test("encodeUnsignedTx", async () => {
"run",
"--no-build",
"--project",
join(__dirname, "..", "..", "..", "..", "Libplanet.Tools"),
join(__dirname, "..", "..", "..", "..", "tools", "Libplanet.Tools"),
"--",
"tx",
"analyze",
Expand All @@ -66,7 +66,7 @@ test("encodeUnsignedTx", async () => {
],
{
input: Buffer.from(payload),
},
}
);
expect(JSON.parse(stdout)).toStrictEqual({
nonce: 123,
Expand Down
22 changes: 11 additions & 11 deletions Dockerfile.explorer
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ WORKDIR /app

# Copy csproj and restore as distinct layers
# Note that it's ordered by the least frequently changed
COPY ./Libplanet.Stun/Libplanet.Stun.csproj ./Libplanet.Stun/
RUN dotnet restore Libplanet.Stun
COPY ./Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj ./Libplanet.RocksDBStore/
RUN dotnet restore Libplanet.RocksDBStore
COPY ./Libplanet.Explorer.Executable/Libplanet.Explorer.Executable.csproj ./Libplanet.Explorer.Executable/
RUN dotnet restore Libplanet.Explorer.Executable
COPY ./Libplanet.Explorer/Libplanet.Explorer.csproj ./Libplanet.Explorer/
RUN dotnet restore Libplanet.Explorer
COPY ./Libplanet/Libplanet.csproj ./Libplanet/
RUN dotnet restore Libplanet
COPY ./src/Libplanet.Stun/Libplanet.Stun.csproj ./src/Libplanet.Stun/
RUN dotnet restore src/Libplanet.Stun
COPY ./src/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj ./src/Libplanet.RocksDBStore/
RUN dotnet restore src/Libplanet.RocksDBStore
COPY ./tools/Libplanet.Explorer.Executable/Libplanet.Explorer.Executable.csproj ./tools/Libplanet.Explorer.Executable/
RUN dotnet restore tools/Libplanet.Explorer.Executable
COPY ./tools/Libplanet.Explorer/Libplanet.Explorer.csproj ./tools/Libplanet.Explorer/
RUN dotnet restore tools/Libplanet.Explorer
COPY ./src/Libplanet/Libplanet.csproj ./src/Libplanet/
RUN dotnet restore src/Libplanet

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -r linux-x64 -o out Libplanet.Explorer.Executable
RUN dotnet publish -c Release -r linux-x64 -o out tools/Libplanet.Explorer.Executable

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
Expand Down
35 changes: 17 additions & 18 deletions Docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
"src": [
{
"files": [
"Libplanet/Libplanet.csproj",
"Libplanet.Action/Libplanet.Action.csproj",
"Libplanet.Common/Libplanet.Common.csproj",
"Libplanet.Crypto/Libplanet.Crypto.csproj",
"Libplanet.Crypto.Secp256k1/Libplanet.Crypto.Secp256k1.csproj",
"Libplanet.Explorer.Cocona/Libplanet.Explorer.Cocona.csproj",
"Libplanet.Extensions.Cocona/Libplanet.Extensions.Cocona.csproj",
"Libplanet.Mocks/Libplanet.Mocks.csproj",
"Libplanet.Net/Libplanet.Net.csproj",
"Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj",
"Libplanet.Store/Libplanet.Store.csproj",
"Libplanet.Store.Remote/Libplanet.Store.Remote.csproj",
"Libplanet.Stun/Libplanet.Stun.csproj",
"Libplanet.Types/Libplanet.Types.csproj"
"src/Libplanet/Libplanet.csproj",
"src/Libplanet.Action/Libplanet.Action.csproj",
"src/Libplanet.Common/Libplanet.Common.csproj",
"src/Libplanet.Crypto/Libplanet.Crypto.csproj",
"src/Libplanet.Crypto.Secp256k1/Libplanet.Crypto.Secp256k1.csproj",
"tools/Libplanet.Explorer.Cocona/Libplanet.Explorer.Cocona.csproj",
"tools/Libplanet.Extensions.Cocona/Libplanet.Extensions.Cocona.csproj",
"test/Libplanet.Mocks/Libplanet.Mocks.csproj",
"src/Libplanet.Net/Libplanet.Net.csproj",
"src/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj",
"src/Libplanet.Store/Libplanet.Store.csproj",
"src/Libplanet.Store.Remote/Libplanet.Store.Remote.csproj",
"src/Libplanet.Stun/Libplanet.Stun.csproj",
"src/Libplanet.Types/Libplanet.Types.csproj"
],
"exclude": ["**/bin/**", "**/obj/**"],
"src": "../"
Expand Down Expand Up @@ -48,22 +48,22 @@
]
},
{
"src": "../Libplanet.Analyzers",
"src": "../tools/Libplanet.Analyzers",
"dest": "analyzer",
"files": [
"*.md",
"rules/*.md"
]
},
{
"src": "../Libplanet.Tools",
"src": "../tools/Libplanet.Tools",
"dest": "cli",
"files": [
"*.md"
]
},
{
"src": "../Libplanet.Explorer",
"src": "../tools/Libplanet.Explorer",
"dest": "explorer",
"files": [
"*.md"
Expand Down Expand Up @@ -111,7 +111,6 @@
"fileMetadataFiles": [],

"template": ["default"],
// "statictoc" has a bug that relative links with nested dirs in nav refer to incorrect destinations

"theme": ["theme"],
"postProcessors": [],
Expand Down
6 changes: 0 additions & 6 deletions Libplanet.Tests/Tx/TxSigningMetadataTest.ts

This file was deleted.

Loading

0 comments on commit 901ecb2

Please sign in to comment.