Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
门心叼龙
VirtualAPK
提交
d01d974e
V
VirtualAPK
项目概览
门心叼龙
/
VirtualAPK
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VirtualAPK
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d01d974e
编写于
7月 11, 2018
作者:
S
superq_sky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed bug: the resources.arsc's type ids was error when the plugin has no attrs value.
上级
dca835f0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
16 deletion
+30
-16
virtualapk-gradle-plugin/src/main/groovy/com.didi.virtualapk/collector/ResourceCollector.groovy
...vy/com.didi.virtualapk/collector/ResourceCollector.groovy
+25
-10
virtualapk-gradle-plugin/src/main/groovy/com.didi.virtualapk/hooker/ProcessResourcesHooker.groovy
.../com.didi.virtualapk/hooker/ProcessResourcesHooker.groovy
+5
-6
未找到文件。
virtualapk-gradle-plugin/src/main/groovy/com.didi.virtualapk/collector/ResourceCollector.groovy
浏览文件 @
d01d974e
...
...
@@ -163,19 +163,27 @@ class ResourceCollector {
* Set the packageId specified in the build.gradle file, and reassign type&entry ID
*/
private
void
reassignPluginResourceId
()
{
//The value of aar type should be 1
def
attrTypeId
=
1
//Other types are allocated from 2
def
lastTypeId
=
2
def
resourceIdList
=
[]
pluginResources
.
keySet
().
each
{
String
resType
->
List
<
ResourceEntry
>
entryList
=
pluginResources
.
get
(
resType
)
resourceIdList
.
add
([
resType:
resType
,
typeId:
entryList
.
empty
?
-
100
:
parseTypeIdFromResId
(
entryList
.
first
().
resourceId
)])
}
resourceIdList
.
sort
{
t1
,
t2
->
t1
.
typeId
-
t2
.
typeId
}
int
lastType
=
1
resourceIdList
.
each
{
if
(
it
.
typeId
<
0
)
{
return
}
def
typeId
=
0
def
entryId
=
0
if
(
resType
==
'attr'
)
{
typeId
=
attrTypeId
}
else
{
typeId
=
lastTypeId
++
}
pluginResources
.
get
(
resType
).
each
{
typeId
=
lastType
++
pluginResources
.
get
(
it
.
resType
).
each
{
it
.
setNewResourceId
(
virtualApk
.
packageId
,
typeId
,
entryId
++)
}
}
...
...
@@ -194,6 +202,13 @@ class ResourceCollector {
}
}
/**
* Parse the type part of a android resource id
*/
def
parseTypeIdFromResId
(
int
resourceId
)
{
resourceId
>>
16
&
0
xFF
}
/**
* Collect all resources the aar project can access
* @param aarDependenceInfo aar dependence info
...
...
virtualapk-gradle-plugin/src/main/groovy/com.didi.virtualapk/hooker/ProcessResourcesHooker.groovy
浏览文件 @
d01d974e
...
...
@@ -192,7 +192,6 @@ class ProcessResourcesHooker extends GradleTaskHooker<ProcessAndroidResources> {
*/
def
convertResourcesForAapt
(
ListMultimap
<
String
,
ResourceEntry
>
pluginResources
)
{
def
retainedTypes
=
[]
retainedTypes
.
add
(
0
,
[
name
:
'placeholder'
,
id
:
Aapt
.
ID_NO_ATTR
,
entries:
[]])
//attr 占位
pluginResources
.
keySet
().
each
{
resType
->
def
firstEntry
=
pluginResources
.
get
(
resType
).
get
(
0
)
...
...
@@ -210,13 +209,13 @@ class ProcessResourcesHooker extends GradleTaskHooker<ProcessAndroidResources> {
vs:
resEntry
.
hexResourceId
,
_vs
:
resEntry
.
hexNewResourceId
])
}
if
(
resType
==
'attr'
)
{
retainedTypes
.
set
(
0
,
typeEntry
)
}
else
{
retainedTypes
.
add
(
typeEntry
)
}
retainedTypes
.
add
(
typeEntry
)
}
retainedTypes
.
sort
{
t1
,
t2
->
t1
.
_id
-
t2
.
_id
}
return
retainedTypes
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录