-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GRAPH] Full apk build resources with dex
- Loading branch information
Showing
40 changed files
with
1,630 additions
and
618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
src/main/java/com/reandroid/common/DiagnosticMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright (C) 2022 github.com/REAndroid | ||
* | ||
* 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. | ||
*/ | ||
package com.reandroid.common; | ||
|
||
public interface DiagnosticMessage { | ||
Type type(); | ||
default String getTag() { | ||
return null; | ||
} | ||
default DiagnosticSource getSource() { | ||
return null; | ||
} | ||
|
||
class StringMessage implements DiagnosticMessage { | ||
|
||
private final Type type; | ||
private final DiagnosticSource source; | ||
private final String tag; | ||
private final String message; | ||
|
||
public StringMessage(Type type, DiagnosticSource source, String tag, String message) { | ||
this.type = type; | ||
this.source = source; | ||
this.tag = tag; | ||
this.message = message; | ||
} | ||
public StringMessage(Type type, String tag, String message) { | ||
this(type, null, tag, message); | ||
} | ||
public StringMessage(Type type, String message) { | ||
this(type, null, null, message); | ||
} | ||
@Override | ||
public Type type() { | ||
return type; | ||
} | ||
@Override | ||
public DiagnosticSource getSource() { | ||
return source; | ||
} | ||
@Override | ||
public String getTag() { | ||
return tag; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder builder = new StringBuilder(); | ||
builder.append(type().getName()); | ||
builder.append(": "); | ||
String tag = getTag(); | ||
if(tag != null) { | ||
builder.append(tag); | ||
builder.append(" : "); | ||
} | ||
DiagnosticSource source = getSource(); | ||
if(source != null) { | ||
builder.append(source); | ||
builder.append(", "); | ||
} | ||
builder.append(getMessage()); | ||
return builder.toString(); | ||
} | ||
} | ||
|
||
enum Type { | ||
|
||
INFO("I"), | ||
WARN("W"), | ||
ERROR("E"), | ||
VERBOSE("V"), | ||
DEBUG("D"); | ||
|
||
String simpleName; | ||
|
||
Type(String simpleName) { | ||
this.simpleName = simpleName; | ||
} | ||
public String getName() { | ||
return simpleName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright (C) 2022 github.com/REAndroid | ||
* | ||
* 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. | ||
*/ | ||
package com.reandroid.common; | ||
|
||
import com.reandroid.utils.StringsUtil; | ||
|
||
public class DiagnosticSource { | ||
|
||
private DiagnosticSource parent; | ||
private final String name; | ||
private String separator = ":"; | ||
|
||
public DiagnosticSource(DiagnosticSource parent, String name) { | ||
this.parent = parent; | ||
this.name = name; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
public DiagnosticSource getParent() { | ||
return parent; | ||
} | ||
public void setParent(DiagnosticSource parent) { | ||
this.parent = parent; | ||
} | ||
|
||
public void setSeparator(String separator) { | ||
this.separator = separator; | ||
} | ||
public String getSeparator() { | ||
String separator = this.separator; | ||
if(separator == null) { | ||
separator = StringsUtil.EMPTY; | ||
} | ||
return separator; | ||
} | ||
|
||
public boolean isRoot() { | ||
return getParent() == null; | ||
} | ||
public DiagnosticSource[] toArray() { | ||
int count = 0; | ||
DiagnosticSource source = this; | ||
while (!source.isRoot()) { | ||
count ++; | ||
source = source.getParent(); | ||
} | ||
DiagnosticSource[] result = new DiagnosticSource[count]; | ||
count = count - 1; | ||
source = this; | ||
while (count >= 0) { | ||
result[count] = source; | ||
source = source.getParent(); | ||
count --; | ||
} | ||
return result; | ||
} | ||
|
||
public DiagnosticSource createChild(String name) { | ||
return new DiagnosticSource(this, name); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder builder = new StringBuilder(); | ||
DiagnosticSource[] sources = toArray(); | ||
int length = sources.length; | ||
for(int i = 0; i < length; i++) { | ||
DiagnosticSource source = sources[i]; | ||
if(i != 0) { | ||
builder.append(source.getSeparator()); | ||
} | ||
builder.append(source.getName()); | ||
} | ||
return builder.toString(); | ||
} | ||
|
||
public static DiagnosticSource newRoot() { | ||
return new DiagnosticSource(null, StringsUtil.EMPTY); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.