diff --git a/dev.jeka.plugins.sonarqube/dev.jeka.plugins.sonarqube.iml b/dev.jeka.plugins.sonarqube/dev.jeka.plugins.sonarqube.iml index c435cc5..85e9ead 100644 --- a/dev.jeka.plugins.sonarqube/dev.jeka.plugins.sonarqube.iml +++ b/dev.jeka.plugins.sonarqube/dev.jeka.plugins.sonarqube.iml @@ -7,25 +7,13 @@ - + + - - - - - - - - - - - - - @@ -38,13 +26,13 @@ - + - + - + diff --git a/dev.jeka.plugins.sonarqube/jeka/def/Build.java b/dev.jeka.plugins.sonarqube/jeka/def/Build.java index c601f8a..901032b 100644 --- a/dev.jeka.plugins.sonarqube/jeka/def/Build.java +++ b/dev.jeka.plugins.sonarqube/jeka/def/Build.java @@ -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", "djeangdev@yahoo.fr"); - 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)); - } } \ No newline at end of file diff --git a/dev.jeka.plugins.sonarqube/jeka/wrapper/jeka.properties b/dev.jeka.plugins.sonarqube/jeka/wrapper/jeka.properties index 8a8f8e6..4e0bc78 100644 --- a/dev.jeka.plugins.sonarqube/jeka/wrapper/jeka.properties +++ b/dev.jeka.plugins.sonarqube/jeka/wrapper/jeka.properties @@ -4,7 +4,7 @@ # The distribution will be downloaded from a Maven repository according the pattern [REPO URL]/dev/jeka/jeka-core/[jeka.version]/jeka-core-[jeka.version]-distrib.zip . # By default [REPO URL] is https://repo.maven.apache.org/maven2 . You can switch to another repository by editing repo.download.url property # located in [JEKA USER HOME DIR]/options.properties file. By default [JEKA USER HOME DIR] is [USER HOME]/.jeka . -jeka.version=0.9.15.M1 +jeka.version=0.9.15.M2 # The filesystem location of Jeka distribution to be used by the wrapper. This feature is only useful in very special cases. # When this property is set, jeka.version is ignored. It can be absolute or relative path to the root of the project to build.