Merge branch 'master' into refine

This commit is contained in:
Goooler 2021-08-30 18:48:04 +08:00
commit 5c6d091f39
16 changed files with 32 additions and 21 deletions

5
.gitattributes vendored
View File

@ -1,4 +1,7 @@
* text=auto eol=lf
*.bat text eol=crlf
*.jar binary
*.jar binary
/brut.apktool/apktool-lib/src/main/resources/prebuilt/windows/* binary
/brut.apktool/apktool-lib/src/main/resources/prebuilt/macosx/* binary
/brut.apktool/apktool-lib/src/main/resources/prebuilt/linux/* binary

View File

@ -1,11 +1,8 @@
name: CI
on:
push:
paths:
- '**.java'
- '**.gradle'
- 'brut.apktool/apktool-lib/src/main/resources/**'
- '.github/workflows/**'
branches:
- master
pull_request:
paths:
- '**.java'
@ -18,11 +15,10 @@ jobs:
runs-on: ${{ matrix.os }}
name: Build/Test (JDK ${{ matrix.java }}, ${{ matrix.os }})
strategy:
fail-fast: false
max-parallel: 10
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-latest, windows-latest ]
java: [ 8, 9, 10, 11, 12, 13, 14 ]
java: [ 8, 9, 10, 11, 12, 13, 14, 15, 16 ]
steps:
- uses: actions/cache@v2

View File

@ -245,7 +245,7 @@ to get the source downloaded. This is no small download, expect to use 150-250GB
After that, you need to build AOSP via this [documentation](https://source.android.com/source/building.html) guide. Now
we aren't building the entire AOSP package, the initial build is to just see if you are capable of building it.
We check out a certain tag or branch. Currently we use
We check out a certain tag or branch. Currently we use
* aapt2 - `master`.
* aapt1 - `master`.
@ -266,7 +266,7 @@ The steps below are different per flavor and operating system.
#### Linux / Windows
1. `source build/envsetup.sh`
2. `lunch sdk-eng`
3. `make LOCAL_MULTILIB=64 USE_NINJA=false aapt`
3. `m aapt`
4. `strip out/host/linux-x86/bin/aapt`
5. `strip out/host/linux-x86/bin/aapt_64`
6. `strip out/host/windows-x86/bin/aapt.exe`
@ -274,9 +274,8 @@ The steps below are different per flavor and operating system.
#### Mac
1. `source build/envsetup.sh`
2. `lunch sdk-eng`
3. `make LOCAL_MULTILIB=64 USE_NINJA=false aapt`
4. `strip out/host/darwin-x86/bin/aapt_64`
2. `m aapt`
3. `strip out/host/darwin-x86/bin/aapt_64`
32/64 bit binaries will be built for Linux and Windows.
@ -285,7 +284,7 @@ The steps below are different per flavor and operating system.
The steps below are different per flavor and operating system.
#### Linux / Windows
1. `make LOCAL_MULTILIB=64 USE_NINJA=false aapt2`
1. `m aapt2`
2. `strip out/host/linux-x86/bin/aapt2`
3. `strip out/host/linux-x86/bin/aapt2_64`
4. `strip out/host/windows-x86/bin/aapt2.exe`
@ -294,7 +293,7 @@ The steps below are different per flavor and operating system.
#### Mac
1. `export ANDROID_JAVA_HOME=/Path/To/Jdk`
2. `source build/envsetup.sh`
3. `make LOCAL_MULTILIB=64 USE_NINJA=false aapt2`
3. `m aapt2`
4. `strip out/host/darwin-x86/bin/aapt2_64`
#### Confirming aapt/aapt2 builds are static

View File

@ -668,6 +668,9 @@ final public class AndrolibResources {
return ResConfigFlags.SDK_R;
case "S":
return ResConfigFlags.SDK_S;
case "T":
case "Tiramisu":
return ResConfigFlags.SDK_DEVELOPMENT;
default:
return Integer.parseInt(sdkVersion);
}

View File

@ -536,10 +536,12 @@ public class ResConfigFlags {
public final static byte SDK_P = 28;
public final static byte SDK_Q = 29;
public final static byte SDK_R = 30;
public final static byte SDK_S = 31;
public final static byte SDK_T = 32;
// AOSP has this as 10,000 for dev purposes.
// platform_frameworks_base/commit/c7a1109a1fe0771d4c9b572dcf178e2779fc4f2d
public final static int SDK_S = 10000;
public final static int SDK_DEVELOPMENT = 10000;
public final static byte ORIENTATION_ANY = 0;
public final static byte ORIENTATION_PORT = 1;

View File

@ -18,11 +18,9 @@ package brut.androlib.androlib;
import brut.androlib.BaseTest;
import brut.androlib.res.AndrolibResources;
import org.junit.Test;
import java.util.LinkedHashMap;
import java.util.Map;
import org.junit.*;
import static org.junit.Assert.assertEquals;
public class InvalidSdkBoundingTest extends BaseTest {
@ -75,6 +73,16 @@ public class InvalidSdkBoundingTest extends BaseTest {
assertEquals("25", androlibResources.checkTargetSdkVersionBounds());
}
@Test
public void checkForShortHandSTag() {
AndrolibResources androlibResources = new AndrolibResources();
Map<String, String> sdkInfo = new LinkedHashMap<>();
sdkInfo.put("targetSdkVersion", "S");
androlibResources.setSdkInfo(sdkInfo);
assertEquals("31", androlibResources.checkTargetSdkVersionBounds());
}
@Test
public void checkForShortHandSdkTag() {
@ -92,7 +100,7 @@ public class InvalidSdkBoundingTest extends BaseTest {
AndrolibResources androlibResources = new AndrolibResources();
Map<String, String> sdkInfo = new LinkedHashMap<>();
sdkInfo.put("targetSdkVersion", "S");
sdkInfo.put("targetSdkVersion", "T");
androlibResources.setSdkInfo(sdkInfo);
assertEquals("10000", androlibResources.checkTargetSdkVersionBounds());