Skip to content

Commit

Permalink
Merge pull request #3620 from onflow/supun/restructure
Browse files Browse the repository at this point in the history
Move  subdirectories under `runtime` to top level
  • Loading branch information
SupunS authored Oct 18, 2024
2 parents dbf5351 + de913e6 commit 8b904c2
Show file tree
Hide file tree
Showing 853 changed files with 1,796 additions and 1,770 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ jobs:

- name: Run benchmark on current branch
run: |
( for i in {1..${{ steps.settings.outputs.benchmark_repetitions }}}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done | sed 's/pkg:.*/pkg: github.com\/onflow\/cadence\/runtime/' ) | tee new.txt
( for i in {1..${{ steps.settings.outputs.benchmark_repetitions }}}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done | sed 's/pkg:.*/pkg: github.com\/onflow\/cadence\/' ) | tee new.txt
# the package replace line above is to make the results table more readable, since it is not fragmented by package

- name: Checkout base branch
run: git checkout ${{ github.event.pull_request.base.sha }}

- name: Run benchmark on base branch
run: |
( for i in {1..${{ steps.settings.outputs.benchmark_repetitions }}}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done | sed 's/pkg:.*/pkg: github.com\/onflow\/cadence\/runtime/' ) | tee old.txt
( for i in {1..${{ steps.settings.outputs.benchmark_repetitions }}}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done | sed 's/pkg:.*/pkg: github.com\/onflow\/cadence\/' ) | tee old.txt
# see https://trstringer.com/github-actions-multiline-strings/ to see why this part is complex
- name: Use benchstat for comparison
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: make ci

- name: Cadence Testing Framework
run: cd runtime/stdlib/contracts && flow test --cover --covercode="contracts" crypto_test.cdc
run: cd stdlib/contracts && flow test --cover --covercode="contracts" crypto_test.cdc

- name: Upload coverage report
uses: codecov/codecov-action@v2
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ suppressions

coverage.txt
coverage.txt-e
runtime/cmd/check/check
runtime/cmd/main/main
runtime/cmd/parse/parse
runtime/cmd/parse/parse.wasm
cmd/check/check
cmd/main/main
cmd/parse/parse
cmd/parse/parse.wasm
tools/golangci-lint/golangci-lint
tools/maprange/maprange
tools/unkeyed/unkeyed
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GOPATH ?= $(HOME)/go
# Ensure go bin path is in path (Especially for CI)
PATH := $(PATH):$(GOPATH)/bin

COVERPKGS := $(shell go list ./... | grep -v /cmd | grep -v /runtime/test | tr "\n" "," | sed 's/,*$$//')
COVERPKGS := $(shell go list ./... | grep -v /cmd | grep -v /test | tr "\n" "," | sed 's/,*$$//')


LINTERS :=
Expand All @@ -30,19 +30,19 @@ ifneq ($(linters),)
endif

.PHONY: build
build: build-tools ./runtime/cmd/parse/parse ./runtime/cmd/parse/parse.wasm ./runtime/cmd/check/check ./runtime/cmd/main/main
build: build-tools ./cmd/parse/parse ./cmd/parse/parse.wasm ./cmd/check/check ./cmd/main/main

./runtime/cmd/parse/parse:
go build -o $@ ./runtime/cmd/parse
./cmd/parse/parse:
go build -o $@ ./cmd/parse

./runtime/cmd/parse/parse.wasm:
GOARCH=wasm GOOS=js go build -o $@ ./runtime/cmd/parse
./cmd/parse/parse.wasm:
GOARCH=wasm GOOS=js go build -o $@ ./cmd/parse

./runtime/cmd/check/check:
go build -o $@ ./runtime/cmd/check
./cmd/check/check:
go build -o $@ ./cmd/check

./runtime/cmd/main/main:
go build -o $@ ./runtime/cmd/main
./cmd/main/main:
go build -o $@ ./cmd/main

.PHONY: build-tools
build-tools: build-analysis build-get-contracts
Expand All @@ -60,7 +60,7 @@ ci:
# test all packages
go test -coverprofile=coverage.txt -covermode=atomic -parallel 8 -race -coverpkg $(COVERPKGS) ./...
# run interpreter smoke tests. results from run above are reused, so no tests runs are duplicated
go test -count=5 ./runtime/tests/interpreter/... -runSmokeTests=true -validateAtree=false
go test -count=5 ./tests/interpreter/... -runSmokeTests=true -validateAtree=false
# remove coverage of empty functions from report
sed -i -e 's/^.* 0 0$$//' coverage.txt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package activations

import (
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// Activation is a map of strings to values.
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions runtime/ast/access.go β†’ ast/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"encoding/json"
"strings"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/errors"
)

//go:generate go run golang.org/x/tools/cmd/stringer -type=PrimitiveAccess
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/ast/argument.go β†’ ast/argument.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

type Argument struct {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/ast/attachment.go β†’ ast/attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// AttachmentDeclaration
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/ast/block.go β†’ ast/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

type Block struct {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions runtime/ast/composite.go β†’ ast/composite.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/errors"
)

// ConformingDeclaration
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/composite_test.go β†’ ast/composite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

func TestFieldDeclaration_MarshalJSON(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/conditionkind.go β†’ ast/conditionkind.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ast
import (
"encoding/json"

"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/errors"
)

//go:generate go run golang.org/x/tools/cmd/stringer -type=ConditionKind
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/ast/declaration.go β†’ ast/declaration.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

type Declaration interface {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// EntitlementDeclaration
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions runtime/ast/expression.go β†’ ast/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/errors"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

const NilConstant = "nil"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ package ast
import (
"fmt"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/errors"
)

type VoidExtractor interface {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/errors"
)

type FunctionPurity int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

func TestFunctionDeclaration_MarshalJSON(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/identifier.go β†’ ast/identifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ast
import (
"encoding/json"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// Identifier
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/import.go β†’ ast/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// ImportDeclaration
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/import_test.go β†’ ast/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

func TestImportDeclaration_MarshalJSON(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions runtime/ast/inspector_test.go β†’ ast/inspector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (

"github.com/stretchr/testify/require"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/runtime/tests/examples"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/parser"
"github.com/onflow/cadence/tests/examples"
)

// TestInspector_Elements compares Inspector against Inspect.
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/interface.go β†’ ast/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// InterfaceDeclaration
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/interface_test.go β†’ ast/interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

func TestInterfaceDeclaration_MarshalJSON(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/memberindices.go β†’ ast/memberindices.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ast
import (
"sync"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// programIndices is a container for all indices of members
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

func TestMemberIndices(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/members.go β†’ ast/members.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// Members
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/ast/operation.go β†’ ast/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ast
import (
"encoding/json"

"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/errors"
)

//go:generate go run golang.org/x/tools/cmd/stringer -type=Operation
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/ast/parameter.go β†’ ast/parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

type Parameter struct {
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/parameterlist.go β†’ ast/parameterlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

type ParameterList struct {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/ast/position.go β†’ ast/position.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ast
import (
"fmt"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

var EmptyPosition = Position{}
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/pragma.go β†’ ast/pragma.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

// Pragma
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/ast/program.go β†’ ast/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

type Program struct {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

func TestProgramIndices(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/ast/statement.go β†’ ast/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/turbolent/prettier"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/common"
)

type Statement interface {
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions runtime/ast/string_test.go β†’ ast/string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (

"github.com/stretchr/testify/assert"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/parser"
)

func TestQuoteString(t *testing.T) {
Expand Down
Loading

0 comments on commit 8b904c2

Please sign in to comment.