Skip to content

Commit

Permalink
Merge pull request #60 from kris7t/rules
Browse files Browse the repository at this point in the history
Refinement rule support
  • Loading branch information
kris7t authored Jun 17, 2024
2 parents 1d9dcf1 + ff234ef commit ac5b719
Show file tree
Hide file tree
Showing 73 changed files with 3,646 additions and 2,272 deletions.
610 changes: 305 additions & 305 deletions .yarn/releases/yarn-4.2.2.cjs → .yarn/releases/yarn-4.3.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ packageExtensions:
peerDependencies:
csstype: "*"

yarnPath: .yarn/releases/yarn-4.2.2.cjs
yarnPath: .yarn/releases/yarn-4.3.0.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.gradle.accessors.dm.LibrariesForLibs

plugins {
application
id("com.github.johnrengelman.shadow")
id("io.github.goooler.shadow")
id("tools.refinery.gradle.internal.java-conventions")
}

Expand Down
29 changes: 8 additions & 21 deletions docker/Dockerfile → docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
# SPDX-FileCopyrightText: 2023-2024 The Refinery Authors <https://refinery.tools/>
#
# SPDX-License-Identifier: EPL-2.0

Expand Down Expand Up @@ -44,28 +44,15 @@ RUN dnf install -y findutils && \
COPY --link --from=jlink /jlink /usr/lib/java
ENV JAVA_HOME="/usr/lib/java" PATH="/usr/lib/java/bin:${PATH}"
# Layer with platform-independent dependencies, slow changing.
ADD --link lib /app/lib
ADD --link common_lib /app/lib

FROM base AS refinery-amd64
FROM base AS base-amd64
# Layer with platform-dependent dependencies, slow changing.
ADD --link lib_amd64 /app/lib
# Layer with platform-dependent startup script containing references to all
# dependency version.
ADD --link app_amd64_bin /app/bin
ADD --link common_amd64_lib /app/lib

FROM base AS refinery-arm64
FROM base AS base-arm64
# Layer with platform-dependent dependencies, slow changing.
ADD --link lib_arm64 /app/lib
# Layer with platform-dependent startup script containing references to all
# dependency version.
ADD --link app_arm64_bin /app/bin
ADD --link common_arm64_lib /app/lib

FROM base-$TARGETARCH

FROM refinery-$TARGETARCH
# Layer with platform-independent application jars.
ADD --link app_lib /app/lib
# Common settings added on top.
ENV REFINERY_LISTEN_HOST=0.0.0.0 REFINERY_LISTEN_PORT=8888
EXPOSE 8888
USER 1000
WORKDIR /app
ENTRYPOINT /app/bin/refinery-language-web
26 changes: 26 additions & 0 deletions docker/Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/>
#
# SPDX-License-Identifier: EPL-2.0

FROM base AS cli-base
# Layer with platform-dependent dependencies, slow changing.
ADD --link cli_lib /app/lib

FROM cli-base AS cli-amd64
# Layer with platform-dependent startup script containing references to all
# dependency versions.
ADD --link cli_amd64_bin /app/bin

FROM cli-base AS cli-arm64
# Layer with platform-dependent startup script containing references to all
# dependency versions.
ADD --link cli_arm64_bin /app/bin

FROM cli-$TARGETARCH
# Layer with platform-independent application jars.
ADD --link cli_app_lib /app/lib
# Common settings added on top.
ENV REFINERY_LIBRARY_PATH=/data
USER 1000
WORKDIR /data
ENTRYPOINT ["/app/bin/refinery-generator-cli"]
27 changes: 27 additions & 0 deletions docker/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: 2023-2024 The Refinery Authors <https://refinery.tools/>
#
# SPDX-License-Identifier: EPL-2.0

FROM base AS web-base
# Layer with platform-dependent dependencies, slow changing.
ADD --link web_lib /app/lib

FROM web-base AS web-amd64
# Layer with platform-dependent startup script containing references to all
# dependency versions.
ADD --link web_amd64_bin /app/bin

FROM web-base AS web-arm64
# Layer with platform-dependent startup script containing references to all
# dependency versions.
ADD --link web_arm64_bin /app/bin

FROM web-$TARGETARCH
# Layer with platform-independent application jars.
ADD --link web_app_lib /app/lib
# Common settings added on top.
ENV REFINERY_LISTEN_HOST=0.0.0.0 REFINERY_LISTEN_PORT=8888
EXPOSE 8888
USER 1000
WORKDIR /app
ENTRYPOINT ["/app/bin/refinery-language-web"]
62 changes: 39 additions & 23 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
#!/usr/bin/env bash

# SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
# SPDX-FileCopyrightText: 2023-2024 The Refinery Authors <https://refinery.tools/>
#
# SPDX-License-Identifier: EPL-2.0

set -euo pipefail

(cd .. && ./gradlew :refinery-language-web:distTar)
(cd .. && ./gradlew distTar)

refinery_version="$(grep '^version=' ../gradle.properties | cut -d'=' -f2)"
distribution_name="refinery-language-web-${refinery_version}"
rm -rf "${distribution_name}" dist app_lib app_{amd64,arm64}_bin lib lib_{amd64,arm64}
cli_distribution_name="refinery-generator-cli-${refinery_version}"
web_distribution_name="refinery-language-web-${refinery_version}"

tar -xf "../subprojects/language-web/build/distributions/${distribution_name}.tar"
mv "${distribution_name}" dist
mkdir -p app_lib app_{amd64,arm64}_bin lib lib_{amd64,arm64}
rm -rf "${cli_distribution_name}" "${web_distribution_name}" {cli,web}_dist \
{cli,web}_{,app_}lib common_{,amd64_,arm64_}lib {cli,web}_{amd64,arm64}_bin

tar -xf "../subprojects/generator-cli/build/distributions/${cli_distribution_name}.tar"
mv "${cli_distribution_name}" cli_dist
tar -xf "../subprojects/language-web/build/distributions/${web_distribution_name}.tar"
mv "${web_distribution_name}" web_dist
mkdir -p {cli,web}_{,app_}lib common_{,amd64_,arm64_}lib {cli,web}_{amd64,arm64}_bin

# Our application itself is very small, so it will get added as the last layer
# of both containers.
mv cli_dist/lib/refinery-* cli_app_lib
mv web_dist/lib/refinery-* web_app_lib

for i in cli_dist/lib/*; do
j="web${i#cli}"
if [[ -f "$j" ]]; then
mv "$i" "common_lib${i#cli_dist/lib}"
rm "$j"
fi
done

# Move architecture-specific jars to their repsective directories.
mv dist/lib/ortools-linux-x86-64-*.jar lib_amd64
mv dist/lib/ortools-linux-aarch64-*.jar lib_arm64
rm dist/lib/ortools-{darwin,win32}-*.jar
mv common_lib/ortools-linux-x86-64-*.jar common_amd64_lib
mv common_lib/ortools-linux-aarch64-*.jar common_arm64_lib
rm common_lib/ortools-{darwin,win32}-*.jar
# Move the applications jars for the dependencies into a separate Docker layer
# to enable faster updates.
mv dist/lib/refinery-* app_lib
mv dist/lib/* lib
mv cli_dist/lib/* cli_lib
mv web_dist/lib/* web_lib
# Omit references to jars not present for the current architecture from the
# startup scripts.
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-aarch64\)[^:]\+\.jar//g' dist/bin/refinery-language-web > app_amd64_bin/refinery-language-web
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-x86-64\)[^:]\+\.jar//g' dist/bin/refinery-language-web > app_arm64_bin/refinery-language-web
chmod a+x app_{amd64,arm64}_bin/refinery-language-web
rm -rf dist

docker buildx build . \
--platform linux/amd64,linux/arm64 \
--output "type=image,\"name=ghcr.io/graphs4value/refinery:${refinery_version},ghcr.io/graphs4value/refinery:latest\",push=true,annotation-index.org.opencontainers.image.source=https://github.com/graphs4value/refinery,annotation-index.org.opencontainers.image.description=Refinery: an efficient graph solver for generating well-formed models,annotation-index.org.opencontainers.image.licenses=EPL-2.0" \
--label 'org.opencontainers.image.source=https://github.com/graphs4value/refinery' \
--label 'org.opencontainers.image.description=Refinery: an efficient graph solver for generating well-formed models' \
--label 'org.opencontainers.image.licenses=EPL-2.0'
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-aarch64\)[^:]\+\.jar//g' cli_dist/bin/refinery-generator-cli > cli_amd64_bin/refinery-generator-cli
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-x86-64\)[^:]\+\.jar//g' cli_dist/bin/refinery-generator-cli > cli_arm64_bin/refinery-generator-cli
chmod a+x cli_{amd64,arm64}_bin/refinery-generator-cli
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-aarch64\)[^:]\+\.jar//g' web_dist/bin/refinery-language-web > web_amd64_bin/refinery-language-web
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-x86-64\)[^:]\+\.jar//g' web_dist/bin/refinery-language-web > web_arm64_bin/refinery-language-web
chmod a+x web_{amd64,arm64}_bin/refinery-language-web
rm -rf {cli,web}_dist

REFINERY_VERSION="${refinery_version}" docker buildx bake -f docker-bake.hcl
39 changes: 39 additions & 0 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/>
#
# SPDX-License-Identifier: EPL-2.0

variable "REFINERY_VERSION" {
default = ""
}

group "default" {
targets = ["cli", "web"]
}

target "base" {
dockerfile = "Dockerfile.base"
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=cacheonly"]
}

target "cli" {
dockerfile = "Dockerfile.cli"
platforms = ["linux/amd64", "linux/arm64"]
output = [
"type=image,\"name=ghcr.io/graphs4value/refinery:cli-${REFINERY_VERSION},ghcr.io/graphs4value/refinery:cli\",push=true,annotation-index.org.opencontainers.image.source=https://github.com/graphs4value/refinery,annotation-index.org.opencontainers.image.description=Refinery: an efficient graph solver for generating well-formed models,annotation-index.org.opencontainers.image.licenses=EPL-2.0"
]
contexts = {
base = "target:base"
}
}

target "web" {
dockerfile = "Dockerfile.web"
platforms = ["linux/amd64", "linux/arm64"]
output = [
"type=image,\"name=ghcr.io/graphs4value/refinery:${REFINERY_VERSION},ghcr.io/graphs4value/refinery:latest\",push=true,annotation-index.org.opencontainers.image.source=https://github.com/graphs4value/refinery,annotation-index.org.opencontainers.image.description=Refinery: an efficient graph solver for generating well-formed models,annotation-index.org.opencontainers.image.licenses=EPL-2.0"
]
contexts = {
base = "target:base"
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: EPL-2.0

file.encoding=UTF-8
frontend.nodeVersion=20.13.1
frontend.nodeVersion=20.14.0
group=tools.refinery
# Set to true once tools.refinery.gradle.frontend-worktree supports the cache.
org.gradle.configuration-cache=false
Expand Down
2 changes: 2 additions & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#This file is generated by updateDaemonJvm
toolchainVersion=21
3 changes: 3 additions & 0 deletions gradle/gradle-daemon-jvm.properties.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/>

SPDX-License-Identifier: CC0-1.0
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@

[versions]
eclipseCollections = "12.0.0.M3"
jetty = "12.0.9"
jetty = "12.0.10"
jmh = "1.37"
junit = "5.11.0-M2"
mockito = "5.12.0"
mwe2 = "2.18.0"
slf4j = "2.0.13"
xtext = "2.35.0.M2"
xtext = "2.35.0"

[libraries]
eclipseCollections = { group = "org.eclipse.collections", name = "eclipse-collections", version.ref = "eclipseCollections" }
eclipseCollections-api = { group = "org.eclipse.collections", name = "eclipse-collections-api", version.ref = "eclipseCollections" }
ecore = { group = "org.eclipse.emf", name = "org.eclipse.emf.ecore", version = "2.36.0" }
ecore-xmi = { group = "org.eclipse.emf", name = "org.eclipse.emf.ecore.xmi", version = "2.37.0" }
ecore-codegen = { group = "org.eclipse.emf", name = "org.eclipse.emf.codegen.ecore", version = "2.37.0" }
gradlePlugin-frontend = { group = "org.siouan", name = "frontend-jdk17", version = "8.0.0" }
gradlePlugin-shadow = { group = "com.github.johnrengelman", name = "shadow", version = "8.1.1" }
ecore-codegen = { group = "org.eclipse.emf", name = "org.eclipse.emf.codegen.ecore", version = "2.38.0" }
gradlePlugin-frontend = { group = "org.siouan", name = "frontend-jdk17", version = "8.1.0" }
gradlePlugin-shadow = { group = "io.github.goooler.shadow", name = "shadow-gradle-plugin", version = "8.1.7" }
gradlePlugin-sonarqube = { group = "org.sonarsource.scanner.gradle", name = "sonarqube-gradle-plugin", version = "5.0.0.4638" }
gson = { group = "com.google.code.gson", name = "gson", version = "2.11.0" }
hamcrest = { group = "org.hamcrest", name = "hamcrest", version = "2.2" }
Expand Down
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,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading

0 comments on commit ac5b719

Please sign in to comment.