Skip to content
This repository was archived by the owner on Oct 31, 2022. It is now read-only.
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ build/
.gradle
.idea
*.iml
gradle.properties
34 changes: 20 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
plugins {
id 'com.gradle.plugin-publish' version '0.11.0'
id 'maven-publish'
id 'java-gradle-plugin'
}

repositories {
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
jcenter()
}

apply plugin: 'groovy'
Expand All @@ -20,13 +21,13 @@ configurations.all {
}

dependencies {
compile gradleApi()
compile localGroovy()
implementation gradleApi()
implementation localGroovy()

// These are compileOnly just so we can inspect these classes in IntelliJ
// Android Gradle Plugin (AGP)
compileOnly 'com.android.tools.build:gradle:4.1.1'
testCompileOnly 'com.android.tools.build:gradle:4.1.1'
compileOnly 'com.android.tools.build:gradle:4.2.1'
testCompileOnly 'com.android.tools.build:gradle:4.2.1'

// Google Play Services Gradle Plugin
compileOnly 'com.google.gms:google-services:4.3.+'
Expand All @@ -36,9 +37,9 @@ dependencies {
compileOnly 'com.google.android.gms:strict-version-matcher-plugin:1.2.+'
testCompileOnly 'com.google.android.gms:strict-version-matcher-plugin:1.2.+'

testCompile gradleTestKit()
testCompile 'junit:junit:4.12'
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
testImplementation gradleTestKit()
testImplementation 'junit:junit:4.12'
testImplementation('org.spockframework:spock-core:2.0-groovy-3.0') {
exclude module: 'groovy-all'
}
}
Expand Down Expand Up @@ -73,20 +74,25 @@ gradlePlugin {
}

test {
// Required for Spock 2
useJUnitPlatform()
testLogging {
showStandardStreams = true
exceptionFormat = 'full'
}
}

processResources {
// Required by Gradle 7
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}

// Build for Local Testing
apply plugin: 'maven'

uploadArchives {
publishing {
repositories {
mavenDeployer {
repository(url: uri('../repo'))
maven {
name = 'localPluginRepository'
url = '../local-plugin-repository'
}
}
}
Expand All @@ -99,4 +105,4 @@ uploadArchives {
// 4. Add to buildscript -> dependencies
// classpath 'com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
// 5. To your app/build.gradle add
// apply plugin: com.onesignal.androidsdk.GradleProjectPlugin
// apply plugin: com.onesignal.androidsdk.GradleProjectPlugin
119 changes: 69 additions & 50 deletions gradle.lockfile
Original file line number Diff line number Diff line change
@@ -1,68 +1,72 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
androidx.databinding:databinding-common:4.1.1=compileClasspath,testCompileClasspath
androidx.databinding:databinding-compiler-common:4.1.1=compileClasspath,testCompileClasspath
com.android.databinding:baseLibrary:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.analytics-library:crash:27.1.1=compileClasspath,testCompileClasspath
com.android.tools.analytics-library:protos:27.1.1=compileClasspath,testCompileClasspath
com.android.tools.analytics-library:shared:27.1.1=compileClasspath,testCompileClasspath
com.android.tools.analytics-library:tracker:27.1.1=compileClasspath,testCompileClasspath
androidx.databinding:databinding-common:4.2.1=compileClasspath,testCompileClasspath
androidx.databinding:databinding-compiler-common:4.2.1=compileClasspath,testCompileClasspath
cglib:cglib-nodep:3.3.0=testCompileClasspath,testRuntimeClasspath
com.android.databinding:baseLibrary:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.analytics-library:crash:27.2.1=compileClasspath,testCompileClasspath
com.android.tools.analytics-library:protos:27.2.1=compileClasspath,testCompileClasspath
com.android.tools.analytics-library:shared:27.2.1=compileClasspath,testCompileClasspath
com.android.tools.analytics-library:tracker:27.2.1=compileClasspath,testCompileClasspath
com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09=compileClasspath,testCompileClasspath
com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta09=compileClasspath,testCompileClasspath
com.android.tools.build:aapt2-proto:4.1.1-6503028=compileClasspath,testCompileClasspath
com.android.tools.build:aaptcompiler:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:apksig:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:apkzlib:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:builder-model:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:builder-test-api:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:builder:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:bundletool:0.14.0=compileClasspath,testCompileClasspath
com.android.tools.build:gradle-api:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:gradle:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:manifest-merger:27.1.1=compileClasspath,testCompileClasspath
com.android.tools.build:aapt2-proto:4.2.1-7147631=compileClasspath,testCompileClasspath
com.android.tools.build:aaptcompiler:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:apksig:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:apkzlib:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:builder-model:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:builder-test-api:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:builder:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:bundletool:1.1.0=compileClasspath,testCompileClasspath
com.android.tools.build:gradle-api:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:gradle:4.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:manifest-merger:27.2.1=compileClasspath,testCompileClasspath
com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api=compileClasspath,testCompileClasspath
com.android.tools.ddms:ddmlib:27.1.1=compileClasspath,testCompileClasspath
com.android.tools.layoutlib:layoutlib-api:27.1.1=compileClasspath,testCompileClasspath
com.android.tools.lint:lint-gradle-api:27.1.1=compileClasspath,testCompileClasspath
com.android.tools.lint:lint-model:27.1.1=compileClasspath,testCompileClasspath
com.android.tools:annotations:27.1.1=compileClasspath,testCompileClasspath
com.android.tools:common:27.1.1=compileClasspath,testCompileClasspath
com.android.tools:dvlib:27.1.1=compileClasspath,testCompileClasspath
com.android.tools:repository:27.1.1=compileClasspath,testCompileClasspath
com.android.tools:sdk-common:27.1.1=compileClasspath,testCompileClasspath
com.android.tools:sdklib:27.1.1=compileClasspath,testCompileClasspath
com.android:signflinger:4.1.1=compileClasspath,testCompileClasspath
com.android:zipflinger:4.1.1=compileClasspath,testCompileClasspath
com.android.tools.ddms:ddmlib:27.2.1=compileClasspath,testCompileClasspath
com.android.tools.layoutlib:layoutlib-api:27.2.1=compileClasspath,testCompileClasspath
com.android.tools.lint:lint-gradle-api:27.2.1=compileClasspath,testCompileClasspath
com.android.tools.lint:lint-model:27.2.1=compileClasspath,testCompileClasspath
com.android.tools:annotations:27.2.1=compileClasspath,testCompileClasspath
com.android.tools:common:27.2.1=compileClasspath,testCompileClasspath
com.android.tools:dvlib:27.2.1=compileClasspath,testCompileClasspath
com.android.tools:repository:27.2.1=compileClasspath,testCompileClasspath
com.android.tools:sdk-common:27.2.1=compileClasspath,testCompileClasspath
com.android.tools:sdklib:27.2.1=compileClasspath,testCompileClasspath
com.android:signflinger:4.2.1=compileClasspath,testCompileClasspath
com.android:zipflinger:4.2.1=compileClasspath,testCompileClasspath
com.google.android.gms:strict-version-matcher-plugin:1.2.2=compileClasspath,testCompileClasspath
com.google.code.findbugs:jsr305:3.0.2=compileClasspath,testCompileClasspath
com.google.code.gson:gson:2.8.5=compileClasspath,testCompileClasspath
com.google.code.gson:gson:2.8.6=compileClasspath,testCompileClasspath
com.google.crypto.tink:tink:1.3.0-rc2=compileClasspath,testCompileClasspath
com.google.errorprone:error_prone_annotations:2.3.2=compileClasspath,testCompileClasspath
com.google.gms:google-services:4.3.4=compileClasspath,testCompileClasspath
com.google.gms:google-services:4.3.8=compileClasspath,testCompileClasspath
com.google.guava:failureaccess:1.0.1=compileClasspath,testCompileClasspath
com.google.guava:guava:28.1-jre=compileClasspath,testCompileClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,testCompileClasspath
com.google.j2objc:j2objc-annotations:1.3=compileClasspath,testCompileClasspath
com.google.jimfs:jimfs:1.1=compileClasspath,testCompileClasspath
com.google.protobuf:protobuf-java-util:3.10.0=compileClasspath,testCompileClasspath
com.google.protobuf:protobuf-java:3.10.0=compileClasspath,testCompileClasspath
com.google.test.platform:core-proto:0.0.2-dev=compileClasspath,testCompileClasspath
com.google.testing.platform:core-proto:0.0.8-alpha01=compileClasspath,testCompileClasspath
com.googlecode.json-simple:json-simple:1.1=compileClasspath,testCompileClasspath
com.googlecode.juniversalchardet:juniversalchardet:1.0.3=compileClasspath,testCompileClasspath
com.squareup:javapoet:1.10.0=compileClasspath,testCompileClasspath
com.squareup:javawriter:2.5.0=compileClasspath,testCompileClasspath
com.sun.activation:javax.activation:1.2.0=compileClasspath,testCompileClasspath
com.sun.istack:istack-commons-runtime:3.0.7=compileClasspath,testCompileClasspath
com.sun.xml.fastinfoset:FastInfoset:1.2.15=compileClasspath,testCompileClasspath
com.sun.istack:istack-commons-runtime:3.0.8=compileClasspath,testCompileClasspath
com.sun.xml.fastinfoset:FastInfoset:1.2.16=compileClasspath,testCompileClasspath
commons-codec:commons-codec:1.10=compileClasspath,testCompileClasspath
commons-io:commons-io:2.4=compileClasspath,testCompileClasspath
commons-logging:commons-logging:1.2=compileClasspath,testCompileClasspath
it.unimi.dsi:fastutil:7.2.0=compileClasspath,testCompileClasspath
javax.activation:javax.activation-api:1.2.0=compileClasspath,testCompileClasspath
it.unimi.dsi:fastutil:8.4.0=compileClasspath,testCompileClasspath
jakarta.activation:jakarta.activation-api:1.2.1=compileClasspath,testCompileClasspath
jakarta.xml.bind:jakarta.xml.bind-api:2.3.2=compileClasspath,testCompileClasspath
javax.inject:javax.inject:1=compileClasspath,testCompileClasspath
javax.xml.bind:jaxb-api:2.3.1=compileClasspath,testCompileClasspath
junit:junit:4.12=testCompileClasspath,testRuntimeClasspath
net.bytebuddy:byte-buddy:1.11.0=testCompileClasspath,testRuntimeClasspath
net.java.dev.jna:jna-platform:5.6.0=compileClasspath,testCompileClasspath
net.java.dev.jna:jna:5.6.0=compileClasspath,testCompileClasspath
net.sf.jopt-simple:jopt-simple:4.9=compileClasspath,testCompileClasspath
net.sf.kxml:kxml2:2.3.0=compileClasspath,testCompileClasspath
net.sf.proguard:proguard-base:6.0.3=compileClasspath,testCompileClasspath
Expand All @@ -72,27 +76,42 @@ org.apache.commons:commons-compress:1.12=compileClasspath,testCompileClasspath
org.apache.httpcomponents:httpclient:4.5.6=compileClasspath,testCompileClasspath
org.apache.httpcomponents:httpcore:4.4.10=compileClasspath,testCompileClasspath
org.apache.httpcomponents:httpmime:4.5.6=compileClasspath,testCompileClasspath
org.apiguardian:apiguardian-api:1.1.0=testCompileClasspath,testRuntimeClasspath
org.assertj:assertj-core:3.16.1=testCompileClasspath,testRuntimeClasspath
org.bouncycastle:bcpkix-jdk15on:1.56=compileClasspath,testCompileClasspath
org.bouncycastle:bcprov-jdk15on:1.56=compileClasspath,testCompileClasspath
org.checkerframework:checker-qual:2.8.1=compileClasspath,testCompileClasspath
org.codehaus.groovy:groovy:3.0.8=testCompileClasspath,testRuntimeClasspath
org.codehaus.mojo:animal-sniffer-annotations:1.18=compileClasspath,testCompileClasspath
org.glassfish.jaxb:jaxb-runtime:2.3.1=compileClasspath,testCompileClasspath
org.glassfish.jaxb:txw2:2.3.1=compileClasspath,testCompileClasspath
org.glassfish.jaxb:jaxb-runtime:2.3.2=compileClasspath,testCompileClasspath
org.glassfish.jaxb:txw2:2.3.2=compileClasspath,testCompileClasspath
org.hamcrest:hamcrest-core:1.3=testCompileClasspath,testRuntimeClasspath
org.hamcrest:hamcrest:2.2=testCompileClasspath,testRuntimeClasspath
org.jdom:jdom2:2.0.6=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-reflect:1.3.72=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-stdlib:1.3.72=compileClasspath,testCompileClasspath
org.jetbrains.trove4j:trove4j:20160824=compileClasspath,testCompileClasspath
org.jetbrains:annotations:13.0=compileClasspath,testCompileClasspath
org.jetbrains.intellij.deps:trove4j:1.0.20181211=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-reflect:1.4.31=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-stdlib-common:1.4.31=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.31=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.31=compileClasspath,testCompileClasspath
org.jetbrains.kotlin:kotlin-stdlib:1.4.31=compileClasspath,testCompileClasspath
org.jetbrains:annotations:13.0=compileClasspath
org.jetbrains:annotations:20.1.0=testCompileClasspath,testRuntimeClasspath
org.json:json:20180813=compileClasspath,testCompileClasspath
org.jvnet.staxex:stax-ex:1.8=compileClasspath,testCompileClasspath
org.junit.platform:junit-platform-commons:1.7.2=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-engine:1.7.2=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-launcher:1.7.2=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-testkit:1.7.2=testCompileClasspath,testRuntimeClasspath
org.junit:junit-bom:5.7.2=testCompileClasspath,testRuntimeClasspath
org.jvnet.staxex:stax-ex:1.8.1=compileClasspath,testCompileClasspath
org.objenesis:objenesis:3.2=testCompileClasspath,testRuntimeClasspath
org.opentest4j:opentest4j:1.2.0=testCompileClasspath,testRuntimeClasspath
org.ow2.asm:asm-analysis:7.0=compileClasspath,testCompileClasspath
org.ow2.asm:asm-commons:7.0=compileClasspath,testCompileClasspath
org.ow2.asm:asm-tree:7.0=compileClasspath,testCompileClasspath
org.ow2.asm:asm-util:7.0=compileClasspath,testCompileClasspath
org.ow2.asm:asm:7.0=compileClasspath,testCompileClasspath
org.spockframework:spock-core:1.0-groovy-2.4=testCompileClasspath,testRuntimeClasspath
org.ow2.asm:asm:7.0=compileClasspath
org.ow2.asm:asm:9.1=testCompileClasspath,testRuntimeClasspath
org.spockframework:spock-core:2.0-groovy-3.0=testCompileClasspath,testRuntimeClasspath
xerces:xercesImpl:2.12.0=compileClasspath,testCompileClasspath
xml-apis:xml-apis:1.4.01=compileClasspath,testCompileClasspath
empty=annotationProcessor,runtimeClasspath,testAnnotationProcessor
1 change: 1 addition & 0 deletions gradle.properties
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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.onesignal.androidsdk;
Copy link

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. 😬

  • DefaultVersionSelectorScheme now requires a VersionParser as part of
    it's constructor parameters.
  • This introduced in Gradle 4.7. or 4.8 but the old deprecated
    constructor was dropped in 7.0
  • Since we want to continue to support Gradle versions older than 4.7
    created DefaultVersionSelectorSchemeCompat to handle constructing
    a DefaultVersionSelectorScheme instance to handle the fallback logic

Copy link
Member Author

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 selected reword and force pushed.
See commit 5c44161 for the fix


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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.DependencyResolveDetails
import org.gradle.api.artifacts.result.DependencyResult
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionComparator
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionSelectorScheme
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.ExactVersionSelector
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.LatestVersionSelector
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.SubVersionSelector
Expand Down Expand Up @@ -50,7 +49,7 @@ import java.util.jar.Manifest

class GradleProjectPlugin implements Plugin<Project> {

static final VERSION_SELECTOR_SCHEME = new DefaultVersionSelectorScheme(new DefaultVersionComparator())
static final VERSION_SELECTOR_SCHEME = DefaultVersionSelectorSchemeCompat.get()

static final String GROUP_GMS = 'com.google.android.gms'
static final String GROUP_ANDROID_SUPPORT = 'com.android.support'
Expand Down Expand Up @@ -1011,20 +1010,10 @@ class GradleProjectPlugin implements Plugin<Project> {
versionSelector
}


// VersionRangeSelector.intersect was introduced in Gradle 4.3, this is a compat wrapper method
static VersionRangeSelector intersectCompat(VersionRangeSelector inComing, VersionRangeSelector existing) {
if (inComing.metaClass.respondsTo(inComing, 'intersect', VersionRangeSelector, VersionRangeSelector))
return inComing.intersect(existing)

// This means we are on Gradle 4.2 or older so use compat version of intersect
VersionCompatHelpers.intersect(inComing, existing)
}

// Returns the intersection range of two versions
// If no over lap the higher of the two will be returned
static VersionRangeSelector mergedIntersectOrHigher(VersionRangeSelector inComing, VersionRangeSelector existing) {
def intersectResult = intersectCompat(inComing, existing)
def intersectResult = VersionCompatHelpers.intersect(inComing, existing)
if (intersectResult != null)
return intersectResult

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static public VersionRangeSelector intersect(VersionRangeSelector thisVersion, V
return null;
}

DefaultVersionSelectorScheme versionSelectorScheme = new DefaultVersionSelectorScheme(new DefaultVersionComparator());
VersionSelectorScheme versionSelectorScheme = DefaultVersionSelectorSchemeCompat.get();
return (VersionRangeSelector)versionSelectorScheme.parseSelector(sb.toString());
}

Expand Down
Loading