Re-submit "Add genrule for the current sdk proto"
This reverts commit e15e6483f6,
but adds embedded_launcher: true, as well as a copy of sdk.proto
as a workaround.
...which should hopefully fix the python3-issues.
Test: m cur_sdkinfo
Change-Id: I58aff4e175bd44372e9e03e67439085f08ccdc5e
This commit is contained in:
@@ -19,6 +19,7 @@ apex {
|
||||
java_libs: [ "framework-sdkext" ],
|
||||
prebuilts: [
|
||||
"com.android.sdkext.ldconfig",
|
||||
"cur_sdkinfo",
|
||||
"derive_sdk.rc",
|
||||
],
|
||||
key: "com.android.sdkext.key",
|
||||
@@ -42,3 +43,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
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