diff --git a/src/main/java/org/jfrog/gradle/plugin/artifactory/extractor/GradleModuleExtractor.java b/src/main/java/org/jfrog/gradle/plugin/artifactory/extractor/GradleModuleExtractor.java index afff98e..38d15ff 100644 --- a/src/main/java/org/jfrog/gradle/plugin/artifactory/extractor/GradleModuleExtractor.java +++ b/src/main/java/org/jfrog/gradle/plugin/artifactory/extractor/GradleModuleExtractor.java @@ -12,6 +12,9 @@ import org.gradle.api.artifacts.result.ResolvedDependencyResult; import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; +import org.gradle.api.plugins.PluginContainer; +import org.gradle.language.cpp.plugins.CppApplicationPlugin; +import org.gradle.language.cpp.plugins.CppLibraryPlugin; import org.jfrog.build.api.builder.ModuleType; import org.jfrog.build.api.util.FileChecksumCalculator; import org.jfrog.build.extractor.ModuleExtractor; @@ -79,7 +82,7 @@ private ModuleBuilder getModuleBuilder(Project project, Set .findAny() .orElse(""); ModuleBuilder builder = new ModuleBuilder() - .type(ModuleType.GRADLE) + .type(getModuleType(project)) .id(moduleId) .repository(repo); try { @@ -99,6 +102,21 @@ private ModuleBuilder getModuleBuilder(Project project, Set return builder; } + /** + * Get the module type to publish. + * + * @param project - Project to extract the module type + * @return the module type. + */ + private ModuleType getModuleType(Project project) { + PluginContainer plugins = project.getPlugins(); + if (!plugins.withType(CppApplicationPlugin.class).isEmpty() || + !plugins.withType(CppLibraryPlugin.class).isEmpty()) { + return ModuleType.CPP; + } + return ModuleType.GRADLE; + } + /** * Extract Artifacts from the given deploy details */