Skip to content
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

fix: make gradle dependencies use implementation instead of compile #3767

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public File getGradleProjectDirectory() {
// which is necessary to support Push on the latest Android devices.
private boolean newFirebaseMessaging = false;

// A flag to indicate whether we should use 'implementation' or 'compile' for dependencies
private boolean useArrImplementation = false;

public static final String[] ANDROID_PERMISSIONS = new String[]{
"android.permission.ACCESS_BACKGROUND_LOCATION",
"android.permission.ACCESS_CHECKIN_PROPERTIES",
Expand Down Expand Up @@ -895,6 +898,7 @@ public boolean build(File sourceZip, final BuildRequest request) throws BuildExc
gradlePluginVersion = "3.0.1";
}
} else {
useArrImplementation = true;
gradlePluginVersion = "4.1.1";
}
}
Expand Down Expand Up @@ -992,8 +996,11 @@ public boolean build(File sourceZip, final BuildRequest request) throws BuildExc
}
if (file.getName().endsWith(".aar")) {
String name = file.getName().substring(0, file.getName().lastIndexOf("."));
if(request.getArg("android.arrimplementation", "").contains(
name)) {
boolean arrCompileLib = request.getArg("android.arrcompile", "").contains(
name);
boolean arrImplementationLib = request.getArg("android.arrimplementation", "").contains(
name);
if(!arrCompileLib && (useArrImplementation || arrImplementationLib)) {
aarDependencies += " implementation(name:'" + name + "', ext:'aar')\n";
} else {
aarDependencies += " compile(name:'" + name + "', ext:'aar')\n";
Expand Down Expand Up @@ -1275,7 +1282,7 @@ public void usesClassMethod(String cls, String method) {

if (useFCM) {
String compile = "compile";
if (useAndroidX) {
if (useAndroidX || useArrImplementation) {
compile = "implementation";
}
if (!googleServicesJson.exists()) {
Expand Down Expand Up @@ -3269,7 +3276,7 @@ public void usesClassMethod(String cls, String method) {
String additionalDependencies = request.getArg("gradleDependencies", "");
if (facebookSupported) {
String compile = "compile";
if (useAndroidX) {
if (useAndroidX || useArrImplementation) {
compile = "implementation";
}
minSDK = maxInt("15", minSDK);
Expand All @@ -3285,7 +3292,7 @@ public void usesClassMethod(String cls, String method) {
}
}
String compile = "compile";
if (useAndroidX) {
if (useAndroidX || useArrImplementation) {
compile = "implementation";
}
if (legacyGplayServicesMode) {
Expand Down Expand Up @@ -3445,7 +3452,7 @@ public void usesClassMethod(String cls, String method) {
}
}

String supportV4Default = " compile 'com.android.support:support-v4:23.+'";
String supportV4Default;

compileSdkVersion = maxPlatformVersion;
String supportLibVersion = maxPlatformVersion;
Expand Down Expand Up @@ -3486,7 +3493,7 @@ public void usesClassMethod(String cls, String method) {
gradlePropertiesObject.put("android.enableAapt2", "false");
}
if (!useAndroidX) {
supportV4Default = " compile 'com.android.support:support-v4:"+supportLibVersion+".+'\n implementation 'com.android.support:appcompat-v7:"+supportLibVersion+".+'\n";
supportV4Default = " " + compile + " 'com.android.support:support-v4:"+supportLibVersion+".+'\n implementation 'com.android.support:appcompat-v7:"+supportLibVersion+".+'\n";
} else {
String appCompatVersionDefault = "1.0.0";
if (useGradle8) {
Expand Down
Loading