Skip to content

Commit

Permalink
Merge pull request #368 from nebula-plugins/gradle-6_4-support
Browse files Browse the repository at this point in the history
Gradle 6.4 support
  • Loading branch information
rpalcolea committed Mar 30, 2020
2 parents ec28193 + 6f993b8 commit fb84f19
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 25 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ dependencies {
}

implementation 'com.bmuschko:gradle-docker-plugin:3.2.1'
testImplementation 'com.github.stefanbirkner:system-rules:1.19.0'
}

def javaApiUrl = 'http://docs.oracle.com/javase/1.6.0/docs/api/'
Expand Down
15 changes: 0 additions & 15 deletions gradle/dependency-locks/default.lockfile

This file was deleted.

4 changes: 3 additions & 1 deletion gradle/dependency-locks/integTestCompileClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# This file is expected to be part of source control.
cglib:cglib-nodep:3.2.2
com.bmuschko:gradle-docker-plugin:3.2.1
com.github.stefanbirkner:system-rules:1.19.0
com.google.guava:guava:19.0
com.netflix.nebula:nebula-test:7.6.0
com.netflix.nebula:nebula-test:7.8.6
commons-io:commons-io:2.6
junit:junit-dep:4.11
junit:junit:4.12
org.apache.ant:ant-launcher:1.10.6
org.apache.ant:ant:1.10.6
Expand Down
4 changes: 3 additions & 1 deletion gradle/dependency-locks/integTestRuntimeClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# This file is expected to be part of source control.
cglib:cglib-nodep:3.2.2
com.bmuschko:gradle-docker-plugin:3.2.1
com.github.stefanbirkner:system-rules:1.19.0
com.google.guava:guava:19.0
com.netflix.nebula:nebula-test:7.6.0
com.netflix.nebula:nebula-test:7.8.6
commons-io:commons-io:2.6
junit:junit-dep:4.11
junit:junit:4.12
org.apache.ant:ant-launcher:1.10.6
org.apache.ant:ant:1.10.6
Expand Down
4 changes: 3 additions & 1 deletion gradle/dependency-locks/testCompileClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# This file is expected to be part of source control.
cglib:cglib-nodep:3.2.2
com.bmuschko:gradle-docker-plugin:3.2.1
com.github.stefanbirkner:system-rules:1.19.0
com.google.guava:guava:19.0
com.netflix.nebula:nebula-test:7.6.0
com.netflix.nebula:nebula-test:7.8.6
commons-io:commons-io:2.6
junit:junit-dep:4.11
junit:junit:4.12
org.apache.ant:ant-launcher:1.10.6
org.apache.ant:ant:1.10.6
Expand Down
4 changes: 3 additions & 1 deletion gradle/dependency-locks/testRuntimeClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# This file is expected to be part of source control.
cglib:cglib-nodep:3.2.2
com.bmuschko:gradle-docker-plugin:3.2.1
com.github.stefanbirkner:system-rules:1.19.0
com.google.guava:guava:19.0
com.netflix.nebula:nebula-test:7.6.0
com.netflix.nebula:nebula-test:7.8.6
commons-io:commons-io:2.6
junit:junit-dep:4.11
junit:junit:4.12
org.apache.ant:ant-launcher:1.10.6
org.apache.ant:ant:1.10.6
Expand Down
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.3-bin.zip
distributionUrl=https://services.gradle.org/distributions-snapshots/gradle-6.4-20200329220053+0000-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import org.gradle.api.internal.file.copy.CopySpecInternal
import org.gradle.api.internal.file.copy.DefaultCopySpec
import org.gradle.api.internal.project.ProjectInternal
import org.gradle.api.specs.Spec
import org.gradle.api.tasks.util.PatternSet
import org.gradle.api.tasks.util.internal.PatternSets
import org.gradle.api.tasks.util.internal.PatternSpecFactory
import org.gradle.internal.Factory
import org.gradle.internal.reflect.Instantiator
import org.gradle.util.GradleVersion

Expand All @@ -39,7 +43,11 @@ class ProjectPackagingExtension extends SystemPackagingExtension {
public ProjectPackagingExtension(Project project) {
FileResolver resolver = ((ProjectInternal) project).getFileResolver();
Instantiator instantiator = ((ProjectInternal) project).getServices().get(Instantiator.class);
if (GradleVersion.current().baseVersion >= GradleVersion.version("6.0")) {
if (GradleVersion.current().baseVersion >= GradleVersion.version("6.4") || GradleVersion.current().version.startsWith('6.4')) {
FileCollectionFactory fileCollectionFactory = ((ProjectInternal) project).getServices().get(FileCollectionFactory.class);
Factory<PatternSet> patternSetFactory = new PatternSets.PatternSetFactory(PatternSpecFactory.INSTANCE)
delegateCopySpec = new DefaultCopySpec(fileCollectionFactory, instantiator, patternSetFactory);
} else if (GradleVersion.current().baseVersion >= GradleVersion.version("6.0")) {
FileCollectionFactory fileCollectionFactory = ((ProjectInternal) project).getServices().get(FileCollectionFactory.class);
delegateCopySpec = new DefaultCopySpec(resolver, fileCollectionFactory, instantiator);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@ package com.netflix.gradle.plugins.application
import com.google.common.base.Throwables
import com.netflix.gradle.plugins.deb.Scanner
import nebula.test.IntegrationSpec
import org.junit.Rule
import org.junit.contrib.java.lang.system.ProvideSystemProperty
import spock.lang.Unroll

import java.util.jar.Manifest
import java.util.zip.ZipFile

class OspackageApplicationSpringBootPluginLauncherSpec extends IntegrationSpec {

//TODO: remove this once @Optional is removed from https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/application/CreateBootStartScripts.java#L33
@Rule
public final ProvideSystemProperty myPropertyHasMyValue = new ProvideSystemProperty("ignoreDeprecations", "true")

def 'plugin throws exception if spring-boot plugin not applied'() {
buildFile << """
${applyPlugin(OspackageApplicationSpringBootPlugin)}
Expand Down Expand Up @@ -84,7 +91,7 @@ class OspackageApplicationSpringBootPluginLauncherSpec extends IntegrationSpec {
buildFile << buildScript(bootVersion, null)

when:
runTasksSuccessfully('buildDeb', '--warning-mode', 'all')
runTasksSuccessfully('buildDeb')

then:
final archivePath = file("build/distributions/test_unspecified_all.deb")
Expand Down Expand Up @@ -123,7 +130,7 @@ class OspackageApplicationSpringBootPluginLauncherSpec extends IntegrationSpec {
buildFile << buildScript(bootVersion, startScript)

when:
def result = runTasksSuccessfully('runStartScript', '--warning-mode', 'all')
def result = runTasksSuccessfully('runStartScript')

then:
result.standardOutput.contains('Hello Integration Test')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.gradle.api.internal.file.FileResolver
import org.gradle.api.internal.file.copy.DefaultCopySpec
import org.gradle.api.tasks.util.PatternSet
import org.gradle.api.tasks.util.internal.PatternSets
import org.gradle.api.tasks.util.internal.PatternSpecFactory
import org.gradle.internal.Factory
import org.gradle.internal.reflect.DirectInstantiator
import org.gradle.internal.reflect.Instantiator
Expand All @@ -23,11 +24,13 @@ class CopySpecEnhancementTest {
private final FileCollectionFactory factory = [configurableFiles: {
null
}] as FileCollectionFactory

private final Factory<PatternSet> patternSetFactory = new PatternSets.PatternSetFactory(PatternSpecFactory.INSTANCE)
def spec = createDefaultCopySpec()

private DefaultCopySpec createDefaultCopySpec() {
if (GradleVersion.current().baseVersion >= GradleVersion.version("6.0")) {
if (GradleVersion.current().baseVersion >= GradleVersion.version("6.4") || GradleVersion.current().version.startsWith('6.4')) {
new DefaultCopySpec(factory, instantiator, patternSetFactory);
} else if (GradleVersion.current().baseVersion >= GradleVersion.version("6.0")) {
new DefaultCopySpec(fileResolver, factory, instantiator);
} else {
new DefaultCopySpec(fileResolver, instantiator);
Expand Down

0 comments on commit fb84f19

Please sign in to comment.