• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1git_files = glob(
2  include = ["resultdb/proto/v1/*.proto"]
3)
4
5dest_files = glob(
6  include = ["proto/resultdb/*"]
7)
8
9# Generate a CL that copy ResultDB proto to the current codebase under proto/resultdb/*.
10# Require mannully run this command in the current directory: copybara copy.bara.sky resultdb.
11core.workflow(
12   name = "resultdb",
13   origin =  git.origin(
14        url = "rpc://chromium/infra/luci/luci-go",
15        ref = "main",
16    ),
17   authoring = authoring.pass_thru("Android Tradefed <android-tradefed@google.com>"),
18   origin_files = git_files,
19   destination_files = dest_files,
20   transformations = [
21    core.move("resultdb/proto/v1", "proto/resultdb/"),
22    core.replace(
23      before = '''// Copyright ${year} The LUCI Authors.
24//
25// Licensed under the Apache License, Version 2.0 (the "License");
26// you may not use this file except in compliance with the License.
27// You may obtain a copy of the License at
28//
29//      http://www.apache.org/licenses/LICENSE-2.0
30//
31// Unless required by applicable law or agreed to in writing, software
32// distributed under the License is distributed on an "AS IS" BASIS,
33// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34// See the License for the specific language governing permissions and
35// limitations under the License.''',
36      after = '''/*
37* Copyright (C) ${year} The Android Open Source Project
38*
39* Licensed under the Apache License, Version 2.0 (the "License");
40* you may not use this file except in compliance with the License.
41* You may obtain a copy of the License at
42*
43*      http://www.apache.org/licenses/LICENSE-2.0
44*
45* Unless required by applicable law or agreed to in writing, software
46* distributed under the License is distributed on an "AS IS" BASIS,
47* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48* See the License for the specific language governing permissions and
49* limitations under the License.
50*/''',
51      multiline = True,
52      regex_groups = {'year' : '[0-9]{4}'}
53    ),
54    core.replace(
55      before = "option java_package = \"com.google.luci.resultdb.v1\";",
56      after = "option java_package = \"com.android.resultdb.proto\";"
57    ),
58    core.replace(
59      before = "import \"go.chromium.org/luci/resultdb/proto/v1/",
60      after = "import public \"tools/tradefederation/core/proto/resultdb/"
61    )
62   ],
63   ask_for_confirmation = True,
64
65   destination =  git.gerrit_destination(
66        url = "rpc://googleplex-android/platform/tools/tradefederation",
67        fetch = "main",
68        push_to_refs_for = "main",
69    )
70)
71