So I have this codebase called Grimoire that contains most of the things I've found worth doing twice, well.
Parsers, FA state generators, Network stuff, even MIDI processing.
Then when i want to use it, I include the relevant code.
When it started, it was just snippets almost.
Then as my library matured, I started building elaborate frameworks and it got overwhelming to keep self-contained code to its own source file.
See my "tried" portion and tell me if there's a better way to manage complex source dependencies.
Normally I'd use DLLs for everything like everyone else does but i like to build standalone exes because they're easier to distribute and install. they're usually self installing too.
What I have tried:
To remedy the issue and keep sourcecode into easy to include format I built a way to generate merged and 'minified' "bricks" of source code which I then "symbolic link" into my project from the core repository. That way I don't have to add half a dozen files for bit of functionality, and I don't have to keep track of all those cross dependencies in my head. They're all in a single "brick" generated using a VS custom tool from a set of input files. This makes it so i only need to reference one file in my destination project, and that includes all of my necessary library code.
I feel I missed whatever better way came along in the past decade or so that i've been out of development professionally.
________________________ example part of "code brick" ________________
// Dependencies for Cauldron
#define COLLECTIONUTILITY_CS
#define STRINGUTILITY_CS
#define STRINGUTILITY_PARSING_CS
#define PARSECONTEXTEXPRESSIONS_REGEX_CS
#define STRINGUTILITY_RANGES_CS
#define STRINGUTILITY_PARSING_CSHARP_CS
#define STRINGUTILITY_PARSING_T4_CS
#define FAUTILITY_CS
#define FAUTILITY_CODEGENERATOR_CS
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
#if !GRIMOIRELIB
namespace Grimoire{using System;using System.Collections;using System.Collections.Generic;using IEnumerable
=System.Collections.IEnumerable;using IEnumerator=System.Collections.IEnumerator;
#if GRIMOIRELIB
public
#else
internal
#endif
static partial class CollectionUtility{
#region CollectionAdapter
internal sealed class CollectionAdapter:ICollection{internal CollectionAdapter(IEnumerable inner){_inner
=inner;}readonly IEnumerable _inner;public int Count{get{return Count(_inner);}}public bool IsSynchronized
{get{return false;}}object ICollection.SyncRoot{get{return this;}}public void CopyTo(Array array,int
index){CollectionUtility.CopyTo(_inner,array,index);}public IEnumerator GetEnumerator(){return _inner.GetEnumerator();
}}internal sealed class CollectionAdapter<t>:ICollection<t>{internal CollectionAdapter(IEnumerable<t>
inner){_inner=inner;}readonly IEnumerable<t>_inner;public int Count{get{return Count(_inner);}}public
bool IsReadOnly{get{return true;}}public void CopyTo(T[]array,int index){CollectionUtility.CopyTo(_inner,
array,index);}public IEnumerator<t>GetEnumerator(){return _inner.GetEnumerator();}void ICollection<t>.Add(T
item){throw new NotSupportedException("The collection is read-only.");}bool ICollection<t>.Remove(T
item){throw new NotSupportedException("The collection is read-only.");}void ICollection<t>.Clear(){
throw new NotSupportedException("The collection is read-only.");}public bool Contains(T item){return
Contains<t>(_inner,item);}IEnumerator IEnumerable.GetEnumerator(){return _inner.GetEnumerator();}}
#endregion CollectionAdapter