engine: flatten out src/

master
q3k 2021-07-11 00:46:57 +00:00
parent 982f5e23db
commit 832218c6a5
34 changed files with 65 additions and 65 deletions

View File

@ -13,38 +13,38 @@ rust_library(
"-Zborrowck=mir", "-Zborrowck=mir",
], ],
srcs = [ srcs = [
"src/lib.rs", "lib.rs",
"src/globals.rs", "globals.rs",
"src/input.rs", "input.rs",
"src/scripting.rs", "scripting.rs",
"src/physics/mod.rs", "physics/mod.rs",
"src/physics/color.rs", "physics/color.rs",
"src/render/mod.rs", "render/mod.rs",
"src/render/light.rs", "render/light.rs",
"src/render/material.rs", "render/material.rs",
"src/render/mesh.rs", "render/mesh.rs",
"src/render/renderable.rs", "render/renderable.rs",
"src/render/resource.rs", "render/resource.rs",
"src/render/vulkan/mod.rs", "render/vulkan/mod.rs",
"src/render/vulkan/data.rs", "render/vulkan/data.rs",
"src/render/vulkan/material.rs", "render/vulkan/material.rs",
"src/render/vulkan/pipeline.rs", "render/vulkan/pipeline.rs",
"src/render/vulkan/pipeline_forward.rs", "render/vulkan/pipeline_forward.rs",
"src/render/vulkan/qfi.rs", "render/vulkan/qfi.rs",
"src/render/vulkan/shaders.rs", "render/vulkan/shaders.rs",
"src/render/vulkan/surface_binding.rs", "render/vulkan/surface_binding.rs",
"src/render/vulkan/swapchain_binding.rs", "render/vulkan/swapchain_binding.rs",
"src/render/vulkan/worker.rs", "render/vulkan/worker.rs",
"src/util/mod.rs", "util/mod.rs",
"src/util/counter.rs", "util/counter.rs",
"src/util/file.rs", "util/file.rs",
"src/util/profiler.rs", "util/profiler.rs",
"src/util/resourcemap.rs", "util/resourcemap.rs",
], ],
deps = [ deps = [
"//lib/ecs", "//lib/ecs",

View File

@ -33,7 +33,7 @@ pub struct Omni {
impl Omni { impl Omni {
/// Make a test light. This has... a color. It's kinda yellow. And something close to 650 /// Make a test light. This has... a color. It's kinda yellow. And something close to 650
/// lumens of luminous power. /// lumens of luminous power.
// TODO(q3k): implement [Kry85] (eq. 68) somewhere in //engine/src/physics for generation // TODO(q3k): implement [Kry85] (eq. 68) somewhere in //engine/physics for generation
// of nice lights colours from color temperature. // of nice lights colours from color temperature.
// //
// [Kry85] // [Kry85]

View File

@ -70,7 +70,7 @@ impl std::io::Seek for Resource {
} }
/// ReleaseFiles is a file/resource accessible for abrasion releases build via /// ReleaseFiles is a file/resource accessible for abrasion releases build via
/// //engine/release. /// //tools/release.
struct ReleaseFiles { struct ReleaseFiles {
} }

View File

@ -1,5 +1,5 @@
load("@rules_rust//rust:rust.bzl", "rust_binary") load("@rules_rust//rust:rust.bzl", "rust_binary")
load("//engine/release:defs.bzl", "abrasion_release") load("//tools/release:defs.bzl", "abrasion_release")
rust_binary( rust_binary(
name = "hsvr", name = "hsvr",

View File

@ -4,9 +4,9 @@ go_binary(
name = "pack", name = "pack",
srcs = ["pack.go"], srcs = ["pack.go"],
deps = [ deps = [
"//engine/release/proto:manifest_go_proto", "//tools/release/proto:manifest_go_proto",
"@org_golang_google_protobuf//encoding/prototext", "@org_golang_google_protobuf//encoding/prototext",
"@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//proto",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

View File

@ -9,7 +9,7 @@ def _abrasion_release_impl(ctx):
runfiles = [rf for rf in runfiles if not rf.path.endswith(".rs")] runfiles = [rf for rf in runfiles if not rf.path.endswith(".rs")]
runfiles = [rf for rf in runfiles if not rf.path == main.path] runfiles = [rf for rf in runfiles if not rf.path == main.path]
# Proprietary little manifest format, for //engine/release/pack.go to use. # Proprietary little manifest format, for //tools/release/pack.go to use.
runfile_manifest = ctx.actions.declare_file(ctx.attr.name + "-manifest.text.pb") runfile_manifest = ctx.actions.declare_file(ctx.attr.name + "-manifest.text.pb")
ctx.actions.write(runfile_manifest, proto.encode_text(struct(file = [ ctx.actions.write(runfile_manifest, proto.encode_text(struct(file = [
struct(short_path=rf.short_path, path=rf.path) struct(short_path=rf.short_path, path=rf.path)
@ -45,7 +45,7 @@ abrasion_release = rule(
"_pack": attr.label( "_pack": attr.label(
executable = True, executable = True,
cfg = "exec", cfg = "exec",
default = Label("//engine/release:pack"), default = Label("//tools/release:pack"),
), ),
} }
) )

View File

@ -5,42 +5,42 @@ import (
"crypto/sha256" "crypto/sha256"
"flag" "flag"
"fmt" "fmt"
"io/ioutil"
"log" "log"
"os" "os"
"io/ioutil"
"sort" "sort"
"google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
pb "abrasion/engine/release/proto" pb "abrasion/tools/release/proto"
) )
var ( var (
flagManifest string flagManifest string
flagExe string flagExe string
flagZip string flagZip string
) )
func packFile(w *zip.Writer, file *pb.File) error { func packFile(w *zip.Writer, file *pb.File) error {
fo, err := w.Create(file.ShortPath) fo, err := w.Create(file.ShortPath)
if err != nil { if err != nil {
return fmt.Errorf("Create: %w", err) return fmt.Errorf("Create: %w", err)
} }
// TODO(q3k): maybe don't read this into memory... // TODO(q3k): maybe don't read this into memory...
data, err := ioutil.ReadFile(file.Path) data, err := ioutil.ReadFile(file.Path)
if err != nil { if err != nil {
return fmt.Errorf("Open: %w", err) return fmt.Errorf("Open: %w", err)
} }
h := sha256.Sum256(data) h := sha256.Sum256(data)
file.Sha256 = h[:] file.Sha256 = h[:]
_, err = fo.Write(data) _, err = fo.Write(data)
if err != nil { if err != nil {
return fmt.Errorf("Write: %w", err) return fmt.Errorf("Write: %w", err)
} }
// We don't need this in the release manifest. // We don't need this in the release manifest.
file.Path = "" file.Path = ""
return nil return nil
} }
func main() { func main() {
@ -81,7 +81,7 @@ func main() {
// Pack engine // Pack engine
engine := pb.File{ engine := pb.File{
ShortPath: "abrasion.exe", ShortPath: "abrasion.exe",
Path: flagExe, Path: flagExe,
} }
if err := packFile(w, &engine); err != nil { if err := packFile(w, &engine); err != nil {
log.Fatalf("Failed to pack engine: %v", err) log.Fatalf("Failed to pack engine: %v", err)
@ -99,4 +99,4 @@ func main() {
if _, err := mo.Write(manifestBytes); err != nil { if _, err := mo.Write(manifestBytes); err != nil {
log.Fatalf("Failed to write manifest: %v", err) log.Fatalf("Failed to write manifest: %v", err)
} }
} }

View File

@ -8,7 +8,7 @@ proto_library(
go_proto_library( go_proto_library(
name = "manifest_go_proto", name = "manifest_go_proto",
importpath = "abrasion/engine/release/proto", importpath = "abrasion/tools/release/proto",
protos = [":manifest_proto"], protos = [":manifest_proto"],
visibility = ["//engine/release:__pkg__"], visibility = ["//tools/release:__pkg__"],
) )

View File

@ -1,6 +1,6 @@
syntax = "proto3"; syntax = "proto3";
package abrasion.engine.release.proto; package abrasion.tools.release.proto;
option go_package = "abrasion/engine/release/proto"; option go_package = "abrasion/tools/release/proto";
message File { message File {
string short_path = 1; string short_path = 1;
@ -15,4 +15,4 @@ message Manifest {
message ReleaseInfo { message ReleaseInfo {
string target = 1; string target = 1;
} }