Skip to content

Commit

Permalink
[TEAMMATES#9862] Update third-party dependencies (TEAMMATES#9863)
Browse files Browse the repository at this point in the history
* Update most back-end dependencies

* Update CheckStyle, PMD, SpotBugs and fix new violations

* Update some front-end dependencies

* Update Gradle to 5.6.4

* Update appengine-gradle-plugin to 2.2.0

* Update Node to 12 and Firefox to latest

* Update Angular to 8
  • Loading branch information
wkurniawan07 authored Jan 18, 2020
1 parent 021db57 commit 3fd10df
Show file tree
Hide file tree
Showing 59 changed files with 365 additions and 402 deletions.
15 changes: 3 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ before_install:
echo "Only doc files or images were updated in PR, not running the CI."
exit
fi
- nvm install 10
- nvm install 12

install: true

Expand All @@ -31,6 +31,7 @@ before_cache:
- rm -rf $HOME/.gradle/caches/*/fileHashes/
- rm -rf $HOME/.gradle/caches/*/javaCompile/
- rm -rf $HOME/.gradle/caches/*/plugin-resolution/
- rm -rf $HOME/.gradle/caches/*/scripts/
- rm -rf $HOME/.gradle/caches/*/workerMain/
- rm -rf $HOME/.gradle/caches/*/gc.properties
- rm -rf $HOME/.gradle/caches/journal-1/
Expand Down Expand Up @@ -69,19 +70,14 @@ jobs:
- bash <(curl -s https://codecov.io/bash)
- name: "E2E Tests - Firefox"
addons:
firefox: "66.0"
firefox: "72.0"
services:
- xvfb
before_script:
- export PATH=$HOME/google-cloud-sdk/bin:$PATH
- cd $HOME
- curl -fsS -o google-cloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
- curl -fsSL -o geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
- tar -xzf google-cloud-sdk.tar.gz
- tar -xzf geckodriver.tar.gz
- ./google-cloud-sdk/install.sh --usage-reporting false --path-update false --command-completion false
- cd $TRAVIS_BUILD_DIR
- gcloud -q components install app-engine-java
- mv src/e2e/resources/test.travis.properties src/e2e/resources/test.properties
- ./gradlew createConfigs testClasses generateTypes
- npm install
Expand All @@ -95,16 +91,11 @@ jobs:
services:
- xvfb
before_script:
- export PATH=$HOME/google-cloud-sdk/bin:$PATH
- cd $HOME
- curl -fsS -o google-cloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
- LATEST_CHROMEDRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"`
- curl -fsSL -o chromedriver.zip "https://chromedriver.storage.googleapis.com/${LATEST_CHROMEDRIVER_VERSION}/chromedriver_linux64.zip"
- tar -xzf google-cloud-sdk.tar.gz
- unzip chromedriver.zip
- ./google-cloud-sdk/install.sh --usage-reporting false --path-update false --command-completion false
- cd $TRAVIS_BUILD_DIR
- gcloud -q components install app-engine-java
- mv src/e2e/resources/test.travis-chrome.properties src/e2e/resources/test.properties
- ./gradlew createConfigs testClasses generateTypes
- npm install
Expand Down
13 changes: 9 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"index": "src/web/index.html",
"main": "src/web/main.ts",
"polyfills": "src/web/polyfills.ts",
"tsConfig": "src/web/tsconfig.app.json",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/web/assets/",
{
Expand Down Expand Up @@ -106,14 +107,18 @@
"aot": true,
"extractLicenses": false,
"vendorChunk": true,
"subresourceIntegrity": true,
"buildOptimizer": true,
"serviceWorker": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
Expand Down Expand Up @@ -146,8 +151,8 @@
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/web/tsconfig.app.json",
"src/web/tsconfig.tslint-spec.json"
"tsconfig.app.json",
"tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ init:
- git config --global core.autocrlf true

install:
- ps: Install-Product node 10
- ps: Install-Product node 12

branches:
only:
Expand Down
12 changes: 12 additions & 0 deletions browserslist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
# npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
IE 9-11
121 changes: 62 additions & 59 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ apply plugin: "jacoco"
apply plugin: "cz.habarta.typescript-generator"

def appengineVersion = "1.9.+"
def checkstyleVersion = "8.20"
def pmdVersion = "6.14.0"
def checkstyleVersion = "8.28"
def pmdVersion = "6.20.0"
def spotbugsVersion = "3.1.12"
def jacocoVersion = "0.8.3"
def jacocoVersion = "0.8.5"

buildscript {
repositories {
Expand All @@ -25,9 +25,12 @@ buildscript {
}
}
dependencies {
classpath "com.google.cloud.tools:appengine-gradle-plugin:1.3.5"
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.9"
classpath "cz.habarta.typescript-generator:typescript-generator-gradle-plugin:2.14.505"
classpath "com.google.cloud.tools:appengine-gradle-plugin:2.2.0"
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:2.0.0"
classpath("cz.habarta.typescript-generator:typescript-generator-gradle-plugin:2.19.577") {
exclude group: "org.gradle"
}
classpath "com.google.guava:guava:28.2-jre"
}
}

Expand All @@ -40,7 +43,7 @@ repositories {
}

def objectify = "com.googlecode.objectify:objectify:5.1.22"
def testng = "org.testng:testng:6.14.3"
def testng = "org.testng:testng:7.1.1"

dependencies {
staticAnalysis("com.puppycrawl.tools:checkstyle:${checkstyleVersion}")
Expand All @@ -58,42 +61,42 @@ dependencies {
// Use the newer servlet library instead
exclude group: "javax.servlet", module: "servlet-api"
}
compile("com.google.api-client:google-api-client-appengine:1.28.0") {
compile("com.google.api-client:google-api-client-appengine:1.30.7") {
// Use the newer servlet library instead
exclude group: "javax.servlet", module: "servlet-api"
}
compile("com.google.apis:google-api-services-storage:v1-rev20190426-1.28.0")
compile("com.google.apis:google-api-services-storage:v1-rev20191011-1.30.3")

compile("com.google.code.gson:gson:2.8.5")
compile("com.google.guava:guava:27.1-jre")
compile("com.google.code.gson:gson:2.8.6")
compile("com.google.guava:guava:28.2-jre")
compile(objectify)
compile("com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20190503.1")
compile("com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20191001.1")
compile("com.mailjet:mailjet-client:4.2.1")
compile("com.sendgrid:sendgrid-java:4.3.0")
compile("com.sendgrid:sendgrid-java:4.4.1")
compile("com.sun.jersey:jersey-client:1.19.4")
compile("com.sun.jersey:jersey-core:1.19.4")
compile("com.sun.jersey.contribs:jersey-multipart:1.19.4")
compile("javax.servlet:javax.servlet-api:3.1.0")
compile("org.jsoup:jsoup:1.11.3")
compile("org.jsoup:jsoup:1.12.1")

testAnnotationProcessor(testng)

testCompile("com.google.appengine:appengine-api-stubs:${appengineVersion}")
testCompile("com.google.appengine:appengine-remote-api:${appengineVersion}")
testCompile("com.google.appengine:appengine-testing:${appengineVersion}")
testCompile("com.tngtech.archunit:archunit:0.10.2")
testCompile("com.tngtech.archunit:archunit:0.11.0")
testCompile("org.httpunit:httpunit:1.7.3")
testCompile("org.seleniumhq.selenium:selenium-java:3.141.59")
testCompile(testng)
// For access to Google APIs such as HTTP transport, authentication and JSON parsing
testCompile("com.google.api-client:google-api-client:1.28.0")
testCompile("com.google.api-client:google-api-client:1.30.7")
// For supporting authorization code flow locally
testCompile("com.google.oauth-client:google-oauth-client-jetty:1.28.0")
testCompile("com.google.oauth-client:google-oauth-client-jetty:1.30.5")
// For using Gmail API
testCompile("com.google.apis:google-api-services-gmail:v1-rev20190422-1.28.0")
testCompile("com.google.apis:google-api-services-gmail:v1-rev20191113-1.30.3")
// For using JMeter APIs
testCompile("org.apache.jmeter:ApacheJMeter_core:5.1.1")
testCompile("org.apache.jmeter:ApacheJMeter_http:5.1.1")
testCompile("org.apache.jmeter:ApacheJMeter_core:5.2.1")
testCompile("org.apache.jmeter:ApacheJMeter_http:5.2.1")

}

Expand Down Expand Up @@ -235,13 +238,19 @@ compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"

appengine {
tools {
if (project.properties['cloud.sdk.home'] != null) {
cloudSdkHome = project.properties['cloud.sdk.home']
}
}
run {
port = 8080
jvmFlags = ["-Xss2m", "-Dfile.encoding=UTF-8",
// Absolute paths are not supported, the following is relative to the project directory
// These only specify the datastore/blobstore paths, but search indexes are still generated in WEB-INF/appengine-generated
"-Ddatastore.backing_store=../../appengine-generated/local_db.bin",
"-Dblobstore.backing_store=../../appengine-generated"]
automaticRestart = true
}
deploy {
String buildPropertiesPath = "${projectDir}/src/main/resources/build.properties"
Expand All @@ -252,19 +261,13 @@ appengine {
props.load(it)
}
}
project = propsExists ? props['app.id'] : null
projectId = propsExists ? props['app.id'] : null
version = propsExists ? props['app.version'] : null
stopPreviousVersion = false
promote = false
}
}

task appengineDeployAll {
description "Deploy an App Engine application and all its extended configurations"
group "App Engine Standard environment"
dependsOn appengineDeploy, appengineDeployIndex, appengineDeployCron, appengineDeployQueue
}

// STATIC ANALYSIS TASKS

def isWindows = System.getProperty("os.name").toLowerCase().contains("windows")
Expand All @@ -277,7 +280,7 @@ checkstyle {
pmd {
toolVersion = pmdVersion
consoleOutput = true
ruleSetFiles = files("static-analysis/teammates-pmd.xml", "static-analysis/teammates-pmd-6.14.0.xml", "static-analysis/teammates-pmdMain.xml")
ruleSetFiles = files("static-analysis/teammates-pmd.xml", "static-analysis/teammates-pmdMain.xml")
ruleSets = []
}

Expand Down Expand Up @@ -339,38 +342,7 @@ def checkTestNgFailureClosure = { descriptor, result ->
}
}

task architectureTest(type: Test) {
useTestNG()
options.suites "src/test/resources/testng-architecture.xml"
options.useDefaultListeners = true
ignoreFailures false
maxHeapSize = "1g"
reports.html.enabled = false
reports.junitXml.enabled = false
jvmArgs "-Xss2m", "-Dfile.encoding=UTF-8"
afterSuite checkTestNgFailureClosure
testLogging {
events "passed"
}
}

architectureTest.dependsOn testClasses
architectureTest.shouldRunAfter lintMain, lintTest

task lint {
description "Runs the entire static analysis tasks for back-end."
group "Static analysis"
dependsOn lintMain, lintTest, architectureTest
}

// TEST TASKS

def numOfTestRetries = 3
def isTravis = System.getenv("TRAVIS") != null
def isAppVeyor = System.getenv("APPVEYOR") != null

// Displays full exception; to be run after the test fails after the last retry
// For HTML tests, the exception is displayed in diff form instead of the extremely verbose full exception message
def afterTestClosure = { descriptor, result ->
if (result.resultType == TestResult.ResultType.FAILURE && result.exception != null && result.exception.getMessage() != null) {
println ""
Expand Down Expand Up @@ -406,6 +378,37 @@ def afterTestClosure = { descriptor, result ->
}
}

task architectureTest(type: Test) {
useTestNG()
options.suites "src/test/resources/testng-architecture.xml"
options.useDefaultListeners = true
ignoreFailures false
maxHeapSize = "1g"
reports.html.enabled = false
reports.junitXml.enabled = false
jvmArgs "-Xss2m", "-Dfile.encoding=UTF-8"
afterTest afterTestClosure
afterSuite checkTestNgFailureClosure
testLogging {
events "passed"
}
}

architectureTest.dependsOn testClasses
architectureTest.shouldRunAfter lintMain, lintTest

task lint {
description "Runs the entire static analysis tasks for back-end."
group "Static analysis"
dependsOn lintMain, lintTest, architectureTest
}

// TEST TASKS

def numOfTestRetries = 3
def isTravis = System.getenv("TRAVIS") != null
def isAppVeyor = System.getenv("APPVEYOR") != null

test {
useTestNG()
options.useDefaultListeners = true
Expand Down
36 changes: 5 additions & 31 deletions docs/setting-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,13 @@ These tools are necessary regardless of whether you are developing front-end or

1. Install JDK 1.8.
1. Install Python 2.7.
1. Install Google Cloud SDK (minimum version 222.0.0). Follow the directions given [here](https://cloud.google.com/sdk/downloads).
Note that you *do not* need to [initialize the SDK](https://cloud.google.com/sdk/docs/initializing).
```sh
# Run the following command at the Google Cloud SDK directory

# Linux/OS X
./install.sh --path-update true

# Windows
install.bat --path-update true
```
If you are installing in Red Hat, CentOS, Fedora, Debian or Ubuntu, refer to the quick start of Google Cloud SDK for [Debian/Ubuntu](https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu) or [Red Hat/CentOS/Fedora](https://cloud.google.com/sdk/docs/quickstart-redhat-centos) respectively.

**Verification**: Run a `gcloud` command (e.g. `gcloud version`) in order to verify that you can access the SDK from the command line.

1. Run the following command to install App Engine Java SDK bundled with the Cloud SDK:
```sh
# Linux/OS X/Windows
gcloud -q components install app-engine-java

# Red Hat/CentOS/Fedora
sudo yum install google-cloud-sdk-app-engine-java

# Debian/Ubuntu
sudo apt-get install google-cloud-sdk-app-engine-java
```
**Verification:** Run `gcloud version` and there should be an entry on `app-engine-java`.

If you want to develop front-end, you need to install the following:

1. Install Node.js (minimum version 8.9.4).
1. (Optional but highly recommended) Install Angular CLI version 7 globally.
1. (Optional but highly recommended) Install Angular CLI version 8 globally.
```sh
npm install -g @angular/cli@7
npm install -g @angular/cli@8
```
**Verification:** Run `ng` and you should see a list of available Angular CLI commands.

Expand All @@ -88,8 +61,9 @@ If you want to develop front-end, you need to install the following:
**Verification:** The file named `gradle.properties` should be added to the project root directory.

1. Modify the following config file:
* `gradle.properties`<br>
If you want to use a JDK other than the one specified in your PATH variable, add the value to the variable `org.gradle.java.home`.
* `gradle.properties`
* If you want to use a JDK other than the one specified in your PATH variable, add the value to the variable `org.gradle.java.home`.
* If you want to use a specific Google Cloud SDK installation, add the value to the variable `cloud.sdk.home`. A minimum version of `222.0.0` is required.

1. Run this command to download the necessary tools for front-end development (if you are going to be involved):
```sh
Expand Down
Loading

0 comments on commit 3fd10df

Please sign in to comment.