Skip to content

Commit

Permalink
generating ts in folders for each adl package
Browse files Browse the repository at this point in the history
  • Loading branch information
millergarym committed Apr 19, 2023
1 parent a00210b commit 8aa3ac5
Show file tree
Hide file tree
Showing 19 changed files with 494 additions and 210 deletions.
17 changes: 15 additions & 2 deletions adl/adl.work.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"adlc": "0.0.0",
"use_embedded_sys_loader": true,
"runtimes": [
{
"ts_runtime": {
"outputDir": "../generated/typescript/tests"
}
}
],
"use": [
{
"path": "./adlc"
"path": "./adlc",
"ts_opts": {
"npm_pkg_name": "@adl-lang/adlc"
}
},
{
"path": "./tests/test31/lib",
Expand All @@ -21,6 +31,9 @@
"path": "./tests/test31/proj",
"ts_opts": {
"npm_pkg_name": "@adl-lang/protoclient",
"runtime_opts": {
"packageRef": "@adl-lang/runtime"
},
"outputs": {
"gen": {
"outputDir": "../generated/typescript/tests/test31/src",
Expand All @@ -31,4 +44,4 @@
}
}
]
}
}
68 changes: 68 additions & 0 deletions adl/adl.work2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"adlc": "0.0.0",
"use_embedded_sys_loader": true,
"runtimes": [
{
"ts_runtime": {
"outputDir": "../generated2/typescript/tests"
}
}
],
"use": [
{
"path": "./adlc",
"ts_opts": {
"npm_pkg_name": "@adl-lang/adlc",
"outputs": {
"gen": {
"outputDir": "../generated2/typescript/tests",
"manifest": "../generated2/typescript/tests/adlc/.adl-manifest"
}
},
"include_resolver": false
}
},
{
"path": "./tests/test31/lib",
"ts_opts": {
"npm_pkg_name": "@adl-lang/common",
"outputs": {
"gen": {
"outputDir": "../generated2/typescript/tests",
"manifest": "../generated2/typescript/tests/common/.adl-manifest"
}
},
"include_resolver": false
}
},
{
"path": "./stdlib",
"ts_opts": {
"npm_pkg_name": "@adl-lang/sys",
"outputs": {
"gen": {
"outputDir": "../generated2/typescript/tests",
"manifest": "../generated2/typescript/tests/sys/.adl-manifest"
}
},
"include_resolver": false
}
},
{
"path": "./tests/test31/proj",
"ts_opts": {
"npm_pkg_name": "@adl-lang/protoclient",
"runtime_opts": {
"packageRef": "@adl-lang/runtime"
},
"outputs": {
"gen": {
"outputDir": "../generated2/typescript/tests/test31/src",
"manifest": "../generated2/typescript/tests/test31/.adl-manifest"
}
},
"include_resolver": true
}
}
]
}
46 changes: 39 additions & 7 deletions adl/adlc/adlc/packaging.adl
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ struct Payload2 {
struct AdlWorkspace<T> {
String adlc;
Vector<T> use;
Vector<RuntimeOpts> runtimes = [];
Bool use_embedded_sys_loader = true;
};

union RuntimeOpts {
TsWriteRuntime ts_runtime;
};

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

// key must be a path to a directory directly under the folder containing the `adl.work.json` file.
// type AdlPackageRefs = StringMap<AdlPackageRef>;

Expand All @@ -42,7 +54,7 @@ struct AdlPackageRef {

struct TypescriptGenOptions {
Nullable<String> npm_pkg_name;
OutputOpts outputs = { "ref": {}};
Nullable<OutputOpts> outputs = null;
TsRuntimeOpt runtime_opts = { "packageRef": "@adl-lang/runtime" };
Bool generate_transitive = false;
Bool include_resolver = false;
Expand Down Expand Up @@ -70,16 +82,17 @@ union TsRuntimeOpt {
};

struct TsGenRuntime {
String runtimeDir;
// this is currently hardcoded to "./runtime"
// String runtimeDir;
};

union OutputOpts {
GenOutput gen;
PkgRef ref;
// PkgRef ref;
};

struct PkgRef {
};
// struct PkgRef {
// };

struct GenOutput {
ReferenceableScopeOption referenceable = "local";
Expand Down Expand Up @@ -122,11 +135,16 @@ struct PackageDirective {
};

struct Require {
String path;
String version;
PkgRef ref;
Nullable<String> version = null;
Bool indirect = false;
};

union PkgRef {
String path;
String alias;
};

struct Exclude {
String path;
String version;
Expand All @@ -142,4 +160,18 @@ struct Retract {
Nullable<String> comment = null;
};

struct NpmPackage {
String name;
StringMap<String> scripts;
StringMap<DependencySpec> dependencies;
StringMap<DependencySpec> devDependencies;
};

union DependencySpec {
Void workspace;
VersionSpec semverSpec;
};

type VersionSpec = String;

};
3 changes: 0 additions & 3 deletions adl/tests/test31/lib/common/flyway/api.adl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
@NpmPackage "@adl-lang/common"
module common.flyway.api {

import adlc.config.typescript.*;

import common.flyway.internals.FlywayAction;
import common.flyway.internals.FlywayContext;
import common.http.HttpPost;
Expand Down
3 changes: 0 additions & 3 deletions adl/tests/test31/lib/common/flyway/internals.adl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
@NpmPackage "@adl-lang/common"
module common.flyway.internals {

import adlc.config.typescript.*;

struct FlywayCommand {
FlywayContext ctx;
/// The action to take on application startup
Expand Down
16 changes: 14 additions & 2 deletions adl/tests/test31/proj/adl.pkg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"path" : "github.com/adl-lang/adl/adl/tests/test31/proj",
"path": "github.com/adl-lang/adl/adl/tests/test31/proj",
"globalAlias": "protoclient",
"adlc": "0.0.0"
"adlc": "0.0.0",
"requires": [
{
"ref": {
"alias": "sys"
}
},
{
"ref": {
"alias": "common"
}
}
]
}
Loading

0 comments on commit 8aa3ac5

Please sign in to comment.