Skip to content

Commit

Permalink
preparing for the hidden-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Palatis committed Sep 16, 2021
1 parent edd24db commit 9af7382
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 4 deletions.
7 changes: 5 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'dev.rikka.tools.refine.gradle-plugin'

if (file('signing.gradle').exists()) {
apply from: 'signing.gradle'
Expand Down Expand Up @@ -37,6 +38,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -75,8 +77,9 @@ android.applicationVariants.all { variant ->
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
compileOnly project(':hiddenapi-stubs')
implementation("dev.rikka.tools.refine:runtime:3.0.3")

implementation "com.google.android.material:material:1.4.0-alpha02"
implementation 'androidx.appcompat:appcompat:1.3.0-rc01'
implementation 'androidx.preference:preference:1.1.1'
Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'

classpath 'dev.rikka.tools.refine:gradle-plugin:3.0.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -20,6 +21,7 @@ allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
}
Expand Down
1 change: 1 addition & 0 deletions hiddenapi-stubs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
38 changes: 38 additions & 0 deletions hiddenapi-stubs/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
plugins {
id 'com.android.library'
}

android {
compileSdk 31

defaultConfig {
minSdk 28
targetSdk 31
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation 'androidx.annotation:annotation:1.2.0'
annotationProcessor 'dev.rikka.tools.refine:annotation-processor:3.0.3'
compileOnly 'dev.rikka.tools.refine:annotation:3.0.3'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Empty file.
21 changes: 21 additions & 0 deletions hiddenapi-stubs/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package tw.idv.palatis.xappdebug.hiddenapi;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("tw.idv.palatis.xappdebug.hiddenapi.test", appContext.getPackageName());
}
}
5 changes: 5 additions & 0 deletions hiddenapi-stubs/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tw.idv.palatis.xappdebug.hiddenapi">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package tw.idv.palatis.xappdebug.hiddenapi;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
rootProject.name='XAppDebug'
include ':app'
include ':hiddenapi-stubs'

0 comments on commit 9af7382

Please sign in to comment.