This repository was archived by the owner on Oct 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Upgrade to Gradle 7.0 and AGP 4.2.1 #154
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
96c3c3f
Bump versions to Gradle 7.0.2
jkasten2 2c36bc1
Replaced "compile" with" implementation"
jkasten2 b438dc2
Upgraded to the testing framework Spock 2.0
jkasten2 ac872a6
Switched to maven-publish for local testing
jkasten2 92f6c49
Moved jcenter last so we don't get old versions
jkasten2 cea0d85
Added required duplicatesStrategy for Gradle 7
jkasten2 5c44161
DefaultVersionSelectorScheme required constructor
jkasten2 761d84a
Upgraded to AGP 4.2.1
jkasten2 b2fa207
Updated .lockfile for all the changes in this PR
jkasten2 ddf798b
Bump OneSignal in tests so they pass
jkasten2 3eec256
SdkVersion 26 test is flaky with Gradle 7
jkasten2 ec80816
Lower APG to 4.1.1 for api 26 test
jkasten2 8122b38
JVM 8 work around for Metaspace error
jkasten2 c5e3919
fixup! Added required duplicatesStrategy for Gradle 7
jkasten2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -21,4 +21,3 @@ build/ | |
.gradle | ||
.idea | ||
*.iml | ||
gradle.properties |
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
org.gradle.jvmargs=-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true |
This file contains hidden or 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
31 changes: 31 additions & 0 deletions
31
src/main/groovy/com/onesignal/androidsdk/DefaultVersionSelectorSchemeCompat.java
This file contains hidden or 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,31 @@ | ||
package com.onesignal.androidsdk; | ||
|
||
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.*; | ||
|
||
import java.lang.reflect.Constructor; | ||
import java.lang.reflect.InvocationTargetException; | ||
|
||
class DefaultVersionSelectorSchemeCompat { | ||
static VersionSelectorScheme get() { | ||
try { | ||
// DefaultVersionSelectorScheme with VersionParser required in Gradle 7.0, induced as optional in 4.7 or 4.8 | ||
return new DefaultVersionSelectorScheme(new DefaultVersionComparator(), new VersionParser()); | ||
} catch (NoSuchMethodError e) { | ||
return getCompat(); | ||
} | ||
} | ||
|
||
// Use reflection to support Gradle 4.7 and older | ||
private static VersionSelectorScheme getCompat() { | ||
try { | ||
Class<?> defaultVersionSelectorSchemeClass = Class.forName("org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionSelectorScheme"); | ||
Constructor<?> defaultVersionSelectorSchemeConstructor = defaultVersionSelectorSchemeClass.getConstructor(VersionComparator.class); | ||
Object defaultVersionSelectorSchemeInstance = defaultVersionSelectorSchemeConstructor.newInstance(new DefaultVersionComparator()); | ||
return (VersionSelectorScheme)defaultVersionSelectorSchemeInstance; | ||
|
||
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { | ||
e.printStackTrace(); | ||
return null; | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message has some types; maybe you want to update it. 😬
it's constructor parameters.
constructor was dropped in 7.0
created DefaultVersionSelectorSchemeCompat to handle constructing
a DefaultVersionSelectorScheme instance to handle the fallback logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catches!
Fixed with
git rebase -i
on selectedreword
and force pushed.See commit 5c44161 for the fix