/// <summary> /// Builds the plugin and returns the name of the jar that was created /// </summary> private string BuildPlugin(RoslynPluginDefinition definition, string outputDirectory) { logger.LogInfo(UIResources.APG_GeneratingPlugin); // Make the .jar name match the format [artefactid]-[version].jar // i.e. the format expected by Maven Directory.CreateDirectory(outputDirectory); string fullJarPath = Path.Combine(outputDirectory, definition.Manifest.Key + "-plugin-" + definition.Manifest.Version + ".jar"); string repositoryId = RepositoryKeyUtilities.GetValidKey(definition.PackageId + "." + definition.Language); string repoKey = RepositoryKeyPrefix + repositoryId; RoslynPluginJarBuilder builder = new RoslynPluginJarBuilder(logger); builder.SetLanguage(definition.Language) .SetRepositoryKey(repoKey) .SetRepositoryName(definition.Manifest.Name) .SetRulesFilePath(definition.RulesFilePath) .SetPluginManifestProperties(definition.Manifest) .SetJarFilePath(fullJarPath); AddRoslynMetadata(builder, definition, repositoryId); string relativeStaticFilePath = "static/" + Path.GetFileName(definition.StaticResourceName); builder.AddResourceFile(definition.SourceZipFilePath, relativeStaticFilePath); builder.Build(); return(fullJarPath); }
private void AddRoslynMetadata(RoslynPluginJarBuilder builder, RoslynPluginDefinition definition, string repositoryId) { builder.SetPluginProperty(repositoryId + ".nuget.packageId", definition.PackageId); builder.SetPluginProperty(repositoryId + ".nuget.packageVersion", definition.PackageVersion); builder.SetPluginProperty(repositoryId + ".analyzerId", definition.PackageId); builder.SetPluginProperty(repositoryId + ".ruleNamespace", definition.PackageId); builder.SetPluginProperty(repositoryId + ".staticResourceName", definition.StaticResourceName); builder.SetPluginProperty(repositoryId + ".pluginKey", definition.Manifest.Key); builder.SetPluginProperty(repositoryId + ".pluginVersion", definition.Manifest.Version); }
/// <summary> /// Builds the plugin and returns the name of the jar that was created /// </summary> private string BuildPlugin(RoslynPluginDefinition definition, string outputDirectory) { this.logger.LogInfo(UIResources.APG_GeneratingPlugin); // Make the .jar name match the format [artefactid]-[version].jar // i.e. the format expected by Maven Directory.CreateDirectory(outputDirectory); string fullJarPath = Path.Combine(outputDirectory, definition.Manifest.Key + "-plugin-" + definition.Manifest.Version + ".jar"); string repositoryId = RepositoryKeyUtilities.GetValidKey(definition.PackageId + "." + definition.Language); string repoKey = RepositoryKeyPrefix + repositoryId; RoslynPluginJarBuilder builder = new RoslynPluginJarBuilder(logger); builder.SetLanguage(definition.Language) .SetRepositoryKey(repoKey) .SetRepositoryName(definition.Manifest.Name) .SetRulesFilePath(definition.RulesFilePath) .SetPluginManifestProperties(definition.Manifest) .SetJarFilePath(fullJarPath); if (!string.IsNullOrWhiteSpace(definition.SqaleFilePath)) { builder.SetSqaleFilePath(definition.SqaleFilePath); } AddRoslynMetadata(builder, definition, repositoryId); string relativeStaticFilePath = "static/" + Path.GetFileName(definition.StaticResourceName); builder.AddResourceFile(definition.SourceZipFilePath, relativeStaticFilePath); builder.Build(); return fullJarPath; }