Skip to content

Commit

Permalink
Merge branch 'release/1.0.0.201608091842'
Browse files Browse the repository at this point in the history
  • Loading branch information
ArloL committed Aug 9, 2016
2 parents 7bccb74 + 3bc2aa9 commit 5f21765
Show file tree
Hide file tree
Showing 52 changed files with 1,553 additions and 1,131 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ These Eclipse plugins are built with the Tycho Maven plugin. The
marriage of OSGi, Eclipse, and Maven is imperfect. In particular, it
rarely works to run a build that does not start with 'clean'.

See docs/release.md for information about how all of this is released.
This project has Oomph, and you can set up an Eclipse development workspace of it in one click by:

1. Downloading the Eclipse Installer from https://www.eclipse.org/downloads/ and starting it.
2. On the initial page, click on the *Switch to advanced mode* button in the top right.
3. On the *Product* page, select *Eclipse for RCP and RAP Developers*.
4. On the *Projects* page, collapse the *Eclipse Projects* to scroll down to the *Github Projects* and select *m2e-code-quality*.
5. Choose your preferred installation settings on the *Variables* page.
6. Finish the wizard and watch how your development environment is being assembled, courtesy of Oomph.

See [doc/release.md](doc/release.md) for information about how all of this is released.

Activity here is 'coordinated' on a mailing list:
`[email protected]`.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.basistech.m2e.code.quality.checkstyle.test;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.basistech.m2e.code.quality.checkstyle.CheckstyleUtil;

public class CheckstyleUtilTest {

@Test
public void testAntToCheckstyleConversion() throws Exception {
assertEquals(".*\\.java", CheckstyleUtil
.convertAntStylePatternToCheckstylePattern("**\\/*.java"));
assertEquals(".*\\.properties", CheckstyleUtil
.convertAntStylePatternToCheckstylePattern("**/*.properties"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.m2e.jdt;bundle-version="[1.0.0,1.8.0)",
net.sf.eclipsecs.core;bundle-version="5.2.0",
net.sf.eclipsecs.checkstyle;bundle-version="5.2.0",
com.basistech.m2e.code.quality.shared;bundle-version="0.13.0",
org.apache.commons.lang;bundle-version="2.6.0"
org.apache.commons.lang;bundle-version="2.6.0",
org.slf4j.api;bundle-version="1.6.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Vendor: Basis Technology Corp.
Import-Package: org.apache.commons.lang,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,14 @@ public class Activator extends AbstractUIPlugin {
public Activator() {
}

/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
@Override
public void start(BundleContext context) throws Exception {
public void start(final BundleContext context) throws Exception {
super.start(context);
plugin = this;
}

/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
@Override
public void stop(BundleContext context) throws Exception {
public void stop(final BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
public final class CheckstyleEclipseConstants {

public static final String LOG_PREFIX = "M2E-CS";
public static final String MAVEN_PLUGIN_GROUPID =
"org.apache.maven.plugins";
public static final String MAVEN_PLUGIN_ARTIFACTID =
"maven-checkstyle-plugin";
public static final String ECLIPSE_CS_PREFS_FILE = ".checkstyle";
public static final String ECLIPSE_CS_PREFS_CONFIG_NAME =
"maven-checkstyle-plugin";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.basistech.m2e.code.quality.checkstyle;

import java.io.File;

import com.google.common.base.Preconditions;

public final class CheckstyleUtil {

private CheckstyleUtil() {
}

/**
* Helper to convert the maven-checkstyle-plugin includes/excludes pattern
* to eclipse checkstyle plugin pattern.
*
* @param pattern
* the maven-checkstyle-plugin pattern.
* @return the converted checkstyle eclipse pattern.
*/
public static String convertAntStylePatternToCheckstylePattern(
final String pattern) {
Preconditions.checkNotNull(pattern, "pattern cannot be null");
Preconditions.checkArgument(!pattern.isEmpty(),
"pattern cannot be empty");

String sanitizedPattern = pattern.replace(
File.separatorChar == '/' ? '\\' : '/', File.separatorChar);
final String dupeSeperatorChar = File.separator + File.separator;
while (sanitizedPattern.contains(dupeSeperatorChar)) {
sanitizedPattern =
sanitizedPattern.replace(dupeSeperatorChar, File.separator);
}

final StringBuilder sb = new StringBuilder();
for (int i = 0; i < sanitizedPattern.length(); ++i) {
final char curChar = sanitizedPattern.charAt(i);
char nextChar = '\0';
char nextNextChar = '\0';
if (i + 1 < sanitizedPattern.length()) {
nextChar = sanitizedPattern.charAt(i + 1);
}
if (i + 2 < sanitizedPattern.length()) {
nextNextChar = sanitizedPattern.charAt(i + 2);
}

if (curChar == '*' && nextChar == '*'
&& nextNextChar == File.separatorChar) {
sb.append(".*");
++i;
++i;
} else if (curChar == '*') {
sb.append(".*");
} else if (curChar == '.') {
sb.append("\\.");
} else {
sb.append(curChar);
}
}
String result = sb.toString();
if (result.endsWith(File.separator)) {
result += ".*";
}

// cleanup the resulting regex pattern
while (result.contains(".*.*")) {
result = result.replace(".*.*", ".*");
}

return result;
}

}

This file was deleted.

Loading

0 comments on commit 5f21765

Please sign in to comment.