aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Šulc <fordfrog@gentoo.org>2019-11-02 22:53:49 +0100
committerMiroslav Šulc <fordfrog@gentoo.org>2019-11-02 22:53:49 +0100
commit9982eb3cbf850fe6985fb29017f2161489cae07a (patch)
tree606c8c4be84a6f615380f5a0cb1bcbf699e5325a
parentfixed projects dump issues (diff)
downloadjava-ebuilder-9982eb3cbf850fe6985fb29017f2161489cae07a.tar.gz
java-ebuilder-9982eb3cbf850fe6985fb29017f2161489cae07a.tar.bz2
java-ebuilder-9982eb3cbf850fe6985fb29017f2161489cae07a.zip
replacing ebuild name and version with variables
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
-rw-r--r--src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index ffb6e66..2194b80 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -226,6 +226,16 @@ public class MavenEbuilder {
return result;
}
+ private String replaceWithVars(final String string, final Config config) {
+ final String pString
+ = config.getEbuildName() + '-' + config.getEbuildVersion();
+
+ return string.
+ replace(pString, "${P}").
+ replace(config.getEbuildName(), "${PN}").
+ replace(config.getEbuildVersion(), "${PV}");
+ }
+
/**
* Writes command that was used to create skeleton of the ebuild.
*
@@ -551,7 +561,8 @@ public class MavenEbuilder {
writer.println('"');
writer.print("SRC_URI=\"");
- writer.print(config.getDownloadUri());
+ writer.print(
+ replaceWithVars(config.getDownloadUri().toString(), config));
writer.println('"');
writer.print("LICENSE=\"");
@@ -653,7 +664,9 @@ public class MavenEbuilder {
writer.print(':');
}
- writer.print(config.getWorkdir().relativize(resources));
+ writer.print(replaceWithVars(
+ config.getWorkdir().relativize(resources).toString(),
+ config));
}
writer.println('"');
@@ -661,8 +674,8 @@ public class MavenEbuilder {
if (mavenProject.hasTests()) {
writer.print("JAVA_TEST_SRC_DIR=\"");
- writer.print(config.getWorkdir().relativize(
- mavenProject.getTestSourceDirectory()));
+ writer.print(replaceWithVars(config.getWorkdir().relativize(
+ mavenProject.getTestSourceDirectory()).toString(), config));
writer.println('"');
if (mavenProject.hasTestResources()) {
@@ -678,7 +691,8 @@ public class MavenEbuilder {
writer.print(':');
}
- writer.print(config.getWorkdir().relativize(resources));
+ writer.print(replaceWithVars(config.getWorkdir().
+ relativize(resources).toString(), config));
}
writer.println('"');