Skip to content

Commit 13c59e9

Browse files
Kelly CampbellKelly Campbell
authored andcommitted
Add wkt timetamp to test protos
1 parent d3aa686 commit 13c59e9

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

src/typescript_proto_library.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ def _get_outputs(target, ctx):
100100
js_outputs_es6 = []
101101
dts_outputs = []
102102
for src in target[ProtoInfo].direct_sources:
103+
# workspace_root is empty for our local workspace, or external/other_workspace
104+
# for @other_workspace//
103105
if ctx.label.workspace_root == "":
104106
file_name = src.basename[:-len(src.extension) - 1]
105107
else:

test/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ts_library(
2424
deps = [
2525
"//test/proto:pizza_service_ts_proto",
2626
"//test/proto/common:delivery_person_ts_proto",
27-
"@npm//@types/jasmine",
27+
"@npm//@types",
2828
],
2929
)
3030

@@ -50,7 +50,7 @@ ts_library(
5050
tsconfig = ":tsconfig.json",
5151
deps = [
5252
"//test/proto/common:delivery_person_ts_proto",
53-
"@npm//@types/jasmine",
53+
"@npm//@types",
5454
# Don't put pizza_ts_proto here, we want to test it is included transitively
5555
],
5656
)
@@ -75,7 +75,7 @@ ts_library(
7575
deps = [
7676
"//test/proto:pizza_service_ts_proto",
7777
"//test/proto/common:pizza_ts_proto",
78-
"@npm//@types/jasmine",
78+
"@npm//@types",
7979
# Don't put delivery_person_ts_proto here, we want to test it is included transitively
8080
],
8181
)

test/commonjs_test.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import deliveryPersonPb = require('rules_typescript_proto/test/proto/common/delivery_person_pb');
1+
import {Timestamp} from 'google-protobuf/google/protobuf/timestamp_pb';
2+
import * as deliveryPersonPb from 'rules_typescript_proto/test/proto/common/delivery_person_pb';
23
import {PizzaService} from 'rules_typescript_proto/test/proto/pizza_service_pb_service';
34

45
describe('CommonJs', () => {
@@ -7,6 +8,9 @@ describe('CommonJs', () => {
78

89
const person = new deliveryPersonPb.DeliveryPerson();
910
person.setName('Doug');
11+
const lastDeliveryTime = new Timestamp();
12+
lastDeliveryTime.fromDate(new Date());
13+
person.setLastDeliveryTime(lastDeliveryTime);
1014
expect(person).toBeDefined();
1115
});
1216

test/proto/common/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ proto_library(
1010
"delivery_person.proto",
1111
],
1212
deps = [
13+
"@com_google_protobuf//:timestamp_proto",
1314
":pizza_proto",
1415
],
1516
)

test/proto/common/delivery_person.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ message DeliveryPerson {
1616
string id = 3;
1717
int64 id_v2 = 4;
1818
}
19+
20+
google.protobuf.Timestamp last_delivery_time = 3;
1921
}

test/tsconfig.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
"noEmitOnError": true,
1616
"types": [
1717
"jasmine"
18-
]
18+
],
19+
"baseUrl": "..",
20+
"paths": {
21+
"rules_typescript_proto/*": [
22+
"*",
23+
"bazel-bin/*"
24+
]
25+
}
26+
1927
}
2028
}

0 commit comments

Comments
 (0)