update to Gradle 5.1
This commit is contained in:
parent
3f21e9eff3
commit
19e2530a5e
44 changed files with 405 additions and 205 deletions
|
@ -19,11 +19,6 @@ printf "Date: %s\nHost: %s\nOS: %s %s %s\nJava: %s %s %s %s\nGradle: %s Groovy:
|
||||||
System.getProperty("java.vm.name"),
|
System.getProperty("java.vm.name"),
|
||||||
gradle.gradleVersion, GroovySystem.getVersion(), JavaVersion.current()
|
gradle.gradleVersion, GroovySystem.getVersion(), JavaVersion.current()
|
||||||
|
|
||||||
// our RPM gradle plugin integration test looks into Gradle's " Task : " output
|
|
||||||
if (VersionNumber.parse(gradle.gradleVersion).compareTo(VersionNumber.parse("4.8")) < 0) {
|
|
||||||
throw new GradleScriptException("Gradle version must be 4.8 or higher", null)
|
|
||||||
}
|
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
user = 'xbib'
|
user = 'xbib'
|
||||||
projectName = 'rpm'
|
projectName = 'rpm'
|
||||||
|
|
|
@ -13,10 +13,10 @@ apply plugin: 'com.gradle.plugin-publish'
|
||||||
dependencies {
|
dependencies {
|
||||||
compile gradleApi()
|
compile gradleApi()
|
||||||
compile project(':rpm-core')
|
compile project(':rpm-core')
|
||||||
compileOnly "org.codehaus.groovy:groovy-all:${project.property('groovy.version')}"
|
compileOnly "org.codehaus.groovy:groovy:${project.property('groovy.version')}"
|
||||||
testCompile "junit:junit:${project.property('junit.version')}"
|
testCompile "junit:junit:${project.property('junit.version')}"
|
||||||
testCompile("org.spockframework:spock-core:${project.property('spock-core.version')}") {
|
testCompile("org.spockframework:spock-core:${project.property('spock-core.version')}") {
|
||||||
exclude module: 'groovy-all'
|
exclude module: 'groovy'
|
||||||
exclude module: 'junit'
|
exclude module: 'junit'
|
||||||
}
|
}
|
||||||
testCompile "org.xbib:guice:${project.property('xbib-guice.version')}"
|
testCompile "org.xbib:guice:${project.property('xbib-guice.version')}"
|
||||||
|
|
|
@ -34,7 +34,7 @@ class ProjectPackagingExtension extends SystemPackagingExtension {
|
||||||
|
|
||||||
ProjectPackagingExtension(Project project) {
|
ProjectPackagingExtension(Project project) {
|
||||||
FileResolver resolver = ((ProjectInternal) project).getFileResolver()
|
FileResolver resolver = ((ProjectInternal) project).getFileResolver()
|
||||||
Instantiator instantiator = ((ProjectInternal) project).getServices().get(Instantiator.class)
|
Instantiator instantiator = ((ProjectInternal) project).getServices().get(Instantiator)
|
||||||
delegateCopySpec = new DefaultCopySpec(resolver, instantiator)
|
delegateCopySpec = new DefaultCopySpec(resolver, instantiator)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.rpm
|
||||||
|
|
||||||
|
import groovy.util.logging.Log4j
|
||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
|
import org.gradle.api.file.RegularFile
|
||||||
import org.gradle.api.internal.ConventionMapping
|
import org.gradle.api.internal.ConventionMapping
|
||||||
import org.gradle.api.internal.IConventionAware
|
import org.gradle.api.internal.IConventionAware
|
||||||
import org.gradle.api.tasks.AbstractCopyTask
|
import org.gradle.api.model.ObjectFactory
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
import org.gradle.api.tasks.Input
|
import org.gradle.api.tasks.Input
|
||||||
import org.gradle.api.tasks.InputFiles
|
import org.gradle.api.tasks.InputFiles
|
||||||
import org.gradle.api.tasks.Optional
|
import org.gradle.api.tasks.Optional
|
||||||
|
@ -11,17 +15,23 @@ import org.gradle.api.tasks.Nested
|
||||||
import org.gradle.api.tasks.SkipWhenEmpty
|
import org.gradle.api.tasks.SkipWhenEmpty
|
||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
import org.gradle.api.tasks.bundling.AbstractArchiveTask
|
import org.gradle.api.tasks.bundling.AbstractArchiveTask
|
||||||
|
import org.gradle.util.GUtil
|
||||||
import org.xbib.rpm.lead.Architecture
|
import org.xbib.rpm.lead.Architecture
|
||||||
import org.xbib.rpm.lead.Os
|
import org.xbib.rpm.lead.Os
|
||||||
import org.xbib.rpm.lead.PackageType
|
import org.xbib.rpm.lead.PackageType
|
||||||
|
|
||||||
|
import javax.annotation.Nullable
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
import java.util.concurrent.Callable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Log4j
|
||||||
class Rpm extends AbstractArchiveTask {
|
class Rpm extends AbstractArchiveTask {
|
||||||
|
|
||||||
|
final ObjectFactory objectFactory
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
@Optional
|
@Optional
|
||||||
Path changeLogFile
|
Path changeLogFile
|
||||||
|
@ -34,12 +44,27 @@ class Rpm extends AbstractArchiveTask {
|
||||||
|
|
||||||
Rpm() {
|
Rpm() {
|
||||||
super()
|
super()
|
||||||
|
objectFactory = project.objects
|
||||||
systemPackagingExtension = new SystemPackagingExtension()
|
systemPackagingExtension = new SystemPackagingExtension()
|
||||||
projectPackagingExtension = project.extensions.findByType(ProjectPackagingExtension)
|
projectPackagingExtension = project.extensions.findByType(ProjectPackagingExtension)
|
||||||
if (projectPackagingExtension) {
|
if (projectPackagingExtension) {
|
||||||
getRootSpec().with(projectPackagingExtension.delegateCopySpec)
|
getRootSpec().with(projectPackagingExtension.delegateCopySpec)
|
||||||
}
|
}
|
||||||
extension = 'rpm'
|
archiveExtension.set('rpm')
|
||||||
|
|
||||||
|
// override archive file name provider in Gradle 5
|
||||||
|
Callable<String> archiveFileNameProvider = new Callable<String>() {
|
||||||
|
@Override
|
||||||
|
String call() throws Exception {
|
||||||
|
constructArchiveFile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getArchiveFileName().set(getProject().provider(archiveFileNameProvider))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
RpmCopyAction createCopyAction() {
|
||||||
|
new RpmCopyAction(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -51,7 +76,7 @@ class Rpm extends AbstractArchiveTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
AbstractCopyTask from(Object... sourcePaths) {
|
Rpm from(Object... sourcePaths) {
|
||||||
for (Object sourcePath : sourcePaths) {
|
for (Object sourcePath : sourcePaths) {
|
||||||
from(sourcePath, {})
|
from(sourcePath, {})
|
||||||
}
|
}
|
||||||
|
@ -59,7 +84,7 @@ class Rpm extends AbstractArchiveTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
AbstractCopyTask from(Object sourcePath, Closure c) {
|
Rpm from(Object sourcePath, Closure c) {
|
||||||
def preserveSymlinks = FromConfigurationFactory.preserveSymlinks(this)
|
def preserveSymlinks = FromConfigurationFactory.preserveSymlinks(this)
|
||||||
use(CopySpecEnhancement) {
|
use(CopySpecEnhancement) {
|
||||||
getMainSpec().from(sourcePath, c << preserveSymlinks)
|
getMainSpec().from(sourcePath, c << preserveSymlinks)
|
||||||
|
@ -68,7 +93,7 @@ class Rpm extends AbstractArchiveTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
AbstractArchiveTask into(Object destPath, Closure configureClosure) {
|
Rpm into(Object destPath, Closure configureClosure) {
|
||||||
use(CopySpecEnhancement) {
|
use(CopySpecEnhancement) {
|
||||||
getMainSpec().into(destPath, configureClosure)
|
getMainSpec().into(destPath, configureClosure)
|
||||||
}
|
}
|
||||||
|
@ -76,7 +101,7 @@ class Rpm extends AbstractArchiveTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
AbstractCopyTask exclude(Closure excludeSpec) {
|
Rpm exclude(Closure excludeSpec) {
|
||||||
use(CopySpecEnhancement) {
|
use(CopySpecEnhancement) {
|
||||||
getMainSpec().exclude(excludeSpec)
|
getMainSpec().exclude(excludeSpec)
|
||||||
}
|
}
|
||||||
|
@ -84,7 +109,7 @@ class Rpm extends AbstractArchiveTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
AbstractCopyTask filter(Closure closure) {
|
Rpm filter(Closure closure) {
|
||||||
use(CopySpecEnhancement) {
|
use(CopySpecEnhancement) {
|
||||||
getMainSpec().filter(closure)
|
getMainSpec().filter(closure)
|
||||||
}
|
}
|
||||||
|
@ -92,24 +117,13 @@ class Rpm extends AbstractArchiveTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
AbstractCopyTask rename(Closure closure) {
|
Rpm rename(Closure closure) {
|
||||||
use(CopySpecEnhancement) {
|
use(CopySpecEnhancement) {
|
||||||
getMainSpec().rename(closure)
|
getMainSpec().rename(closure)
|
||||||
}
|
}
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
RpmCopyAction createCopyAction() {
|
|
||||||
new RpmCopyAction(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Input
|
|
||||||
@Optional
|
|
||||||
void setArch(Object arch) {
|
|
||||||
setArchStr((arch instanceof Architecture)?arch.name():arch.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
@Optional
|
@Optional
|
||||||
List<Object> getAllConfigurationPaths() {
|
List<Object> getAllConfigurationPaths() {
|
||||||
|
@ -243,14 +257,14 @@ class Rpm extends AbstractArchiveTask {
|
||||||
ConventionMapping mapping = ((IConventionAware) this).getConventionMapping()
|
ConventionMapping mapping = ((IConventionAware) this).getConventionMapping()
|
||||||
|
|
||||||
mapping.map('packageName', {
|
mapping.map('packageName', {
|
||||||
projectPackagingExtension?.getPackageName()?:getBaseName()
|
projectPackagingExtension?.getPackageName()?:getArchiveBaseName().getOrNull()?:'test'
|
||||||
})
|
|
||||||
mapping.map('release', {
|
|
||||||
projectPackagingExtension?.getRelease()?:getClassifier()
|
|
||||||
})
|
})
|
||||||
mapping.map('version', {
|
mapping.map('version', {
|
||||||
sanitizeVersion(projectPackagingExtension?.getVersion()?:project.getVersion().toString())
|
sanitizeVersion(projectPackagingExtension?.getVersion()?:project.getVersion().toString())
|
||||||
})
|
})
|
||||||
|
mapping.map('release', {
|
||||||
|
projectPackagingExtension?.getRelease()?:''
|
||||||
|
})
|
||||||
mapping.map('epoch', {
|
mapping.map('epoch', {
|
||||||
projectPackagingExtension?.getEpoch()?:0
|
projectPackagingExtension?.getEpoch()?:0
|
||||||
})
|
})
|
||||||
|
@ -327,40 +341,33 @@ class Rpm extends AbstractArchiveTask {
|
||||||
mapping.map('postUninstall', {
|
mapping.map('postUninstall', {
|
||||||
projectPackagingExtension?.getPostUninstall()
|
projectPackagingExtension?.getPostUninstall()
|
||||||
})
|
})
|
||||||
mapping.map('archiveName', {
|
|
||||||
assembleArchiveName()
|
|
||||||
})
|
|
||||||
mapping.map('fileType', {
|
mapping.map('fileType', {
|
||||||
projectPackagingExtension?.getFileType()
|
projectPackagingExtension?.getFileType()
|
||||||
})
|
})
|
||||||
mapping.map('addParentDirs', {
|
mapping.map('addParentDirs', {
|
||||||
projectPackagingExtension?.getAddParentDirs()?:true
|
projectPackagingExtension?.getAddParentDirs()?:true
|
||||||
})
|
})
|
||||||
mapping.map('archStr', {
|
mapping.map('arch', {
|
||||||
projectPackagingExtension?.getArchStr()?:Architecture.NOARCH.name()
|
projectPackagingExtension?.arch?:Architecture.NOARCH
|
||||||
})
|
})
|
||||||
mapping.map('os', {
|
mapping.map('os', {
|
||||||
projectPackagingExtension?.getOs()?:Os.UNKNOWN
|
projectPackagingExtension?.os?:Os.UNKNOWN
|
||||||
})
|
})
|
||||||
mapping.map('type', {
|
mapping.map('type', {
|
||||||
projectPackagingExtension?.getType()?:PackageType.BINARY
|
projectPackagingExtension?.type?:PackageType.BINARY
|
||||||
})
|
})
|
||||||
mapping.map('prefixes', {
|
mapping.map('prefixes', {
|
||||||
projectPackagingExtension?.getPrefixes()?:[]
|
projectPackagingExtension?.getPrefixes()?:[]
|
||||||
})
|
})
|
||||||
}
|
mapping.map('archiveName', {
|
||||||
|
constructArchiveFile()
|
||||||
String assembleArchiveName() {
|
})
|
||||||
String name = getPackageName()
|
mapping.map('archivePath', {
|
||||||
name += getVersion() ? "-${getVersion()}" : ''
|
determineArchivePath()
|
||||||
name += getRelease() ? "-${getRelease()}" : ''
|
})
|
||||||
name += getArchString() ? ".${getArchString()}" : ''
|
mapping.map('archiveFile', {
|
||||||
name += getExtension() ? ".${getExtension()}" : ''
|
determineArchiveFile()
|
||||||
name
|
})
|
||||||
}
|
|
||||||
|
|
||||||
String getArchString() {
|
|
||||||
getArchStr()?.toLowerCase()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void prefixes(String... addPrefixes) {
|
void prefixes(String... addPrefixes) {
|
||||||
|
@ -379,6 +386,26 @@ class Rpm extends AbstractArchiveTask {
|
||||||
changeLogFile
|
changeLogFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Provider<RegularFile> determineArchiveFile() {
|
||||||
|
Property<RegularFile> regularFile = objectFactory.fileProperty()
|
||||||
|
regularFile.set(new DestinationFile(new File(getDestinationDirectory().get().asFile.path, constructArchiveFile())))
|
||||||
|
regularFile
|
||||||
|
}
|
||||||
|
|
||||||
|
File determineArchivePath() {
|
||||||
|
determineArchiveFile().get().asFile
|
||||||
|
}
|
||||||
|
|
||||||
|
String constructArchiveFile() {
|
||||||
|
String name = GUtil.elvis(getPackageName(), "")
|
||||||
|
name += maybe(name, '-', getVersion())
|
||||||
|
name += maybe(name, '-', getRelease())
|
||||||
|
name += maybe(name, '.', getArch().name().toLowerCase())
|
||||||
|
String extension = archiveExtension.getOrNull()
|
||||||
|
name += GUtil.isTrue(extension) ? "." + extension : ""
|
||||||
|
name
|
||||||
|
}
|
||||||
|
|
||||||
static String sanitizeVersion(String version) {
|
static String sanitizeVersion(String version) {
|
||||||
version.replaceAll(/\+.*/, '').replaceAll(/-/, '~')
|
version.replaceAll(/\+.*/, '').replaceAll(/-/, '~')
|
||||||
}
|
}
|
||||||
|
@ -390,4 +417,32 @@ class Rpm extends AbstractArchiveTask {
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String maybe(@Nullable String prefix, String delimiter, @Nullable String value) {
|
||||||
|
if (GUtil.isTrue(value)) {
|
||||||
|
if (GUtil.isTrue(prefix)) {
|
||||||
|
return delimiter.concat(value)
|
||||||
|
} else {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
static class DestinationFile implements RegularFile {
|
||||||
|
private final File file
|
||||||
|
|
||||||
|
DestinationFile(File file) {
|
||||||
|
this.file = file
|
||||||
|
}
|
||||||
|
|
||||||
|
String toString() {
|
||||||
|
return this.file.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
File getAsFile() {
|
||||||
|
return this.file
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.gradle.api.tasks.WorkResults
|
||||||
import org.gradle.internal.UncheckedException
|
import org.gradle.internal.UncheckedException
|
||||||
import org.xbib.gradle.plugin.rpm.validation.RpmTaskPropertiesValidator
|
import org.xbib.gradle.plugin.rpm.validation.RpmTaskPropertiesValidator
|
||||||
import org.xbib.rpm.RpmBuilder
|
import org.xbib.rpm.RpmBuilder
|
||||||
import org.xbib.rpm.lead.Architecture
|
|
||||||
import org.xbib.rpm.header.HeaderTag
|
import org.xbib.rpm.header.HeaderTag
|
||||||
import org.xbib.rpm.payload.Directive
|
import org.xbib.rpm.payload.Directive
|
||||||
|
|
||||||
|
@ -164,7 +163,7 @@ class RpmCopyAction implements CopyAction {
|
||||||
builder = new RpmBuilder()
|
builder = new RpmBuilder()
|
||||||
builder.setPackage task.packageName, task.version, task.release, task.epoch
|
builder.setPackage task.packageName, task.version, task.release, task.epoch
|
||||||
builder.setType task.type
|
builder.setType task.type
|
||||||
builder.setPlatform Architecture.valueOf(task.archStr.toUpperCase()), task.os
|
builder.setPlatform task.arch, task.os
|
||||||
builder.setGroup task.packageGroup
|
builder.setGroup task.packageGroup
|
||||||
builder.setBuildHost task.buildHost
|
builder.setBuildHost task.buildHost
|
||||||
builder.setSummary task.summary
|
builder.setSummary task.summary
|
||||||
|
@ -266,18 +265,19 @@ class RpmCopyAction implements CopyAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void end() {
|
protected void end() {
|
||||||
Path path = task.getArchivePath().toPath()
|
Path path = task.archiveFile.get().asFile.toPath()
|
||||||
|
Files.createDirectories(path.parent)
|
||||||
Files.newByteChannel(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE,
|
Files.newByteChannel(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE,
|
||||||
StandardOpenOption.TRUNCATE_EXISTING).withCloseable { ch ->
|
StandardOpenOption.TRUNCATE_EXISTING).withCloseable { ch ->
|
||||||
builder.build(ch)
|
builder.build(ch)
|
||||||
}
|
}
|
||||||
logger.info 'Created RPM archive {}', path
|
logger.info 'created RPM archive {}', path
|
||||||
}
|
}
|
||||||
|
|
||||||
String standardScriptDefines() {
|
String standardScriptDefines() {
|
||||||
includeStandardDefines ?
|
includeStandardDefines ?
|
||||||
String.format(" RPM_ARCH=%s \n RPM_OS=%s \n RPM_PACKAGE_NAME=%s \n RPM_PACKAGE_VERSION=%s \n RPM_PACKAGE_RELEASE=%s \n\n",
|
String.format(" RPM_ARCH=%s \n RPM_OS=%s \n RPM_PACKAGE_NAME=%s \n RPM_PACKAGE_VERSION=%s \n RPM_PACKAGE_RELEASE=%s \n\n",
|
||||||
task.getArchString(),
|
task.arch?.toString()?.toLowerCase()?:'',
|
||||||
task.os?.toString()?.toLowerCase()?: '',
|
task.os?.toString()?.toLowerCase()?: '',
|
||||||
task.getPackageName(),
|
task.getPackageName(),
|
||||||
task.getVersion(),
|
task.getVersion(),
|
||||||
|
|
|
@ -75,13 +75,6 @@ class SystemPackagingExtension {
|
||||||
@Input @Optional
|
@Input @Optional
|
||||||
String sourcePackage
|
String sourcePackage
|
||||||
|
|
||||||
String archStr
|
|
||||||
|
|
||||||
@Input @Optional
|
|
||||||
void setArch(Object arch) {
|
|
||||||
archStr = (arch instanceof Architecture) ? arch.name() : arch.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Input @Optional
|
@Input @Optional
|
||||||
List<String> fileType
|
List<String> fileType
|
||||||
|
|
||||||
|
@ -91,6 +84,14 @@ class SystemPackagingExtension {
|
||||||
@Input @Optional
|
@Input @Optional
|
||||||
Boolean addParentDirs
|
Boolean addParentDirs
|
||||||
|
|
||||||
|
//String archStr
|
||||||
|
|
||||||
|
@Input @Optional
|
||||||
|
Architecture arch
|
||||||
|
//void setArch(Object arch) {
|
||||||
|
// archStr = (arch instanceof Architecture) ? arch.name() : arch.toString()
|
||||||
|
//}
|
||||||
|
|
||||||
@Input @Optional
|
@Input @Optional
|
||||||
Os os
|
Os os
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.xbib.gradle.plugin.rpm
|
||||||
|
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import org.xbib.gradle.plugin.test.ProjectSpec
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals
|
import static org.junit.Assert.assertEquals
|
||||||
import static org.junit.Assert.assertTrue
|
import static org.junit.Assert.assertTrue
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.rpm
|
||||||
|
|
||||||
|
import org.xbib.gradle.plugin.test.IntegrationSpec
|
||||||
|
|
||||||
class RpmPluginIntegrationTest extends IntegrationSpec {
|
class RpmPluginIntegrationTest extends IntegrationSpec {
|
||||||
|
|
||||||
def "rpm task is marked up-to-date when setting arch or os property"() {
|
def "rpm task is marked up-to-date when setting arch or os property"() {
|
||||||
|
@ -10,8 +12,8 @@ apply plugin: 'org.xbib.gradle.plugin.rpm'
|
||||||
|
|
||||||
task buildRpm(type: Rpm) {
|
task buildRpm(type: Rpm) {
|
||||||
packageName = 'rpmIsUpToDate'
|
packageName = 'rpmIsUpToDate'
|
||||||
arch = NOARCH
|
arch = org.xbib.rpm.lead.Architecture.NOARCH
|
||||||
os = LINUX
|
os = org.xbib.rpm.lead.Os.LINUX
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
when:
|
when:
|
||||||
|
|
|
@ -4,12 +4,13 @@ import org.gradle.api.Project
|
||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
import org.gradle.api.plugins.BasePlugin
|
import org.gradle.api.plugins.BasePlugin
|
||||||
import org.gradle.testfixtures.ProjectBuilder
|
import org.gradle.testfixtures.ProjectBuilder
|
||||||
import org.xbib.rpm.lead.Architecture
|
import org.xbib.gradle.plugin.test.DependencyGraph
|
||||||
|
import org.xbib.gradle.plugin.test.GradleDependencyGenerator
|
||||||
|
import org.xbib.gradle.plugin.test.ProjectSpec
|
||||||
import org.xbib.rpm.format.Flags
|
import org.xbib.rpm.format.Flags
|
||||||
import org.xbib.rpm.header.Header
|
import org.xbib.rpm.header.Header
|
||||||
import org.xbib.rpm.lead.Os
|
|
||||||
import org.xbib.rpm.lead.PackageType
|
|
||||||
import org.xbib.rpm.signature.SignatureTag
|
import org.xbib.rpm.signature.SignatureTag
|
||||||
|
import spock.lang.Ignore
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
@ -49,9 +50,9 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
packageName = 'bleah'
|
packageName = 'bleah'
|
||||||
version = '1.0'
|
version = '1.0'
|
||||||
release = '1'
|
release = '1'
|
||||||
type = PackageType.BINARY
|
type = org.xbib.rpm.lead.PackageType.BINARY
|
||||||
arch = Architecture.I386.name()
|
arch = org.xbib.rpm.lead.Architecture.I386
|
||||||
os = Os.LINUX
|
os = org.xbib.rpm.lead.Os.LINUX
|
||||||
permissionGroup = 'Development/Libraries'
|
permissionGroup = 'Development/Libraries'
|
||||||
summary = 'Bleah blarg'
|
summary = 'Bleah blarg'
|
||||||
packageDescription = 'Not a very interesting library.'
|
packageDescription = 'Not a very interesting library.'
|
||||||
|
@ -80,7 +81,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def result = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
def result = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -108,8 +109,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
|
|
||||||
Project project = ProjectBuilder.builder().build()
|
Project project = ProjectBuilder.builder().build()
|
||||||
File buildDir = project.buildDir
|
File buildDir = project.buildDir
|
||||||
|
File srcDir = new File(buildDir, 'src')
|
||||||
File srcDir = new File(projectDir, 'src')
|
|
||||||
srcDir.mkdirs()
|
srcDir.mkdirs()
|
||||||
String fruit = 'apple'
|
String fruit = 'apple'
|
||||||
new File(srcDir, fruit).withWriter { out ->
|
new File(srcDir, fruit).withWriter { out ->
|
||||||
|
@ -143,7 +143,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def result = RpmReader.read(project.file('build/tmp/ObsoletesConflictsTest/testing-1.2-3.i386.rpm').toPath())
|
def result = RpmReader.read(project.file('build/tmp/ObsoletesConflictsTest/testing-1.2-3.i386.rpm').toPath())
|
||||||
|
@ -193,7 +193,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
'projectNameDefault' == project.buildRpm.packageName
|
'projectNameDefault' == project.buildRpm.packageName
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
|
@ -204,8 +204,8 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
when:
|
when:
|
||||||
project.apply plugin: 'org.xbib.gradle.plugin.rpm'
|
project.apply plugin: 'org.xbib.gradle.plugin.rpm'
|
||||||
project.task([type: Rpm], 'buildRpm', {})
|
project.task([type: Rpm], 'buildRpm', {})
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
project.tasks.clean.execute()
|
//project.tasks.clean.execute()
|
||||||
then:
|
then:
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def files = RpmReader.read(rpmTask.getArchivePath().toPath()).files
|
def files = RpmReader.read(rpmTask.getArchivePath().toPath()).files
|
||||||
|
@ -266,7 +266,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(rpmTask.getArchivePath().toPath())
|
def res = RpmReader.read(rpmTask.getArchivePath().toPath())
|
||||||
|
@ -295,7 +295,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
'foo' == project.buildRpm.packageName
|
'foo' == project.buildRpm.packageName
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
|
@ -366,9 +366,8 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
into('/conf/defaults')
|
into('/conf/defaults')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
// Evaluate response
|
// Evaluate response
|
||||||
|
@ -424,7 +423,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/userTest-2.0-2.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/userTest-2.0-2.i386.rpm').toPath())
|
||||||
|
@ -480,7 +479,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/userTest-2.0-2.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/userTest-2.0-2.i386.rpm').toPath())
|
||||||
|
@ -534,7 +533,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/userTest-2.0-2.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/userTest-2.0-2.i386.rpm').toPath())
|
||||||
|
@ -594,7 +593,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/one-prefix-1.0-1.i386.rpm').toPath())
|
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/one-prefix-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -627,7 +626,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/one-prefix-1.0-1.i386.rpm').toPath())
|
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/one-prefix-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -660,7 +659,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/one-prefix-1.0-1.i386.rpm').toPath())
|
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/one-prefix-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -695,7 +694,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/one-prefix-1.0-1.i386.rpm').toPath())
|
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/one-prefix-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -728,7 +727,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/multi-prefix-1.0-1.i386.rpm').toPath())
|
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/multi-prefix-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -762,7 +761,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/multi-prefix-1.0-1.i386.rpm').toPath())
|
def scan = RpmReader.read(project.file('build/tmp/RpmPluginTest/multi-prefix-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -802,7 +801,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -849,7 +848,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -878,7 +877,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -912,7 +911,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/has-epoch-1.0-1.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/has-epoch-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -936,7 +935,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -964,7 +963,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -1011,7 +1010,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task.execute()
|
task.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -1019,9 +1018,10 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
res.files*.type == [DIR, DIR, SYMLINK, DIR, FILE]
|
res.files*.type == [DIR, DIR, SYMLINK, DIR, FILE]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
def "Does not throw UnsupportedOperationException when copying external artifact with createDirectoryEntry option"() {
|
def "Does not throw UnsupportedOperationException when copying external artifact with createDirectoryEntry option"() {
|
||||||
given:
|
given:
|
||||||
String testCoordinates = 'com.netflix.nebula:a:1.0.0'
|
String testCoordinates = 'org.xbib:foobar:1.0.0'
|
||||||
DependencyGraph graph = new DependencyGraph([testCoordinates])
|
DependencyGraph graph = new DependencyGraph([testCoordinates])
|
||||||
File reposRootDir = new File(project.buildDir, 'repos')
|
File reposRootDir = new File(project.buildDir, 'repos')
|
||||||
GradleDependencyGenerator generator = new GradleDependencyGenerator(graph, reposRootDir.absolutePath)
|
GradleDependencyGenerator generator = new GradleDependencyGenerator(graph, reposRootDir.absolutePath)
|
||||||
|
@ -1055,7 +1055,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
|
@ -1076,7 +1076,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0.noarch.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0.noarch.rpm').toPath())
|
||||||
|
@ -1104,7 +1104,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0.noarch.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0.noarch.rpm').toPath())
|
||||||
|
@ -1139,7 +1139,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
Header header = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0.noarch.rpm').toPath()).format.header
|
Header header = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0.noarch.rpm').toPath()).format.header
|
||||||
|
@ -1180,7 +1180,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
when:
|
when:
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
Header header = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0.noarch.rpm').toPath()).format.header
|
Header header = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0.noarch.rpm').toPath()).format.header
|
||||||
|
@ -1200,7 +1200,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
packageName = 'semvertest'
|
packageName = 'semvertest'
|
||||||
})
|
})
|
||||||
|
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
expect:
|
expect:
|
||||||
project.file("build/tmp/RpmPluginTest/semvertest-${expected}.noarch.rpm").exists()
|
project.file("build/tmp/RpmPluginTest/semvertest-${expected}.noarch.rpm").exists()
|
||||||
|
@ -1227,7 +1227,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/providesTest-1.0.noarch.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/providesTest-1.0.noarch.rpm').toPath())
|
||||||
|
@ -1260,7 +1260,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
})
|
})
|
||||||
|
|
||||||
when:
|
when:
|
||||||
project.tasks.buildRpm.execute()
|
project.tasks.buildRpm.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
def res = RpmReader.read(project.file('build/tmp/RpmPluginTest/bleah-1.0-1.i386.rpm').toPath())
|
||||||
|
@ -1283,7 +1283,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
Rpm rpmTask = project.task([type: Rpm], 'buildRpm', {
|
Rpm rpmTask = project.task([type: Rpm], 'buildRpm', {
|
||||||
from 'bin'
|
from 'bin'
|
||||||
})
|
})
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(rpmTask.getArchivePath().toPath())
|
def res = RpmReader.read(rpmTask.getArchivePath().toPath())
|
||||||
|
@ -1306,7 +1306,7 @@ class RpmPluginTest extends ProjectSpec {
|
||||||
into 'lib'
|
into 'lib'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
rpmTask.execute()
|
rpmTask.copy()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
def res = RpmReader.read(rpmTask.getArchivePath().toPath())
|
def res = RpmReader.read(rpmTask.getArchivePath().toPath())
|
||||||
|
|
|
@ -2,8 +2,6 @@ package org.xbib.gradle.plugin.rpm
|
||||||
|
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
import java.nio.file.Paths
|
|
||||||
|
|
||||||
class SystemPackagingExtensionTest extends Specification {
|
class SystemPackagingExtensionTest extends Specification {
|
||||||
|
|
||||||
SystemPackagingExtension extension = new SystemPackagingExtension()
|
SystemPackagingExtension extension = new SystemPackagingExtension()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.xbib.gradle.plugin.rpm.validation
|
package org.xbib.gradle.plugin.rpm.validation
|
||||||
|
|
||||||
import org.gradle.api.InvalidUserDataException
|
import org.gradle.api.InvalidUserDataException
|
||||||
import org.xbib.gradle.plugin.rpm.ProjectSpec
|
import org.xbib.gradle.plugin.test.ProjectSpec
|
||||||
import org.xbib.gradle.plugin.rpm.Rpm
|
import org.xbib.gradle.plugin.rpm.Rpm
|
||||||
|
|
||||||
class RpmTaskPropertiesValidatorIntegrationTest extends ProjectSpec {
|
class RpmTaskPropertiesValidatorIntegrationTest extends ProjectSpec {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.testfixtures.ProjectBuilder
|
import org.gradle.testfixtures.ProjectBuilder
|
||||||
|
@ -21,7 +21,7 @@ abstract class AbstractProjectSpec extends Specification {
|
||||||
MultiProjectHelper helper
|
MultiProjectHelper helper
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
ourProjectDir = new File("build/nebulatest/${this.class.canonicalName}/${testName.methodName.replaceAll(/\W+/, '-')}").absoluteFile
|
ourProjectDir = new File("build/xbibtest/${this.class.canonicalName}/${testName.methodName.replaceAll(/\W+/, '-')}").absoluteFile
|
||||||
if (ourProjectDir.exists()) {
|
if (ourProjectDir.exists()) {
|
||||||
ourProjectDir.deleteDir()
|
ourProjectDir.deleteDir()
|
||||||
}
|
}
|
|
@ -0,0 +1,192 @@
|
||||||
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
|
import groovy.transform.CompileStatic
|
||||||
|
import groovy.transform.TypeCheckingMode
|
||||||
|
import org.gradle.api.logging.LogLevel
|
||||||
|
import org.junit.Rule
|
||||||
|
import org.junit.rules.TestName
|
||||||
|
import spock.lang.Specification
|
||||||
|
|
||||||
|
abstract class BaseIntegrationSpec extends Specification {
|
||||||
|
@Rule
|
||||||
|
TestName testName = new TestName()
|
||||||
|
File projectDir
|
||||||
|
protected String moduleName
|
||||||
|
protected LogLevel logLevel = LogLevel.LIFECYCLE
|
||||||
|
protected List<File> initScripts = []
|
||||||
|
|
||||||
|
private static final LOGGING_LEVEL_ENV_VARIABLE = "TEST_LOGGING_LEVEL"
|
||||||
|
|
||||||
|
def setup() {
|
||||||
|
projectDir = new File("build/xbibtest/${this.class.canonicalName}/${testName.methodName.replaceAll(/\W+/, '-')}").absoluteFile
|
||||||
|
if (projectDir.exists()) {
|
||||||
|
projectDir.deleteDir()
|
||||||
|
}
|
||||||
|
projectDir.mkdirs()
|
||||||
|
moduleName = findModuleName()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override to alter its value
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected LogLevel getLogLevel() {
|
||||||
|
String levelFromEnv = System.getenv(LOGGING_LEVEL_ENV_VARIABLE)
|
||||||
|
if(!levelFromEnv) {
|
||||||
|
return logLevel
|
||||||
|
}
|
||||||
|
return LogLevel.valueOf(levelFromEnv.toUpperCase())
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup */
|
||||||
|
|
||||||
|
protected File directory(String path, File baseDir = getProjectDir()) {
|
||||||
|
new File(baseDir, path).with {
|
||||||
|
mkdirs()
|
||||||
|
it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected File file(String path, File baseDir = getProjectDir()) {
|
||||||
|
def splitted = path.split('/')
|
||||||
|
def directory = splitted.size() > 1 ? directory(splitted[0..-2].join('/'), baseDir) : baseDir
|
||||||
|
def file = new File(directory, splitted[-1])
|
||||||
|
file.createNewFile()
|
||||||
|
file
|
||||||
|
}
|
||||||
|
|
||||||
|
@CompileStatic(TypeCheckingMode.SKIP)
|
||||||
|
protected File createFile(String path, File baseDir = getProjectDir()) {
|
||||||
|
File file = file(path, baseDir)
|
||||||
|
if (!file.exists()) {
|
||||||
|
assert file.parentFile.mkdirs() || file.parentFile.exists()
|
||||||
|
file.createNewFile()
|
||||||
|
}
|
||||||
|
file
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void checkForDeprecations(String output) {
|
||||||
|
def deprecations = output.readLines().findAll {
|
||||||
|
it.contains("has been deprecated and is scheduled to be removed in Gradle") ||
|
||||||
|
it.contains("Deprecated Gradle features were used in this build") ||
|
||||||
|
it.contains("has been deprecated. This is scheduled to be removed in Gradle") ||
|
||||||
|
it.contains("This behaviour has been deprecated and is scheduled to be removed in Gradle")
|
||||||
|
}
|
||||||
|
// temporary for known issue with overwriting task
|
||||||
|
// overridden task expected to not be needed in future version
|
||||||
|
if (deprecations.size() == 1 && deprecations.first().contains("Creating a custom task named 'dependencyInsight' has been deprecated and is scheduled to be removed in Gradle 5.0.")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!System.getProperty("ignoreDeprecations") && !deprecations.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("Deprecation warnings were found (Set the ignoreDeprecations system property during the test to ignore):\n" + deprecations.collect {
|
||||||
|
" - $it"
|
||||||
|
}.join("\n"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void checkForMutableProjectState(String output) {
|
||||||
|
def mutableProjectStateWarnings = output.readLines().findAll {
|
||||||
|
it.contains("was resolved without accessing the project in a safe manner") ||
|
||||||
|
it.contains("This may happen when a configuration is resolved from a thread not managed by Gradle or from a different project")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!System.getProperty("ignoreMutableProjectStateWarnings") && !mutableProjectStateWarnings.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("Mutable Project State warnings were found (Set the ignoreMutableProjectStateWarnings system property during the test to ignore):\n" + mutableProjectStateWarnings.collect {
|
||||||
|
" - $it"
|
||||||
|
}.join("\n"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void writeHelloWorld(String packageDotted, File baseDir = getProjectDir()) {
|
||||||
|
def path = 'src/main/java/' + packageDotted.replace('.', '/') + '/HelloWorld.java'
|
||||||
|
def javaFile = createFile(path, baseDir)
|
||||||
|
javaFile << """\
|
||||||
|
package ${packageDotted};
|
||||||
|
|
||||||
|
public class HelloWorld {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello Integration Test");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".stripIndent()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a unit test for testing your plugin.
|
||||||
|
* @param failTest true if you want the test to fail, false if the test should pass
|
||||||
|
* @param baseDir the directory to begin creation from, defaults to projectDir
|
||||||
|
*/
|
||||||
|
protected void writeUnitTest(boolean failTest, File baseDir = getProjectDir()) {
|
||||||
|
writeTest('src/test/java/', 'xbib', failTest, baseDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Creates a unit test for testing your plugin.
|
||||||
|
* @param srcDir the directory in the project where the source file should be created.
|
||||||
|
* @param packageDotted the package for the unit test class, written in dot notation
|
||||||
|
* @param failTest true if you want the test to fail, false if the test should pass
|
||||||
|
* @param baseDir the directory to begin creation from, defaults to projectDir
|
||||||
|
*/
|
||||||
|
protected void writeTest(String srcDir, String packageDotted, boolean failTest, File baseDir = getProjectDir()) {
|
||||||
|
def path = srcDir + packageDotted.replace('.', '/') + '/HelloWorldTest.java'
|
||||||
|
def javaFile = createFile(path, baseDir)
|
||||||
|
javaFile << """\
|
||||||
|
package ${packageDotted};
|
||||||
|
import org.junit.Test;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
|
||||||
|
public class HelloWorldTest {
|
||||||
|
@Test public void doesSomething() {
|
||||||
|
assertFalse( $failTest );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".stripIndent()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a properties file to included as project resource.
|
||||||
|
* @param srcDir the directory in the project where the source file should be created.
|
||||||
|
* @param fileName to be used for the file, sans extension. The .properties extension will be added to the name.
|
||||||
|
* @param baseDir the directory to begin creation from, defaults to projectDir
|
||||||
|
*/
|
||||||
|
protected void writeResource(String srcDir, String fileName, File baseDir = getProjectDir()) {
|
||||||
|
def path = "$srcDir/${fileName}.properties"
|
||||||
|
def resourceFile = createFile(path, baseDir)
|
||||||
|
resourceFile.text = "firstProperty=foo.bar"
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addResource(String srcDir, String filename, String contents, File baseDir = getProjectDir()) {
|
||||||
|
def resourceFile = createFile("${srcDir}/${filename}", baseDir)
|
||||||
|
resourceFile.text = contents
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String findModuleName() {
|
||||||
|
getProjectDir().getName().replaceAll(/_\d+/, '')
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<String> calculateArguments(String... args) {
|
||||||
|
List<String> arguments = []
|
||||||
|
// Gradle will use these files name from the PWD, instead of the project directory. It's easier to just leave
|
||||||
|
// them out and let the default find them, since we're not changing their default names.
|
||||||
|
//arguments += '--build-file'
|
||||||
|
//arguments += (buildFile.canonicalPath - projectDir.canonicalPath).substring(1)
|
||||||
|
//arguments += '--settings-file'
|
||||||
|
//arguments += (settingsFile.canonicalPath - projectDir.canonicalPath).substring(1)
|
||||||
|
//arguments += '--no-daemon'
|
||||||
|
switch (getLogLevel()) {
|
||||||
|
case LogLevel.INFO:
|
||||||
|
arguments += '--info'
|
||||||
|
break
|
||||||
|
case LogLevel.DEBUG:
|
||||||
|
arguments += '--debug'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
arguments += '--stacktrace'
|
||||||
|
arguments += '-Dorg.gradle.warning.mode=all'
|
||||||
|
arguments.addAll(args)
|
||||||
|
arguments.addAll(initScripts.collect { file -> '-I' + file.absolutePath })
|
||||||
|
arguments
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import org.gradle.tooling.BuildException
|
import org.gradle.tooling.BuildException
|
||||||
import org.gradle.tooling.BuildLauncher
|
import org.gradle.tooling.BuildLauncher
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import com.google.common.base.Function
|
import com.google.common.base.Function
|
||||||
import com.google.common.base.Predicate
|
import com.google.common.base.Predicate
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm;
|
package org.xbib.gradle.plugin.test;
|
||||||
|
|
||||||
import com.google.common.base.Predicate
|
import com.google.common.base.Predicate
|
||||||
import org.gradle.util.GFileUtils
|
import org.gradle.util.GFileUtils
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import groovy.transform.Immutable
|
import groovy.transform.Immutable
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm;
|
package org.xbib.gradle.plugin.test;
|
||||||
|
|
||||||
import org.gradle.api.GradleException
|
import org.gradle.api.GradleException
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
class DefaultGradleRunner implements GradleRunner {
|
class DefaultGradleRunner implements GradleRunner {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
class DependencyGraph {
|
class DependencyGraph {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import groovy.transform.Immutable
|
import groovy.transform.Immutable
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
interface ExecutedTask {
|
interface ExecutedTask {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm;
|
package org.xbib.gradle.plugin.test;
|
||||||
|
|
||||||
interface ExecutionResult {
|
interface ExecutionResult {
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
class GradleDependencyGenerator {
|
class GradleDependencyGenerator {
|
||||||
|
|
||||||
static final String STANDARD_SUBPROJECT_BLOCK = '''\
|
static final String STANDARD_SUBPROJECT_BLOCK = '''\
|
||||||
subprojects {
|
subprojects {
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'ivy-publish'
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
@ -13,24 +12,9 @@ class GradleDependencyGenerator {
|
||||||
maven {
|
maven {
|
||||||
url "../mavenrepo"
|
url "../mavenrepo"
|
||||||
}
|
}
|
||||||
ivy {
|
|
||||||
url "../ivyrepo"
|
|
||||||
layout('pattern') {
|
|
||||||
ivy '[organisation]/[module]/[revision]/[module]-[revision]-ivy.[ext]'
|
|
||||||
artifact '[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]'
|
|
||||||
m2compatible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
publications {
|
publications {
|
||||||
maven(MavenPublication) {
|
maven(MavenPublication) {
|
||||||
artifactId artifactName
|
|
||||||
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
ivy(IvyPublication) {
|
|
||||||
module artifactName
|
|
||||||
|
|
||||||
from components.java
|
from components.java
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,13 +27,11 @@ class GradleDependencyGenerator {
|
||||||
|
|
||||||
DependencyGraph graph
|
DependencyGraph graph
|
||||||
File gradleRoot
|
File gradleRoot
|
||||||
File ivyRepoDir
|
|
||||||
File mavenRepoDir
|
File mavenRepoDir
|
||||||
|
|
||||||
GradleDependencyGenerator(DependencyGraph graph, String directory = 'build/testrepogen') {
|
GradleDependencyGenerator(DependencyGraph graph, String directory = 'build/testrepogen') {
|
||||||
this.graph = graph
|
this.graph = graph
|
||||||
this.gradleRoot = new File(directory)
|
this.gradleRoot = new File(directory)
|
||||||
this.ivyRepoDir = new File(directory, 'ivyrepo')
|
|
||||||
this.mavenRepoDir = new File(directory, 'mavenrepo')
|
this.mavenRepoDir = new File(directory, 'mavenrepo')
|
||||||
generateGradleFiles()
|
generateGradleFiles()
|
||||||
}
|
}
|
||||||
|
@ -74,33 +56,6 @@ class GradleDependencyGenerator {
|
||||||
""".stripIndent()
|
""".stripIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
File generateTestIvyRepo() {
|
|
||||||
runTasks('publishIvyPublicationToIvyRepository')
|
|
||||||
|
|
||||||
ivyRepoDir
|
|
||||||
}
|
|
||||||
|
|
||||||
String getIvyRepoDirPath() {
|
|
||||||
ivyRepoDir.absolutePath
|
|
||||||
}
|
|
||||||
|
|
||||||
String getIvyRepoUrl() {
|
|
||||||
ivyRepoDir.toURI().toURL()
|
|
||||||
}
|
|
||||||
|
|
||||||
String getIvyRepositoryBlock() {
|
|
||||||
"""\
|
|
||||||
ivy {
|
|
||||||
url '${getIvyRepoUrl()}'
|
|
||||||
layout('pattern') {
|
|
||||||
ivy '[organisation]/[module]/[revision]/[module]-[revision]-ivy.[ext]'
|
|
||||||
artifact '[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]'
|
|
||||||
m2compatible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
""".stripIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateGradleFiles() {
|
private void generateGradleFiles() {
|
||||||
if (generated) {
|
if (generated) {
|
||||||
return
|
return
|
||||||
|
@ -138,9 +93,7 @@ class GradleDependencyGenerator {
|
||||||
"""\
|
"""\
|
||||||
group = '${node.group}'
|
group = '${node.group}'
|
||||||
version = '${node.version}'
|
version = '${node.version}'
|
||||||
ext {
|
ext { artifactName = '${node.artifact}' }
|
||||||
artifactName = '${node.artifact}'
|
|
||||||
}
|
|
||||||
""".stripIndent() + block.toString()
|
""".stripIndent() + block.toString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
interface GradleHandle {
|
interface GradleHandle {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
interface GradleHandleBuildListener {
|
interface GradleHandleBuildListener {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
interface GradleHandleFactory {
|
interface GradleHandleFactory {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import com.google.common.base.Predicate
|
import com.google.common.base.Predicate
|
||||||
import com.google.common.base.Predicates
|
import com.google.common.base.Predicates
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import com.google.common.base.Predicate
|
import com.google.common.base.Predicate
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import com.google.common.base.Predicate
|
import com.google.common.base.Predicate
|
||||||
import org.gradle.api.logging.LogLevel
|
import org.gradle.api.logging.LogLevel
|
||||||
|
@ -38,7 +38,7 @@ abstract class IntegrationSpec extends BaseIntegrationSpec {
|
||||||
|
|
||||||
protected Integer daemonMaxIdleTimeInSecondsInMemorySafeMode = DEFAULT_DAEMON_MAX_IDLE_TIME_IN_SECONDS_IN_MEMORY_SAFE_MODE
|
protected Integer daemonMaxIdleTimeInSecondsInMemorySafeMode = DEFAULT_DAEMON_MAX_IDLE_TIME_IN_SECONDS_IN_MEMORY_SAFE_MODE
|
||||||
|
|
||||||
private String findModuleName() {
|
String findModuleName() {
|
||||||
getProjectDir().getName().replaceAll(/_\d+/, '')
|
getProjectDir().getName().replaceAll(/_\d+/, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ abstract class IntegrationSpec extends BaseIntegrationSpec {
|
||||||
runner.handle(getProjectDir(), arguments, jvmArguments, preExecutionActions)
|
runner.handle(getProjectDir(), arguments, jvmArguments, preExecutionActions)
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> calculateArguments(String... args) {
|
List<String> calculateArguments(String... args) {
|
||||||
List<String> arguments = []
|
List<String> arguments = []
|
||||||
// Gradle will use these files name from the PWD, instead of the project directory. It's easier to just leave
|
// Gradle will use these files name from the PWD, instead of the project directory. It's easier to just leave
|
||||||
// them out and let the default find them, since we're not changing their default names.
|
// them out and let the default find them, since we're not changing their default names.
|
|
@ -1,4 +1,6 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
|
import org.xbib.gradle.plugin.test.ExecutedTask
|
||||||
|
|
||||||
class MinimalExecutedTask implements ExecutedTask {
|
class MinimalExecutedTask implements ExecutedTask {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.testfixtures.ProjectBuilder
|
import org.gradle.testfixtures.ProjectBuilder
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
interface PreExecutionAction {
|
interface PreExecutionAction {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
class ProjectSpec extends AbstractProjectSpec {
|
class ProjectSpec extends AbstractProjectSpec {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
import org.gradle.tooling.BuildLauncher
|
import org.gradle.tooling.BuildLauncher
|
||||||
import org.gradle.tooling.GradleConnector
|
import org.gradle.tooling.GradleConnector
|
|
@ -1,4 +1,4 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
package org.xbib.gradle.plugin.test
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hold additional response data, that is only available
|
* Hold additional response data, that is only available
|
|
@ -1,4 +1,3 @@
|
||||||
package org.xbib.gradle.plugin.rpm
|
|
||||||
|
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.rules.TestName
|
import org.junit.rules.TestName
|
|
@ -1,14 +1,14 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = rpm
|
name = rpm
|
||||||
version = 1.0.2
|
version = 1.1.0
|
||||||
|
|
||||||
bouncycastle.version = 1.60
|
bouncycastle.version = 1.60
|
||||||
xbib-archive.version = 0.0.1
|
xbib-archive.version = 0.0.1
|
||||||
ant.version = 1.10.5
|
ant.version = 1.10.5
|
||||||
log4j.version = 2.11.1
|
log4j.version = 2.11.1
|
||||||
# must match groovy version in gradle
|
# must match groovy version in gradle
|
||||||
groovy.version = 2.4.12
|
groovy.version = 2.5.4
|
||||||
spock-core.version = 1.1-groovy-2.4
|
spock-core.version = 1.2-groovy-2.5
|
||||||
xbib-guice.version = 4.0.4
|
xbib-guice.version = 4.0.4
|
||||||
maven.version = 3.5.0
|
maven.version = 3.5.0
|
||||||
maven-plugin-annotations.version = 3.5
|
maven-plugin-annotations.version = 3.5
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
#Thu Aug 16 18:31:50 CEST 2018
|
#Thu Jan 10 23:25:32 CET 2019
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip
|
||||||
|
|
2
gradlew
vendored
2
gradlew
vendored
|
@ -28,7 +28,7 @@ APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS='"-Xmx64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
|
@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS=
|
set DEFAULT_JVM_OPTS="-Xmx64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
|
@ -444,6 +444,7 @@ public class RpmBuilder {
|
||||||
* @throws IllegalArgumentException if passed in character sequence contains dashes.
|
* @throws IllegalArgumentException if passed in character sequence contains dashes.
|
||||||
*/
|
*/
|
||||||
private void checkVariableContainsIllegalChars(char[] illegalChars, CharSequence variable, String variableName) {
|
private void checkVariableContainsIllegalChars(char[] illegalChars, CharSequence variable, String variableName) {
|
||||||
|
if (variable != null) {
|
||||||
for (int i = 0; i < variable.length(); i++) {
|
for (int i = 0; i < variable.length(); i++) {
|
||||||
char currChar = variable.charAt(i);
|
char currChar = variable.charAt(i);
|
||||||
for (char illegalChar : illegalChars) {
|
for (char illegalChar : illegalChars) {
|
||||||
|
@ -454,6 +455,7 @@ public class RpmBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required Field. Sets the package information, such as the rpm name, the version, and the release number.
|
* Required Field. Sets the package information, such as the rpm name, the version, and the release number.
|
||||||
|
|
Loading…
Reference in a new issue