Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66d7bd23 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Re-submit "Add genrule for the current sdk proto"" am: 630e3ac6 am: 65ccfa9c

Change-Id: I293a5f376e41bdd84e9c1a2795536ccff22492d6
parents 5178397f 65ccfa9c
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ apex {
    java_libs: [ "framework-sdkext" ],
    prebuilts: [
      "com.android.sdkext.ldconfig",
      "cur_sdkinfo",
      "derive_sdk.rc",
    ],
    key: "com.android.sdkext.key",
@@ -51,3 +52,33 @@ prebuilt_etc {
    filename: "ld.config.txt",
    installable: false,
}

python_binary_host {
    name: "gen_sdkinfo",
    srcs: [
        "sdk.proto",
        "gen_sdkinfo.py",
    ],
    proto: {
        canonical_path_from_root: false,
    },
    version: {
        py3: {
            embedded_launcher: true,
        },
    },
}

gensrcs {
    name: "cur_sdkinfo_src",
    srcs: [""],
    tools: [ "gen_sdkinfo" ],
    cmd: "$(location) -v 0 -o $(out)",
}

prebuilt_etc {
    name: "cur_sdkinfo",
    src: ":cur_sdkinfo_src",
    filename: "sdkinfo.binarypb",
    installable: false,
}
+19 −0
Original line number Diff line number Diff line
import sdk_pb2
import sys

if __name__ == '__main__':
  argv = sys.argv[1:]
  if not len(argv) == 4 or sorted([argv[0], argv[2]]) != ['-o', '-v']:
    print('usage: gen_sdkinfo -v <version> -o <output-file>')
    sys.exit(1)

  for i in range(len(argv)):
    if sys.argv[i] == '-o':
      filename = sys.argv[i+1]
    if sys.argv[i] == '-v':
      version = int(sys.argv[i+1])

  proto = sdk_pb2.SdkVersion()
  proto.version = version
  with open(filename, 'wb') as f:
    f.write(proto.SerializeToString())

apex/sdkext/sdk.proto

0 → 100644
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * 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.
 */

syntax = "proto3";
package com.android.sdkext.proto;

option java_outer_classname = "SdkProto";
option optimize_for = LITE_RUNTIME;

message SdkVersion {
  int32 version = 1;
}