Skip to content

Commit

Permalink
wip: define workspace and packaging defs
Browse files Browse the repository at this point in the history
  • Loading branch information
millergarym committed Apr 14, 2023
1 parent 8658ee9 commit 9285ba4
Show file tree
Hide file tree
Showing 5 changed files with 419 additions and 2 deletions.
99 changes: 99 additions & 0 deletions adl/stdlib/adlc/packaging.adl
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// This is based on Golang's modules and workspace.
// e.g. see https://go.dev/ref/mod#workspaces

module adlc.packaging {

/// Expected to live in a file named `adl.work.json`
struct AdlWorkspace {
/// Version
String adlc;
AdlPackageRefs use;
};

type AdlPackageRefs = Vector<AdlPackageRef>;

struct AdlPackageRef {
/// must be a path to a directory directly under the folder containing the `adl.work.json` file.
String root;
Vector<GenOptions> genOptions;
};

union GenOptions {
TypescriptGenOptions tsgen;
};


struct TypescriptGenOptions {
ReferenceableScopeOption referenceable = "local";
// Vector<> searchDir;
OutputOpts outputs;
Bool includeRuntime;
Nullable<String> runtimeDir;
Bool generate_transitive;
Bool include_resolver;
TsStyle ts_style = "tsc";
ModuleSrc modules;
Bool capitalize_branch_names_in_types;
Bool capitalize_type_names;
};

struct OutputOpts {
String outputDir;
Nullable<String> manifest = null;
};

union TsStyle {
Void tsc;
Void deno;
};

union ModuleSrc {
Void all;
Vector<String> modules;
};

union ReferenceableScopeOption {
/// Generated code will only be referred internal to the repo
Void local;
/// Generated code can be published via a package manager (e.g. npm)
Void remote;
};

/// Expected to live in a file named `adl.pkg.json`
struct AdlPackage {
PackageDirective pkg;
/// Version
String adlc;
Vector<Require> requires = [];
Vector<Exclude> excludes = [];
Vector<Replace> replaces = [];
Vector<Retract> retracts = [];
};

struct PackageDirective {
String path;
Nullable<String> repo = null;
};

struct Require {
String path;
String version;
Bool indirect = false;
};

struct Exclude {
String path;
String version;
};

struct Replace {
String path;
Nullable<String> version;
};

struct Retract {
String version;
Nullable<String> comment = null;
};

};
2 changes: 1 addition & 1 deletion rust/compiler/genadl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ adlc rust \
--runtime-module adlrt \
--include-rt \
--searchdir $ADL_STDLIB_DIR \
$ADL_STDLIB_DIR/sys/adlast2.adl
$ADL_STDLIB_DIR/sys/adlast2.adl $ADL_STDLIB_DIR/adlc/packaging.adl

ADL_DIR=../../adl

Expand Down
3 changes: 2 additions & 1 deletion rust/compiler/src/adlgen/adlc/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod config;
pub mod config;
pub mod packaging;
Loading

0 comments on commit 9285ba4

Please sign in to comment.