Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ant-lara-2.0-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

# Daily at midnight
schedule:
- cron: '0 0 * * *'
- cron: '0 0 1 * *'

permissions:
checks: write
Expand All @@ -26,7 +26,7 @@ jobs:
# working-directory: ./..

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
# Because of scheduled runs, by default run on default branch
with:
ref: lara-2.0-legacy
Expand Down
51 changes: 32 additions & 19 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- .github/workflows/copilot-setup-steps.yml

env:
CLAVA_BRANCH: ${{ github.head_ref || github.ref_name }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
# The job MUST be called `copilot-setup-steps`
Expand All @@ -41,65 +41,78 @@ jobs:
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: current
dependency-graph: generate-and-submit

- name: Checkout clava
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: clava

- name: Determine repository refs
id: repo-refs
shell: bash
env:
BRANCH_NAME: ${{ env.CLAVA_BRANCH }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}
BASE_BRANCH: ${{ github.base_ref }}
run: |
set -euo pipefail

# For each dependency repository, determine which branch to checkout.
# Priority order:
# 1. A branch with the same name as the current branch
# 2. If this is a PR, the target branch (base_ref)
# 3. The default branch of the repository

determine_ref() {
local prefix=$1
local repo=$2
local url="https://github.com/${repo}.git"

# Get the default branch
local default_branch
default_branch=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ {print $2}' | sed 's@refs/heads/@@')
echo "${prefix}_default=${default_branch}" >> "$GITHUB_OUTPUT"
echo "Default branch for ${repo} is '${default_branch}'"

if git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}" >/dev/null; then
echo "${prefix}_match=true" >> "$GITHUB_OUTPUT"
echo "${prefix}_ref=${BRANCH_NAME}" >> "$GITHUB_OUTPUT"
echo "Branch '${BRANCH_NAME}' exists in ${repo}"
local ref_to_use=""

# Priority 1: Same branch name
if [ -n "$(git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}")" ]; then
ref_to_use="${BRANCH_NAME}"
echo "Using matching branch '${BRANCH_NAME}' in ${repo}"
# Priority 2: PR target branch (if this is a PR)
elif [ -n "${BASE_BRANCH}" ] && [ -n "$(git ls-remote --heads "$url" "refs/heads/${BASE_BRANCH}")" ]; then
ref_to_use="${BASE_BRANCH}"
echo "Using PR target branch '${BASE_BRANCH}' in ${repo}"
# Priority 3: Default branch
else
echo "${prefix}_match=false" >> "$GITHUB_OUTPUT"
echo "${prefix}_ref=${default_branch}" >> "$GITHUB_OUTPUT"
echo "Branch '${BRANCH_NAME}' not found in ${repo}. Falling back to '${default_branch}'."
ref_to_use="${default_branch}"
echo "Using default branch '${default_branch}' for ${repo}"
fi

echo "${prefix}_ref=${ref_to_use}" >> "$GITHUB_OUTPUT"
}

determine_ref "lara" "specs-feup/lara-framework"
determine_ref "specs" "specs-feup/specs-java-libs"

- name: Echo checks
run: |
echo "Clava branch: ${{ env.CLAVA_BRANCH }}"
echo "Matching branch found (lara-framework): ${{ steps.repo-refs.outputs.lara_match }}"
echo "Matching branch found (specs-java-libs): ${{ steps.repo-refs.outputs.specs_match }}"
echo "Weaver branch: ${{ env.BRANCH_NAME }}"
echo "PR target branch (if any): ${{ github.base_ref }}"
echo "Lara framework ref: ${{ steps.repo-refs.outputs.lara_ref }}"
echo "Lara framework default: ${{ steps.repo-refs.outputs.lara_default }}"
echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}"
echo "Lara framework default fallback: ${{ steps.repo-refs.outputs.lara_default }}"
echo "Specs-java-libs default fallback: ${{ steps.repo-refs.outputs.specs_default }}"
echo "Pull request base_ref (if any): ${{ github.base_ref }}"
echo "Specs-java-libs default: ${{ steps.repo-refs.outputs.specs_default }}"

- name: Checkout lara-framework
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: specs-feup/lara-framework
path: lara-framework
ref: ${{ steps.repo-refs.outputs.lara_ref }}

- name: Checkout specs-java-libs
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: specs-feup/specs-java-libs
path: specs-java-libs
Expand Down
88 changes: 62 additions & 26 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,15 @@ permissions:
env:
JAVA_VERSION: 17
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# Setting default branch to staging assuming PRs will be done against the staging versions of the repository
# main versions will just receive what comes from the staging
DEFAULT_BRANCH: ${{ github.base_ref || 'staging' }}
#SPECS_JAVA_LIBS_BRANCH: ${{ 'master' }}
#LARA_FRAMEWORK_BRANCH: ${{ github.head_ref || github.ref_name }}

jobs:
build-java:
name: Build Java
runs-on: ubuntu-latest

outputs:
branch-exists-lara-framework: ${{ steps.Branch-lara-framework.outputs.value }}
branch-exists-specs-java-libs: ${{ steps.Branch-specs-java-libs.outputs.value }}
lara_ref: ${{ steps.repo-refs.outputs.lara_ref }}
specs_ref: ${{ steps.repo-refs.outputs.specs_ref }}

steps:
- name: Setup Java
Expand All @@ -48,39 +43,80 @@ jobs:
dependency-graph: generate-and-submit

- name: Checkout Clava
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: clava

- name: Check if branch exists on lara-framework
id: Branch-lara-framework
run: echo "value=$(git ls-remote --heads https://github.com/specs-feup/lara-framework.git refs/heads/${{ env.BRANCH_NAME }} | wc -l)" >> $GITHUB_OUTPUT
- name: Determine repository refs
id: repo-refs
shell: bash
env:
BRANCH_NAME: ${{ env.BRANCH_NAME }}
BASE_BRANCH: ${{ github.base_ref }}
run: |
set -euo pipefail

# For each dependency repository, determine which branch to checkout.
# Priority order:
# 1. A branch with the same name as the current branch
# 2. If this is a PR, the target branch (base_ref)
# 3. The default branch of the repository

determine_ref() {
local prefix=$1
local repo=$2
local url="https://github.com/${repo}.git"

# Get the default branch
local default_branch
default_branch=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ {print $2}' | sed 's@refs/heads/@@')
echo "${prefix}_default=${default_branch}" >> "$GITHUB_OUTPUT"
echo "Default branch for ${repo} is '${default_branch}'"

local ref_to_use=""

# Priority 1: Same branch name
if [ -n "$(git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}")" ]; then
ref_to_use="${BRANCH_NAME}"
echo "Using matching branch '${BRANCH_NAME}' in ${repo}"
# Priority 2: PR target branch (if this is a PR)
elif [ -n "${BASE_BRANCH}" ] && [ -n "$(git ls-remote --heads "$url" "refs/heads/${BASE_BRANCH}")" ]; then
ref_to_use="${BASE_BRANCH}"
echo "Using PR target branch '${BASE_BRANCH}' in ${repo}"
# Priority 3: Default branch
else
ref_to_use="${default_branch}"
echo "Using default branch '${default_branch}' for ${repo}"
fi

echo "${prefix}_ref=${ref_to_use}" >> "$GITHUB_OUTPUT"
}

- name: Check if branch exists on specs-java-libs
id: Branch-specs-java-libs
run: echo "value=$(git ls-remote --heads https://github.com/specs-feup/specs-java-libs.git refs/heads/${{ env.BRANCH_NAME }} | wc -l)" >> $GITHUB_OUTPUT
determine_ref "lara" "specs-feup/lara-framework"
determine_ref "specs" "specs-feup/specs-java-libs"

- name: Echo checks
run: |
echo "Branch-lara-framework: ${{ steps.Branch-lara-framework.outputs.value }}"
echo "Branch-specs-java-libs: ${{ steps.Branch-specs-java-libs.outputs.value }}"
echo "Branch name: ${{ env.BRANCH_NAME }}"
echo "Default branch: ${{ env.DEFAULT_BRANCH }}"
echo "Branch base_ref: ${{ github.base_ref }}"
echo "Weaver branch: ${{ env.BRANCH_NAME }}"
echo "PR target branch (if any): ${{ github.base_ref }}"
echo "Lara framework ref: ${{ steps.repo-refs.outputs.lara_ref }}"
echo "Lara framework default: ${{ steps.repo-refs.outputs.lara_default }}"
echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}"
echo "Specs-java-libs default: ${{ steps.repo-refs.outputs.specs_default }}"

- name: Checkout lara-framework
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: specs-feup/lara-framework
path: lara-framework
ref: ${{ steps.Branch-lara-framework.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }}
ref: ${{ steps.repo-refs.outputs.lara_ref }}

- name: Checkout specs-java-libs
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: specs-feup/specs-java-libs
path: specs-java-libs
ref: ${{ steps.Branch-specs-java-libs.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }}
ref: ${{ steps.repo-refs.outputs.specs_ref }}

- name: Build with Gradle
run: |
Expand Down Expand Up @@ -148,16 +184,16 @@ jobs:
echo 'export PATH="$(brew --prefix gcc)/bin:$PATH"' >> $GITHUB_ENV

- name: Checkout Clava
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: clava

- name: Checkout lara-framework
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: specs-feup/lara-framework
path: lara-framework
ref: ${{ needs.build-java.outputs.branch-exists-lara-framework == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }}
ref: ${{ needs.build-java.outputs.lara_ref }}

- name: Setup js workspace
run: |
Expand Down
8 changes: 6 additions & 2 deletions Clava-JS/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { fileURLToPath } from "url";
import { dirname } from "path";
import typescriptEslint from "typescript-eslint";
import tsdoc from "eslint-plugin-tsdoc";
import jest from "eslint-plugin-jest";
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

export default [
js.configs.recommended,
eslintConfigPrettier,
Expand All @@ -18,14 +23,13 @@ export default [
},

languageOptions: {
tsconfigRootDir: __dirname,

parser: typescriptEslint.parser,
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
project: ["./*/tsconfig.json", "./tsconfig.*.json"],
tsconfigRootDir: __dirname,
},
},

Expand Down
26 changes: 13 additions & 13 deletions Clava-JS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@
"homepage": "https://github.com/specs-feup/clava#readme",
"dependencies": {
"@specs-feup/lara": "~3.5.0",
"cytoscape": "^3.0.0"
"cytoscape": "^3.33.1"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@jest/globals": "^30.2.0",
"@types/debug": "^4.1.12",
"@types/java": "^0.9.6",
"@types/jest": "^29.5.14",
"@types/jest": "^30.0.0",
"@types/node": "^20.14.10",
"@types/yargs": "^17.0.33",
"typescript-eslint": "^8.26.1",
"cross-env": "^7.0.3",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-tsdoc": "^0.4.0",
"jest": "^29.7.0",
"@types/yargs": "^17.0.35",
"cross-env": "^10.1.0",
"eslint": "^9.32.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-jest": "^29.12.1",
"eslint-plugin-tsdoc": "^0.5.0",
"jest": "^30.2.0",
"node-notifier": "^10.0.1",
"ts-jest": "^29.2.6",
"typescript": "^5.9.0"
"ts-jest": "^29.4.6",
"typescript": "^5.9.3",
"typescript-eslint": "^8.52.0"
}
}
9 changes: 5 additions & 4 deletions Clava-JS/src-api/clava/Clava.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class Clava {
}

const $file = wrapJoinPoint(
ClavaJavaTypes.AstFactory.file(file.getAbsolutePath(), "")
ClavaJavaTypes.AstFactory.file(Weaver.getWeaverEngine(), file.getAbsolutePath(), "")
) as FileJp;
Clava.addFile($file);
}
Expand Down Expand Up @@ -187,6 +187,7 @@ extern "C" {
}

const $newJp = ClavaJavaTypes.CxxWeaverApi.findJp(
Weaver.getWeaverEngine(),
$file.filepath,
$jp.astId
);
Expand All @@ -209,7 +210,7 @@ extern "C" {
static writeCode(outputFoldername: string) {
const outputFolder = Io.mkdir(outputFoldername);

ClavaJavaTypes.CxxWeaverApi.writeCode(outputFolder);
ClavaJavaTypes.CxxWeaverApi.writeCode(Weaver.getWeaverEngine(), outputFolder);

return outputFolder;
}
Expand All @@ -233,14 +234,14 @@ extern "C" {
* @returns A list of join points representing available user includes
*/
static getAvailableIncludes(): JavaClasses.List<Include> {
return ClavaJavaTypes.CxxWeaverApi.getAvailableUserIncludes();
return ClavaJavaTypes.CxxWeaverApi.getAvailableUserIncludes(Weaver.getWeaverEngine());
}

/**
*
* @returns {J#Set<String>} A set with paths to the include folders of the current configuration.
*/
static getIncludeFolders() {
return ClavaJavaTypes.CxxWeaverApi.getIncludeFolders();
return ClavaJavaTypes.CxxWeaverApi.getIncludeFolders(Weaver.getWeaverEngine());
}
}
Loading
Loading