Skip to content

Commit

Permalink
Remove dependencies on deprecated Gradle feature (#1278)
Browse files Browse the repository at this point in the history
* chore: mark gradle wrapper scripts as linguist-generated

* build: bump up Gradle to 6.6.1

* build: replace deprecated feature with proper dependencies

compileOnly configuration is not expected to refer from
other projects, so load properties file in eclipsePlugni-junit and
eclipsePlugin-test projects directly.

* build: replace `new File` with `project.file`
  • Loading branch information
KengoTODA committed Sep 18, 2020
1 parent c42bf86 commit a11965a
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gradlew linguist-generated=true
gradlew.bat linguist-generated=true
24 changes: 23 additions & 1 deletion eclipsePlugin-junit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
apply from: "$rootDir/gradle/checkstyle.gradle"
apply from: "$rootDir/gradle/jacoco.gradle"

def localProps = new Properties()
localProps.load(new FileInputStream("$rootDir/eclipsePlugin/local.properties"))

def eclipseRootDir = file(localProps.getProperty('eclipseRoot.dir'))
// Eclipse 4.5+ uses a different directory layout under macOS. Try to detect this first.
def eclipseExecutable = new File(eclipseRootDir, "Contents/MacOS/eclipse")
def eclipsePluginsDir = new File(eclipseRootDir, "Contents/Eclipse/plugins")
if (!eclipseExecutable.exists()) {
// Fall back to non-macOS directory layout.
eclipsePluginsDir = new File(eclipseRootDir, "plugins")
}

dependencies {
implementation project(':eclipsePlugin')
testImplementation project(path: ':eclipsePlugin', configuration: 'compileOnly')
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.5.10'

// List below includes all Eclipse SDK plugins except few causing troubles.
// TODO: it should include what is required in the MANIFEST.MF, and nothing else
testImplementation fileTree(dir:eclipsePluginsDir, include:'**/*.jar',
exclude:[
'**/datanucleus-enhancer*.jar',
'edu.umd.cs.findbugs.**/*.jar',
'org.mockito*.jar',
'com.github.spotbugs.**/*.jar',
'**/*source_*.jar'
])
}

jacocoTestReport {
Expand Down
23 changes: 22 additions & 1 deletion eclipsePlugin-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
apply from: "$rootDir/gradle/checkstyle.gradle"

def localProps = new Properties()
localProps.load(new FileInputStream("$rootDir/eclipsePlugin/local.properties"))

def eclipseRootDir = file(localProps.getProperty('eclipseRoot.dir'))
// Eclipse 4.5+ uses a different directory layout under macOS. Try to detect this first.
def eclipseExecutable = new File(eclipseRootDir, "Contents/MacOS/eclipse")
def eclipsePluginsDir = new File(eclipseRootDir, "Contents/Eclipse/plugins")
if (!eclipseExecutable.exists()) {
// Fall back to non-macOS directory layout.
eclipsePluginsDir = new File(eclipseRootDir, "plugins")
}

sourceSets {
main {
java {
Expand All @@ -17,7 +29,16 @@ dependencies {
implementation(project(':eclipsePlugin')) {
transitive = true
}
implementation project(path: ':eclipsePlugin', configuration: 'compileOnly')
// List below includes all Eclipse SDK plugins except few causing troubles.
// TODO: it should include what is required in the MANIFEST.MF, and nothing else
compileOnly fileTree(dir:eclipsePluginsDir, include:'**/*.jar',
exclude:[
'**/datanucleus-enhancer*.jar',
'edu.umd.cs.findbugs.**/*.jar',
'org.mockito*.jar',
'com.github.spotbugs.**/*.jar',
'**/*source_*.jar'
])

implementation project(':test-harness')
implementation 'org.hamcrest:hamcrest-all:1.3'
Expand Down
2 changes: 1 addition & 1 deletion eclipsePlugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def eclipsePluginId = 'com.github.spotbugs.plugin.eclipse'
def localProps = new Properties()
localProps.load(new FileInputStream("$projectDir/local.properties"))

def eclipseRootDir = new File(localProps.getProperty('eclipseRoot.dir'))
def eclipseRootDir = file(localProps.getProperty('eclipseRoot.dir'))
// Eclipse 4.5+ uses a different directory layout under macOS. Try to detect this first.
def eclipseExecutable = new File(eclipseRootDir, "Contents/MacOS/eclipse")
def eclipsePluginsDir = new File(eclipseRootDir, "Contents/Eclipse/plugins")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a11965a

Please sign in to comment.