Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move custom gradle configs into custom plugins #721

Merged
merged 7 commits into from Nov 21, 2019
Merged

Conversation

m273d15
Copy link
Contributor

@m273d15 m273d15 commented Oct 14, 2019

  • Moves our custom configs of IDE specific gradle plugins in custom plugins
    which are written in Java. This reduces the usage of implicit groovy/gradle magic,
    allows to reduce the amount of code in the build.gradle files and allows to reuse more code.
  • Removes the mavenize workflow that uses an existing eclipse installation as P2 Repository and
    converts this repository into a maven repository. The new workflow uses the maven artifacts which
    are deployed into maven central by the eclipse community. The mapping of eclipse version + bundle id -> maven artifact is performed by the goomph mavencentral plugin.
  • Adds a workaround for duplicate classpath entries in the eclipse build path.

Also solves the issue #517 in the intellij environment.

@m273d15 m273d15 added the Area: Infrastructure Issue affecting the infrastructure to build, test and deploy Saros and its documentation label Oct 14, 2019
@m273d15
Copy link
Contributor Author

m273d15 commented Oct 14, 2019

TODO: Remove workaround that removes duplicate classpath entries. Already fixed with #722

Copy link
Member

@tobous tobous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review in progress. But here are the first notes.

@tobous
Copy link
Member

tobous commented Oct 15, 2019

I think Codacy is a bit broken. The first analysis failed to find anything (as it did not analyze the 'buildSrc' directory), and the results of the successful analysis were not posted here. Anyways, @m273d15, you should have a look at the results of the newest codacy build.

Copy link
Member

@tobous tobous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I only had a very coarse look at the changes for the Eclipse build stuff as I am not really familiar with it or the Eclipse usage (as I don't use Eclipse myself). Also, the review already took me long enough as it is.
So it would be nice if somebody else could have a more detailed look at the eclipse (and STF) part of the code as well.

In general, a lot of classes and methods (at least for the IntelliJ stuff) need javadoc. There are a lot of implicit assumptions based on "insider knowledge" about Gradle, Gradle Tasks, IntelliJ, and the IntelliJ Gradle build process that is not mentioned at all. This makes it a lot harder to understand the logic.

build.gradle Show resolved Hide resolved
buildSrc/build.gradle Outdated Show resolved Hide resolved
stf/build.gradle Show resolved Hide resolved
Copy link
Contributor Author

@m273d15 m273d15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, thank you for your review 👍

build.gradle Show resolved Hide resolved
@@ -123,37 +108,16 @@ configure(projectsToConfigure) { projectToConf ->
from projectToConf.configurations.releaseDep
}

projectToConf.ext.eclipseHome = projectToConf.hasProperty('eclipseHome') ? eclipseHome : System.getenv('ECLIPSE_HOME')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means that the developers don't have to use a local eclipse installation in order to build the eclipse plugin. You still need a local installation in order to run the plugin (which would be the next step of the infrastructure improvement). This has the advantage that you don't need to install eclipse if you want to build all projects in your ide without problems.
If you want to use a specific eclipse version for build and testing you can set the value:

sarosEclipse {
  eclipseVersion = <version string>
}

Is this due to complications in the eclipse build process that required the "Mavenize" job in the previous setup?

The previous setup was necessary, because the eclipse bundles were not available via maven central, but the bundle are now deployed into maven central (by the eclipse project itself). Therefore, we don't need the weird setup of converting an eclipse installation (more specific the P2 repository) into a local maven repository. The only bundle that is not available via maven central is gef (because it is not part of the default bundles)

buildSrc/build.gradle Outdated Show resolved Hide resolved
buildSrc/build.gradle Outdated Show resolved Hide resolved
stf/build.gradle Show resolved Hide resolved
@tobous
Copy link
Member

tobous commented Oct 28, 2019

Also, since this (at least slightly) changes the necessary build setup (e.g. the reference to a local eclipse installation no longer being necessary), the documentation should be updated accordingly.

@m273d15 m273d15 force-pushed the pr/impr_gradle branch 2 times, most recently from 213a724 to 72599a2 Compare October 31, 2019 14:19
@saros-project saros-project deleted a comment Oct 31, 2019
docs/contribute/development-environment.md Outdated Show resolved Hide resolved
docs/contribute/development-environment.md Outdated Show resolved Hide resolved
intellij/build.gradle Outdated Show resolved Hide resolved
import org.jetbrains.intellij.IntelliJPluginExtension;

/** Gradle task that configures the intellij plugin. */
public class IntellijConfigurator {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this no longer extend DefaultTask? Is it no longer necessary?

intellij/build.gradle Outdated Show resolved Hide resolved
Copy link
Contributor

@stefaus stefaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eclipse and IntelliJ (runIde) worked for me, but gradlew stfTest failed with:

exception
> Task :saros.stf.test:compileStfTestJava FAILED
[gitfolder]/stf.test/test/saros/stf/test/followmode/SimpleFollowModeITest.java:8: error: package org.eclipse.jface.bindings.keys does not exist
import org.eclipse.jface.bindings.keys.IKeyLookup;
                                      ^
[gitfolder]/stf.test/test/saros/stf/test/filefolderoperations/FileOperationsTest.java:11: error: package org.eclipse.core.runtime does not exist
import org.eclipse.core.runtime.CoreException;
                               ^
[gitfolder]/stf.test/test/saros/stf/test/filefolderoperations/FileOperationsTest.java:194: error: cannot find symbol
  public void testNewPkgAndClass() throws CoreException, IOException {
                                          ^
  symbol:   class CoreException
  location: class FileOperationsTest
[gitfolder]/stf.test/test/saros/stf/test/editing/ConcurrentEditingTest.java:8: error: package org.eclipse.jface.bindings.keys does not exist
import org.eclipse.jface.bindings.keys.IKeyLookup;
                                      ^
[gitfolder]/stf.test/test/saros/stf/test/invitation/ParallelInvitationWithTerminationByHostTest.java:13: error: package org.eclipse.core.runtime does not exist
import org.eclipse.core.runtime.CoreException;
                               ^
[gitfolder]/stf.test/test/saros/stf/test/invitation/ParallelInvitationWithTerminationByHostTest.java:65: error: cannot find symbol
      throws IOException, CoreException, InterruptedException {
                          ^
  symbol:   class CoreException
  location: class ParallelInvitationWithTerminationByHostTest
[gitfolder]/stf.test/test/saros/stf/test/invitation/HostInvitesBelatedlyTest.java:8: error: package org.eclipse.core.runtime does not exist
import org.eclipse.core.runtime.CoreException;
                               ^
[gitfolder]/stf.test/test/saros/stf/test/followmode/SimpleFollowModeITest.java:55: error: cannot find symbol
        .pressShortcut(IKeyLookup.BACKSPACE_NAME, IKeyLookup.BACKSPACE_NAME);
                       ^
  symbol:   variable IKeyLookup
  location: class SimpleFollowModeITest
[gitfolder]/stf.test/test/saros/stf/test/followmode/SimpleFollowModeITest.java:55: error: cannot find symbol
        .pressShortcut(IKeyLookup.BACKSPACE_NAME, IKeyLookup.BACKSPACE_NAME);
                                                  ^
  symbol:   variable IKeyLookup
  location: class SimpleFollowModeITest
[gitfolder]/stf.test/test/saros/stf/test/editing/ConcurrentEditingTest.java:72: error: cannot find symbol
    ALICE.remoteBot().editor(FILE).pressShortcut(new String[] {IKeyLookup.BACKSPACE_NAME});
                                                               ^
  symbol:   variable IKeyLookup
  location: class ConcurrentEditingTest
[gitfolder]/stf.test/test/saros/stf/test/editing/ConcurrentEditingTest.java:78: error: cannot find symbol
    ALICE.remoteBot().editor(FILE).pressShortcut(new String[] {IKeyLookup.BACKSPACE_NAME});
                                                               ^
  symbol:   variable IKeyLookup
  location: class ConcurrentEditingTest
11 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':saros.stf.test:compileStfTestJava'.
> Compilation failed; see the compiler error output for details.

Comment on lines 68 to 99
return Arrays.stream(value.split(","))
.map(
(it) -> {
return it.split(";")[0];
})
.filter(
(it) -> {
return !bundlesToExclude.contains(it);
})
.toArray(String[]::new);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

return Arrays.stream(value.split(","))
            .map(it -> it.split(";")[0])
            .filter(it -> !bundlesToExclude.contains(it))
            .toArray(String[]::new);

@m273d15
Copy link
Contributor Author

m273d15 commented Nov 13, 2019

eclipse and IntelliJ (runIde) worked for me, but gradlew stfTest failed with:

I know it is a simple fix. Seems like I forgot to add this as comment (I commented this issue somewhere ...). I will add the fix and the remaining improvements as soon as possible.

@m273d15 m273d15 force-pushed the pr/impr_gradle branch 2 times, most recently from 6e4b6ba to b50160d Compare November 19, 2019 12:29
@m273d15 m273d15 requested a review from tobous November 19, 2019 12:41
* You need an **Intellij IDEA** installation which is used for dependency resolution. Install a current version of [**IntelliJ IDEA**](https://www.jetbrains.com/idea/download/#section=linux) (we have only tested Saros/I for IntelliJ releases 2017.X and later)

Set the **system-wide environment variable `ECLIPSE_HOME`** to the eclipse installation dir that contains the directory `plugins`.<br/>
* *Optional:* You can install an **Intellij IDEA** installation which is used for dependency resolution. Install a current version of [**IntelliJ IDEA**](https://www.jetbrains.com/idea/download/#section=linux) (we have only tested Saros/I for IntelliJ releases 2017.X and later)<br/>
Set the **system-wide environment variable `INTELLIJ_HOME`** to the intellij installation dir that contains the directory `lib`.
Copy link
Member

@tobous tobous Nov 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Set the **system-wide environment variable `INTELLIJ_HOME`** to the intellij installation dir that contains the directory `lib`.
Set the **system-wide environment variable `INTELLIJ_HOME`** to the IntelliJ installation dir that contains the directory `lib`.
* *Optional:* You can also set the **system-wide environment variable `SAROS_INTELLIJ_SANDBOX`** to specify the base directory in which the IntelliJ sandboxes will be created. Otherwise, the directory `intellij/build` in the repository will be used by default.

@m273d15
Copy link
Contributor Author

m273d15 commented Nov 19, 2019

Fixed all mentioned issues. @tobous Sorry, the review board is very chaotic. Seems like I missed the issues you already highlighted in the previous review.

@m273d15 m273d15 requested a review from tobous November 19, 2019 14:31
@saros-infrastructure
Copy link

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- buildSrc/src/main/java/saros/gradle/intellij/SarosIntellijExtension.java  1
- buildSrc/src/main/java/saros/gradle/eclipse/SarosEclipseExtension.java  1
- buildSrc/src/main/java/saros/gradle/eclipse/SarosEclipsePlugin.java  4
- buildSrc/src/main/java/saros/gradle/eclipse/configurator/EclipseConfigurator.java  1
- buildSrc/src/main/java/saros/gradle/eclipse/configurator/OsgiDependencyConfigurator.java  7
- buildSrc/src/main/java/saros/gradle/intellij/SarosIntellijPlugin.java  3
- buildSrc/src/main/java/saros/gradle/eclipse/configurator/JarConfigurator.java  3
- buildSrc/src/main/java/saros/gradle/intellij/IntellijConfigurator.java  6
         

See the complete overview on Codacy

* You need an **IntelliJ IDEA** installation which is used for dependency resolution. Install a current version of [**IntelliJ IDEA**](https://www.jetbrains.com/idea/download/) (we have only tested Saros/I for IntelliJ releases 2017.X and later)

Set the **system-wide environment variable `ECLIPSE_HOME`** to the Eclipse installation dir that contains the directory `plugins`.<br/>
* *Optional:* You can install an **IntelliJ IDEA** installation which is used for dependency resolution. Install a current version of [**IntelliJ IDEA**](https://www.jetbrains.com/idea/download/#section=linux) (we have only tested Saros/I for IntelliJ releases 2017.X and later).<br/>
Copy link
Member

@tobous tobous Nov 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change got lost during rebasing (or rather the code suggestion this change is based on was still based on the old content of the file).

Suggested change
* *Optional:* You can install an **IntelliJ IDEA** installation which is used for dependency resolution. Install a current version of [**IntelliJ IDEA**](https://www.jetbrains.com/idea/download/#section=linux) (we have only tested Saros/I for IntelliJ releases 2017.X and later).<br/>
* *Optional:* You can install an **IntelliJ IDEA** installation which is used for dependency resolution. Install a current version of [**IntelliJ IDEA**](https://www.jetbrains.com/idea/download/) (we have only tested Saros/I for IntelliJ releases 2017.X and later).<br/>

tobous
tobous previously approved these changes Nov 20, 2019
Add the SarosEclipsePlugin that configures
the gradle eclipse plugin and provides methods
to create osgi-bundles and resolve bundle dependencies
from MANIFEST.MF

This plugin uses the goomph mavencentral plugin
in order to match eclipse bundle ids to maven artifacts.
This makes the mavenize step obsolete

Add the SarosIntellijPlugin that configures
the gradle intellij plugin and enhances the runIde
task by locking/unlocking actions that allow us
to use muliple simultaneously running runIde
instances (as already configured in the
intellij/build.gradle).
The gef entry is superfluous since the
stf is in a separate project and bundle.
Therefore, the entry has to be removed.
All other bundles can be resolved by the
goomph plugin (which is used in the custom saros
gradle eclipse plugin). This is not an eclipse
core bundle and therefore not deployed to maven
central.
@m273d15
Copy link
Contributor Author

m273d15 commented Nov 21, 2019

rebased, removed #section=linux

@m273d15 m273d15 merged commit d125f9d into master Nov 21, 2019
@m273d15 m273d15 deleted the pr/impr_gradle branch November 21, 2019 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Infrastructure Issue affecting the infrastructure to build, test and deploy Saros and its documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants