Skip to content

Commit

Permalink
Merge branch 'master' into cdToGit
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhee17 committed Oct 17, 2022
2 parents e2c8db4 + 0cf990c commit eabe06a
Show file tree
Hide file tree
Showing 32 changed files with 415 additions and 117 deletions.
50 changes: 38 additions & 12 deletions .github/workflows/ci.yml → .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
branches:
- master
tags-ignore:
# The release versions will be verified by 'publish-release.yml'
- centraldogma-*
pull_request:

concurrency:
Expand All @@ -23,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-12, windows-latest]
java: [11]
include:
- java: 11
Expand All @@ -47,7 +50,9 @@ jobs:

- name: Build with Gradle
run: |
./gradlew --no-daemon --stacktrace -Pcoverage -PnoLint build \
./gradlew --no-daemon --stacktrace -Pleak -PnoLint build \
${{ matrix.coverage && '-Pcoverage' || '' }} \
-PflakyTests=false \
-PbuildJdkVersion=${{ matrix.java }} \
-PtestJavaVersion=${{ matrix.java }} \
shell: bash
Expand Down Expand Up @@ -75,30 +80,51 @@ jobs:
shell: bash

lint:
runs-on: ${{ matrix.os }}
if: github.repository == 'line/centraldogma'
runs-on: ubuntu-latest
timeout-minutes: 60
env:
GRADLE_OPTS: -Xmx1280m
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
java: [17]
steps:
- uses: actions/checkout@v2

- name: Set up JDK ${{ matrix.java }}
- id: setup-jdk-17
name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build with Gradle
run: |
./gradlew --no-daemon --stacktrace lint \
-PbuildJdkVersion=${{ matrix.java }} \
-PtestJavaVersion=${{ matrix.java }}
-PbuildJdkVersion=17 \
-PtestJavaVersion=17
shell: bash

flaky-tests:
if: github.repository == 'line/centraldogma'
runs-on: ubuntu-latest
timeout-minutes: 60
env:
GRADLE_OPTS: -Xmx1280m
steps:
- uses: actions/checkout@v2

- id: setup-jdk-17
name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run flaky tests
run: |
./gradlew --no-daemon --stacktrace -PnoLint -PflakyTests=true
shell: bash
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
alias libs.plugins.nexus.publish
alias libs.plugins.osdetector apply false
alias libs.plugins.jmh apply false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
import com.linecorp.armeria.client.endpoint.EndpointGroup;
import com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroup;
import com.linecorp.armeria.client.endpoint.healthcheck.HealthCheckedEndpointGroup;
import com.linecorp.centraldogma.testing.internal.FlakyTest;

@FlakyTest
class ArmeriaCentralDogmaBuilderTest {

// Note: This test case relies on https://sslip.io/
Expand Down
19 changes: 10 additions & 9 deletions dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ guava = "31.1-jre"
jgit = "5.13.0.202109080827-r"
json-unit = "2.35.0"
jmh = "1.35"
micrometer = "1.9.3"
micrometer = "1.9.4"
mockito = "4.8.0"
slf4j = "1.7.36"
spring-boot1 = "1.5.22.RELEASE"
spring-boot2 = "2.7.3"
spring-boot2 = "2.7.4"

[boms]
armeria = { module = "com.linecorp.armeria:armeria-bom", version = "1.19.0" }
armeria = { module = "com.linecorp.armeria:armeria-bom", version = "1.20.1" }
jackson = { module = "com.fasterxml.jackson:jackson-bom", version = "2.13.4" }
junit5 = { module = "org.junit:junit-bom", version = "5.9.0" }
junit5 = { module = "org.junit:junit-bom", version = "5.9.1" }

[libraries.armeria]
module = "com.linecorp.armeria:armeria"
Expand Down Expand Up @@ -129,7 +129,7 @@ module = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"

[libraries.javassist]
module = "org.javassist:javassist"
version = "3.29.1-GA"
version = "3.29.2-GA"

[libraries.javax-annotation]
module = "javax.annotation:javax.annotation-api"
Expand Down Expand Up @@ -306,10 +306,11 @@ exclusions = [

[plugins]
docker = { id = "com.bmuschko.docker-remote-api", version = "6.7.0" }
download = { id = "de.undercouch.download", version = "5.1.0" }
jmh = { id = "me.champeau.jmh", version = "0.6.7" }
download = { id = "de.undercouch.download", version = "5.2.1" }
jmh = { id = "me.champeau.jmh", version = "0.6.8" }
jxr = { id = "net.davidecavestro.gradle.jxr", version = "0.2.1" }
log = { id = "com.boazj.log", version = "0.1.0" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version = "1.1.0" }
node-gradle = { id = "com.github.node-gradle.node", version = "3.4.0" }
osdetector = { id = "com.google.osdetector", version = "1.6.2" }
sphinx = { id = "kr.motd.sphinx", version = "2.10.0" }
osdetector = { id = "com.google.osdetector", version = "1.7.1" }
sphinx = { id = "kr.motd.sphinx", version = "2.10.1" }
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=com.linecorp.centraldogma
version=0.58.0-SNAPSHOT
version=0.57.4-SNAPSHOT
projectName=Central Dogma
projectUrl=https://line.github.io/centraldogma/
projectDescription=Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2
Expand Down
8 changes: 4 additions & 4 deletions gradle/scripts/.gitrepo
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
;
[subrepo]
remote = https://github.com/line/gradle-scripts.git
branch = master
commit = d8dbcb3f2d1730582f30db4c6f0007102011a2ba
parent = 40da8c431672c35f0face746c3d247f87f700dfa
cmdver = 0.4.3
commit = 566f6109098bb5c3737f494b67d943e760d804c9
parent = 3fbe79292a19239434ee29c22462059bc9c8839b
cmdver = 0.4.5
method = merge
18 changes: 18 additions & 0 deletions gradle/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@ generate Maven BOM based on the dependencies specified in `dependencies.toml`.
`bom` flag implies `publish` flag, which means the BOM will be uploaded to a
Maven repository by `./gradlew publish`.

```groovy
// settings.gradle
includeWithFlags ':bom', 'bom'
```

If you want to publish multiple boms with different subprojects, you can use the `bomGroups` extension property.
Specify each bom's name with the subprojects:
```groovy
Expand All @@ -534,6 +539,19 @@ ext {
}
```

## Sharing [dependency versions](https://docs.gradle.org/current/userguide/platforms.html#sec:version-catalog-plugin) with `version-catalog` flag

If you configure a project with the `version-catalog` flag, the project will be configured to
publish version catalog based on the dependencies specified in `dependencies.toml`.

The `version-catalog` flag also implies `publish` flag, which means the `libs.versions.toml` will be uploaded to a
Maven repository by `./gradlew publish`.

```groovy
// settings.gradle
includeWithFlags ':version-catalog', 'version-catalog'
```

## Building shaded JARs with `shade` flag

Let's say you have a project that depends on a very old version of Guava and
Expand Down
2 changes: 1 addition & 1 deletion gradle/scripts/lib/common-dependencies-legacy.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
dependencies {
// These should be the only dependencies that need hard-coded versions.
classpath 'com.github.ben-manes:gradle-versions-plugin:0.39.0'
classpath 'org.yaml:snakeyaml:1.29'
classpath 'org.yaml:snakeyaml:1.33'
}
}

Expand Down
64 changes: 61 additions & 3 deletions gradle/scripts/lib/common-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
dependencies {
// These should be the only dependencies that need hard-coded versions.
classpath 'com.github.ben-manes:gradle-versions-plugin:0.42.0'
classpath 'org.yaml:snakeyaml:1.29'
classpath 'org.yaml:snakeyaml:1.33'
}
}

Expand Down Expand Up @@ -91,6 +91,64 @@ configure(rootProject) {
}
}

// Publish version catalog so that other projects can easily align transitive versions of the project by
// importing the published catalog.
// https://docs.gradle.org/current/userguide/platforms.html#sec:version-catalog-plugin
configure(projectsWithFlag('version-catalog')) { catalogProject ->
apply plugin: 'version-catalog'
apply plugin: 'maven-publish'

publishing {
publications {
maven(MavenPublication) {
from components.versionCatalog
}
}
}

catalog {
versionCatalog {
def catalogs = rootProject.extensions.getByType(VersionCatalogsExtension).named('libs')
catalogs.libraryAliases.forEach { alias ->
def dep = catalogs.findLibrary(alias).get().get()
if (!dep.versionConstraint.requiredVersion.isEmpty()) {
library(alias, dep.toString())
}
}

catalogs.pluginAliases.forEach { alias ->
def plug = catalogs.findPlugin(alias).get().get()
plugin(alias, plug.pluginId).version(plug.version.requiredVersion)
}

catalogs.versionAliases.forEach { alias ->
def ver = catalogs.findVersion(alias).get()
version(alias, ver.toString())
}

catalogs.bundleAliases.forEach { alias ->
def aliases = catalogs.findBundle(alias).get().get()
bundle(alias, aliases.toString())
}

afterEvaluate {
projectsWithFlag('publish').each { proj ->
if (proj != catalogProject) {
String alias = proj.ext.artifactId
// Normalize the alias since Gradle prefixes `get` for '.' or '_' followed by a number.
// Replace "armeria-scala_2.12" with "armeria-scala_v2.12"
alias = alias.replaceAll('_(\\d)', '_v$1')
// Replace "armeria-scala_v2.12" with "armeria-scala_v212"
// or "armeria-thrift0.13" with "armeria-thrift013"
alias = alias.replaceAll('\\.(\\d)', '$1')
library(alias, proj.group, proj.ext.artifactId).version(proj.version)
}
}
}
}
}
}

configure(projectsWithFlags('java')) {

configurations.configureEach { configuration ->
Expand Down Expand Up @@ -260,7 +318,7 @@ final class GentlePlainTextReporter implements Reporter {
}

String quickSearchLink = "https://search.maven.org/search?q=g:${old.group}%20a:${old.name}%20v:" +
"${versionParts[0]}.${versionParts[1]}.*\n"
"${versionParts[0]}.${versionParts[1]}.*\n"
String projectUrl
if (old.projectUrl == null) {
projectUrl = quickSearchLink
Expand All @@ -272,7 +330,7 @@ final class GentlePlainTextReporter implements Reporter {

DependenciesGroup<DependencyOutdated> outdatedWithNote = new DependenciesGroup<>(outdated.count, updated)
return new Result(result.count, result.current, outdatedWithNote, result.exceeded, result.undeclared,
result.unresolved, result.gradle)
result.unresolved, result.gradle)
}

String getFileExtension() {
Expand Down
9 changes: 6 additions & 3 deletions gradle/scripts/lib/java-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ configure(projectsWithFlags('publish')) {
}
}

// For now, disable Gradle metadata generation until verifying it is correctly generated.
tasks.withType(GenerateModuleMetadata) {
enabled = false
// A version catalog need to publish Gradle metadata together to be correctly imported externally.
if (!hasFlags('version-catalog')) {
// For now, disable Gradle metadata generation until verifying it is correctly generated.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
}
}
4 changes: 2 additions & 2 deletions gradle/scripts/lib/scala.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ configure(scala212 + scala213 + scala3) {

configure(scala212) {
dependencies {
implementation('org.scala-lang:scala-library:2.12.15')
implementation('org.scala-lang:scala-library:2.12.17')
if (managedVersions.containsKey('org.scalameta:munit_2.12')) {
testImplementation "org.scalameta:munit_2.12:${managedVersions['org.scalameta:munit_2.12']}"
}
Expand All @@ -76,7 +76,7 @@ configure(scala212) {

configure(scala213) {
dependencies {
implementation 'org.scala-lang:scala-library:2.13.8'
implementation 'org.scala-lang:scala-library:2.13.9'
if (managedVersions.containsKey('org.scalameta:munit_2.13')) {
testImplementation "org.scalameta:munit_2.13:${managedVersions['org.scalameta:munit_2.13']}"
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added gradle/scripts/lib/thrift/0.17/thrift.osx-x86_64
Binary file not shown.
Binary file not shown.
50 changes: 50 additions & 0 deletions gradle/scripts/lib/thrift/dockerfile/Dockerfile.bionic
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# this builds a thrift binary without library support (only for code generation)
# because Apache thrift official repo no longer maintain a binary distribution
FROM ubuntu:bionic as builder

ENV DEBIAN_FRONTEND=noninteractive

# see https://archive.apache.org/dist/thrift/
ENV THRIFT_VERSION=0.17.0

# see https://thrift.apache.org/docs/install/debian.html
RUN apt-get update -yq && \
apt-get install -y --no-install-recommends \
automake \
bison \
binutils \
flex \
g++ \
git \
libboost-all-dev \
libevent-dev \
libssl-dev \
libtool \
make \
pkg-config

ADD https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz /tmp/thrift.tar.gz

RUN echo "b272c1788bb165d99521a2599b31b97fa69e5931d099015d91ae107a0b0cc58f /tmp/thrift.tar.gz" | sha256sum -c && \
tar xzf /tmp/thrift.tar.gz -C /tmp

RUN cd /tmp/thrift-${THRIFT_VERSION} && \
./bootstrap.sh && \
./configure \
--disable-debug \
--disable-tests \
--disable-libs \
&& \
make -j$(nproc) && \
make install

FROM ubuntu:bionic

COPY --from=builder /usr/local/bin/thrift /usr/local/bin/thrift

# Minimizing Thrift binary size
RUN /usr/bin/strip /usr/local/bin/thrift

ENTRYPOINT [ "/usr/local/bin/thrift" ]

CMD [ "-help" ]
Loading

0 comments on commit eabe06a

Please sign in to comment.