Skip to content

Commit

Permalink
Fixes and improvements
Browse files Browse the repository at this point in the history
- Fix bug with breakpoint in mule xml-file
- Increase gradle version to 7.0.1
  • Loading branch information
karnilaev committed May 22, 2021
1 parent 6fb90aa commit a19d4f8
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 215 deletions.
15 changes: 9 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@


buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://jcenter.bintray.com/" }
}

dependencies {

}
}

plugins {
id 'net.researchgate.release' version '2.3.4'
id "org.jetbrains.intellij" version "0.7.2"
id("net.researchgate.release") version "2.8.1"
id("org.jetbrains.intellij") version "0.7.3"
}

subprojects {
repositories {
mavenLocal()
mavenCentral()
maven {
url "http://central.maven.org/maven2/"
url "https://central.maven.org/maven2/"
}
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
Expand All @@ -28,7 +30,7 @@ subprojects {
url "https://repository.mulesoft.org/releases/"
}
maven {
url "http://repository.mulesoft.org/snapshots/"
url "https://repository.mulesoft.org/snapshots/"
}
maven {
url "https://repository.mulesoft.org/nexus/content/repositories/releases"
Expand All @@ -43,7 +45,7 @@ subprojects {

task jarSources(type:Jar) {
from sourceSets.main.allSource
classifier = 'sources'
archiveClassifier.set 'sources'
}
assemble.dependsOn jarSources

Expand All @@ -62,7 +64,8 @@ subprojects {
}

dependencies {
testCompile 'junit:junit:4.+'
testImplementation 'junit:junit:4.+'
compileOnly 'org.jetbrains:annotations:21.0.0'
}
}

Expand Down
22 changes: 11 additions & 11 deletions data-weave-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ configurations {
}

dependencies {
compile files('lib/weave/core-1.1.5.jar')
compile files('lib/weave/parser-1.1.5.jar')
compile files('lib/weave/scala-library-2.11.8.jar')
compile files('lib/weave/mule-plugin-weave-3.8.5.jar')
implementation files('lib/weave/core-1.1.5.jar')
implementation files('lib/weave/parser-1.1.5.jar')
implementation files('lib/weave/scala-library-2.11.8.jar')
implementation files('lib/weave/mule-plugin-weave-3.8.5.jar')

compile (group: 'org.mule.mvel', name: 'mule-mvel2', version: '2.1.9-MULE-008')
compile (group: 'org.parboiled', name: 'parboiled_2.11', version: '2.1.3')
compile (group: 'org.threeten', name: 'threetenbp', version: '1.3.1')
compile (group: 'org.spire-math', name: 'spire_2.11', version: '0.11.0')
compile (group: 'org.mule', name: 'mule-core', version: '3.8.1')
compile (group: 'org.codehaus.woodstox', name: 'stax2-api', version: '4.0.0')
compile (group: 'com.fasterxml.woodstox', name: 'woodstox-core', version: '5.0.2')
implementation (group: 'org.mule.mvel', name: 'mule-mvel2', version: '2.1.9-MULE-008')
implementation (group: 'org.parboiled', name: 'parboiled_2.11', version: '2.1.3')
implementation (group: 'org.threeten', name: 'threetenbp', version: '1.3.1')
implementation (group: 'org.spire-math', name: 'spire_2.11', version: '0.11.0')
implementation (group: 'org.mule', name: 'mule-core', version: '3.8.1')
implementation (group: 'org.codehaus.woodstox', name: 'stax2-api', version: '4.0.0')
implementation (group: 'com.fasterxml.woodstox', name: 'woodstox-core', version: '5.0.2')
}

intellij {
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ideaVersion = IC-2020.3.3
ideaVersion = IC-2021.1
javaVersion = 11
ijPluginRepoChannel = alpha
version = 0.14
-Dorg.gradle.warning.mode=all
14 changes: 8 additions & 6 deletions mule-esb-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@ configurations {
}

dependencies {
compile files('lib/mule-plugin-debugger-3.8.4.jar',
implementation files('lib/mule-plugin-debugger-3.8.4.jar',
'lib/security-api-1.6.0.jar',
'lib/mule-module-apikit-soap-common-1.0.0.jar',
'lib/mule-module-apikit-soap-xml-generator-1.0.0.jar',
)

compile project(':data-weave-plugin')
compile project(':raml-plugin')
compileOnly project(':data-weave-plugin')
compileOnly project(':raml-plugin')

compile ('org.mule.tools:apikit-scaffolder:3.8.4') {
implementation ('org.mule.tools:apikit-scaffolder:3.8.4') {
exclude module: 'xml-apis'
exclude module: 'commons-logging'
exclude module: 'raml-parser-2'
exclude group: "org.slf4j"
}

compile (group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.55')
compile (group: 'wsdl4j', name: 'wsdl4j', version: '1.6.3')
implementation (group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.55')
implementation (group: 'wsdl4j', name: 'wsdl4j', version: '1.6.3')

implementation (group: 'org.mule', name: 'mule-core', version: '3.8.1')
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,22 @@
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileAdapter;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiFile;
import org.apache.commons.io.IOUtils;
import org.bouncycastle.util.encoders.Base64;
import org.jdom2.Element;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
import org.mule.security.encryption.binary.jce.algorithms.EncryptionAlgorithm;
import org.mule.security.encryption.binary.jce.algorithms.EncryptionMode;
import org.mule.soapkit.common.utils.WsdlUtils;
import org.mule.soapkit.xml.generator.Scaffolder;
import org.mule.soapkit.xml.generator.model.buildables.SoapkitApiConfig;
import org.mule.soapkit.xml.generator.parsers.SoapkitMuleConfigParser;
import org.mule.tooling.esb.launcher.configuration.project.MuleDeployProperties;
import org.mule.tooling.esb.soapkit.ui.SoapKitDialog;
import org.mule.tooling.esb.util.MuleConfigUtils;
import org.mule.tooling.esb.util.MuleUIUtils;

import javax.wsdl.Definition;
import java.io.*;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.List;

public class SOAPKitScaffoldingAction extends AnAction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.mule.tooling.esb.debugger.breakpoint;

import com.intellij.lang.Language;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
Expand Down Expand Up @@ -56,10 +57,9 @@ public boolean canPutAt(@NotNull VirtualFile file, int line, @NotNull Project pr
final PsiElement firstWeaveElement = WeavePsiUtils.getFirstWeaveElement(project, document, line);
if (firstWeaveElement != null)
{
PsiLanguageInjectionHost parent = PsiTreeUtil.getParentOfType(firstWeaveElement, PsiLanguageInjectionHost.class);
if (parent != null)
{
final PsiElement elementInInjected = InjectedLanguageUtil.findElementInInjected(parent, line);
final PsiElement elementInInjected = InjectedLanguageManager.getInstance(project)
.findInjectedElementAt(psiFile, line);
if (elementInInjected != null) {
final Language language = elementInInjected.getLanguage();
return language == WeaveLanguage.getInstance();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;


class MuleConfigurationFactory extends ConfigurationFactory
Expand All @@ -20,6 +22,12 @@ public RunConfiguration createTemplateConfiguration(Project project)
return new MuleConfiguration("Mule ESB", this, project);
}

@Override
public @NotNull
@NonNls String getId() {
return "Mule ESB";
}

@Override
public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
import com.intellij.ide.fileTemplates.FileTemplateManager;
import com.intellij.ide.util.EditorHelper;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.maven.model.MavenConstants;
import org.jetbrains.idea.maven.model.MavenId;
import org.jetbrains.idea.maven.utils.MavenUtil;
Expand All @@ -20,6 +17,8 @@
import java.io.IOException;
import java.util.Properties;

import static com.intellij.openapi.command.WriteCommandAction.writeCommandAction;

public class MuleDomainMavenProjectBuilderHelper
{

Expand Down Expand Up @@ -48,19 +47,11 @@ private static PsiFile getPsiFile(Project project, VirtualFile pom)
return PsiManager.getInstance(project).findFile(pom);
}

private VirtualFile createMuleConfigFile(final Project project, final MavenId projectId, final VirtualFile appDirectory)
{
//final String domainConfigName = projectId.getArtifactId();
private VirtualFile createMuleConfigFile(final Project project, final MavenId projectId, final VirtualFile appDirectory) throws IOException {
final String domainConfigName = "mule-domain-config"; //Currently Mule requires it to be mule-domain-config.xml

return new WriteCommandAction<VirtualFile>(project, "Create Mule Domain Config File", PsiFile.EMPTY_ARRAY)
{
@Override
protected void run(@NotNull Result<VirtualFile> result) throws Throwable
{

try
{
return writeCommandAction(project, PsiFile.EMPTY_ARRAY)
.compute(() -> {
VirtualFile configFile = appDirectory.findOrCreateChildData(this, domainConfigName + ".xml");
final Properties templateProps = new Properties();
templateProps.setProperty("NAME", projectId.getArtifactId());
Expand All @@ -70,26 +61,13 @@ protected void run(@NotNull Result<VirtualFile> result) throws Throwable
defaultProperties.putAll(templateProps);
final String text = template.getText(defaultProperties);
VfsUtil.saveText(configFile, text);
result.setResult(configFile);
}
catch (IOException e)
{
showError(project, e);
}
}
}.execute().getResultObject();
return configFile;
});
}

private VirtualFile createMuleDeployPropertiesFile(final Project project, final MavenId projectId, final VirtualFile appDirectory)
{
return new WriteCommandAction<VirtualFile>(project, "Create Mule Deploy Properties File", PsiFile.EMPTY_ARRAY)
{
@Override
protected void run(@NotNull Result<VirtualFile> result) throws Throwable
{

try
{
private VirtualFile createMuleDeployPropertiesFile(final Project project, final MavenId projectId, final VirtualFile appDirectory) throws IOException {
return writeCommandAction(project, PsiFile.EMPTY_ARRAY)
.compute(() -> {
VirtualFile configFile = appDirectory.findOrCreateChildData(this, "mule-deploy.properties");
final Properties templateProps = new Properties();
templateProps.setProperty("NAME", projectId.getArtifactId());
Expand All @@ -99,31 +77,18 @@ protected void run(@NotNull Result<VirtualFile> result) throws Throwable
defaultProperties.putAll(templateProps);
final String text = template.getText(defaultProperties);
VfsUtil.saveText(configFile, text);
result.setResult(configFile);
}
catch (IOException e)
{
showError(project, e);
}
}
}.execute().getResultObject();
return configFile;
});
}

private static void showError(Project project, Throwable e)
{
MavenUtil.showError(project, "Failed to create a Mule Domain project", e);
}

private VirtualFile createPomFile(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root)
{
return new WriteCommandAction<VirtualFile>(project, "Create Mule Domain Project", PsiFile.EMPTY_ARRAY)
{
@Override
protected void run(@NotNull Result<VirtualFile> result) throws Throwable
{

try
{
private VirtualFile createPomFile(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root) throws IOException {
return writeCommandAction(project, PsiFile.EMPTY_ARRAY)
.compute(() -> {
VirtualFile pomFile = root.findOrCreateChildData(this, MavenConstants.POM_XML);
final Properties templateProps = new Properties();
templateProps.setProperty("GROUP_ID", projectId.getGroupId());
Expand All @@ -136,13 +101,7 @@ protected void run(@NotNull Result<VirtualFile> result) throws Throwable
defaultProperties.putAll(templateProps);
final String text = template.getText(defaultProperties);
VfsUtil.saveText(pomFile, text);
result.setResult(pomFile);
}
catch (IOException e)
{
showError(project, e);
}
}
}.execute().getResultObject();
return pomFile;
});
}
}
Loading

0 comments on commit a19d4f8

Please sign in to comment.