This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
M999JAD
authored and
M999JAD
committed
Oct 8, 2021
1 parent
f78ea0f
commit 38bdf05
Showing
3 changed files
with
49 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,65 @@ | ||
import dev.jeka.core.api.depmanagement.JkRepoSet; | ||
import dev.jeka.core.api.depmanagement.JkVersion; | ||
import dev.jeka.core.api.java.JkJavaVersion; | ||
import dev.jeka.core.api.system.JkLocator; | ||
import dev.jeka.core.api.tooling.JkGitProcess; | ||
import dev.jeka.core.tool.JkClass; | ||
import dev.jeka.core.tool.JkEnv; | ||
import dev.jeka.core.tool.JkPlugin; | ||
import dev.jeka.core.tool.builtins.git.JkPluginGit; | ||
import dev.jeka.core.tool.builtins.java.JkPluginJava; | ||
|
||
import java.util.Optional; | ||
import dev.jeka.core.tool.builtins.release.JkPluginVersionFromGit; | ||
import dev.jeka.core.tool.builtins.repos.JkPluginGpg; | ||
|
||
class Build extends JkClass { | ||
|
||
final JkPluginJava javaPlugin = getPlugin(JkPluginJava.class); | ||
private final JkPluginJava java = getPlugin(JkPluginJava.class); | ||
|
||
@JkEnv("OSSRH_USER") | ||
public String ossrhUser; | ||
|
||
@JkEnv("OSSRH_PWD") | ||
public String ossrhPwd; | ||
|
||
final JkPluginGit gitPlugin = getPlugin(JkPluginGit.class); | ||
final JkPluginGpg gpg = getPlugin(JkPluginGpg.class); | ||
|
||
final JkPluginVersionFromGit versionFromGit = getPlugin(JkPluginVersionFromGit.class); | ||
|
||
@Override | ||
protected void setup() { | ||
javaPlugin.getProject().simpleFacade() | ||
.setJavaVersion(JkJavaVersion.V8) | ||
.setSimpleLayout() | ||
.mixResourcesAndSources() | ||
.setCompileDependencies(deps -> deps | ||
.andFiles(JkLocator.getJekaJarPath()) | ||
); | ||
JkPlugin.setJekaPluginCompatibilityRange(javaPlugin.getProject().getConstruction().getManifest(), | ||
"0.9.15.M1", | ||
JkPlugin.setJekaPluginCompatibilityRange(java.getProject().getConstruction().getManifest(), | ||
"0.9.15.M2", | ||
"https://raw.githubusercontent.com/jerkar/sonarqube-plugin/master/breaking_versions.txt"); | ||
java.getProject().simpleFacade() | ||
.setJavaVersion(JkJavaVersion.V8) | ||
.mixResourcesAndSources() | ||
.setSimpleLayout() | ||
.setCompileDependencies(deps -> deps | ||
.andFiles(JkLocator.getJekaJarPath()) | ||
); | ||
|
||
|
||
// This section is necessary to publish on a public repository | ||
javaPlugin.getProject().getPublication() | ||
.getMaven() | ||
.setModuleId("dev.jeka:sonarqube-plugin") | ||
.setVersion(this::version) | ||
.getPomMetadata() | ||
java.getProject().getPublication().getMaven() | ||
.setModuleId("dev.jeka:sonarqube-plugin") | ||
.setRepos(JkRepoSet.ofOssrhSnapshotAndRelease(ossrhUser, ossrhPwd, | ||
gpg.get().getSigner(""))) | ||
.getPomMetadata() | ||
.getProjectInfo() | ||
.setName("Jeka plugin for Sonarqube") | ||
.setDescription("A Jeka plugin for Jacoco coverage tool") | ||
.setUrl("https://github.com/jerkar/sonarqube-plugin") | ||
.__ | ||
.getScm() | ||
.setUrl("https://github.com/jerkar/sonarqube-plugin").__ | ||
.addApache2License() | ||
.getProjectInfo() | ||
.setName("Jeka plugin for SonarQube") | ||
.setDescription("A Jeka plugin for SonarQube") | ||
.setUrl("https://github.com/jerkar/sonarqube-plugin").__ | ||
.getScm() | ||
.setUrl("https://github.com/jerkar/sonarqube-plugin").__.__.__ | ||
.getPostActions() | ||
.append(this::tagIfNeeded); | ||
} | ||
.addGithubDeveloper("djeang", "[email protected]"); | ||
|
||
public void cleanPack() { | ||
clean(); javaPlugin.pack(); | ||
// Make javadoc only for releases | ||
if (!JkVersion.of(java.getProject().getPublication().getVersion()).isSnapshot()) { | ||
java.pack.javadoc = true; | ||
} | ||
} | ||
|
||
private String version() { | ||
String currentTagVersion = gitPlugin.getWrapper().getVersionFromTag(); | ||
currentTagVersion = currentTagVersion.equals("HEAD-SNAPSHOT") ? "master-SNAPSHOT" : currentTagVersion; | ||
String releaseVersion = gitPlugin.getWrapper().extractSuffixFromLastCommitMessage("Release:"); | ||
return Optional.ofNullable(releaseVersion).orElse(currentTagVersion); | ||
public void cleanPack() { | ||
clean(); java.pack(); | ||
} | ||
|
||
private void tagIfNeeded() { | ||
JkGitProcess git = gitPlugin.getWrapper(); | ||
Optional.ofNullable(git.extractSuffixFromLastCommitMessage("Release:")) | ||
.ifPresent(version -> git.tagAndPush(version)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters