schtanislau
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2015
06:24 AM
source folder structure
Hello!
Excuse me, I have a question regarding 'source' folder structure. I understand, that we can have any kind of structure in the 'source' folder, but it can slower the compilation time.
Assuming, that I have this kind of structure:
source/
source/common
source/common/test1.brs
source/utilities
source/utilities/test2.brs
source/classes
source/classes/test3.brs
source/appMain.brs
I understand, that the app.mk file in the RokuSDK needs to be adjusted so it will compile files not only in the 'source' folder, but even in the nested folders.
I'm not sure how to adjust this code for '/utilities' and '/classes' folders.
Can anyone help me on this? Thank you 🙂
Excuse me, I have a question regarding 'source' folder structure. I understand, that we can have any kind of structure in the 'source' folder, but it can slower the compilation time.
Assuming, that I have this kind of structure:
source/
source/common
source/common/test1.brs
source/utilities
source/utilities/test2.brs
source/classes
source/classes/test3.brs
source/appMain.brs
I understand, that the app.mk file in the RokuSDK needs to be adjusted so it will compile files not only in the 'source' folder, but even in the nested folders.
DISTREL = ../../dist
COMMONREL = ../common
SOURCEREL = ..
ZIPREL = $(DISTREL)/apps
PKGREL = $(DISTREL)/packages
APPSOURCEDIR = source
IMPORTFILES = $(foreach f,$(IMPORTS),$(COMMONREL)/$f.brs)
IMPORTCLEANUP = $(foreach f,$(IMPORTS),$(APPSOURCEDIR)/$f.brs)
I'm not sure how to adjust this code for '/utilities' and '/classes' folders.
Can anyone help me on this? Thank you 🙂
5 REPLIES 5
Veeta
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2015
11:54 AM
Re: source folder structure
I don't quite understand "can slower the compilation time" comment. But the app.mk by default will use "zip -r" and gather up all sources in the subdirectories as well.
schtanislau
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015
12:27 AM
Re: source folder structure
It will zip all folders and sub directories, but will it be possible i.e. to access functions from /source/utilities/test.brs from /source/appMain.brs ? I think not.
Regarding slowing the compilation time - last post in this thread 🙂
Regarding slowing the compilation time - last post in this thread 🙂
schtanislau
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015
01:46 AM
Re: source folder structure
Just tested my helloworld app. Actually, I can call function from source/folder/functions.brs in source/appMain.brs.
Question is closed :oops:
Question is closed :oops:
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2015
02:55 PM
Re: source folder structure
"schtanislau" wrote:
It will zip all folders and sub directories, but will it be possible i.e. to access functions from /source/utilities/test.brs from /source/appMain.brs ? I think not.
Regarding slowing the compilation time - last post in this thread 🙂
That same thread is telling you that B/S interpreter will "slurp" all BRS files under /source, regardless of the directory (sub)structure. Everything will be #included, everything will be flattened, there are no packages and namespaces, it's equivalent to concatenating everything to one file.
And may i share personal opinion: there is no point of breaking your source to subdirectories, there is no point of splitting it to separate files either - unless you are sharing codebase between different projects. No need to split to multiple files till your source is at least 2000 lines long. No need to organize in subdirectory structure till you have at least couple of dozen files. Writing in a high-level language, that means at least 20k lines - which is a massive, massive, massive undertaking not likely to be your case. I just published a puzzle game and it is under 2k lines total. All code in one file - lock, stock, and barrel. So, umm...

Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2015
03:03 PM
Re: source folder structure
I have all my brs files in one folder, and I prefer to keep them under 1000 lines, far under usually. I like separate files divided into various sections/categories, so I can have them open in multiple tabs and "see" everything I'm doing without scrolling up and down much. But yeah, it all just gets lumped together in the end.