Skip to content

Commit

Permalink
build: make update-license script work on Windows (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Jan 2, 2020
1 parent b49698a commit 191d3b8
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 93 deletions.
2 changes: 1 addition & 1 deletion dev/protos/firestore_admin_v1_proto_api.d.ts
@@ -1,5 +1,5 @@
/*!
* Copyright 2019 Google LLC
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/protos/firestore_admin_v1_proto_api.js
@@ -1,5 +1,5 @@
/*!
* Copyright 2019 Google LLC
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions dev/protos/firestore_v1_proto_api.d.ts
@@ -1,5 +1,5 @@
/*!
* Copyright 2019 Google LLC
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -3278,10 +3278,6 @@ export namespace google {
public direction: google.firestore.v1.StructuredQuery.Direction;
}

/** Direction enum. */
type Direction =
"DIRECTION_UNSPECIFIED"| "ASCENDING"| "DESCENDING";

/** Properties of a FieldReference. */
interface IFieldReference {

Expand Down Expand Up @@ -3321,6 +3317,10 @@ export namespace google {
/** Projection fields. */
public fields: google.firestore.v1.StructuredQuery.IFieldReference[];
}

/** Direction enum. */
type Direction =
"DIRECTION_UNSPECIFIED"| "ASCENDING"| "DESCENDING";
}

/** Properties of a Cursor. */
Expand Down
34 changes: 17 additions & 17 deletions dev/protos/firestore_v1_proto_api.js
@@ -1,5 +1,5 @@
/*!
* Copyright 2019 Google LLC
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -5705,22 +5705,6 @@ $root.google = (function() {
return Order;
})();

/**
* Direction enum.
* @name google.firestore.v1.StructuredQuery.Direction
* @enum {number}
* @property {string} DIRECTION_UNSPECIFIED=DIRECTION_UNSPECIFIED DIRECTION_UNSPECIFIED value
* @property {string} ASCENDING=ASCENDING ASCENDING value
* @property {string} DESCENDING=DESCENDING DESCENDING value
*/
StructuredQuery.Direction = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "DIRECTION_UNSPECIFIED"] = "DIRECTION_UNSPECIFIED";
values[valuesById[1] = "ASCENDING"] = "ASCENDING";
values[valuesById[2] = "DESCENDING"] = "DESCENDING";
return values;
})();

StructuredQuery.FieldReference = (function() {

/**
Expand Down Expand Up @@ -5792,6 +5776,22 @@ $root.google = (function() {
return Projection;
})();

/**
* Direction enum.
* @name google.firestore.v1.StructuredQuery.Direction
* @enum {number}
* @property {string} DIRECTION_UNSPECIFIED=DIRECTION_UNSPECIFIED DIRECTION_UNSPECIFIED value
* @property {string} ASCENDING=ASCENDING ASCENDING value
* @property {string} DESCENDING=DESCENDING DESCENDING value
*/
StructuredQuery.Direction = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "DIRECTION_UNSPECIFIED"] = "DIRECTION_UNSPECIFIED";
values[valuesById[1] = "ASCENDING"] = "ASCENDING";
values[valuesById[2] = "DESCENDING"] = "DESCENDING";
return values;
})();

return StructuredQuery;
})();

Expand Down
2 changes: 1 addition & 1 deletion dev/protos/firestore_v1beta1_proto_api.d.ts
@@ -1,5 +1,5 @@
/*!
* Copyright 2019 Google LLC
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/protos/firestore_v1beta1_proto_api.js
@@ -1,5 +1,5 @@
/*!
* Copyright 2019 Google LLC
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
26 changes: 10 additions & 16 deletions dev/protos/google/firestore/v1/firestore.proto
Expand Up @@ -40,20 +40,12 @@ option php_namespace = "Google\\Cloud\\Firestore\\V1";

// The Cloud Firestore service.
//
// This service exposes several types of comparable timestamps:
//
// * `create_time` - The time at which a document was created. Changes only
// when a document is deleted, then re-created. Increases in a strict
// monotonic fashion.
// * `update_time` - The time at which a document was last updated. Changes
// every time a document is modified. Does not change when a write results
// in no modifications. Increases in a strict monotonic fashion.
// * `read_time` - The time at which a particular state was observed. Used
// to denote a consistent snapshot of the database or the time at which a
// Document was observed to not exist.
// * `commit_time` - The time at which the writes in a transaction were
// committed. Any read with an equal or greater `read_time` is guaranteed
// to see the effects of the transaction.
// Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL
// document database that simplifies storing, syncing, and querying data for
// your mobile, web, and IoT apps at global scale. Its client libraries provide
// live synchronization and offline support, while its security features and
// integrations with Firebase and Google Cloud Platform (GCP) accelerate
// building truly serverless apps.
service Firestore {
option (google.api.default_host) = "firestore.googleapis.com";
option (google.api.oauth_scopes) =
Expand Down Expand Up @@ -425,7 +417,8 @@ message CommitResponse {
// request.
repeated WriteResult write_results = 1;

// The time at which the commit occurred.
// The time at which the commit occurred. Any read with an equal or greater
// `read_time` is guaranteed to see the effects of the commit.
google.protobuf.Timestamp commit_time = 2;
}

Expand Down Expand Up @@ -566,7 +559,8 @@ message WriteResponse {
// request.
repeated WriteResult write_results = 3;

// The time at which the commit occurred.
// The time at which the commit occurred. Any read with an equal or greater
// `read_time` is guaranteed to see the effects of the write.
google.protobuf.Timestamp commit_time = 4;
}

Expand Down
24 changes: 12 additions & 12 deletions dev/protos/google/firestore/v1/query.proto
Expand Up @@ -155,18 +155,6 @@ message StructuredQuery {
Direction direction = 2;
}

// A sort direction.
enum Direction {
// Unspecified.
DIRECTION_UNSPECIFIED = 0;

// Ascending.
ASCENDING = 1;

// Descending.
DESCENDING = 2;
}

// A reference to a field, such as `max(messages.time) as max_time`.
message FieldReference {
string field_path = 2;
Expand All @@ -181,6 +169,18 @@ message StructuredQuery {
repeated FieldReference fields = 2;
}

// A sort direction.
enum Direction {
// Unspecified.
DIRECTION_UNSPECIFIED = 0;

// Ascending.
ASCENDING = 1;

// Descending.
DESCENDING = 2;
}

// The projection to return.
Projection select = 1;

Expand Down
38 changes: 0 additions & 38 deletions dev/protos/insert-license.sh

This file was deleted.

2 changes: 1 addition & 1 deletion dev/protos/update.sh
Expand Up @@ -108,7 +108,7 @@ PBJS_ARGS=( --proto_path=. \
"${PROTOS_DIR}/google/longrunning/*.proto"
"${PBTS}" -o firestore_v1beta1_proto_api.d.ts firestore_v1beta1_proto_api.js

"${PROTOS_DIR}"/insert-license.sh *.d.ts *.js
node "${PROTOS_DIR}"/../../scripts/license.js *.d.ts *.js

# Copy typings into source repo
cp {firestore_v1_proto_api.d.ts,firestore_v1_proto_api.js} ${PROTOS_DIR}
Expand Down
39 changes: 39 additions & 0 deletions scripts/license.js
@@ -0,0 +1,39 @@
/*!
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const fs = require('fs');

const LICENSE_HEADER = `/*!
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
`;

for (const file of process.argv.slice(2)) {
const content = fs.readFileSync(file, 'utf-8');
fs.writeFileSync(file, `${LICENSE_HEADER}\n${content.trim()}\n`);
}

0 comments on commit 191d3b8

Please sign in to comment.