private static void DoConfigureBuilder(PluginBuilder builder, PluginManifest definition, string language, string rulesFilePath, string sqaleFilePath, string workingFolder) { string uniqueId = Guid.NewGuid().ToString(); AddRuleSources(workingFolder, builder); ConfigureSourceFileReplacements(language, builder); builder.SetSourceCodeTokenReplacement("[RESOURCE_ID]", uniqueId); builder.AddExtension(RulesExtensionClassName); AddRuleJars(workingFolder, builder); // Add the rules and sqale files as resources // The files are uniquely named to avoid issues with multiple resources // of the same name in different jars on the classpath. This shouldn't be // an issue with SonarQube as plugins should be loaded in isolation from each other // but it simplifies testing. builder.AddResourceFile(rulesFilePath, "resources/" + uniqueId + ".rules.xml"); if (!string.IsNullOrEmpty(sqaleFilePath)) { builder.AddResourceFile(rulesFilePath, "resources/" + uniqueId + ".sqale.xml"); } // TODO: consider moving - not specific to the rules plugin builder.SetProperties(definition); }
private static void ConfigureSourceFileReplacements(string language, PluginBuilder builder) { builder.SetSourceCodeTokenReplacement(WellKnownSourceCodeTokens.Rule_Language, language); }
private static void DoConfigureBuilder(PluginBuilder builder, PluginManifest definition, string language, string rulesFilePath, string sqaleFilePath, string workingFolder) { string uniqueId = Guid.NewGuid().ToString(); AddRuleSources(workingFolder, builder); ConfigureSourceFileReplacements(language, builder); builder.SetSourceCodeTokenReplacement("[RESOURCE_ID]", uniqueId); builder.AddExtension(RulesExtensionClassName); AddRuleJars(workingFolder, builder); // Add the rules and sqale files as resources // The files are uniquely named to avoid issues with multiple resources // of the same name in different jars on the classpath. This shouldn't be // an issue with SonarQube as plugins should be loaded in isolation from each other // but it simplifies testing. builder.AddResourceFile(rulesFilePath, "resources/" + uniqueId + ".rules.xml"); if (!string.IsNullOrEmpty(sqaleFilePath)) { builder.AddResourceFile(rulesFilePath, "resources/" + uniqueId + ".sqale.xml"); } // TODO: consider moving - not specific to the rules plugin builder.SetProperties(definition); }
private static void ConfigureSourceFileReplacements(string language, PluginBuilder builder) { builder.SetSourceCodeTokenReplacement(WellKnownSourceCodeTokens.Rule_Language, language); }