digitalmars.D - A little project
- Andrei Alexandrescu (39/39) Feb 03 2010 I'd like to propose a small project suggested by Walter. If anyone could...
- Ellery Newcomer (2/40) Feb 04 2010
- torhu (1/1) Feb 04 2010 superretard, is it?
I'd like to propose a small project suggested by Walter. If anyone could take this up, it would be great. The project is a small utility program that could be a good complement to the likes of rdmd. The program allows you to play with entire D projects as zip files. It takes a zip file, extracts the files if needed, and builds it. Many improvements can be easily imagined. I paste below a rudimentary prototype that I wrote for Linux. It has many shortcomings; don't hold them against me, I wrote that script in less time than it takes "retard" to switch from smug to sarcastic. If anyone would like to take this over, that would be great. Thanks! Andrei // Accepted extensions auto extensions = [ "d", "di", "a", "o" ]; int main(string[] args) { // The one and only parameter is the zip file auto zip = args[1]; if (!exists(zip)) { stderr.writeln("Zip file missing: `", zip, "'"); stderr.writeln("Usage: dmdz file.zip"); return 1; } // Target directory auto tgt = "/tmp/" ~ zip; // Binary result is the name of the zip without the .zip auto bin = replace(zip, ".zip", ""); // Was the zip file already extracted? If not, extract it if (lastModified(zip) >= lastModified(tgt, d_time.min)) { system("mkdir --parents " ~ tgt); system("unzip " ~ zip " -d " tgt ~ " >/dev/null"); } // Compile all files with accepted extensions auto find = "find . -type f -false "; foreach (ext; extensions) { find ~= " -or -iname '*." ~ ext ~ "'"; } return system("cd " ~ tgt ~ " && dmd -of" ~ bin ~ " `eval " ~ find ~ "`"); }
Feb 03 2010
I'll volunteer if no one else has On 02/03/2010 09:01 PM, Andrei Alexandrescu wrote:I'd like to propose a small project suggested by Walter. If anyone could take this up, it would be great. The project is a small utility program that could be a good complement to the likes of rdmd. The program allows you to play with entire D projects as zip files. It takes a zip file, extracts the files if needed, and builds it. Many improvements can be easily imagined. I paste below a rudimentary prototype that I wrote for Linux. It has many shortcomings; don't hold them against me, I wrote that script in less time than it takes "retard" to switch from smug to sarcastic. If anyone would like to take this over, that would be great. Thanks! Andrei // Accepted extensions auto extensions = [ "d", "di", "a", "o" ]; int main(string[] args) { // The one and only parameter is the zip file auto zip = args[1]; if (!exists(zip)) { stderr.writeln("Zip file missing: `", zip, "'"); stderr.writeln("Usage: dmdz file.zip"); return 1; } // Target directory auto tgt = "/tmp/" ~ zip; // Binary result is the name of the zip without the .zip auto bin = replace(zip, ".zip", ""); // Was the zip file already extracted? If not, extract it if (lastModified(zip) >= lastModified(tgt, d_time.min)) { system("mkdir --parents " ~ tgt); system("unzip " ~ zip " -d " tgt ~ " >/dev/null"); } // Compile all files with accepted extensions auto find = "find . -type f -false "; foreach (ext; extensions) { find ~= " -or -iname '*." ~ ext ~ "'"; } return system("cd " ~ tgt ~ " && dmd -of" ~ bin ~ " `eval " ~ find ~ "`"); }
Feb 04 2010