Browse Source
The Java packaging used a custom thingsboard.package Gradle plugin, built by the packaging Maven module, for its deb packages. It now applies the public com.netflix.nebula.ospackage plugin 12.1.1, as the JS packaging already does, so the packaging module and its Groovy plugin sources are removed.pull/16270/head
9 changed files with 2 additions and 657 deletions
@ -1,26 +0,0 @@ |
|||
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. |
|||
// SPDX-License-Identifier: BUSL-1.1 |
|||
plugins { |
|||
id 'groovy' |
|||
id 'java-library' |
|||
} |
|||
|
|||
repositories { |
|||
mavenCentral() |
|||
} |
|||
|
|||
dependencies { |
|||
implementation localGroovy() |
|||
implementation gradleApi() |
|||
implementation 'com.netflix.nebula:gradle-ospackage-plugin:12.1.1' |
|||
implementation 'org.apache.commons:commons-lang3:3.9' |
|||
} |
|||
|
|||
buildDir = projectBuildDir |
|||
version = projectVersion |
|||
|
|||
compileGroovy { |
|||
destinationDirectory = file("${buildDir}/classes") |
|||
} |
|||
|
|||
description 'ThingsBoard packaging plugin for constructing RPM and DEB package files.' |
|||
@ -1,84 +0,0 @@ |
|||
<!-- |
|||
|
|||
SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. |
|||
SPDX-License-Identifier: BUSL-1.1 |
|||
|
|||
--> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>org.thingsboard</groupId> |
|||
<version>4.4.0.1-SNAPSHOT</version> |
|||
<artifactId>thingsboard</artifactId> |
|||
</parent> |
|||
<artifactId>packaging</artifactId> |
|||
<packaging>jar</packaging> |
|||
|
|||
<name>ThingsBoard Packaging Plugin</name> |
|||
<url>https://thingsboard.io</url> |
|||
|
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<main.dir>${basedir}/..</main.dir> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.netflix.nebula</groupId> |
|||
<artifactId>gradle-ospackage-plugin</artifactId> |
|||
<version>12.1.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.codehaus.groovy</groupId> |
|||
<artifactId>groovy-all</artifactId> |
|||
<version>3.0.9</version> |
|||
<type>pom</type> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.gradle</groupId> |
|||
<artifactId>gradle-tooling-api</artifactId> |
|||
<version>7.1.1</version> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.gradle</groupId> |
|||
<artifactId>gradle-core</artifactId> |
|||
<version>6.1.1</version> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.thingsboard</groupId> |
|||
<artifactId>gradle-maven-plugin</artifactId> |
|||
<configuration> |
|||
<gradleProjectDirectory>${main.dir}/packaging</gradleProjectDirectory> |
|||
<tasks> |
|||
<task>build</task> |
|||
</tasks> |
|||
<args> |
|||
<arg>-PprojectBuildDir=${project.build.directory}</arg> |
|||
<arg>-PprojectVersion=${project.version}</arg> |
|||
</args> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<phase>compile</phase> |
|||
<goals> |
|||
<goal>invoke</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
<repositories> |
|||
<repository> |
|||
<id>repo.gradle.org</id> |
|||
<url>https://repo.gradle.org/gradle/libs-releases-local</url> |
|||
</repository> |
|||
</repositories> |
|||
</project> |
|||
@ -1,101 +0,0 @@ |
|||
/* |
|||
* SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. |
|||
* SPDX-License-Identifier: BUSL-1.1 |
|||
*/ |
|||
package org.thingsboard.packaging |
|||
|
|||
import com.netflix.gradle.plugins.deb.Deb |
|||
import com.netflix.gradle.plugins.deb.TemplateHelper |
|||
import com.netflix.gradle.plugins.utils.FileSystemActions |
|||
import groovy.transform.Canonical |
|||
import groovy.transform.CompileDynamic |
|||
|
|||
class DebMaintainerScriptsGenerator { |
|||
private final Deb task |
|||
private final TemplateHelper templateHelper |
|||
private final File destination |
|||
private final FileSystemActions fileSystem |
|||
|
|||
DebMaintainerScriptsGenerator(Deb task, TemplateHelper templateHelper, File destination, FileSystemActions fileSystem) { |
|||
this.destination = destination |
|||
this.task = task |
|||
this.templateHelper = templateHelper |
|||
this.fileSystem = fileSystem |
|||
} |
|||
|
|||
void generate(Map<String, Object> context) { |
|||
templateHelper.generateFile("control", context) |
|||
|
|||
def configurationFiles = task.allConfigurationFiles |
|||
if (configurationFiles.any()) { |
|||
templateHelper.generateFile("conffiles", [files: configurationFiles] ) |
|||
} |
|||
|
|||
List<MaintainerScript> scripts = [ |
|||
new MaintainerScript("preinst", task.preInstallFile, task.allPreInstallCommands), |
|||
new PostInstScript(task.postInstallFile, task.allPostInstallCommands, context), |
|||
new MaintainerScript("prerm", task.preUninstallFile, task.allPreUninstallCommands), |
|||
new MaintainerScript("postrm", task.postUninstallFile, task.allPostUninstallCommands) |
|||
] |
|||
if (task.configFile) { |
|||
scripts << new MaintainerScript("config", task.configFile, []) |
|||
} |
|||
if (task.templatesFile) { |
|||
scripts << new MaintainerScript("templates", task.templatesFile, []) |
|||
} |
|||
|
|||
def installUtils = task.allCommonCommands.collect { stripShebang(it) } |
|||
for (script in scripts) { |
|||
if(script.file) { |
|||
fileSystem.copy(script.file, new File(destination, script.name)) |
|||
} else if (script.needsTemplateGeneration()) { |
|||
Map<String, Object> commands = [commands: installUtils + script.commands.collect { stripShebang(it) }] as Map<String, Object> |
|||
templateHelper.generateFile(script.name, context + commands) |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Works with nulls, Strings and Files. |
|||
* |
|||
* @param script |
|||
* @return |
|||
*/ |
|||
@CompileDynamic |
|||
private static String stripShebang(Object script) { |
|||
StringBuilder result = new StringBuilder() |
|||
script?.eachLine { line -> |
|||
if (!line.matches('^#!.*$')) { |
|||
result.append line |
|||
result.append "\n" |
|||
} |
|||
} |
|||
result.toString() |
|||
} |
|||
|
|||
@Canonical |
|||
private static class MaintainerScript { |
|||
String name |
|||
File file |
|||
List<Object> commands |
|||
|
|||
boolean needsTemplateGeneration() { |
|||
return commands |
|||
} |
|||
} |
|||
|
|||
private static class PostInstScript extends MaintainerScript { |
|||
Map<String, Object> context |
|||
|
|||
PostInstScript(File file, List<Object> commands, Map<String, Object> context) { |
|||
super("postinst", file, commands) |
|||
this.context = context |
|||
} |
|||
|
|||
@Override |
|||
boolean needsTemplateGeneration() { |
|||
return super.needsTemplateGeneration() || context['dirs'] |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,35 +0,0 @@ |
|||
/* |
|||
* SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. |
|||
* SPDX-License-Identifier: BUSL-1.1 |
|||
*/ |
|||
package org.thingsboard.packaging |
|||
|
|||
import com.netflix.gradle.plugins.deb.Deb |
|||
import com.netflix.gradle.plugins.packaging.AbstractPackagingCopyAction |
|||
import org.gradle.api.file.ProjectLayout |
|||
import org.gradle.api.tasks.InputFile |
|||
import org.gradle.api.tasks.Optional |
|||
|
|||
import javax.inject.Inject |
|||
|
|||
abstract class DebPackaging extends Deb { |
|||
|
|||
@Inject |
|||
DebPackaging(ProjectLayout projectLayout) { |
|||
super(projectLayout) |
|||
} |
|||
|
|||
@InputFile |
|||
@Optional |
|||
File configFile |
|||
|
|||
@InputFile |
|||
@Optional |
|||
File templatesFile |
|||
|
|||
@Override |
|||
AbstractPackagingCopyAction createCopyAction() { |
|||
return new DebPackagingCopyAction(this, new File(projectLayout.buildDirectory.getAsFile().get(), "debian")) |
|||
} |
|||
|
|||
} |
|||
@ -1,368 +0,0 @@ |
|||
/* |
|||
* SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. |
|||
* SPDX-License-Identifier: BUSL-1.1 |
|||
*/ |
|||
package org.thingsboard.packaging |
|||
|
|||
import com.netflix.gradle.plugins.deb.control.MultiArch |
|||
import com.netflix.gradle.plugins.deb.validation.DebTaskPropertiesValidator |
|||
import com.netflix.gradle.plugins.packaging.AbstractPackagingCopyAction |
|||
import com.netflix.gradle.plugins.packaging.Dependency |
|||
import com.netflix.gradle.plugins.packaging.Directory |
|||
import com.netflix.gradle.plugins.packaging.Link |
|||
import com.netflix.gradle.plugins.utils.ApacheCommonsFileSystemActions |
|||
import com.netflix.gradle.plugins.utils.DeprecationLoggerUtils |
|||
import com.netflix.gradle.plugins.utils.FilePermissionUtil |
|||
import com.netflix.gradle.plugins.deb.InstallLineGenerator |
|||
import com.netflix.gradle.plugins.deb.Deb |
|||
import com.netflix.gradle.plugins.deb.DebFileVisitorStrategy |
|||
import com.netflix.gradle.plugins.deb.TemplateHelper |
|||
import groovy.transform.Canonical |
|||
import org.apache.commons.lang3.StringUtils |
|||
import org.apache.commons.lang3.time.DateFormatUtils |
|||
import org.gradle.api.GradleException |
|||
import org.gradle.api.internal.file.copy.CopyAction |
|||
import org.gradle.api.internal.file.copy.FileCopyDetailsInternal |
|||
import org.slf4j.Logger |
|||
import org.slf4j.LoggerFactory |
|||
import org.vafer.jdeb.Compression |
|||
import org.vafer.jdeb.Console |
|||
import org.vafer.jdeb.DataProducer |
|||
import org.vafer.jdeb.DebMaker |
|||
import org.vafer.jdeb.mapping.Mapper |
|||
import org.vafer.jdeb.mapping.PermMapper |
|||
import org.vafer.jdeb.producers.DataProducerLink |
|||
import org.vafer.jdeb.producers.DataProducerPathTemplate |
|||
import org.redline_rpm.payload.Directive |
|||
|
|||
import static com.netflix.gradle.plugins.utils.GradleUtils.lookup |
|||
/** |
|||
* Forked and modified from org.jamel.pkg4j.gradle.tasks.BuildDebTask |
|||
*/ |
|||
class DebPackagingCopyAction extends AbstractPackagingCopyAction<Deb> { |
|||
static final Logger logger = LoggerFactory.getLogger(DebPackagingCopyAction.class) |
|||
|
|||
File debianDir |
|||
List<String> dependencies |
|||
List<String> conflicts |
|||
List<String> recommends |
|||
List<String> suggests |
|||
List<String> enhances |
|||
List<String> preDepends |
|||
List<String> breaks |
|||
List<String> replaces |
|||
List<String> provides |
|||
List<DataProducer> dataProducers |
|||
List<InstallDir> installDirs |
|||
private final DebTaskPropertiesValidator debTaskPropertiesValidator = new DebTaskPropertiesValidator() |
|||
private DebFileVisitorStrategy debFileVisitorStrategy |
|||
private final DebMaintainerScriptsGenerator maintainerScriptsGenerator |
|||
private final InstallLineGenerator installLineGenerator |
|||
|
|||
DebPackagingCopyAction(Deb debTask, File debianDir) { |
|||
super(debTask) |
|||
debTaskPropertiesValidator.validate(debTask) |
|||
dependencies = [] |
|||
conflicts = [] |
|||
recommends = [] |
|||
suggests = [] |
|||
enhances = [] |
|||
preDepends = [] |
|||
breaks = [] |
|||
replaces = [] |
|||
dataProducers = [] |
|||
installDirs = [] |
|||
provides = [] |
|||
this.debianDir = debianDir |
|||
debFileVisitorStrategy = new DebFileVisitorStrategy(dataProducers, installDirs) |
|||
maintainerScriptsGenerator = new DebMaintainerScriptsGenerator(debTask, new TemplateHelper(debianDir, '/deb'), debianDir, new ApacheCommonsFileSystemActions()) |
|||
installLineGenerator = new InstallLineGenerator() |
|||
} |
|||
|
|||
@Canonical |
|||
static class InstallDir { |
|||
String name |
|||
String user |
|||
String group |
|||
} |
|||
|
|||
@Override |
|||
void startVisit(CopyAction action) { |
|||
super.startVisit(action) |
|||
|
|||
debianDir.deleteDir() |
|||
debianDir.mkdirs() |
|||
|
|||
} |
|||
|
|||
@Override |
|||
void visitFile(FileCopyDetailsInternal fileDetails, def specToLookAt) { |
|||
logger.debug "adding file {}", fileDetails.relativePath.pathString |
|||
|
|||
def inputFile = extractFile(fileDetails) |
|||
|
|||
Directive fileType = lookup(specToLookAt, 'fileType') |
|||
if (fileType == 'CONFIG') { |
|||
logger.debug "mark {} as configuration file", fileDetails.relativePath.pathString |
|||
task.configurationFile(fileDetails.relativePath.pathString) |
|||
} |
|||
|
|||
String user = lookup(specToLookAt, 'user') ?: task.user |
|||
Integer uid = (Integer) lookup(specToLookAt, 'uid') ?: task.uid ?: 0 |
|||
String group = lookup(specToLookAt, 'permissionGroup') ?: task.permissionGroup |
|||
Integer gid = (Integer) lookup(specToLookAt, 'gid') ?: task.gid ?: 0 |
|||
|
|||
Integer explicitMode = FilePermissionUtil.getFileMode(specToLookAt) |
|||
int fileMode = explicitMode != null ? explicitMode : FilePermissionUtil.getUnixPermission(fileDetails) |
|||
|
|||
debFileVisitorStrategy.addFile(fileDetails, inputFile, user, uid, group, gid, fileMode) |
|||
} |
|||
|
|||
@Override |
|||
void visitDir(FileCopyDetailsInternal dirDetails, def specToLookAt) { |
|||
def specCreateDirectoryEntry = lookup(specToLookAt, 'createDirectoryEntry') |
|||
boolean createDirectoryEntry = specCreateDirectoryEntry!=null ? specCreateDirectoryEntry : task.createDirectoryEntry |
|||
if (createDirectoryEntry) { |
|||
|
|||
logger.debug "adding directory {}", dirDetails.relativePath.pathString |
|||
String user = lookup(specToLookAt, 'user') ?: task.user |
|||
Integer uid = (Integer) lookup(specToLookAt, 'uid') ?: task.uid ?: 0 |
|||
String group = lookup(specToLookAt, 'permissionGroup') ?: task.permissionGroup |
|||
Integer gid = (Integer) lookup(specToLookAt, 'gid') ?: task.gid ?: 0 |
|||
Boolean setgid = lookup(specToLookAt, 'setgid') |
|||
|
|||
Integer explicitDirMode = FilePermissionUtil.getDirMode(specToLookAt) |
|||
int dirMode = explicitDirMode != null ? explicitDirMode : FilePermissionUtil.getUnixPermission(dirDetails) |
|||
if (setgid == null) { |
|||
setgid = task.setgid |
|||
} |
|||
if (setgid) { |
|||
dirMode = dirMode | 02000 |
|||
} |
|||
|
|||
debFileVisitorStrategy.addDirectory(dirDetails, user, uid, group, gid, dirMode) |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
protected void addLink(Link link) { |
|||
dataProducers << new DataProducerLink(link.path, link.target, true, null, null, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void addDependency(Dependency dep) { |
|||
dependencies << dep.toDebString() |
|||
} |
|||
|
|||
@Override |
|||
protected void addConflict(Dependency dep) { |
|||
conflicts << dep.toDebString() |
|||
} |
|||
|
|||
@Override |
|||
protected void addProvides(Dependency dep) { |
|||
String providesString = dep.packageName |
|||
if (dep.version) { |
|||
providesString += " (= ${dep.version})" |
|||
} |
|||
provides << providesString |
|||
} |
|||
|
|||
@Override |
|||
protected void addObsolete(Dependency dep) { |
|||
logger.warn "Obsoletes functionality not implemented for deb files" |
|||
} |
|||
|
|||
protected void addRecommends(Dependency dep) { |
|||
recommends << dep.toDebString() |
|||
} |
|||
|
|||
protected void addSuggests(Dependency dep) { |
|||
suggests << dep.toDebString() |
|||
} |
|||
|
|||
protected void addEnhances(Dependency dep) { |
|||
enhances << dep.toDebString() |
|||
} |
|||
|
|||
protected void addPreDepends(Dependency dep) { |
|||
preDepends << dep.toDebString() |
|||
} |
|||
|
|||
protected void addBreaks(Dependency dep) { |
|||
breaks << dep.toDebString() |
|||
} |
|||
|
|||
protected void addReplaces(Dependency dep) { |
|||
replaces << dep.toDebString() |
|||
} |
|||
|
|||
@Override |
|||
protected void addDirectory(Directory directory) { |
|||
def user = directory.user ? directory.user : task.user |
|||
def permissionGroup = directory.permissionGroup ? directory.permissionGroup : task.permissionGroup |
|||
dataProducers << new DataProducerPathTemplate( |
|||
[directory.path] as String[], null, null, |
|||
[ new PermMapper(-1, -1, user, permissionGroup, |
|||
directory.permissions, -1, 0, null) ] as Mapper[]) |
|||
} |
|||
|
|||
protected String getMultiArch() { |
|||
def archString = task.getArchString() |
|||
def multiArch = task.getMultiArch() |
|||
if (('all' == archString) && (MultiArch.SAME == multiArch)) { |
|||
throw new IllegalArgumentException('Deb packages with Architecture: all cannot declare Multi-Arch: same') |
|||
} |
|||
def multiArchString = multiArch?.name()?.toLowerCase() ?: '' |
|||
return multiArchString |
|||
} |
|||
|
|||
protected Map<String,String> getCustomFields() { |
|||
task.getAllCustomFields().collectEntries { String key, String val -> |
|||
// in the deb control file, header XB-Foo becomes Foo in the binary package |
|||
['XB-' + key.capitalize(), val] |
|||
} as Map<String, String> |
|||
} |
|||
|
|||
@Override |
|||
protected void end() { |
|||
for (Dependency recommends : task.allRecommends) { |
|||
logger.debug "adding recommends on {} {}", recommends.packageName, recommends.version |
|||
addRecommends(recommends) |
|||
} |
|||
|
|||
for (Dependency suggests : task.allSuggests) { |
|||
logger.debug "adding suggests on {} {}", suggests.packageName, suggests.version |
|||
addSuggests(suggests) |
|||
} |
|||
|
|||
for (Dependency enhances : task.allEnhances) { |
|||
logger.debug "adding enhances on {} {}", enhances.packageName, enhances.version |
|||
addEnhances(enhances) |
|||
} |
|||
|
|||
for (Dependency preDepends : task.allPreDepends) { |
|||
logger.debug "adding preDepends on {} {}", preDepends.packageName, preDepends.version |
|||
addPreDepends(preDepends) |
|||
} |
|||
|
|||
for (Dependency breaks : task.getAllBreaks()) { |
|||
logger.debug "adding breaks on {} {}", breaks.packageName, breaks.version |
|||
addBreaks(breaks) |
|||
} |
|||
|
|||
for (Dependency replaces : task.allReplaces) { |
|||
logger.debug "adding replaces on {} {}", replaces.packageName, replaces.version |
|||
addReplaces(replaces) |
|||
} |
|||
|
|||
maintainerScriptsGenerator.generate(toContext()) |
|||
|
|||
task.allSupplementaryControlFiles.each { supControl -> |
|||
File supControlFile = supControl instanceof File ? supControl as File : task.project.file(supControl) |
|||
new File(debianDir, supControlFile.name).bytes = supControlFile.bytes |
|||
} |
|||
|
|||
DebMaker maker = new DebMaker(new GradleLoggerConsole(), dataProducers, null) |
|||
File debFile = task.getArchiveFile().get().asFile |
|||
maker.setControl(debianDir) |
|||
maker.setDeb(debFile) |
|||
if (StringUtils.isNotBlank(task.getSigningKeyId()) |
|||
&& StringUtils.isNotBlank(task.getSigningKeyPassphrase()) |
|||
&& task.getSigningKeyRingFile().exists()) { |
|||
maker.setKey(task.getSigningKeyId()) |
|||
maker.setPassphrase(task.getSigningKeyPassphrase()) |
|||
maker.setKeyring(task.getSigningKeyRingFile()) |
|||
maker.setSignPackage(true) |
|||
} |
|||
|
|||
try { |
|||
logger.info("Creating debian package: ${debFile}") |
|||
maker.setCompression(Compression.GZIP.toString()) |
|||
maker.makeDeb() |
|||
} catch (Exception e) { |
|||
throw new GradleException("Can't build debian package ${debFile}", e) |
|||
} |
|||
|
|||
logger.info 'Created deb {}', debFile |
|||
} |
|||
|
|||
private static class GradleLoggerConsole implements Console { |
|||
@Override |
|||
void debug(String message) { |
|||
logger.debug(message) |
|||
} |
|||
|
|||
@Override |
|||
void info(String message) { |
|||
logger.info(message) |
|||
} |
|||
|
|||
@Override |
|||
void warn(String message) { |
|||
logger.warn(message) |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Map to be consumed by generateFile when transforming template |
|||
*/ |
|||
def Map toContext() { |
|||
Map context = [:] |
|||
DeprecationLoggerUtils.whileDisabled { |
|||
context = [ |
|||
name: task.getPackageName(), |
|||
version: task.getVersion(), |
|||
release: task.getRelease(), |
|||
maintainer: task.getMaintainer(), |
|||
uploaders: task.getUploaders(), |
|||
priority: task.getPriority(), |
|||
epoch: task.getEpoch(), |
|||
description: task.getPackageDescription() ?: '', |
|||
distribution: task.getDistribution(), |
|||
summary: task.getSummary(), |
|||
section: task.getPackageGroup(), |
|||
time: DateFormatUtils.SMTP_DATETIME_FORMAT.format(new Date()), |
|||
provides: StringUtils.join(provides, ", "), |
|||
depends: StringUtils.join(dependencies, ", "), |
|||
url: task.getUrl(), |
|||
arch: task.getArchString(), |
|||
multiArch: getMultiArch(), |
|||
conflicts: StringUtils.join(conflicts, ", "), |
|||
recommends: StringUtils.join(recommends, ", "), |
|||
suggests: StringUtils.join(suggests, ", "), |
|||
enhances: StringUtils.join(enhances, ", " ), |
|||
preDepends: StringUtils.join(preDepends, ", "), |
|||
breaks: StringUtils.join(breaks, ", "), |
|||
replaces: StringUtils.join(replaces, ", "), |
|||
fullVersion: buildFullVersion(), |
|||
customFields: getCustomFields(), |
|||
|
|||
// Uses install command for directory |
|||
dirs: installDirs.collect { InstallDir dir -> [install: installLineGenerator.generate(dir)] } |
|||
] |
|||
} |
|||
return context |
|||
} |
|||
|
|||
private String buildFullVersion() { |
|||
StringBuilder fullVersion = new StringBuilder() |
|||
|
|||
DeprecationLoggerUtils.whileDisabled { |
|||
if (task.getEpoch() != 0) { |
|||
fullVersion <<= task.getEpoch() |
|||
fullVersion <<= ':' |
|||
} |
|||
|
|||
fullVersion <<= task.getVersion() |
|||
|
|||
if(task.getRelease()) { |
|||
fullVersion <<= '-' |
|||
fullVersion <<= task.getRelease() |
|||
} |
|||
|
|||
} |
|||
|
|||
fullVersion.toString() |
|||
} |
|||
} |
|||
@ -1,31 +0,0 @@ |
|||
/* |
|||
* SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. |
|||
* SPDX-License-Identifier: BUSL-1.1 |
|||
*/ |
|||
package org.thingsboard.packaging |
|||
|
|||
import com.netflix.gradle.plugins.packaging.SystemPackagingBasePlugin |
|||
import com.netflix.gradle.plugins.packaging.SystemPackagingPlugin |
|||
import com.netflix.gradle.plugins.rpm.Rpm |
|||
import org.gradle.api.Plugin |
|||
import org.gradle.api.Project |
|||
import org.gradle.api.logging.Logger |
|||
import org.gradle.api.logging.Logging |
|||
|
|||
public class PackagingPlugin implements Plugin<Project> { |
|||
private static Logger logger = Logging.getLogger(SystemPackagingPlugin); |
|||
|
|||
Project project |
|||
DebPackaging debTask |
|||
Rpm rpmTask |
|||
|
|||
void apply(Project project) { |
|||
|
|||
this.project = project |
|||
|
|||
project.plugins.apply(SystemPackagingBasePlugin.class) |
|||
debTask = project.tasks.create('buildDeb', DebPackaging) |
|||
rpmTask = project.tasks.create('buildRpm', Rpm) |
|||
} |
|||
|
|||
} |
|||
@ -1 +0,0 @@ |
|||
implementation-class=org.thingsboard.packaging.PackagingPlugin |
|||
Loading…
Reference in new issue