Skip to content

Commit

Permalink
chore(license): fix 3rd party refer in LICENSE
Browse files Browse the repository at this point in the history
also add sky-walking action to check license header
  • Loading branch information
imbajin committed Feb 3, 2023
1 parent 8724b12 commit ba59d21
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 88 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '11'
distribution: 'adopt'
- name: mvn install
run: |
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -37,12 +37,13 @@ jobs:

- name: License check(RAT)
run: |
mvn apache-rat:check | grep -v "Downloading\|Downloaded\|Progress"
find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt && cat merged-rat.txt
mvn apache-rat:check -ntp
find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt
grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt
- name: Compile
run: |
mvn compile -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded"
mvn compile -Dmaven.javadoc.skip=true -ntp
- name: Run test
run: |
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/license-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: License checker

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
check-license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# More info could refer to: https://github.com/apache/skywalking-eyes
- name: Check License Header
uses: apache/skywalking-eyes@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
log: info
config: .licenserc.yaml

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'

- name: License check(RAT)
run: |
mvn apache-rat:check -ntp
find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt
grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
stale-pr-message: 'Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label'
stale-issue-label: 'inactive'
stale-pr-label: 'inactive'
exempt-issue-labels: 'feature,bug,enhancement,improvement,wontfix,todo,help wanted'
exempt-pr-labels: 'feature,bug,enhancement,improvement,wontfix,todo,help wanted'
exempt-issue-labels: 'feature,bug,enhancement,improvement,todo,guide,doc,help wanted,security'
exempt-pr-labels: 'feature,bug,enhancement,improvement,todo,guide,doc,help wanted,security'
exempt-all-milestones: true

days-before-issue-stale: 15
Expand Down
77 changes: 77 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#
# 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.
#

header: # `header` section is configurations for source codes license header.
license:
spdx-id: Apache-2.0 # the spdx id of the license, it's convenient when your license is standard SPDX license.
copyright-owner: Apache Software Foundation # the copyright owner to replace the [owner] in the `spdx-id` template.
content: | # `license` will be used as the content when `fix` command needs to insert a license header.
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.
# `pattern` is optional regexp if all the file headers are the same as `license` or the license of `spdx-id` and `copyright-owner`.
pattern: |
Licensed to the Apache Software Foundation under one or more contributor
license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright
ownership. The Apache Software Foundation 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.
paths: # `paths` are the path list that will be checked (and fixed) by license-eye, default is ['**'].
- '**'

paths-ignore: # `paths-ignore` are the path list that will be ignored by license-eye.
- '.gitignore'
- 'LICENSE'
- 'NOTICE'
- 'DISCLAIMER'
- '**/*.md'
- '**/*.versionsBackup'
- '**/*.log'
- '**/*.txt'
- '**/*.csv'
- '**/*.json'
- '**/*.svg'
- '**/*.gitattributes'
- '**/.flattened-pom.xml'
- '**/.prettierrc'
- '**/.stylelintrc'
- 'assembly/**'
- '.github/**/*'
- '**/target/*'
comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`.

# license-location-threshold specifies the index threshold where the license header can be located,
# after all, a "header" cannot be TOO far from the file start.
license-location-threshold: 80
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,8 @@ private static MediaType parseCustomContentType(MultivaluedMap<String, Object> h
private static void configConnectionManager(String url, ClientConfig conf) {
/*
* Using httpclient with connection pooling, and configuring the
* jersey connector, reference:
* http://www.theotherian.com/2013/08/jersey-client-2.0-httpclient-timeouts-max-connections.html
* https://stackoverflow.com/questions/43228051/memory-issue-with-jax-rs-using-jersey/46175943#46175943
*
* But the jersey that has been released in the maven central
* repository seems to have a bug.
* https://github.com/jersey/jersey/pull/3752
* jersey connector. But the jersey that has been released in the maven central
* repository seems to have a bug: https://github.com/jersey/jersey/pull/3752
*/
PoolingHttpClientConnectionManager pool = connectionManager(url, conf);
Object maxTotal = conf.getProperty("maxTotal");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public final class Bytes {
public static final long PB = GB * MB;
public static final long EB = GB * GB;

private static final Comparator<byte[]> CMP =
UnsignedBytes.lexicographicalComparator();
private static final Comparator<byte[]> CMP = UnsignedBytes.lexicographicalComparator();

public static int compare(byte[] bytes1, byte[] bytes2) {
return CMP.compare(bytes1, bytes2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,37 @@
// Copyright 2017 JanusGraph Authors
//
// Licensed 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.
/*
* 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.
*/

package org.apache.hugegraph.util;

import java.io.IOException;
import static java.lang.System.exit;

import java.net.InetAddress;
import java.net.Socket;

/*
* This doesn't really belong here. It's only used in the zipfile
* distribution to check whether Gremlin Server or ES are listening on
* their respective TCP ports. But it's so tiny that I don't want
* to reorganize the repo to accommodate it (yet).
*
* Many widely available *NIX programs do this task better (e.g.
* netcat, telnet, nmap, socat, ... we could even use netstat since
* we're interested only in the status of local ports). But we want
* to keep the JanusGraph distribution self-contained insofar as is
* reasonable.
*/
public final class CheckSocket {

private static final int E_USAGE = 1;
private static final int E_FAILED = 2;
private static final String MSG_USAGE =
"Usage: " + CheckSocket.class.getSimpleName() + " hostname port";

public static void main(String[] args) {
if (args.length != 2) {
System.err.println(MSG_USAGE);
System.exit(E_USAGE);
}
try {
Socket s = new Socket(InetAddress.getByName(args[0]),
Integer.parseInt(args[1]));
s.close();
System.exit(0);
} catch (IOException e) {
System.err.println(e);
System.exit(E_FAILED);
// Check if the socket connection can be closed normally
new Socket(InetAddress.getByName(args[0]), Integer.parseInt(args[1])).close();
exit(0);
} catch (Exception e) {
e.printStackTrace();
exit(-1);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public final class DateUtil {
"yyyy-MM-dd HH:mm:ss.SSS"
);

private static final Map<String, SafeDateFormat> DATE_FORMATS =
new ConcurrentHashMap<>();
private static final Map<String, SafeDateFormat> DATE_FORMATS = new ConcurrentHashMap<>();

public static Date parse(String value) {
for (Map.Entry<String, String> entry : VALID_DFS.entrySet()) {
Expand All @@ -47,8 +46,7 @@ public static Date parse(String value) {
}
}
throw new IllegalArgumentException(String.format(
"Expected date format is: %s, but got '%s'",
VALID_DFS.values(), value));
"Expected date format is: %s, but got '%s'", VALID_DFS.values(), value));
}

public static Date parse(String value, String df) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ public static void checkNotEmpty(Collection<?> collection, String elem) {
"The '%s' can't be empty", elem);
}

public static void checkNotEmpty(Collection<?> collection,
String elem,
String owner) {
public static void checkNotEmpty(Collection<?> collection, String elem, String owner) {
Preconditions.checkArgument(!collection.isEmpty(),
"The '%s' of '%s' can't be empty",
elem, owner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

package org.apache.hugegraph.util;

/**
* Utility class for encoding longs in strings based on:
* @see <a href="http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java">encode decode long to string</a>
*/
public final class LongEncoding {

private static final String B64_SYMBOLS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,9 @@ public static boolean isNumber(Object value) {

public static boolean isNumber(Class<?> clazz) {
if (clazz.isPrimitive()) {
if (clazz == int.class || clazz == long.class ||
clazz == float.class || clazz == double.class ||
clazz == short.class || clazz == byte.class) {
return true;
}
return false;
return clazz == int.class || clazz == long.class ||
clazz == float.class || clazz == double.class ||
clazz == short.class || clazz == byte.class;
}
return Number.class.isAssignableFrom(clazz);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@
import com.google.common.base.Functions;
import com.google.common.collect.Ordering;

/**
* Reference:
* <a href="https://stackoverflow.com/questions/109383/sort-a-mapkey-value-by-values">...</a>
*/
public class OrderLimitMap<K extends Comparable<K>, V extends Comparable<V>>
extends TreeMap<K, V> {
public class OrderLimitMap<K extends Comparable<K>, V extends Comparable<V>> extends TreeMap<K, V> {

private static final long serialVersionUID = 756490437953358633L;

private final int capacity;
private final Map<K, V> valueMap;

private static <V extends Comparable<V>> Ordering<? super V> incr() {
return Ordering.from((V o1, V o2) -> o1.compareTo(o2));
return Ordering.from(Comparable::compareTo);
}

private static <V extends Comparable<V>> Ordering<? super V> decr() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public static String getImplementationVersion(Class<?> clazz) {
/*
* We don't use Package.getImplementationVersion() due to
* a duplicate package would override the origin package info.
* https://stackoverflow.com/questions/1272648/reading-my-own-jars-manifest
*/
String className = clazz.getSimpleName() + ".class";
String classPath = Objects.requireNonNull(clazz.getResource(className)).toString();
Expand Down Expand Up @@ -137,10 +136,6 @@ public static String getPomVersion() {
}
}

/**
* class Version for compare
* https://stackoverflow.com/questions/198431/how-do-you-compare-two-version-strings-in-java
*/
public static class Version implements Comparable<Version> {

public static Version of(Class<?> clazz) {
Expand Down

0 comments on commit ba59d21

Please sign in to comment.