Skip to content

Commit

Permalink
Merge pull request #331 from jGleitz/improve-gradle
Browse files Browse the repository at this point in the history
Fix Most Gradle Deprecation Warnings & Update Wrapper
  • Loading branch information
jGleitz authored Apr 13, 2020
2 parents 1d581ee + a99420d commit 0e0e7cc
Show file tree
Hide file tree
Showing 28 changed files with 151 additions and 149 deletions.
9 changes: 5 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ The following are a few guidelines on how we suggest you start.

1. Fork the repository to your repositories (see [Fork a repo](https://help.github.com/en/articles/fork-a-repo) for help).
2. Use an IDE which supports Kotlin and gradle projects.
We suggest [IntelliJ Community Edition](https://www.jetbrains.com/idea/download/)
and install the following plugins:
We suggest [IntelliJ Community Edition](https://www.jetbrains.com/idea/download/).
Because of [IDEA-228368](https://youtrack.jetbrains.com/issue/IDEA-228368) you will need at least IntelliJ 2020.1, or the Gradle import will fail.
Install the following plugins:
- EditorConfig by JetBrains (might be already activated)
- Spek Framework by Spek Team
3. Import the project (import the build.gradle -> import as project, works more reliably)
4. Open up a terminal (e.g. Intellij's built in -> usually ALT+F12) and run `./gr build`
This builds the project (compile, run tests etc) via gradle (notice, we renamed `gradlew` to `gr`, more convenient no?)
4. Open up a terminal (e.g. Intellij's built in -> usually ALT+F12) and run `./gradlew build`
This builds the project (compile, run tests etc) via gradle
5. Read up the [Coding Conventions of Atrium](#coding-conventions) (there are only 5 points).

Note: IntelliJ requires a few workarounds.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
java-version: ${{ matrix.java_version }}
- name: Build buildNonDeprecatedJvm
run: ./gr buildNonDeprecatedJvm
run: ./gradlew buildNonDeprecatedJvm
env:
CI: true

Expand Down
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,28 @@ language: java
jdk:
- openjdk11

before_install: chmod +x gr

install: skip

jobs:
include:
- env: MODE=current_11
script: ./gr buildAllWithoutJs
script: ./gradlew buildAllWithoutJs
after_success: bash <(curl -s https://codecov.io/bash) -F current

- env: MODE=current_8
jdk: oraclejdk8
script: ./gr buildNonDeprecatedJvm buildAllAndroid
script: ./gradlew buildNonDeprecatedJvm buildAllAndroid
after_success: bash <(curl -s https://codecov.io/bash) -F current

- env: MODE=js
script: ./gr buildAllJs
script: ./gradlew buildAllJs

- env: MODE=bbc
script: ./gr bbcTests
script: ./gradlew bbcTests
after_success: bash <(curl -s https://codecov.io/bash) -F bbc

- env: MODE=bc
script: ./gr bcTests
script: ./gradlew bcTests
after_success: bash <(curl -s https://codecov.io/bash) -F bc

- env: MODE=samples
Expand Down
19 changes: 7 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ buildscript {

// project setup
tutteli_plugins_version = '0.32.2'
node_plugin_version = '1.3.1'
node_plugin_version = '2.2.0'

// gh-pages.gradle
docProjects = (subprojects - sampleProjectsFun - toolProjectsFun).findAll {
Expand Down Expand Up @@ -124,7 +124,7 @@ buildscript {
classpath "ch.tutteli:tutteli-gradle-project-utils:$tutteli_plugins_version"
classpath "ch.tutteli:tutteli-gradle-publish:$tutteli_plugins_version"
classpath "ch.tutteli:tutteli-gradle-spek:$tutteli_plugins_version"
classpath "com.moowork.gradle:gradle-node-plugin:$node_plugin_version"
classpath "com.github.node-gradle:gradle-node-plugin:$node_plugin_version"
}
}

Expand Down Expand Up @@ -438,7 +438,7 @@ List<Project> projectNamesToProject(String[] names) {

def createJsTestTask(String... subprojectNames) {
configure(projectNamesToProject(subprojectNames)) {
apply plugin: 'com.moowork.node'
apply plugin: 'com.github.node-gradle.node'

compileTestKotlin2Js.configure {
kotlinOptions.moduleKind = "commonjs"
Expand Down Expand Up @@ -467,13 +467,8 @@ def createJsTestTask(String... subprojectNames) {
nodeModulesDir = nodeModulesParentDir
}

task installMocha(type: NpmTask) {
args = ['install', 'mocha', '--prefer-offline']
}

task prepareMocha(dependsOn: [compileTestKotlin2Js, populateNodeModules, installMocha])
task runMocha(type: NodeTask, dependsOn: [prepareMocha]) {
script = file("$nodeModulesParentDir/node_modules/mocha/bin/mocha")
task runMocha(type: NpxTask, dependsOn: [compileTestKotlin2Js, populateNodeModules]) {
command = "mocha"
args = [compileTestKotlin2Js.outputFile]
}
test.dependsOn runMocha
Expand All @@ -493,7 +488,7 @@ createJsTestTask(
def useJupiter(String... projectNames) {
configure(projectNamesToProject(projectNames)) {
dependencies {
testRuntime "org.junit.jupiter:junit-jupiter-engine:$jupiter_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiter_version"
}
test {
options {
Expand Down Expand Up @@ -562,7 +557,7 @@ assumes you have a atrium-gh-pages folder on the same level as atrium where the
3. deploy to bintray:
// CI=true is a temporary work around till https://youtrack.jetbrains.com/issue/KT-29069 is fixed:
a) java -version 2>&1 | grep "version \"11" && CI=true ./gr clean publishToBintray
a) java -version 2>&1 | grep "version \"9" && CI=true ./gr clean publishToBintray
b) Log in to bintray, check that there are 926 artifacts and publish them
c) synchronise to maven central
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = 'Contains the bits and pieces behind robstoll\'s <rstoll@tutteli.c
'Atrium, then you should depend on atrium-core-robstoll instead.'

dependencies {
compile prefixedProject('core-api-android')
implementation prefixedProject('core-api-android')

// it is up to the consumer of atrium-core-robstoll-lib which atrium-translations module is used at runtime
compileOnly prefixedProject('translations-en_GB-android')
Expand Down
6 changes: 3 additions & 3 deletions gradle/package-lock.json

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

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-5.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 12 additions & 17 deletions gr → gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
File renamed without changes.
2 changes: 1 addition & 1 deletion misc/tools/atrium-bc-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def createBcAndBbcTasks(String apiName, String oldVersion, String forgive) {
}
add(confCommon, sourceSets.main.runtimeClasspath)

owner."${srcName}Compile" configurations[confCommon].dependencies
owner."${srcName}Implementation" configurations[confCommon].dependencies
}

def getArgs = { String scanClassPath ->
Expand Down
4 changes: 2 additions & 2 deletions misc/verbs/atrium-verbs-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ dependencies {
api prefixedProject('core-api-android')

testImplementation prefixedProject('specs-android')
testRuntime prefixedProject('domain-robstoll-android')
testRuntime prefixedProject('core-robstoll-android')
testRuntimeOnly prefixedProject('domain-robstoll-android')
testRuntimeOnly prefixedProject('core-robstoll-android')

//TODO remove with 1.0.0
testImplementation prefixedProject('spec')
Expand Down
4 changes: 2 additions & 2 deletions misc/verbs/atrium-verbs-jvm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ dependencies {
api prefixedProject('core-api-jvm')

testImplementation prefixedProject('specs-jvm')
testRuntime prefixedProject('domain-robstoll-jvm')
testRuntime prefixedProject('core-robstoll-jvm')
testRuntimeOnly prefixedProject('domain-robstoll-jvm')
testRuntimeOnly prefixedProject('core-robstoll-jvm')

//TODO remove with 1.0.0
testImplementation prefixedProject('spec')
Expand Down
22 changes: 7 additions & 15 deletions samples/js/jasmine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'
classpath 'com.github.node-gradle:gradle-node-plugin:2.2.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71'
}
}

apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'com.github.node-gradle.node'

repositories {
jcenter()
Expand Down Expand Up @@ -69,14 +69,6 @@ node {
nodeModulesDir = nodeModulesParentDir
}

task installJasmine(type: NpmTask) {
// note, without the '--prefer-offline' it works only if you are online,
// with '--prefer-offline' it works also offline if you have already as well in case you have already downloaded jasmine once
args = ['install', 'jasmine', '--prefer-offline']
}

task prepareJasmine(dependsOn: [compileTestKotlin2Js, populateNodeModules, installJasmine])

//either you use this task or create a testSetup.kt in your src/test with the following content
//
// // adopt to the api you use
Expand All @@ -93,8 +85,8 @@ task establishDependencyToAtrium(dependsOn: [compileTestKotlin2Js]) {
srcFile.write(newContent, 'UTF-8')
}
}
task runJasmine(type: NodeTask, group: 'Verification', dependsOn: [prepareJasmine, test, establishDependencyToAtrium]) {
script = file("$nodeModulesParentDir/node_modules/jasmine/bin/jasmine")
task runJasmine(type: NpxTask, group: 'Verification', dependsOn: [populateNodeModules, test, establishDependencyToAtrium]) {
command = "jasmine"
args = [compileTestKotlin2Js.outputFile]
}
check.dependsOn runJasmine
Expand Down Expand Up @@ -153,8 +145,8 @@ task establishDependencyFromCurrentToAtrium(dependsOn: [compileTestKotlin2Js]) {
srcFile.write(newContent, 'UTF-8')
}
}
task runJasmineForCurrent(type: NodeTask, group: 'Verification', dependsOn: [compileCurrentKotlin2Js, populateCurrentNodeModules, installJasmine, establishDependencyFromCurrentToAtrium]) {
script = file("$nodeModulesParentDir/node_modules/jasmine/bin/jasmine")
task runJasmineForCurrent(type: NpxTask, group: 'Verification', dependsOn: [compileCurrentKotlin2Js, populateCurrentNodeModules, establishDependencyFromCurrentToAtrium]) {
command = "jasmine"
args = [compileCurrentKotlin2Js.outputFile]
}

Expand Down
22 changes: 7 additions & 15 deletions samples/js/mocha/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'
classpath 'com.github.node-gradle:gradle-node-plugin:2.2.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71'
}
}

apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'com.github.node-gradle.node'

repositories {
jcenter()
Expand Down Expand Up @@ -69,14 +69,6 @@ node {
nodeModulesDir = nodeModulesParentDir
}

task installMocha(type: NpmTask) {
// note, without the '--prefer-offline' it works only if you are online,
// with '--prefer-offline' it works also offline if you have already as well in case you have already downloaded mocha once
args = ['install', 'mocha', '--prefer-offline']
}

task prepareMocha(dependsOn: [compileTestKotlin2Js, populateNodeModules, installMocha])

//either you use this task or create a testSetup.kt in your src/test with the following content
//
// // adopt to the api you use
Expand All @@ -93,8 +85,8 @@ task establishDependencyToAtrium(dependsOn: [compileTestKotlin2Js]) {
srcFile.write(newContent, 'UTF-8')
}
}
task runMocha(type: NodeTask, group: 'Verification', dependsOn: [prepareMocha, test, establishDependencyToAtrium]) {
script = file("$nodeModulesParentDir/node_modules/mocha/bin/mocha")
task runMocha(type: NpxTask, group: 'Verification', dependsOn: [compileTestKotlin2Js, populateNodeModules, establishDependencyToAtrium]) {
command = "mocha"
args = [compileTestKotlin2Js.outputFile]
}
check.dependsOn runMocha
Expand Down Expand Up @@ -153,8 +145,8 @@ task establishDependencyFromCurrentToAtrium(dependsOn: [compileTestKotlin2Js]) {
srcFile.write(newContent, 'UTF-8')
}
}
task runMochaForCurrent(type: NodeTask, group: 'Verification', dependsOn: [compileCurrentKotlin2Js, populateCurrentNodeModules, installMocha, establishDependencyFromCurrentToAtrium]) {
script = file("$nodeModulesParentDir/node_modules/mocha/bin/mocha")
task runMochaForCurrent(type: NpxTask, group: 'Verification', dependsOn: [compileCurrentKotlin2Js, populateCurrentNodeModules, establishDependencyFromCurrentToAtrium]) {
command = "mocha"
args = [compileCurrentKotlin2Js.outputFile]
}

Expand Down
2 changes: 1 addition & 1 deletion samples/jvm/junit5/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext {
kotlin_version= '1.3.41'
kotlin_version= '1.3.71'
atrium_api= 'atrium-fluent-en_GB'
atrium_version='0.10.0'
junit_version= '5.3.1'
Expand Down
Binary file modified samples/jvm/junit5/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions samples/jvm/spek/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext {
kotlin_version = '1.3.41'
kotlin_version = '1.3.71'
spek_version = '2.0.0'
atrium_version='0.10.0'
}
Expand All @@ -15,7 +15,7 @@ buildscript {
}

plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
id 'org.jetbrains.kotlin.jvm' version "$kotlin_version"
}

group 'com.atrium.spek'
Expand Down
Binary file modified samples/jvm/spek/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions samples/jvm/spek/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Oct 21 02:29:44 IST 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0e0e7cc

Please sign in to comment.