Skip to content

Conversation

mikelehen
Copy link
Contributor

This imports the protos we need (and adds an update.sh to re-import in the future) and reenables our serializer tests (for node only).

@@ -0,0 +1,67 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to write this as a piece of the gulpfile.js at the top level. Removing the dependency on bash will make it so we can enable windows dev which I am looking in to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a ton of work, I have no beef, but it feels like something that is doable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible? Probably. Worth it? Probably not. Nobody except us should be updating the checked-in protos.

Copy link
Contributor

@jshcrowthe jshcrowthe Oct 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My issue is more general than this specific use case and more just a "lets make our SDK buildable in multiple envs (i.e. windows, unix)"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to take a crack at it, but I don't think it's worth our time. Writing the update.sh at all (rather than just listing the steps in the README.md) was probably a questionable investment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and to be clear, this isn't at all required to build the SDK...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note that on windows bash is straightforwardly available:

https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I haven't used Windows bash, so I tend to stick with JS based tooling. @mikelehen if you could just throw a note in to possibly refactor this to the gulp scripts, I'm fine to go ahead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it occurs to me that script should be copypastad into the iOS repo (and Android when that happens). The iOS version was manually assembled via copybara before these protos were public but it would be better to just get this from the public repo just like this.

When Android becomes open source it will need this too. Please don't gulpify this.

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some shell nitpicking.

pushd "$WORK_DIR"

# Clone necessary git repos.
git clone git@github.com:googleapis/googleapis.git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be cloned via https or it will require users without ssh-agent set up to type their passphrases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Interesting. Is that true even for public repos? Anyway, switched it.

"${PROTOS_DIR}/google/type/"

mkdir -p "${PROTOS_DIR}/google/protobuf"
cp protobuf/src/google/protobuf/{any.proto,empty.proto,struct.proto,timestamp.proto,wrappers.proto} \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanted to make this shorter this could factor out .proto too.

protobuf/src/google/protobuf/{any,empty,struct,timestamp,wrappers}.proto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

# See the License for the specific language governing permissions and
# limitations under the License.

set -o nounset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unofficial strict mode for bash is

set -euo pipefail
IFS=$'\n\t'

Rationale here: http://redsymbol.net/articles/unofficial-bash-strict-mode/

It's worth just putting this at the top of every script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

WORK_DIR=`mktemp -d`

# check if tmp dir was created
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you intending to guard against with ! "$WORK_DIR"? As long as you're quoting $WORK_DIR just checking that it's a directory should be enough here.

Note that if mktemp fails it will return non-zero status and that will fail the script due to set -e.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copypasta'd this from elsewhere. I just removed the check entirely given your point about set -e and the fact that this isn't mission critical.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@mikelehen mikelehen changed the base branch from mikelehen-exclude-node-tests-in-browser-2 to master October 12, 2017 17:58
@jshcrowthe
Copy link
Contributor

Closing then reopening to retrigger travis. (I think the base change got things in a weird state)

@jshcrowthe jshcrowthe closed this Oct 12, 2017
@jshcrowthe jshcrowthe reopened this Oct 12, 2017
Copy link
Contributor

@jshcrowthe jshcrowthe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 , if you're going to try and share the script w/ the other platforms it seems reasonable.

@mikelehen mikelehen merged commit 6c4c2aa into master Oct 12, 2017
@jshcrowthe jshcrowthe deleted the mikelehen-serializer-tests branch October 16, 2017 13:47
@firebase firebase locked and limited conversation to collaborators Oct 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants