Skip to content

Add Proguard Files to Smoke Tests #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions smoke-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "smoke-test-rules.pro"
testProguardFiles "infrastructure-rules.pro"
}
}

flavorDimensions "systemUnderTest"

// TODO(allisonbm92): Switch to the default flavor.
Expand All @@ -58,12 +68,11 @@ apply from: "configure.gradle"

dependencies {
// Common
api "androidx.test:runner:1.2.0"
api "com.google.truth:truth:0.45"
api "junit:junit:4.12"

implementation "androidx.test:rules:1.2.0"
implementation "androidx.test:runner:1.2.0"
implementation "com.google.firebase:firebase-common"
implementation "com.google.truth:truth:0.44"
implementation "junit:junit:4.12"

// All
combinedImplementation "com.google.firebase:firebase-auth"
Expand All @@ -73,6 +82,10 @@ dependencies {
// combinedImplementation "com.google.firebase:firebase-inappmessaging"
combinedImplementation "com.google.firebase:firebase-config"
combinedImplementation "com.google.firebase:firebase-storage"

androidTestImplementation "androidx.test:core:1.2.0"
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestImplementation "junit:junit:4.12"
}

clean.doLast {
Expand Down
2 changes: 1 addition & 1 deletion smoke-tests/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

android.enableJetifier=true
android.enableR8=true
android.useAndroidX=true
3 changes: 3 additions & 0 deletions smoke-tests/infrastructure-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-dontobfuscate
-dontoptimize
-dontshrink
23 changes: 23 additions & 0 deletions smoke-tests/smoke-test-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-optimizationpasses 3
-keepattributes SourceFile, LineNumberTable, *Annotation*

-keep @org.junit.runner.RunWith class *
-keep class androidx.test.**
-keep class org.junit.**

-keepclassmembers @org.junit.runner.RunWith class * {
public <methods>;
public <fields>;
}

-keepclassmembers class androidx.test.** {
public <methods>;
}

-keepclassmembers class org.junit.** {
protected <methods>;
public <methods>;
}

-dontwarn android.**
-dontwarn okio.**
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import androidx.test.InstrumentationRegistry;
import androidx.test.core.app.ApplicationProvider;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -69,7 +69,7 @@ protected void runChild(Runner runner, RunNotifier notifier) {
}

private static List<Class<?>> getTestClasses() throws InitializationError {
Context ctx = InstrumentationRegistry.getTargetContext();
Context ctx = ApplicationProvider.getApplicationContext();
return getTestClasses(ctx);
}

Expand Down