Skip to content

Commit

Permalink
Merge branch 'master' into error-prone
Browse files Browse the repository at this point in the history
  • Loading branch information
regisd committed Oct 15, 2018
2 parents 00a7dd2 + 4f6a96b commit 41c70f6
Show file tree
Hide file tree
Showing 361 changed files with 12,316 additions and 11,247 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
**/target
dependency-reduced-pom.xml
bazel-*
# Generated by ant
jflex/build

# IntelliJ
*.iml
Expand Down
17 changes: 17 additions & 0 deletions .lgtm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Configutation for LGTM
# https://lgtm.com/projects/g/jflex-de/jflex/
# Format at https://help.semmle.com/lgtm-enterprise/user/help/lgtm.yml-configuration-file.html

# Note that results for all files classified with a tag are hidden.
# Path syntax is ant matcher https://confluence.atlassian.com/fisheye/pattern-matching-guide-298976797.html
path_classifiers:
test:
- "src/test"
docs:
- "LICENSE*"
- "*.md"
third_party:
- "/cup"
- "/third_party"
generated:
- "/jflex/src/main/java/jflex/unicode/data/Unicode_*.java"
110 changes: 110 additions & 0 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: : " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
9 changes: 9 additions & 0 deletions .travis.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is from Bazel's former travis setup, to avoid blowing up the RAM usage.
startup --host_jvm_args=-Xms2000m
startup --host_jvm_args=-Xmx3000m
test --ram_utilization_factor=10

# This is so we understand failures better
build --verbose_failures
test --test_output=errors

103 changes: 85 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,109 @@ branches:
- aggregated-java-sources
- travis

# We don't use the git log, a very small depth is sufficient
git:
depth: 3

language: java

# TODO(regisd) Remove the build matrix ; it really makes the deploy phase more complex
jdk:
- openjdk7
- oraclejdk8
- openjdk9

env:
matrix:
- TEST_SUITE=ant
- TEST_SUITE=unit
- TEST_SUITE=regression
matrix:
include:
- name: "🛂 Check Java format"
script: scripts/test-java-format.sh
language: generic
- name: "🔨 Maven (compile, unit test, uberjar, ubersrcs, site)"
script:
- scripts/test-unit.sh
- scripts/mvn-site.sh
- scripts/mvn-aggregate-srcs.sh
after_success: scripts/send-code-coverage.sh
env:
- PUBLISH_SOURCES=true
language: generic
- name: "📝 Regression tests"
script:
- scripts/mvn-install-fastbuild.sh jflex-maven-plugin,testsuite/jflex-testsuite-maven-plugin
- scripts/test-regression.sh
- name: "😎 Examples (mvn, ant, make)"
script: scripts/test-examples.sh
- name: "👴 Examples (mvn, ant, make) — JDK7"
script: scripts/test-examples.sh
jdk: openjdk7
- name: "💚 Bazel (Examples and documentation)"
language: generic
script:
- scripts/mvn-install-fastbuild.sh
- scripts/bazel.sh
# Prerequisites for Bazel
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- curl
- pkg-config
- zip
- g++
- zlib1g-dev
- unzip
- python
before_install:
- mkdir -p tools
- curl -L https://github.com/bazelbuild/bazel/releases/download/0.17.2/bazel_0.17.2-linux-x86_64.deb -o tools/bazel-0.17.2.deb
install:
- sudo apt-get install ./tools/bazel-0.17.2.deb
sudo: true
- name: "📄 Documentation"
language: generic
install: true
addons:
apt:
packages:
# pandoc used for building the doc
- pandoc
- pandoc-citeproc
# texlive used for PDF output
- texlive
# texlive-latex-extra provides extra styles such as a4wide and upquote.sty
- texlive-latex-extra
# lmodern.sty
- lmodern
script:
- cd docs; make; cd ..

# Empty the previously built artifacts
# They cannot be deleted in the before_cache phase,
# otherwise `mvn site` fails in the before_deploy phase.
before_install: ./scripts/clean.sh

install: ./mvnw -version
before_install:
- ./scripts/clean.sh

script: ./scripts/run-tests.sh
install:
- java -version
- javac -version
- ./mvnw -version

after_success:
- ./scripts/mvn-site.sh
- ./scripts/mvn-aggregate-srcs.sh
script: scripts/run-tests.sh

# Travis sometimes fails to download deps from repo1.maven.org
# A cache avoids downloading too much, and will also speed up the build.
# NB: There is one cache per branch and language version/ compiler version/ JDK version
cache:
apt: true
# The timeout (in seconds) empties the cache to avoid being stuck with a corrupted artefact
timeout: 86400 # 24 hours
directories:
- $HOME/.m2
# All our Bazel build artifacts
- $HOME/__bazel_output_base__/
# Items fetched from repositories
- $HOME/__bazel_travis_root__/cache
# DO NOT cache __bazel_output_travis__/install
- jflex/lib
- tools

deploy:
# Deploy the maven site on Github pages
Expand All @@ -49,7 +117,7 @@ deploy:
branch: release
condition:
- $TEST_SUITE = unit
- $TRAVIS_JDK_VERSION = oraclejdk8
- $TRAVIS_JDK_VERSION = openjdk9
local_dir: target/maven-staging-site/maven-site
# GITHUB_TOKEN set in travis-ci.org dashboard
github_token: $GITHUB_TOKEN
Expand All @@ -64,6 +132,5 @@ deploy:
- master
- travis
condition:
- $TEST_SUITE = unit
- $TRAVIS_JDK_VERSION = oraclejdk8
- $PUBLISH_SOURCES
script: ./scripts/deploy-source-code.sh
13 changes: 13 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Default owner for everything, unless a later match takes precedence
# This project was created by Gerwin
* @lsf37

# In general, we don't wan't to change code in cup.
# Be sure we have a big red warning by giving ownership to nobody.
/cup/ @issues

# The Maven plugin was initally authored by Régis
/jflex-maven-plugin/ @regisd
# Régis alsi knows more Bazel confg
WORKSPACE @regis
BUILD @regisd
64 changes: 0 additions & 64 deletions CONTRIBUTING.md

This file was deleted.

Loading

0 comments on commit 41c70f6

Please sign in to comment.