remove extension from rpm plugin
This commit is contained in:
parent
ed0049ae68
commit
d8f82a8978
12 changed files with 566 additions and 571 deletions
|
@ -13,6 +13,7 @@ dependencies {
|
|||
api "org.xbib:groovy-git:${project.property('groovy-git.version')}"
|
||||
testImplementation gradleTestKit()
|
||||
testImplementation "org.spockframework:spock-core:${project.property('spock.version')}"
|
||||
testImplementation "junit:junit:${project.property('junit4.version')}"
|
||||
}
|
||||
|
||||
compileGroovy {
|
||||
|
|
|
@ -10,11 +10,13 @@ import org.xbib.groovy.git.Git
|
|||
import spock.lang.Specification
|
||||
|
||||
class GitPluginTest extends Specification {
|
||||
@Rule TemporaryFolder tempDir = new TemporaryFolder()
|
||||
@Rule TemporaryFolder tempDir
|
||||
File projectDir
|
||||
File buildFile
|
||||
|
||||
def setup() {
|
||||
tempDir = new TemporaryFolder()
|
||||
tempDir.create()
|
||||
projectDir = tempDir.newFolder('project')
|
||||
buildFile = projectFile('build.gradle')
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
version = 2.1.1
|
||||
version = 3.0.0
|
||||
|
|
|
@ -1,20 +1,302 @@
|
|||
package org.xbib.gradle.plugin
|
||||
|
||||
import org.gradle.api.internal.file.copy.CopyAction
|
||||
import org.gradle.api.tasks.Nested
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.bundling.AbstractArchiveTask
|
||||
import org.xbib.rpm.Dependency
|
||||
import org.xbib.rpm.Directory
|
||||
import org.xbib.rpm.Link
|
||||
import org.xbib.rpm.lead.Architecture
|
||||
import org.xbib.rpm.lead.Os
|
||||
import org.xbib.rpm.lead.PackageType
|
||||
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
class Rpm extends AbstractArchiveTask {
|
||||
|
||||
@Delegate(methodAnnotations = true)
|
||||
@Nested
|
||||
RpmExtension rpmExtension
|
||||
@Input
|
||||
String packageName
|
||||
|
||||
@Input
|
||||
String packageVersion
|
||||
|
||||
@Input
|
||||
String packageRelease
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Integer epoch
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String signingKeyPassphrase
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String signingKeyRing
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String signingKeyId
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String signingKeyHashAlgo
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String user
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String group
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String buildHost
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packageGroup
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packageDescription
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String summary
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String license
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packager
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String distribution
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String vendor
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String url
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String sourcePackage
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<String> fileType
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Boolean addParentDirs
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Architecture arch
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Os os
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
PackageType packageType
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<String> prefixes
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Integer uid
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Integer gid
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String maintainer
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String uploaders
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String priority
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String preInstall
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File preInstallFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> preInstallCommands
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String postInstall
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File postInstallFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> postInstallCommands
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String preUninstall
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File preUninstallFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> preUninstallCommands
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String postUninstall
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File postUninstallFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> postUninstallCommands
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String preTrans
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File preTransFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> preTransCommands
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String postTrans
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File postTransFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Directory> directories
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File changeLogFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String changeLog
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> postTransCommands
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> commonCommands
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Link> links
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> dependencies
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> obsoletes
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> conflicts
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> recommends
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> suggests
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> enhances
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> preDepends
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> breaks
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> replaces
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> provides
|
||||
|
||||
Rpm() {
|
||||
super()
|
||||
rpmExtension = project.extensions.findByType(RpmExtension) as RpmExtension
|
||||
// sane defaults
|
||||
os = Os.LINUX
|
||||
arch = Architecture.AMD64
|
||||
packageType = PackageType.BINARY
|
||||
epoch = 0
|
||||
packageDescription = ''
|
||||
preInstallCommands = []
|
||||
preUninstallCommands = []
|
||||
preTransCommands = []
|
||||
postInstallCommands = []
|
||||
postUninstallCommands = []
|
||||
postTransCommands = []
|
||||
commonCommands = []
|
||||
prefixes = []
|
||||
directories = []
|
||||
links = []
|
||||
dependencies = []
|
||||
obsoletes = []
|
||||
conflicts = []
|
||||
recommends = []
|
||||
suggests = []
|
||||
enhances = []
|
||||
preDepends = []
|
||||
breaks = []
|
||||
replaces = []
|
||||
provides = []
|
||||
getArchiveExtension().set("rpm")
|
||||
Callable<String> archiveFileNameProvider = new Callable<String>() {
|
||||
@Override
|
||||
|
@ -27,7 +309,7 @@ class Rpm extends AbstractArchiveTask {
|
|||
|
||||
@Override
|
||||
protected CopyAction createCopyAction() {
|
||||
new RpmCopyAction(project, rpmExtension, this)
|
||||
new RpmCopyAction(project, this)
|
||||
}
|
||||
|
||||
private String constructArchiveFileName() {
|
||||
|
@ -49,4 +331,161 @@ class Rpm extends AbstractArchiveTask {
|
|||
}
|
||||
sb.toString()
|
||||
}
|
||||
|
||||
|
||||
Directory directory(String path) {
|
||||
Directory directory = new Directory(path: path)
|
||||
directories << directory
|
||||
directory
|
||||
}
|
||||
|
||||
Link link(String path, String target) {
|
||||
link(path, target, -1)
|
||||
}
|
||||
|
||||
Link link(String path, String target, int permissions) {
|
||||
Link link = new Link(path, target, permissions)
|
||||
links.add(link)
|
||||
link
|
||||
}
|
||||
|
||||
Dependency requires(String packageName) {
|
||||
requires(packageName, '')
|
||||
}
|
||||
|
||||
Dependency requires(String packageName, String version){
|
||||
requires(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency requires(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
dependencies.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency obsoletes(String packageName) {
|
||||
obsoletes(packageName, '')
|
||||
}
|
||||
|
||||
Dependency obsoletes(String packageName, String version) {
|
||||
obsoletes(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency obsoletes(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
obsoletes.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency conflicts(String packageName) {
|
||||
conflicts(packageName, '')
|
||||
}
|
||||
|
||||
Dependency conflicts(String packageName, String version) {
|
||||
conflicts(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency conflicts(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
conflicts.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency recommends(String packageName) {
|
||||
recommends(packageName, '')
|
||||
}
|
||||
|
||||
Dependency recommends(String packageName, String version) {
|
||||
recommends(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency recommends(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
recommends.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency suggests(String packageName) {
|
||||
suggests(packageName, '')
|
||||
}
|
||||
|
||||
Dependency suggests(String packageName, String version) {
|
||||
suggests(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency suggests(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
suggests.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency enhances(String packageName) {
|
||||
enhances(packageName, '')
|
||||
}
|
||||
|
||||
Dependency enhances(String packageName, String version) {
|
||||
enhances(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency enhances(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
enhances.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency preDepends(String packageName) {
|
||||
preDepends(packageName, '')
|
||||
}
|
||||
|
||||
Dependency preDepends(String packageName, String version) {
|
||||
preDepends(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency preDepends(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
preDepends.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency breaks(String packageName) {
|
||||
breaks(packageName, '')
|
||||
}
|
||||
|
||||
Dependency breaks(String packageName, String version) {
|
||||
breaks(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency breaks(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
breaks.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency replaces(String packageName) {
|
||||
replaces(packageName, '')
|
||||
}
|
||||
|
||||
Dependency replaces(String packageName, String version) {
|
||||
replaces(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency replaces(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
replaces.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency provides(String packageName) {
|
||||
provides(packageName, '')
|
||||
}
|
||||
|
||||
Dependency provides(String packageName, String version) {
|
||||
provides(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency provides(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
provides.add(dep)
|
||||
dep
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,24 +24,21 @@ class RpmCopyAction implements CopyAction {
|
|||
|
||||
Rpm task
|
||||
|
||||
RpmExtension ext
|
||||
|
||||
RpmBuilder builder
|
||||
|
||||
Path tempDir
|
||||
|
||||
RpmCopyAction(Project project, RpmExtension rpmExtension, Rpm task) {
|
||||
RpmCopyAction(Project project, Rpm task) {
|
||||
this.project = project
|
||||
this.task = task
|
||||
this.ext = rpmExtension
|
||||
}
|
||||
|
||||
@Override
|
||||
WorkResult execute(CopyActionProcessingStream copyActionProcessingStream) {
|
||||
if (ext.enabled) {
|
||||
if (task.enabled) {
|
||||
task.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
|
||||
tempDir = task.getTemporaryDir().toPath()
|
||||
this.builder = createRpm()
|
||||
builder = createRpm()
|
||||
copyActionProcessingStream.process(new StreamAction())
|
||||
addOther()
|
||||
buildRpm()
|
||||
|
@ -51,18 +48,18 @@ class RpmCopyAction implements CopyAction {
|
|||
|
||||
RpmBuilder createRpm() {
|
||||
RpmBuilder builder = new RpmBuilder()
|
||||
builder.setPackage ext.packageName, ext.packageVersion, ext.packageRelease, ext.epoch
|
||||
builder.setType ext.packageType
|
||||
builder.setPlatform ext.arch, ext.os
|
||||
builder.setGroup ext.packageGroup
|
||||
builder.setBuildHost ext.buildHost
|
||||
builder.setSummary ext.summary
|
||||
builder.setDescription ext.packageDescription
|
||||
builder.setLicense ext.license
|
||||
builder.setPackager ext.packager
|
||||
builder.setDistribution ext.distribution
|
||||
builder.setVendor ext.vendor
|
||||
builder.setUrl ext.url
|
||||
builder.setPackage task.packageName, task.packageVersion, task.packageRelease, task.epoch
|
||||
builder.setType task.packageType
|
||||
builder.setPlatform task.arch, task.os
|
||||
builder.setGroup task.packageGroup
|
||||
builder.setBuildHost task.buildHost
|
||||
builder.setSummary task.summary
|
||||
builder.setDescription task.packageDescription
|
||||
builder.setLicense task.license
|
||||
builder.setPackager task.packager
|
||||
builder.setDistribution task.distribution
|
||||
builder.setVendor task.vendor
|
||||
builder.setUrl task.url
|
||||
builder.setPrefixes task.prefixes
|
||||
builder.setPrivateKeyId task.getSigningKeyId()
|
||||
builder.setPrivateKeyPassphrase task.getSigningKeyPassphrase()
|
||||
|
@ -126,7 +123,7 @@ class RpmCopyAction implements CopyAction {
|
|||
|
||||
@Override
|
||||
void processFile(FileCopyDetailsInternal fileCopyDetailsInternal) {
|
||||
boolean addParents = ext.addParentDirs != null ? ext.addParentDirs : task.addParentDirs
|
||||
boolean addParents = task.addParentDirs != null ? task.addParentDirs : task.addParentDirs
|
||||
Path path = extractPath(tempDir, fileCopyDetailsInternal)
|
||||
String p = "/${fileCopyDetailsInternal.path}"
|
||||
if (Files.isSymbolicLink(path)) {
|
||||
|
@ -134,9 +131,9 @@ class RpmCopyAction implements CopyAction {
|
|||
} else if (!fileCopyDetailsInternal.isDirectory()) {
|
||||
int mode = fileCopyDetailsInternal.mode
|
||||
int dirmode = -1
|
||||
EnumSet<Directive> directive = makeDirective(ext.fileType)
|
||||
String user = ext.user ?: task.user
|
||||
String group = ext.group ?: task.group
|
||||
EnumSet<Directive> directive = makeDirective(task.fileType)
|
||||
String user = task.user ?: task.user
|
||||
String group = task.group ?: task.group
|
||||
builder.addFile(p, path, mode, dirmode, directive, user, group, addParents)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,430 +0,0 @@
|
|||
package org.xbib.gradle.plugin
|
||||
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.xbib.rpm.Dependency
|
||||
import org.xbib.rpm.Directory
|
||||
import org.xbib.rpm.Link
|
||||
import org.xbib.rpm.lead.Architecture
|
||||
import org.xbib.rpm.lead.Os
|
||||
import org.xbib.rpm.lead.PackageType
|
||||
|
||||
class RpmExtension {
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Boolean enabled = true
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packageName
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packageVersion
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packageRelease
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Integer epoch = 0
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String signingKeyPassphrase
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String signingKeyRing
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String signingKeyId
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String signingKeyHashAlgo
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String user
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String group
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String buildHost
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packageGroup
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packageDescription = ''
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String summary
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String license
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String packager
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String distribution
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String vendor
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String url
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String sourcePackage
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<String> fileType
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Boolean addParentDirs = false
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Architecture arch = Architecture.X86_64
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Os os = Os.LINUX
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
PackageType packageType = PackageType.BINARY
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<String> prefixes = new ArrayList<String>()
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Integer uid
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
Integer gid
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String maintainer
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String uploaders
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String priority
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String preInstall
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File preInstallFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> preInstallCommands = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String postInstall
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File postInstallFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> postInstallCommands = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String preUninstall
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File preUninstallFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> preUninstallCommands = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String postUninstall
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File postUninstallFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> postUninstallCommands = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String preTrans
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File preTransFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> preTransCommands = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String postTrans
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File postTransFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Directory> directories = []
|
||||
|
||||
@Optional
|
||||
@InputFile
|
||||
File changeLogFile
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
String changeLog
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> postTransCommands = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Object> commonCommands = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Link> links = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> dependencies = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> obsoletes = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> conflicts = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> recommends = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> suggests = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> enhances = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> preDepends = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> breaks = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> replaces = []
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
List<Dependency> provides = []
|
||||
|
||||
Directory directory(String path) {
|
||||
Directory directory = new Directory(path: path)
|
||||
directories << directory
|
||||
directory
|
||||
}
|
||||
|
||||
Link link(String path, String target) {
|
||||
link(path, target, -1)
|
||||
}
|
||||
|
||||
Link link(String path, String target, int permissions) {
|
||||
Link link = new Link(path, target, permissions)
|
||||
links.add(link)
|
||||
link
|
||||
}
|
||||
|
||||
Dependency requires(String packageName) {
|
||||
requires(packageName, '')
|
||||
}
|
||||
|
||||
Dependency requires(String packageName, String version){
|
||||
requires(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency requires(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
dependencies.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency obsoletes(String packageName) {
|
||||
obsoletes(packageName, '')
|
||||
}
|
||||
|
||||
Dependency obsoletes(String packageName, String version) {
|
||||
obsoletes(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency obsoletes(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
obsoletes.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency conflicts(String packageName) {
|
||||
conflicts(packageName, '')
|
||||
}
|
||||
|
||||
Dependency conflicts(String packageName, String version) {
|
||||
conflicts(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency conflicts(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
conflicts.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency recommends(String packageName) {
|
||||
recommends(packageName, '')
|
||||
}
|
||||
|
||||
Dependency recommends(String packageName, String version) {
|
||||
recommends(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency recommends(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
recommends.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency suggests(String packageName) {
|
||||
suggests(packageName, '')
|
||||
}
|
||||
|
||||
Dependency suggests(String packageName, String version) {
|
||||
suggests(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency suggests(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
suggests.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency enhances(String packageName) {
|
||||
enhances(packageName, '')
|
||||
}
|
||||
|
||||
Dependency enhances(String packageName, String version) {
|
||||
enhances(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency enhances(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
enhances.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency preDepends(String packageName) {
|
||||
preDepends(packageName, '')
|
||||
}
|
||||
|
||||
Dependency preDepends(String packageName, String version) {
|
||||
preDepends(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency preDepends(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
preDepends.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency breaks(String packageName) {
|
||||
breaks(packageName, '')
|
||||
}
|
||||
|
||||
Dependency breaks(String packageName, String version) {
|
||||
breaks(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency breaks(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
breaks.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency replaces(String packageName) {
|
||||
replaces(packageName, '')
|
||||
}
|
||||
|
||||
Dependency replaces(String packageName, String version) {
|
||||
replaces(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency replaces(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
replaces.add(dep)
|
||||
dep
|
||||
}
|
||||
|
||||
Dependency provides(String packageName) {
|
||||
provides(packageName, '')
|
||||
}
|
||||
|
||||
Dependency provides(String packageName, String version) {
|
||||
provides(packageName, version, 0)
|
||||
}
|
||||
|
||||
Dependency provides(String packageName, String version, int flag) {
|
||||
def dep = new Dependency(packageName, version, flag)
|
||||
provides.add(dep)
|
||||
dep
|
||||
}
|
||||
}
|
|
@ -10,22 +10,11 @@ class RpmPlugin implements Plugin<Project> {
|
|||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
checkVersion()
|
||||
project.plugins.apply(BasePlugin)
|
||||
project.ext.Rpm = Rpm.class
|
||||
project.with {
|
||||
createExtension(project)
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkVersion() {
|
||||
String version = '6.4'
|
||||
if (GradleVersion.current() < GradleVersion.version(version)) {
|
||||
throw new GradleException("need Gradle ${version} or higher")
|
||||
}
|
||||
}
|
||||
|
||||
private static void createExtension(Project project) {
|
||||
project.extensions.create('rpm', RpmExtension)
|
||||
project.plugins.apply(BasePlugin)
|
||||
project.ext.Rpm = Rpm.class
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ class RpmFullTest {
|
|||
packageRelease = '1'
|
||||
with customCopySpec
|
||||
})
|
||||
project.tasks.buildRpm.copy()
|
||||
project.tasks.buildRpm.copy() // run task
|
||||
RpmReader rpmReader = new RpmReader()
|
||||
RpmReaderResult result = rpmReader.read(project.tasks.buildRpm.outputs.files.first().toPath())
|
||||
assertThat(result.files*.name, is(['./lib/apple']))
|
||||
|
|
|
@ -35,10 +35,6 @@ plugins {
|
|||
id 'org.xbib.gradle.plugin.rpm'
|
||||
}
|
||||
|
||||
rpm {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
task myRpm(type: Rpm) {
|
||||
packageName = 'rpmIsUpToDate'
|
||||
arch = org.xbib.rpm.lead.Architecture.NOARCH
|
||||
|
|
|
@ -2,8 +2,9 @@ group = 'org.xbib.gradle.plugin'
|
|||
name = 'gradle-plugins'
|
||||
version = 0.0.1
|
||||
|
||||
groovy.version = 2.5.12
|
||||
gradle.wrapper.version = 6.6.1
|
||||
groovy.version = 3.0.9
|
||||
gradle.wrapper.version = 7.3
|
||||
groovy-git.version = 2.0.1
|
||||
rpm.version = 2.1.0
|
||||
spock.version = 1.2-groovy-2.5
|
||||
spock.version = 2.0-groovy-3.0
|
||||
junit4.version = 4.13.2
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
178
gradlew.bat
vendored
178
gradlew.bat
vendored
|
@ -1,89 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@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="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@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="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
Loading…
Reference in a new issue