Skip to content
Merged
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
57 changes: 57 additions & 0 deletions migration/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
#
# sonar-tools
# Copyright (C) 2025 Olivier Korach
# mailto:olivier.korach AT gmail DOT com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
CONF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

build_image=1
release=0
release_docker=0

while [[ $# -ne 0 ]]; do
case "${1}" in
nodocker)
build_image=0
;;
pypi)
release=1
;;
dockerhub)
release_docker=1
;;
*)
;;
esac
shift
done

rm -rf "${ROOT_DIR}/build/lib/migration" "${ROOT_DIR}/build/lib/cli" "${ROOT_DIR}/build/lib/sonar" "${ROOT_DIR}"/build/scripts*/sonar_migration "${ROOT_DIR}"/dist/sonar_migration*
mv "${ROOT_DIR}/pyproject.toml" "${ROOT_DIR}/pyproject.toml.sonar-tools"
cp "${ROOT_DIR}/migration/pyproject.toml" "${ROOT_DIR}"
poetry build
mv "${ROOT_DIR}/pyproject.toml.sonar-tools" "${ROOT_DIR}/pyproject.toml"

# Deploy locally for tests
pip install --upgrade --force-reinstall "${ROOT_DIR}"/dist/sonar_migration-*-py3-*.whl

if [[ "${build_image}" == "1" ]]; then
docker build -t olivierkorach/sonar-migration:latest -f migration/snapshot.Dockerfile "${ROOT_DIR}" --load
fi
2 changes: 1 addition & 1 deletion migration/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ requires = [
]

[tool.poetry]
packages = [{include = "sonar"}, {include = "migration"}]
packages = [{include = "sonar"}, {include = "migration"}, {include = "cli"}]

[dependency-groups]
test = [
Expand Down
4 changes: 1 addition & 3 deletions migration/release.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
WORKDIR /opt/sonar-migration

COPY ./sonar sonar
COPY ./requirements.txt .
COPY ./cli cli
COPY ./setup_migration.py .
COPY ./migration migration
COPY ./migration/README.md .
COPY ./LICENSE .
COPY ./sonar/audit sonar/audit

RUN pip install --upgrade pip \
&& pip install sonar-migration==0.4 --force-reinstall
&& pip install sonar-migration==0.6 --force-reinstall

USER ${USERNAME}
WORKDIR /home/${USERNAME}
Expand Down
9 changes: 4 additions & 5 deletions migration/snapshot.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
WORKDIR /opt/sonar-migration

COPY ./sonar sonar
COPY ./requirements.txt .
COPY ./migration/pyproject.toml .
COPY ./migration migration
COPY ./migration/README.md .
COPY ./LICENSE .
COPY ./cli cli
COPY ./setup_migration.py .

RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir --upgrade pip setuptools wheel \
&& python setup_migration.py bdist_wheel \
&& pip install --no-cache-dir poetry \
&& poetry build \
&& pip install dist/sonar_migration-*-py3-*.whl --force-reinstall

USER ${USERNAME}
Expand Down
12 changes: 0 additions & 12 deletions requirements-to-build.txt

This file was deleted.

7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

84 changes: 0 additions & 84 deletions setup.py

This file was deleted.

67 changes: 0 additions & 67 deletions setup_migration.py

This file was deleted.

5 changes: 2 additions & 3 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sonar.projectName=Sonar Tools
sonar.python.version=3.9

# Comma-separated paths to directories with sources (required)
sonar.sources=sonar, cli, migration, conf, setup.py, setup_migration.py
sonar.sources=sonar, cli, migration, conf

# Encoding of the source files
sonar.sourceEncoding=UTF-8
Expand All @@ -16,6 +16,5 @@ sonar.sarifReportPaths=build/results_sarif.sarif
# sonar.python.bandit.reportPaths=build/bandit-report.json

sonar.tests=test/gen/latest, test/gen/lts, test/gen/9, test/gen/9-ce, test/gen/cb
sonar.coverage.exclusions=setup*.py, test/**/*, conf/*2sonar.py, cli/cust_measures.py, sonar/custom_measures.py, cli/support.py, cli/projects_export.py, cli/projects_import.py, **/*.sh
sonar.coverage.exclusions=test/**/*, conf/*2sonar.py, cli/cust_measures.py, sonar/custom_measures.py, cli/support.py, cli/projects_export.py, cli/projects_import.py, **/*.sh

sonar.cpd.exclusions=setup*.py