Skip to content

Commit 353ae0b

Browse files
committed
chore: revert "build: owlbot.py changes for merging split gapic clients correctly (#1739)"
This reverts commit 6e461cd.
1 parent 2fe9743 commit 353ae0b

File tree

104 files changed

+36552
-52036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+36552
-52036
lines changed

owlbot.py

Lines changed: 10 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -18,108 +18,32 @@
1818
import os
1919
from pathlib import Path
2020
from synthtool import _tracked_paths
21-
from typing import AnyStr
2221
import shutil
2322

2423
logging.basicConfig(level=logging.DEBUG)
2524

2625
staging = Path("owl-bot-staging")
2726

2827
if staging.is_dir():
29-
versions = ['v2']
30-
versions_admin = [f"admin/{p}" for p in versions]
28+
logging.info(f"Copying files from staging directory ${staging}.")
3129

32-
logging.info(f"Copying files from staging directory {staging}.")
33-
34-
src_paths = {}
35-
src_files = {}
36-
for version in versions + versions_admin:
37-
src_paths[version] = staging / version
38-
src_files[version] = list([fn for fn in src_paths[version].glob('**/*.*')])
3930

4031
# Copy bigtable library.
41-
# src/index.ts src/admin/v2/index.ts has added AdminClients manually, we don't wanna override it.
32+
# src/index.ts src/v2/index.ts has added AdminClients manually, we don't wanna override it.
4233
# src/*.ts is a added layer for the client libraries, they need extra setting in tsconfig.json & tslint.json
4334
# Tracking issues: 1. https://github.com/googleapis/nodejs-bigtable/issues/636
4435
# 2. https://github.com/googleapis/nodejs-bigtable/issues/635
45-
for version in versions:
46-
library = src_paths[version]
36+
for version in ['v2']:
37+
library = staging / version
4738
_tracked_paths.add(library)
48-
admin_files = filter(
49-
lambda f: str(f).find('_admin') >= 0,
50-
src_files[version]
51-
)
52-
excludes = [
53-
'package.json',
54-
'README.md',
55-
'src/index.ts',
56-
'src/v2/index.ts',
57-
'tsconfig.json',
58-
'tslint.json',
59-
'.github/sync-repo-settings.yaml',
60-
'.OwlBot.yaml',
61-
] + list(admin_files)
62-
logging.info(f"excluding files for non-admin: {excludes}")
63-
s.copy([library], excludes = excludes)
39+
s.copy([library], excludes=['package.json', 'README.md', 'src/index.ts', 'src/v2/index.ts', 'tsconfig.json', 'tslint.json', '.github/sync-repo-settings.yaml'])
6440

65-
# Copy the admin library pieces and knit them in.
66-
# Don't override system-test for admin/v2, just keep the v2 version.
67-
for version in versions:
68-
admin_version = f"admin/{version}"
69-
library = src_paths[admin_version]
70-
inProtoPath = f"protos/google/bigtable/{admin_version}"
71-
protos = library / inProtoPath
72-
classes = library / 'src' / version
73-
samples = library / 'samples' / 'generated'
74-
tests = library / 'test'
41+
# Copy the admin library.
42+
# Not override system-test for admin/v2, just keep the v2 version.
43+
for version in ['v2']:
44+
library = staging / 'admin' / version
7545
_tracked_paths.add(library)
76-
77-
# We also have to munge the proto paths in the *_proto_list.json due to making it a level deeper.
78-
# That also applies to the classes themselves.
79-
classesStr = str(classes)
80-
jsons = [fn
81-
for fn
82-
in src_files[admin_version]
83-
if str(fn)[:len(classesStr)] == classesStr]
84-
for jfn in jsons:
85-
logging.info(f"munging json file: {str(jfn)}")
86-
contents = jfn.read_text()
87-
contents = contents.replace("'../..", "'../../..")
88-
contents = contents.replace('"../..', '"../../..')
89-
jfn.write_text(contents)
90-
91-
# Also to the tests that import stuff from src. ../ -> ../../../
92-
testsStr = str(tests)
93-
tfns = [fn
94-
for fn
95-
in src_files[admin_version]
96-
if str(fn)[:len(testsStr)] == testsStr]
97-
for tfn in tfns:
98-
logging.info(f"munging test file: {str(tfn)}")
99-
contents = tfn.read_text()
100-
contents = contents.replace("'../", "'../../../")
101-
tfn.write_text(contents)
102-
103-
# Finally, the samples. .v2 -> .admin.v2
104-
samplesStr = str(samples)
105-
sfns = [fn
106-
for fn
107-
in src_files[admin_version]
108-
if str(fn)[:len(samplesStr)] == samplesStr]
109-
for sfn in sfns:
110-
logging.info(f"munging sample file: {str(sfn)}")
111-
contents = sfn.read_text()
112-
contents = contents.replace(').v2', ').admin.v2')
113-
sfn.write_text(contents)
114-
115-
os.system(f"mkdir -p {inProtoPath}")
116-
s.copy([protos / '*'], destination=inProtoPath)
117-
os.system(f"mkdir -p src/{admin_version}")
118-
s.copy([classes / '*'], destination=f"src/{admin_version}")
119-
os.system(f"mkdir -p samples/generated/{admin_version}")
120-
s.copy([samples / 'v2' / '*admin*'], destination=f"samples/generated/{admin_version}")
121-
os.system(f"mkdir -p test/{admin_version}")
122-
s.copy([tests / '*admin*.ts'], destination=f"test/{admin_version}")
46+
s.copy([library], excludes=['package.json', 'README.md', 'src/index.ts', 'src/v2/index.ts', 'tsconfig.json', 'tslint.json', 'system-test/fixtures/sample/src/index.ts', 'system-test/fixtures/sample/src/index.js', '.github/sync-repo-settings.yaml'])
12347

12448
# Replace the client name for generated system-test.
12549
system_test_files=['system-test/fixtures/sample/src/index.ts','system-test/fixtures/sample/src/index.js']

0 commit comments

Comments
 (0)