Merge "Re-submit "Add genrule for the current sdk proto""
This commit is contained in:
@@ -23,6 +23,7 @@ apex {
|
|||||||
java_libs: [ "framework-sdkext" ],
|
java_libs: [ "framework-sdkext" ],
|
||||||
prebuilts: [
|
prebuilts: [
|
||||||
"com.android.sdkext.ldconfig",
|
"com.android.sdkext.ldconfig",
|
||||||
|
"cur_sdkinfo",
|
||||||
"derive_sdk.rc",
|
"derive_sdk.rc",
|
||||||
],
|
],
|
||||||
key: "com.android.sdkext.key",
|
key: "com.android.sdkext.key",
|
||||||
@@ -51,3 +52,33 @@ prebuilt_etc {
|
|||||||
filename: "ld.config.txt",
|
filename: "ld.config.txt",
|
||||||
installable: false,
|
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
apex/sdkext/gen_sdkinfo.py
Normal file
19
apex/sdkext/gen_sdkinfo.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
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())
|
||||||
25
apex/sdkext/sdk.proto
Normal file
25
apex/sdkext/sdk.proto
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user