Skip to content

Commit

Permalink
Initial commit to make Buildship open-source
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennestuder committed Mar 24, 2015
0 parents commit dc92317
Show file tree
Hide file tree
Showing 320 changed files with 18,437 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store

.gradle
.settings
.eclipse
build
target
bin

.idea
*.iml
*.ipr
*.iws
49 changes: 49 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.gradleware.tooling.eclipse.ROOT</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
<filteredResources>
<filter>
<id>1340825059592</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-org.gradle.*</arguments>
</matcher>
</filter>
<filter>
<id>1340825059596</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-projectRelativePath-matches-false-false-commons</arguments>
</matcher>
</filter>
<filter>
<id>1340825059599</id>
<name></name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-projectRelativePath-matches-false-false-docs</arguments>
</matcher>
</filter>
<filter>
<id>1340825059602</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-projectRelativePath-matches-false-false-docs</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
161 changes: 161 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Buildship: Eclipse Plug-ins for Gradle

## Requirements

Buildship can be used with Eclipse 3.6.x or newer. Older versions might work but have not been tested explicitly. Depending on the version of Gradle that
Buildship interacts with, certain features of Buildship may not be available.


## Documentation

Documentation is available on [GitHub](https://github.com/gradleware/buildship).


## Usage Setup instructions

This section describes the steps to install the latest snapshot version of Buildship into Eclipse.

### Installing from snapshot update site

Each commit to the master repository creates a new snapshot version of Buildship on
our [Continuous Integration Server](https://builds.gradle.org/project.html?projectId=Tooling_Master_Eclipse&tab=projectOverview).

The following snapshot update sites are currently available for all the supported Eclipse versions:
* `https://builds.gradle.org/repository/download/Tooling_Master_Commit_Eclipse45Build/.lastSuccessful/update-site` (latest 4.5 development snapshot)
* `https://builds.gradle.org/repository/download/Tooling_Master_Commit_Eclipse44Build/.lastSuccessful/update-site` (latest 4.4 development snapshot)
* `https://builds.gradle.org/repository/download/Tooling_Master_Commit_Eclipse43Build/.lastSuccessful/update-site` (latest 4.3 development snapshot)
* `https://builds.gradle.org/repository/download/Tooling_Master_Commit_Eclipse42Build/.lastSuccessful/update-site` (latest 4.2 development snapshot)
* `https://builds.gradle.org/repository/download/Tooling_Master_Commit_Eclipse37Build/.lastSuccessful/update-site` (latest 3.7 development snapshot)
* `https://builds.gradle.org/repository/download/Tooling_Master_Commit_Eclipse36Build/.lastSuccessful/update-site` (latest 3.6 development snapshot)

Apply the following instructions to use one of the Eclipse update sites previously listed:

1. In Eclipse, open the menu item _Help >> Install New Software_.
1. Paste the update site link that matches your Eclipse version into the _Work with_ text box.
1. Click the _Add_ button at the top of the screen, give the update site a name, and press _OK_.
1. Ensure that the option _Group Items by Category_ is enabled.
1. Select the top-level node _Buildship: Eclipse Plug-ins for Gradle_ once it appears. This may take a moment.
1. Click _Next_. This may take a while.
1. Review the list of software that will be installed. Click _Next_ again.
1. Review and accept the licence agreement and click _Finish_.

If you have already installed the plugin previously, you can update to the most recent version by opening the menu item _Help >> Check for Updates_.


## Development Setup Instructions

This section describes the steps to setup Eclipse such that it can be used for development of Buildship.

### Setting up Eclipse

We use Eclipse

- as our development environment of Buildship and
- as our target platform against which we compile and run Buildship.

We use our internally-packaged Eclipse distribution, but the latest Eclipse for RCP Developers package should be fine, too.

Proceed as following to get all the required software installed:

1. Download the Eclipse distribution matching your OS from the http://dev1.gradle.org:8000/eclipse/distro/ site.
1. Untar the downloaded distribution and start Eclipse.
1. Install the latest version of Buildship from the e44 update site listed above.

### Getting the source code

The project and its source code is hosted on GitHub: `https://github.com/gradleware/buildship`.

Apply the following command to get a clone of the source code:

git clone [email protected]:gradleware/buildship.git

#### Committers

Navigate into the created _buildship_ directory and set the git username and email address:

git config user.name "johnsmith"
git config user.email "[email protected]"

And make sure to properly map the part before the domain of your email address in TeamCity under _My Settings & Tools_ >>
_General_ >> _Version Control Username Settings_ >> _Default for all of the Git roots_.

john.smith

From now on, when you commit to the _buildship_ project through Git, the change will be properly associated with your user in
TeamCity. You can verify that the setup is correct by seeing your full name next to each commit.

In order to avoid extra commits in the Git history after merging local changes with remote changes, apply the
_rebase_ strategy when pulling in the remote changes. By applying the _update_ alias listed below, you can conveniently
pull in the remote changes from master without ending up with ‘merge branch’ commits in the Git history later on.

git config --global alias.update=“pull --rebase origin master”
git update

### Importing the source code into Eclipse

The source code consists of a single root project and several sub-projects nested within it. You can use the
generic Eclipse 'Import Existing Projects' wizard. Select the root folder _buildship_ and
check the option 'Search for nested projects'. Select all _com.gradleware.*_ projects. You
can then press _Finish_.

### Setting the target platform

After importing all the projects into Eclipse, there will be some build errors due to code references to missing
plugins. To add these missing plugins to Eclipse, open the _tooling-e44.target_ file (or the one matching your
Eclipse version) located in the project root folder and click _Set as Target Platform_ in the top-right corner. This
will fix all compilation issues. Note, that it might take a while as it will download a whole SDK for the specified
version of Eclipse.

### Running the tests inside of Eclipse

To run the complete set of core tests from inside Eclipse, right-click
on the package _com.gradleware.tooling.eclipse.core.test_ and choose _Run As >> JUnit Plug-In-Test_
(not as a _JUnit Test_!). Individual tests can be run the same way.

To run the complete set of ui tests from inside Eclipse, right-click
on the package _com.gradleware.tooling.eclipse.ui.test_ and choose _Run As >> JUnit Plug-In-Test_
(not as a _JUnit Test_!). Individual tests can be run the same way.

### Running the Build

To run the full build, execute

./gradlew build

The final P2 repository will be created in the `com.gradleware.tooling.eclipse.site/build/repository` directory. If
the target platform had not been downloaded previously, it will appear in the _~/.tooling/eclipse/targetPlatforms_ folder.

To run the build without running the tests, exclude the `eclipseTest` task:

./gradlew build -x eclipseTest

To have full build ids in the name of the generated jars and in the manifest files, set the `build.invoker` property to _ci_:

./gradlew build -Pbuild.invoker=ci

The default Eclipse version to use as the target platform is defined in the root project's _build.gradle_ file. To override the
Eclipse version to use as the target platform, set the `eclipse.version` accordingly:

./gradlew build -Peclipse.version=44

The possible values for `eclipse.version` are: 36, 37, 42, 43, 44, and 45.

### Adding a new Eclipse plugin

* Create a new folder under the _buildship_ root folder
* Create a project in that folder with Eclipse and use the same name for the project as for the folder
* Create a _build.gradle_ file and apply the `BundlePlugin`
* Add the project to the _settings.gradle_ file

### References

* [Eclipse Testing](http://wiki.eclipse.org/Eclipse/Testing)
* [PDE Test Automation](http://www.eclipse.org/articles/article.php?file=Article-PDEJUnitAntAutomation/index.html)

## Continuous Integration

The automated builds for each supported Eclipse version can be found on TeamCity:
`https://builds.gradle.org/project.html?projectId=Tooling_Buildship&tab=projectOverview`

It is possible to reference the last successful run of a given TeamCity configuration like this:
`https://builds.gradle.org/repository/download/Tooling_Master_Commit_Eclipse44Build/.lastSuccessful/update-site`
82 changes: 82 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import org.gradle.internal.os.OperatingSystem

apply plugin: eclipsebuild.BuildDefinitionPlugin

// declare that by default the plugins are built and tested against Eclipse 3.7
eclipseBuild {
eclipseVersion = '37'
}

// read the current version from an external file and add a timestamp suffix if requested by the caller
version = getVersion(file('version.txt').text.trim())

subprojects {
// set the calculated version on all projects in the hierarchy
version = rootProject.version

// the built plugins must be Java 6 compatible, try to compile with JDK 6 if the location is specified by the caller or if it can be derived
plugins.withType(eclipsebuild.BundlePlugin) {
sourceCompatibility = 1.6
targetCompatibility = 1.6

tasks.withType(AbstractCompile).all {
options.compilerArgs << '-Xlint:all'
options.fork = true

if (OperatingSystem.current().isMacOsX()) {
options.compilerArgs << '-Werror'
options.forkOptions.executable = "/usr/libexec/java_home -v $targetCompatibility".execute().text.trim() + "/bin/javac"
} else if (project.hasProperty('compiler.location')) {
// quotes required on TeamCity to pass property with spaces, e.g. a Windows file path
String compilerLocation = project.property('compiler.location').replace('\"', '').replace('\'', '')
options.compilerArgs << '-Werror'
options.forkOptions.executable = compilerLocation
}
}
}

// apply Checkstyle plugin, mainly to ensure license/copyright and javadoc is present
apply plugin: 'checkstyle'

// share checkstyle config across all sub-projects
def checkstyleConfigDir = "$rootDir/gradle/config/checkstyle"
tasks.withType(Checkstyle).all {
configFile = "$checkstyleConfigDir/checkstyle.xml" as File
configProperties = ['checkstyleConfigDir': checkstyleConfigDir]
inputs.file "$checkstyleConfigDir/suppressions.xml" as File
}

// configure the repositories where the external dependencies can be found
repositories {
maven {
name = 'mavenized-target-platform'
url "${eclipsebuild.Config.on(project).mavenizedTargetPlatformDir}"
}

maven {
name = 'gradle-snapshots'
url gradleSnapshotsRepositoryUrl
}

maven {
name = 'gradle-releases'
url gradleReleasesRepositoryUrl
}

maven {
name = 'gradle-remote'
url gradleRemoteRepositoryUrl
}
}
}

String getVersion(def baseVersion) {
if (project.hasProperty('build.invoker') && project.property('build.invoker') == 'ci') {
// note that for Eclipse plugin versions, the '-' and '.' character are invalid in front of the build id
baseVersion + new Date().format('yyyyMMddkkmmss', TimeZone.getTimeZone('GMT'))
} else {
baseVersion + new Date().format('yyyyMMdd', TimeZone.getTimeZone('GMT'))
}
}

wrapper.gradleVersion = '2.4-20150209230027+0000'
2 changes: 2 additions & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.classpath
.project
18 changes: 18 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'

repositories {
maven {
url gradleRemoteRepositoryUrl
}
}

dependencies {
compile gradleApi()
compile localGroovy()
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.akhikhl.unpuzzle:unpuzzle-plugin:0.0.17'
compile 'nu.studer:java-ordered-properties:1.0.1'
}

1 change: 1 addition & 0 deletions buildSrc/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gradleRemoteRepositoryUrl = https://repo.gradle.org/gradle/remote-repos
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit dc92317

Please sign in to comment.