-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
broken due to bazel-contrib/rules_nodejs#2298
- Loading branch information
zemnmez
committed
Aug 19, 2021
1 parent
4e7a9fc
commit 3c03cc4
Showing
14 changed files
with
381 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = tab | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[BUILD] | ||
indent_style = space | ||
|
||
[*.bzl] | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,87 @@ | ||
load("@npm//@bazel/typescript:index.bzl", "ts_project") | ||
load("@rules_proto//proto:defs.bzl", "proto_library") | ||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | ||
load("@rules_pkg//:pkg.bzl", "pkg_zip") | ||
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") | ||
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library") | ||
|
||
package(default_visibility = [":__subpackages__", "//solve:__subpackages__"]) | ||
|
||
ts_project( | ||
name="gen", | ||
srcs=glob(["*.ts"]), | ||
deps=[ | ||
"@npm//@types/node" | ||
], | ||
tsconfig="//:tsconfig" | ||
) | ||
|
||
nodejs_binary( | ||
name="collate_game_core", | ||
entry_point="collate_game_core.js" | ||
) | ||
|
||
genrule( | ||
name = "gen_core", | ||
srcs = [ "//gen/cultist_data:steam_gen_cultist_out.zip" ], | ||
tools = [ "@bazel_tools//tools/zip:zipper" ], | ||
exec_tools = [ ":collate_game_core" ], | ||
outs = [ "core_en.json" ], | ||
cmd = "$(execpath @bazel_tools//tools/zip:zipper) x $(location //gen/cultist_data:steam_gen_cultist_out.zip) -d $(location :core_en.json)_gamedir_tmp &&" + | ||
"find $@_gamedir_tmp/CS_Data/StreamingAssets/content/core -name '*.json' | xargs ./$(execpath //gen:collate_game_core) > $@", | ||
message = "generating collated game data" | ||
) | ||
|
||
proto_library ( | ||
name = "core_proto", | ||
srcs = [ "core.proto" ], | ||
deps = [ "//proto:cultist_proto", "@com_google_protobuf//:struct_proto" ], | ||
) | ||
|
||
|
||
py_proto_library ( | ||
name = "core_py_proto", | ||
srcs = [ "core.proto" ], | ||
deps = [ "//proto:cultist_py_proto", "@com_google_protobuf//:protobuf_python" ] | ||
) | ||
|
||
typescript_proto_library( | ||
name = "core_ts_proto", | ||
proto = ":core_proto", | ||
) | ||
|
||
py_library ( | ||
name = "core_py", | ||
srcs = [ "core.py" ], | ||
deps = ["//gen:core_py_proto"], | ||
data = [ "//gen:core_en.json" ] | ||
) | ||
|
||
|
||
|
||
|
||
load("@npm//@bazel/typescript:index.bzl", "ts_project") | ||
load("@rules_proto//proto:defs.bzl", "proto_library") | ||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | ||
load("@rules_pkg//:pkg.bzl", "pkg_zip") | ||
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") | ||
|
||
package(default_visibility = [ | ||
":__subpackages__", | ||
"//solve:__subpackages__", | ||
]) | ||
|
||
ts_project( | ||
name = "gen", | ||
srcs = ["collate_game_core.ts"], | ||
declaration = True, | ||
tsconfig = "//:tsconfig", | ||
deps = [ | ||
"@npm//@types/node", | ||
], | ||
) | ||
|
||
nodejs_binary( | ||
name = "collate_game_core", | ||
entry_point = "collate_game_core.js", | ||
) | ||
|
||
genrule( | ||
name = "gen_core", | ||
srcs = ["//gen/cultist_data:steam_gen_cultist_out.zip"], | ||
outs = ["core_en.json"], | ||
cmd = "$(execpath @bazel_tools//tools/zip:zipper) x $(location //gen/cultist_data:steam_gen_cultist_out.zip) -d $(location :core_en.json)_gamedir_tmp &&" + | ||
"find $@_gamedir_tmp/CS_Data/StreamingAssets/content/core -name '*.json' | xargs ./$(execpath //gen:collate_game_core) > $@", | ||
exec_tools = [":collate_game_core"], | ||
message = "generating collated game data", | ||
tools = ["@bazel_tools//tools/zip:zipper"], | ||
) | ||
|
||
proto_library( | ||
name = "core_proto", | ||
srcs = ["core.proto"], | ||
deps = [ | ||
"//proto:cultist_proto", | ||
"@com_google_protobuf//:struct_proto", | ||
], | ||
) | ||
|
||
py_proto_library( | ||
name = "core_py_proto", | ||
srcs = ["core.proto"], | ||
deps = [ | ||
"//proto:cultist_py_proto", | ||
"@com_google_protobuf//:protobuf_python", | ||
], | ||
) | ||
|
||
py_library( | ||
name = "core_py", | ||
srcs = ["core.py"], | ||
data = ["//gen:core_en.json"], | ||
deps = ["//gen:core_py_proto"], | ||
) | ||
|
||
|
||
genrule( | ||
name = "core_en_ts", | ||
srcs = [ "core_en_types.ts", "core_en.json" ], | ||
outs = [ "core_en_ts.ts" ], | ||
cmd = " ".join([ | ||
"cat", | ||
"<(echo '// @ts-nocheck')", | ||
"$(location core_en_types.ts)", | ||
"<(echo 'export default (')", | ||
"$(location core_en.json)", | ||
"<(echo ');')" | ||
]) + " > $@" | ||
) | ||
|
||
|
||
ts_project( | ||
name = "core_en_ts_js", | ||
srcs = ["core_en_ts.ts"], | ||
tsconfig="//:tsconfig", | ||
declaration = True, | ||
deps = [ | ||
"@npm//@types/node", | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
import fs from 'fs'; | ||
|
||
// ts proto generation seems bad outside | ||
// the google spaceship so this'll have to do | ||
|
||
export interface Core { | ||
cultures: Culture[], | ||
decks: Deck[], | ||
elements: Element[], | ||
verbs: Verb[], | ||
/** @deprecated in-game typo */ | ||
legcies: Legacy[], | ||
legacies: Legacy[], | ||
settings: Setting[], | ||
recipes: Recipe[] | ||
endings: unknown[] | ||
} | ||
|
||
export interface Culture { | ||
id: string, | ||
fontscript?: string, | ||
released?: boolean, | ||
endonym?: string, | ||
exonym?: string, | ||
uilabels?: unknown, | ||
boldallowed?: boolean | ||
} | ||
|
||
export interface Deck { | ||
id: string, | ||
description?: string, | ||
label?: string, | ||
resetonexhaustion?: boolean, | ||
spec?: string[], | ||
draws?: number[], | ||
defaultcard?: string, | ||
comments?: string | ||
drawmessages?: Record<string, string> | ||
} | ||
|
||
export interface Element { | ||
id: string, | ||
isAspect?: boolean, | ||
isHidden?: boolean, | ||
label?: string, | ||
icon?: string, | ||
unique?: boolean, | ||
xtriggers?: { | ||
[key: string]: unknown | ||
}, | ||
description?: string, | ||
aspects?: { [elementId: string]: number }, | ||
lifetime?: number, | ||
uniquenessgroup?: string, | ||
slots?: Slot[], | ||
decayTo?: string, | ||
comments?: string, | ||
resaturate?: boolean, | ||
lever?: string, | ||
noartneeded?: boolean, | ||
induces?: Induction[], | ||
verbicon?: string, | ||
inherits?: string | ||
} | ||
|
||
export interface Induction { | ||
id: string, | ||
chance: number | ||
} | ||
|
||
export interface Recipe { | ||
id: string, | ||
actionid?: string, | ||
aspects?: { [elementid: string]: number }, | ||
requirements?: unknown, | ||
description?: string, | ||
label?: string, | ||
warmup?: number, | ||
craftable?: boolean, | ||
alt?: Recipe[], | ||
slots?: Slot[], | ||
startdescription?: string, | ||
comments?: string, | ||
mutations?: Mutation[], | ||
maxexecutions?: number, | ||
linked?: Recipe[], | ||
tablereqs?: { [aspect: string]: number}, | ||
effects?: { [aspect: string]: number | string}, | ||
deckeffects?: { [aspect: string]: number | string}, | ||
burnimage?: string, | ||
extantreqs?: { [aspect: string]: number | string}, | ||
hintonly?: boolean, | ||
ending?: string, | ||
signalEndingFlavour?: string, | ||
purge?: { [aspect: string]: number | string}, | ||
deleteverb?: { [aspect: string]: number | string}, | ||
haltverb?: { [aspect: string]: number | string}, | ||
chance?: number, | ||
additional?: boolean, | ||
expulsion?: Expulsion, | ||
challenges?: { [kind: string]: string }, | ||
signalimportantloop?: boolean | ||
} | ||
|
||
export interface Mutation { | ||
filter?: string, | ||
level?: number, | ||
mutate?: string, | ||
additive?: boolean | ||
} | ||
|
||
export interface Expulsion { | ||
limit?: number, | ||
filter?: { [key: string]: number } | ||
} | ||
|
||
export interface Slot { | ||
id: string, | ||
label?: string, | ||
description?: string, | ||
required?: {[kind:string]: number}, | ||
forbidden?: {[kind:string]: number}, | ||
greedy?: boolean, | ||
actionid?: string, | ||
consumes?: boolean, | ||
noanim?: boolean | ||
} | ||
|
||
export interface Verb { | ||
id: string, | ||
description?: string, | ||
slots?: Slot[], | ||
label?: string, | ||
slot?: Slot | ||
} | ||
|
||
export interface Legacy { | ||
id: string, | ||
label?: string, | ||
fromending?: string, | ||
description?: string, | ||
startdescription?: string, | ||
effects?: { [key: string]: number}, | ||
image?: string, | ||
startingverbid?: string, | ||
newstart?: boolean, | ||
availableWithoutEndingMatch?: boolean, | ||
tablecoverimage?: string, | ||
excludesOnEnding?: string[] | ||
statusbarelements?: string[] | ||
} | ||
|
||
export interface Setting { | ||
id: string, | ||
tabid?: string, | ||
hint?: string, | ||
datatype?: string, | ||
minvalue?: number, | ||
maxvalue?: number, | ||
defaultvalue?: string, | ||
valuelabels?: Record<number, string> | ||
} | ||
|
||
|
||
|
||
/* | ||
let _core: Promise<Core> | undefined; | ||
export const core: () => Promise<Core> = async () => { | ||
if (_core === undefined) _core = await fs.promises.readFile('core_en.json') | ||
.then(b => JSON.parse(b.toString('utf-8'))); | ||
return _core!; | ||
} | ||
export default core; | ||
*/ |
Oops, something went wrong.