Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make-generated version defs #38

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,19 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Git describe
id: ghd
uses: proudust/gh-describe@v1

- name: Install and setup MSYS2 mingw
if: runner.os == 'Windows' && matrix.compiler == 'mingw-w64'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
install: mingw-w64-x86_64-toolchain make gcc diffutils
install: mingw-w64-x86_64-toolchain make gcc diffutils git

- name: Build and test windows mingw
if: runner.os == 'Windows' && matrix.compiler == 'mingw-w64'
Expand All @@ -75,13 +81,13 @@ jobs:
make

- name: Install and setup msvc prompt
if: runner.os == 'Windows'
if: runner.os == 'Windows' && matrix.compiler == 'cl'
uses: ilammy/msvc-dev-cmd@v1

- name: Build and test windows MSVC
if: runner.os == 'Windows' && matrix.compiler == 'cl'
run: |
.\build_msvc.bat --clean
.\build_msvc.bat --version ${{ steps.ghd.outputs.describe }}

- name: Install and setup Linux packages
if: runner.os == 'Linux'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/debs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
with:
docker-image: "debian:${{ matrix.dist }}-slim"
buildpackage-opts: --build=binary --no-sign
extra-build-deps: git

- name: Upload deb files
uses: actions/upload-artifact@v3
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
with:
docker-image: "debian:${{ matrix.dist }}-slim"
buildpackage-opts: --build=binary --no-sign
extra-build-deps: git

- name: Upload deb files
uses: actions/upload-artifact@v3
Expand All @@ -65,7 +66,7 @@ jobs:
id: get_version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo ${{ env.VERSION }}
echo ${VERSION }

- uses: actions/checkout@v3
with:
Expand All @@ -74,6 +75,11 @@ jobs:
# download all artifacts to project dir
- uses: actions/download-artifact@v3

- name: Generate source release
run: |
make cccc dist
ls dist

- name: Generate changes file
uses: sarnold/gitchangelog-action@v1
with:
Expand All @@ -92,3 +98,4 @@ jobs:
prerelease: false
files: |
packages/*.deb
dist/*.gz
25 changes: 19 additions & 6 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,42 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Add 64-bit mingw-w64 to the PATH
run: |
echo "c:/msys64/bin;c:/msys64/mingw64/bin" >> $GITHUB_PATH
which gcc
if: startsWith(matrix.os, 'win')

- name: build
run: make cccc
- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: run test
run: make test
- name: Add requirements
run: |
python -m pip install --upgrade pip
pip install tox

- name: Build and test
run: |
tox -e build

windows:
runs-on: windows-2019

steps:
- uses: actions/checkout@v3

- name: Git describe
id: ghd
uses: proudust/gh-describe@v1

- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1

- name: Build
run: |
.\build_msvc.bat --clean
.\cccc.exe
.\build_msvc.bat --version ${{ steps.ghd.outputs.describe }}
.\cccc.exe --version
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

cccc/cccc

dist/
doxygen/*
ccccout/*
pccts/bin/*
Expand All @@ -20,6 +21,7 @@ cccc/Jtokens.h
cccc/cccc.cpp
cccc/java.cpp
cccc/parser.dlg
cccc/cccc_ver.h

# generated test output
test/.cccc/*
Expand Down
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LD ?= g++
DOX = doxygen
CCCC = ./cccc/cccc
CCCOPTS = --lang=c++
CCCCSRC = ./cccc/*.cc ./cccc/*.h
CCCCSRC = ./cccc/*.cc ./cccc/*.cpp ./cccc/*.h
GENSRC = cccc/CLexer.cpp \
cccc/CLexer.h \
cccc/CParser.cpp \
Expand All @@ -30,7 +30,7 @@ GENSRC = cccc/CLexer.cpp \
cccc/java.cpp \
cccc/parser.dlg

.PHONY : all mini pccts cccc test
.PHONY : all mini pccts cccc test dist clean

all : mini cccc test

Expand Down Expand Up @@ -70,12 +70,21 @@ docs : Doxyfile.html_cfg $(CCCCSRC) $(DOCS)/.keep_dir
$(DOX) Doxyfile.html_cfg
@echo "API docs now in $(DOCS)/html"

# dist target requires VERSION set in build environment
dist : clean
mkdir -p dist/cccc-$(VERSION)
cp *.rst *.md build* LICENSE tox.ini Makefile dist/cccc-$(VERSION)/
cp -r cccc conda test dist/cccc-$(VERSION)/
tar -czf dist/cccc-$(VERSION).tar.gz -C dist cccc-$(VERSION)

clean :
rm -rf cccc/*.o cccc/cccc $(GENSRC) pccts/bin/*
rm -f cccc/*.o cccc/cccc

reallyclean : clean
rm -rf ccccout/* doxygen/html test/.cccc $(TESTOBJ)
rm -f pccts/bin/* $(TESTOBJ) $(GENSRC)
rm -rf ccccout/ doxygen/ test/.cccc dist/
make -C pccts clean

clobber : reallyclean
rm -f cccc/cccc_ver.h
make -C pccts scrub
78 changes: 57 additions & 21 deletions README.md → README.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
README for CCCC versions 3.2.x
==============================

[![Github CI](https://github.com/sarnold/cccc/actions/workflows/ci.yml/badge.svg)](https://github.com/sarnold/cccc/actions/workflows/ci.yml)
[![Conda CI](https://github.com/sarnold/cccc/actions/workflows/conda.yml/badge.svg)](https://github.com/sarnold/cccc/actions/workflows/conda.yml)
[![Debian packages](https://github.com/sarnold/cccc/actions/workflows/debs.yml/badge.svg)](https://github.com/sarnold/cccc/actions/workflows/debs.yml)
[![Release CI](https://github.com/sarnold/cccc/actions/workflows/release.yml/badge.svg)](https://github.com/sarnold/cccc/actions/workflows/release.yml)
|ci| |conda| |debs| |release|

[![CCCC License](https://img.shields.io/badge/license-GPL2-green.svg?dummy)](https://github.com/sarnold/cccc/blob/master/cccc/COPYING)
![GitHub tag (latest SemVer pre-release)](https://img.shields.io/github/v/tag/sarnold/cccc?include_prereleases)
[![Github Issues](https://img.shields.io/github/issues/sarnold/cccc)](https://github.com/sarnold/cccc/issues?q=is:issue+is:open)
|tag| |license| |issues|

[![Conda Version](https://img.shields.io/conda/vn/conda-forge/cccc.svg)](https://anaconda.org/conda-forge/cccc)
[![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/cccc.svg)](https://anaconda.org/conda-forge/cccc)
|vconda| |pconda|

What is it?
-----------

This is a maintenance update of the last (sourceforge) release of the program
CCCC (C and C++ Code Counter). This software performs analysis and reports
Expand All @@ -21,12 +18,22 @@ Ada95, which were supported in previous versions are presently not supported
new site for CCCC development is: https://github.com/sarnold/cccc and for
current documentation see: http://sarnold.github.io/cccc/

* [Github Action](https://github.com/marketplace/actions/cccc-action) - Now available as a github action!
* [Quick Install](https://github.com/sarnold/cccc/blob/master/README_install.rst) - Quick start install instructions
* [User Guide](http://sarnold.github.io/cccc/CCCC_User_Guide.html) - User guide (updated)
* [Release Notes](https://github.com/sarnold/cccc/blob/master/CHANGELOG.md) - Autogenerated changelog for github releases (with a little SVN history for context)
* [Software API docs](http://sarnold.github.io/cccc/api/html/index.html) - Software API documentation with design diagrams, etc
* [Complexity Metrics](http://sarnold.github.io/cccc/metrics/cccc.html) - Source code metrics for a source code metrics tool... ;)
* `Github Action`_ - Now available as a github action!
* `Quick Install`_ - Quick start install instructions
* `User Guide`_ - User guide (updated)
* `Release Notes`_ - Autogenerated changelog for github releases (with a little SVN history for context)
* `Software API docs`_ - Software API documentation with design diagrams, etc
* `Complexity Metrics`_ - Source code metrics for a source code metrics tool... ;)

.. _Github Action: https://github.com/marketplace/actions/cccc-action
.. _Quick Install: https://github.com/sarnold/cccc/blob/master/README_install.rst
.. _User Guide: http://sarnold.github.io/cccc/CCCC_User_Guide.html
.. _Release Notes: https://github.com/sarnold/cccc/blob/master/CHANGELOG.md
.. _Software API docs: http://sarnold.github.io/cccc/api/html/index.html
.. _Complexity Metrics: http://sarnold.github.io/cccc/metrics/cccc.html

Background
----------

CCCC is a command line tool, originally implemented for Linux and other
POSIX-style platforms, but also buildable on the Win32 platform. Files
Expand Down Expand Up @@ -67,6 +74,9 @@ to which you have and whether it is installed at the default position
in the filesystem). On Linux and similar platforms the shell script
build_posixgcc.sh should still work.

Historical
----------

As of the last upstream release (ver 3.1.4) the reference build tool for the
Win32 platform is the freely distributed Microsoft Visual C++ Toolkit 2003.
As this toolkit does not contain a 'make' style program the script
Expand Down Expand Up @@ -125,7 +135,10 @@ domain with no restrictions, other than the pious hope that should anyone
base a derivative work on it I will be given due credit. The current version
is released under the GNU Public License (including the bundled PCCTS source).

The upcoming 3.1.5 release will be a maintenance release to clean up the build and
Notes from the maintainer
-------------------------

The initial 3.1.5 release was a maintenance release to clean up the build and
makefile config (enabling parallel make) and fix a build error with recent gcc.
The pccts build target "mini" builds only the tools required to build cccc,
while the make target "pccts" builds the complete toolset, and "all" will build
Expand All @@ -137,10 +150,8 @@ of (expensive) commercial engineering tools. It has a simple CLI and other
support like Jenkins plugins. Use it to find out your own complexity metrics.
You might be surprised...

The above updates by Stephen L Arnold.

Notes from the original author
==============================
------------------------------

CCCC was originally developed as a proof-of-concept tool for some ideas
relating to software metrics which I was investigating as an academic
Expand Down Expand Up @@ -169,13 +180,38 @@ available for the forseeable future from https://github.com/sarnold/cccc
as well as the original home at http://cccc.sourceforge.net


.. |ci| image:: https://github.com/sarnold/cccc/actions/workflows/ci.yml/badge.svg
:target: https://github.com/sarnold/cccc/actions/workflows/ci.yml
:alt: CI Status

.. |conda| image:: https://github.com/sarnold/cccc/actions/workflows/conda.yml/badge.svg
:target: https://github.com/sarnold/cccc/actions/workflows/conda.yml
:alt: Conda Status

.. |debs| image:: https://github.com/sarnold/cccc/actions/workflows/debs.yml/badge.svg
:target: https://github.com/sarnold/cccc/actions/workflows/release.yml
:alt: Debian packages

.. |release| image:: https://github.com/sarnold/cccc/actions/workflows/release.yml/badge.svg
:target: https://github.com/sarnold/cccc/actions/workflows/release.yml
:alt: Release Status

.. |license| image:: https://img.shields.io/badge/license-GPL2-green.svg?dummy
:target: https://github.com/sarnold/cccc/blob/master/cccc/COPYING
:alt: License

.. |tag| image:: https://img.shields.io/github/v/tag/sarnold/cccc?include_prereleases
:target: https://github.com/sarnold/cccc/releases
:alt: GitHub tag (latest SemVer pre-release)

.. |issues| image:: https://img.shields.io/github/issues/sarnold/cccc
:target: https://github.com/sarnold/cccc/issues?q=is:issue+is:open
:alt: Issues

.. |vconda| image:: https://img.shields.io/conda/vn/conda-forge/cccc.svg
:target: https://anaconda.org/conda-forge/cccc
:alt: Conda Version



.. |pconda| image:: https://img.shields.io/conda/pn/conda-forge/cccc.svg
:target: https://anaconda.org/conda-forge/cccc
:alt: Conda Platforms
15 changes: 5 additions & 10 deletions build_msvc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,17 @@ REM for cccc.exe install
set BIN_DIR="%PREFIX%"\\bin

set arg1=%1

if "%arg1%"=="--version" (
echo // This version built on %HOSTNAME% at %DATE% > cccc\cccc_ver.h
echo #define CCCC_VERSION %2 >> cccc\cccc_ver.h
echo #define BUILD_HOST %HOSTNAME% > cccc\cccc_ver.h
echo #define BUILD_TIME %DATE% >> cccc\cccc_ver.h
echo #define CCCC_VERSION_DEV %2 >> cccc\cccc_ver.h
echo #define CCCC_VERSION_STRING "%2" >> cccc\cccc_ver.h
set arg1=--clean
)
if "%arg1%"=="--installer" (
goto :buildInstaller
)


if "%arg1%"=="--clean" (
for %%d in ( pccts\dlg pccts\antlr cccc ) do (
if exist %%d\*.obj del %%d\*.obj
Expand Down Expand Up @@ -145,8 +144,10 @@ call run_test java prn13
call run_test java prn14
call run_test java prn15
call run_test java prn16
echo All tests passed
cd ..
endlocal
if not exist "c:\Program Files\My Inno Setup Extensions\iscc.exe" goto :end

rem The visual C++ addin can't be built using MS Visual C++ Toolkit 2003
rem because it doesn't provide MFC header files and libraries
Expand Down Expand Up @@ -185,10 +186,4 @@ echo Please rerun the script with the argument --clean to build these binaries.
goto :end



:end





3 changes: 0 additions & 3 deletions cccc/cccc_ver.h

This file was deleted.

Loading