Skip to content

Commit

Permalink
move embedded_sys_loader details into packaging.adl
Browse files Browse the repository at this point in the history
  • Loading branch information
millergarym committed Apr 20, 2023
1 parent c8c980e commit ac20a81
Show file tree
Hide file tree
Showing 17 changed files with 293 additions and 184 deletions.
7 changes: 3 additions & 4 deletions adl/adl.work.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"adlc": "0.0.0",
"use_embedded_sys_loader": true,
"runtimes": [
{
"ts_runtime": {
"outputDir": "../generated/typescript/tests"
"output_dir": "../generated/typescript/tests"
}
}
],
Expand Down Expand Up @@ -32,11 +31,11 @@
"ts_opts": {
"npm_pkg_name": "@adl-lang/protoclient",
"runtime_opts": {
"packageRef": "@adl-lang/runtime"
"package_ref": {"name": "@adl-lang/runtime", "version": "1.0.0"}
},
"outputs": {
"gen": {
"outputDir": "../generated/typescript/tests/test31/src",
"output_dir": "../generated/typescript/tests/test31/src",
"manifest": "../generated/typescript/tests/test31/.adl-manifest"
}
},
Expand Down
28 changes: 14 additions & 14 deletions adl/adl.work2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"runtimes": [
{
"ts_runtime": {
"outputDir": "../generated2/runtime",
"output_dir": "../generated2/runtime",
"npm_pkg_name": "@adl-lang/runtime"
}
}
Expand All @@ -14,16 +14,16 @@
"path": "./adlc",
"ts_opts": {
"npm_pkg_name": "@adl-lang/adlc",
"extraDevDependencies": {
"extra_dev_dependencies": {
"tsconfig": "workspace:*",
"typescript": "^4.9.3"
},
"runtime_opts": {
"workspaceRef": "@adl-lang/runtime"
"workspace_ref": "@adl-lang/runtime"
},
"outputs": {
"gen": {
"outputDir": "../generated2/adlc",
"output_dir": "../generated2/adlc",
"manifest": "../generated2/adlc/.adl-manifest"
}
},
Expand All @@ -34,16 +34,16 @@
"path": "./tests/test31/lib",
"ts_opts": {
"npm_pkg_name": "@adl-lang/common",
"extraDevDependencies": {
"extra_dev_dependencies": {
"tsconfig": "workspace:*",
"typescript": "^4.9.3"
},
"runtime_opts": {
"workspaceRef": "@adl-lang/runtime"
"workspace_ref": "@adl-lang/runtime"
},
"outputs": {
"gen": {
"outputDir": "../generated2/common",
"output_dir": "../generated2/common",
"manifest": "../generated2/common/.adl-manifest",
"strip_first": false
}
Expand All @@ -55,16 +55,16 @@
"path": "./stdlib",
"ts_opts": {
"npm_pkg_name": "@adl-lang/sys",
"extraDevDependencies": {
"extra_dev_dependencies": {
"tsconfig": "workspace:*",
"typescript": "^4.9.3"
},
"runtime_opts": {
"workspaceRef": "@adl-lang/runtime"
"workspace_ref": "@adl-lang/runtime"
},
"outputs": {
"gen": {
"outputDir": "../generated2/sys",
"output_dir": "../generated2/sys",
"manifest": "../generated2/sys/.adl-manifest"
}
},
Expand All @@ -75,19 +75,19 @@
"path": "./tests/test31/proj",
"ts_opts": {
"npm_pkg_name": "@adl-lang/protoclient",
"extraDependencies": {
"extra_dependencies": {
"base64-js": "^1.5.1"
},
"extraDevDependencies": {
"extra_dev_dependencies": {
"tsconfig": "workspace:*",
"typescript": "^4.9.3"
},
"runtime_opts": {
"workspaceRef": "@adl-lang/runtime"
"workspace_ref": "@adl-lang/runtime"
},
"outputs": {
"gen": {
"outputDir": "../generated2/test31",
"output_dir": "../generated2/test31",
"manifest": "../generated2/test31/.adl-manifest"
}
},
Expand Down
51 changes: 51 additions & 0 deletions adl/adl.work3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"adlc": "0.0.0",
"use_embedded_sys_loader": true,
"runtimes": [
],
"use": [
{
"path": "./adlc",
"ts_opts": {
"npm_pkg_name": "@adl-lang/adlc"
}
},
{
"path": "./tests/test31/lib",
"ts_opts": {
"npm_pkg_name": "@adl-lang/common"
}
},
{
"path": "./stdlib",
"ts_opts": {
"npm_pkg_name": "@adl-lang/sys"
}
},
{
"path": "./tests/test31/proj",
"ts_opts": {
"npm_pkg_name": "@adl-lang/protoclient",
"generate_transitive": true,
"extra_dependencies": {
"base64-js": "^1.5.1"
},
"extra_dev_dependencies": {
"tsconfig": "workspace:*",
"typescript": "^4.9.3"
},
"runtime_opts": {
"generate": {}
},
"outputs": {
"gen": {
"output_dir": "../generated3/test31",
"manifest": "../generated3/test31/.adl-manifest",
"strip_first": false
}
},
"include_resolver": true
}
}
]
}
2 changes: 1 addition & 1 deletion adl/adlc/adl.pkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"path" : "github.com/adl-lang/adl/adl/adlc",
"globalAlias": "adlc",
"global_alias": "adlc",
"adlc": "0.0.0",
"requires": [
{
Expand Down
56 changes: 45 additions & 11 deletions adl/adlc/adlc/packaging.adl
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,49 @@ struct AdlWorkspace<T> {
String adlc;
Vector<T> use;
Vector<RuntimeOpts> runtimes = [];
Bool use_embedded_sys_loader = true;
};
Nullable<Payload1> embedded_sys_loader = {
"p_ref": {
"path": "",
"ts_opts": {
"npm_pkg_name": "@adl-lang/sys",
"npm_version": "1.0.0",
"extra_dependencies": {
"base64-js": "^1.5.1"
},
"extra_dev_dependencies": {
"tsconfig": "workspace:*",
"typescript": "^4.9.3"
}
}
},
"pkg": {
"path": "github.com/adl-lang/adl/adl/stdlib/sys",
"global_alias": "sys",
"adlc": "0.0.0"
}
};
};

// struct EmbeddedSysLoaderOpt {
// AdlPackageRef p_ref;
// AdlPackage pkg;
// // String npm_pkg_name;
// // String npm_version = "1.0.0";
// // TsStyle ts_style = "tsc";
// // StringMap<String> dependencies = {};
// // StringMap<String> devDependencies = {};
// };

union RuntimeOpts {
TsWriteRuntime ts_runtime;
};

struct TsWriteRuntime {
String outputDir;
String output_dir;
ReferenceableScopeOption referenceable = "local";
String npm_pkg_name = "@adl-lang/runtime";
TsStyle ts_style = "tsc";
Bool strip_first = true;
};

// key must be a path to a directory directly under the folder containing the `adl.work.json` file.
Expand All @@ -55,10 +86,10 @@ struct AdlPackageRef {
struct TypescriptGenOptions {
String npm_pkg_name;
String npm_version = "1.0.0";
StringMap<VersionSpec> extraDependencies = {};
StringMap<VersionSpec> extraDevDependencies = {};
StringMap<VersionSpec> extra_dependencies = {};
StringMap<VersionSpec> extra_dev_dependencies = {};
Nullable<OutputOpts> outputs = null;
TsRuntimeOpt runtime_opts = { "packageRef": {"name": "@adl-lang/runtime", "version": "^1.0.0"} };
TsRuntimeOpt runtime_opts = { "package_ref": {"name": "@adl-lang/runtime", "version": "^1.0.0"} };
Bool generate_transitive = false;
Bool include_resolver = false;
TsStyle ts_style = "tsc";
Expand All @@ -80,8 +111,8 @@ union InjectAnnotation {
};

union TsRuntimeOpt {
String workspaceRef;
NpmPackageRef packageRef;
String workspace_ref;
NpmPackageRef package_ref;
TsGenRuntime generate;
};

Expand All @@ -100,9 +131,11 @@ union OutputOpts {

struct GenOutput {
ReferenceableScopeOption referenceable = "local";
String outputDir;
String output_dir;
Nullable<String> manifest = null;
/// When creating the path for output ts files delete the first part of the module name
/// This needs to be false for "generate_transitive" and
/// packages like "common" where the module and directory at the top level named the same.
Bool strip_first = true;
};

Expand All @@ -126,7 +159,7 @@ union ReferenceableScopeOption {
/// Expected to live in a file named `adl.pkg.json`
struct AdlPackage {
String path;
Nullable<String> globalAlias = null;
Nullable<String> global_alias = null;
/// Version
String adlc;
Vector<Require> requires = [];
Expand Down Expand Up @@ -171,7 +204,8 @@ struct NpmPackage {
String version;
StringMap<String> scripts = {};
StringMap<String> dependencies = {};
StringMap<String> devDependencies = {};
@SerializedName "devDependencies"
StringMap<String> dev_dependencies = {};
};

// union DependencySpec {
Expand Down
2 changes: 1 addition & 1 deletion adl/stdlib/adl.pkg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"path" : "github.com/adl-lang/adl/adl/stdlib/sys",
"globalAlias": "sys",
"global_alias": "sys",
"adlc": "0.0.0"
}
2 changes: 1 addition & 1 deletion adl/tests/test31/lib/adl.pkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"path" : "github.com/adl-lang/adl/adl/tests/test31/lib",
"globalAlias": "common",
"global_alias": "common",
"adlc": "0.0.0",
"requires": [
{
Expand Down
2 changes: 1 addition & 1 deletion adl/tests/test31/proj/adl.pkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"path": "github.com/adl-lang/adl/adl/tests/test31/proj",
"globalAlias": "protoclient",
"global_alias": "protoclient",
"adlc": "0.0.0",
"requires": [
{
Expand Down
8 changes: 7 additions & 1 deletion adl/tests/test31/proj/protoclient/protoapp/api.adl
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ import protoclient.protoapp.db.AppUser;
import protoclient.protoapp.db.AppUserId;
import protoclient.protoapp.db.MessageId;

struct X<A> {

};

/// The app API
struct ApiRequests {
Map imamap;
X<String> x;
// Vector y;
Map<String,String> imamap;
/// Login a user
HttpPost<String, Vector<StringMap<Int64>>> with_prim = {
"path": "/login",
Expand Down
Loading

0 comments on commit ac20a81

Please sign in to comment.