Skip to content

Commit

Permalink
chore: only call hermetic functions;
Browse files Browse the repository at this point in the history
  • Loading branch information
sofisl committed Sep 25, 2023
1 parent ee41a29 commit b47ca2e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions synthtool/languages/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,22 @@ def fix(hide_output=False):
logger.debug("Running fix...")
shell.run(["npm", "run", "fix"], hide_output=hide_output)


#TODO: delete these functions if it turns out we no longer
#need them to be hermetic.
def fix_hermetic(hide_output=False):
"""
Fixes the formatting in the current Node.js library. It assumes that gts
is already installed in a well known location on disk (node_modules/.bin).
"""
logger.debug("Copy eslint config")
shell.run(
["cp", "-r", "node_modules", "."],
["cp", "-r", "/node_modules", "."],
check=True,
hide_output=hide_output,
)
logger.debug("Running fix...")
shell.run(
["node_modules/.bin/gts", "fix"],
["/node_modules/.bin/gts", "fix"],
check=False,
hide_output=hide_output,
)
Expand All @@ -240,7 +241,8 @@ def compile_protos(hide_output=False):
logger.debug("Compiling protos...")
shell.run(["npx", "compileProtos", "src"], hide_output=hide_output)


#TODO: delete these functions if it turns out we no longer
#need them to be hermetic.
def compile_protos_hermetic(hide_output=False):
"""
Compiles protos into .json, .js, and .d.ts files using
Expand All @@ -249,7 +251,7 @@ def compile_protos_hermetic(hide_output=False):
"""
logger.debug("Compiling protos...")
shell.run(
["node_modules/.bin/compileProtos", "src"],
["/node_modules/.bin/compileProtos", "src"],
check=True,
hide_output=hide_output,
)
Expand All @@ -265,8 +267,8 @@ def postprocess_gapic_library(hide_output=False):

def postprocess_gapic_library_hermetic(hide_output=False):
logger.debug("Post-processing GAPIC library...")
fix_hermetic(hide_output=hide_output)
compile_protos_hermetic(hide_output=hide_output)
fix(hide_output=hide_output)
compile_protos(hide_output=hide_output)
logger.debug("Post-processing completed")


Expand Down

0 comments on commit b47ca2e

Please sign in to comment.