Skip to content

Commit

Permalink
Merge pull request #7 from es-ude/refactor-util
Browse files Browse the repository at this point in the history
Refactor util
  • Loading branch information
glencoe committed Sep 13, 2019
2 parents 4fe141d + 387aa64 commit 1ddbb8f
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 35 deletions.
136 changes: 131 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,133 @@
# Created by https://www.gitignore.io/api/clion,bazel,macos,visualstudiocode
# Edit at https://www.gitignore.io/?templates=clion,bazel,macos,visualstudiocode

### Bazel ###
# gitignore template for Bazel build system
# website: https://bazel.build/

# Ignore all bazel-* symlinks. There is no full list since this can change
# based on the name of the directory bazel is cloned into.
/bazel-*

### CLion ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### CLion Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### VisualStudioCode Patch ###
# Ignore all local history of files
.history

# End of https://www.gitignore.io/api/clion,bazel,macos,visualstudiocode

bazel-*
compile_commands.json
user.bazelrc
docs/_build/
docs/xml/
38 changes: 21 additions & 17 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_deb", "pkg_tar")

filegroup(
name = "UtilHeaders",
srcs = glob(["Util/*.h"]),
srcs = glob(["EmbeddedUtilities/*.h"]),
)

cc_library(
name = "Util",
name = "EmbeddedUtilities",
srcs = glob([
"src/**/*.c",
"src/**/*.h",
Expand All @@ -26,7 +26,7 @@ cc_library(

cc_library(
name = "BitManipulation",
hdrs = ["Util/BitManipulation.h"],
hdrs = ["EmbeddedUtilities/BitManipulation.h"],
visibility = ["//visibility:public"],
)

Expand All @@ -36,9 +36,9 @@ cc_library(
"src/Mutex.c",
],
hdrs = [
"Util/Atomic.h",
"Util/Callback.h",
"Util/Mutex.h",
"EmbeddedUtilities/Atomic.h",
"EmbeddedUtilities/Callback.h",
"EmbeddedUtilities/Mutex.h",
],
linkstatic = True,
visibility = ["//visibility:public"],
Expand All @@ -48,9 +48,9 @@ cc_library(
cc_library(
name = "MutexHdrsOnly",
hdrs = [
"Util/Atomic.h",
"Util/Callback.h",
"Util/Mutex.h",
"EmbeddedUtilities/Atomic.h",
"EmbeddedUtilities/Callback.h",
"EmbeddedUtilities/Mutex.h",
],
linkstatic = True,
visibility = ["//visibility:public"],
Expand All @@ -63,7 +63,7 @@ cc_library(
"src/PeriodicSchedulerIntern.h",
],
hdrs = [
"Util/PeriodicScheduler.h",
"EmbeddedUtilities/PeriodicScheduler.h",
],
linkstatic = True,
visibility = ["//visibility:public"],
Expand All @@ -76,7 +76,7 @@ cc_library(
cc_library(
name = "PeriodicSchedulerHdrsOnly",
hdrs = [
"Util/PeriodicScheduler.h",
"EmbeddedUtilities/PeriodicScheduler.h",
],
linkstatic = True,
visibility = ["//visibility:public"],
Expand All @@ -85,15 +85,15 @@ cc_library(
cc_library(
name = "Debug",
hdrs = [
"Util/Debug.h",
"EmbeddedUtilities/Debug.h",
],
visibility = ["//visibility:public"],
)

cc_library(
name = "Callback",
hdrs = [
"Util/Callback.h",
"EmbeddedUtilities/Callback.h",
],
visibility = ["//visibility:public"],
)
Expand All @@ -104,7 +104,7 @@ cc_library(
"src/MultiReaderBuffer.c",
],
hdrs = [
"Util/MultiReaderBuffer.h",
"EmbeddedUtilities/MultiReaderBuffer.h",
],
linkstatic = True,
visibility = ["//visibility:public"],
Expand All @@ -124,14 +124,18 @@ other projects.
"""

exports_files(
srcs = glob(["Util/**/*.h"]),
srcs = glob(["EmbeddedUtilities/**/*.h"]),
visibility = ["//visibility:public"],
)

pkg_tar(
name = "pkg",
srcs = glob(["Util/*.h", "src/*.c", "src/*.h"]) + ["BUILD"],
srcs = glob([
"EmbeddedUtilities/*.h",
"src/*.c",
"src/*.h",
]) + ["BUILD"],
extension = "tar.gz",
mode = "0644",
strip_prefix = ".",
)
)
2 changes: 1 addition & 1 deletion Util/Atomic.h → EmbeddedUtilities/Atomic.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef COMMUNICATIONMODULE_ATOMIC_H
#define COMMUNICATIONMODULE_ATOMIC_H

#include "Util/Callback.h"
#include "EmbeddedUtilities/Callback.h"

/**
* \file Util/Atomic.h
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/MultiReaderBuffer.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Util/MultiReaderBuffer.h"
#include "EmbeddedUtilities/MultiReaderBuffer.h"
#include "CException.h"

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Mutex.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Util/Mutex.h"
#include "Util/Atomic.h"
#include "EmbeddedUtilities/Mutex.h"
#include "EmbeddedUtilities/Atomic.h"
#include "CException.h"
#include <stdbool.h>
#include <stddef.h>
Expand Down
4 changes: 2 additions & 2 deletions src/PeriodicScheduler.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Util/Debug.h"
#include "Util/PeriodicScheduler.h"
#include "EmbeddedUtilities/Debug.h"
#include "EmbeddedUtilities/PeriodicScheduler.h"
#include "src/PeriodicSchedulerIntern.h"

PeriodicScheduler *
Expand Down
2 changes: 1 addition & 1 deletion src/PeriodicSchedulerIntern.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PERIODICSCHEDULER_PERIODICSCHEDULERINTERN_H
#define PERIODICSCHEDULER_PERIODICSCHEDULERINTERN_H

#include "Util/PeriodicScheduler.h"
#include "EmbeddedUtilities/PeriodicScheduler.h"

static void
executeTaskIfDue(InternalTask *tasks, uint8_t index);
Expand Down
2 changes: 1 addition & 1 deletion test/BitManipulation_Test.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "unity.h"
#include "Util/BitManipulation.h"
#include "EmbeddedUtilities/BitManipulation.h"
// #include "CommunicationModule/Mac802154.h"

#define ADDRESSING_MODE_SHORT_ADDRESS 0b10 // source: "CommunicationModule/Mac802154.h"
Expand Down
2 changes: 1 addition & 1 deletion test/MultiReaderBuffer_Test.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <unity.h>
#include <CException.h>
#include "Util/MultiReaderBuffer.h"
#include "EmbeddedUtilities/MultiReaderBuffer.h"

#define BUFFER_WORD_SIZE (2)
#define MAX_ELEMENTS (50)
Expand Down
4 changes: 2 additions & 2 deletions test/Mutex_Test.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Util/Atomic.h"
#include "Util/Mutex.h"
#include "EmbeddedUtilities/Atomic.h"
#include "EmbeddedUtilities/Mutex.h"
#include <CException.h>
#include <stdbool.h>
#include <unity.h>
Expand Down
4 changes: 2 additions & 2 deletions test/PeriodicScheduler_Test.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Util/Debug.h"
#include "Util/PeriodicScheduler.h"
#include "EmbeddedUtilities/Debug.h"
#include "EmbeddedUtilities/PeriodicScheduler.h"
#include <CException.h>
#include <stdio.h>
#include <unity.h>
Expand Down

0 comments on commit 1ddbb8f

Please sign in to comment.