[haiku-commits] haiku: hrev50614 - 3rdparty/qtcreator

  • From: waddlesplash@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 22 Oct 2016 19:08:07 +0200 (CEST)

hrev50614 adds 1 changeset to branch 'master'
old head: cfe0adf0fb7ec72c613fe66cee508c97bd6c6ef8
new head: 71452e98334eaac603bf542d159e24788a46bebb
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=71452e98334e+%5Ecfe0adf0fb7e

----------------------------------------------------------------------------

71452e98334e: 3rdparty/qtcreator: Totally new version of the 
create_project_file script.
  
  Qt Creator now has a "generic project" mode, in which it just acts
  as an auto-completing code editor. I tried using it on the entire
  Haiku project at once, but it's just too much for Qt Creator to handle.
  So instead, I created a script which generates project files for
  any given directory in the tree, as well as sets up the proper include
  directories. The project files themselves are .gitignore'd; use the script
  to create them.
  
  Works on Haiku. Did not test on Linux with a crosstools setup; but
  it should work there too.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50614
Commit:      71452e98334eaac603bf542d159e24788a46bebb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=71452e98334e
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Oct 22 06:02:42 2016 UTC

----------------------------------------------------------------------------

3 files changed, 32 insertions(+), 106 deletions(-)
3rdparty/qtcreator/.gitignore              |   5 ++
3rdparty/qtcreator/create_project_file.sh  |  27 +++++++
3rdparty/qtcreator/create_project_files.pl | 106 -------------------------

----------------------------------------------------------------------------

diff --git a/3rdparty/qtcreator/.gitignore b/3rdparty/qtcreator/.gitignore
new file mode 100644
index 0000000..e0f75dc
--- /dev/null
+++ b/3rdparty/qtcreator/.gitignore
@@ -0,0 +1,5 @@
+# Ignore everything in this directory...
+*
+# Except for this file, and the script.
+!.gitignore
+!create_project_file.sh
diff --git a/3rdparty/qtcreator/create_project_file.sh 
b/3rdparty/qtcreator/create_project_file.sh
new file mode 100755
index 0000000..ce9fb8a
--- /dev/null
+++ b/3rdparty/qtcreator/create_project_file.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+if [ "$#" -ne 2 ]; then
+       echo "This script creates project files for Qt Creator to develop Haiku 
with."
+       echo "It should only be used on a per-project basis, as Qt Creator is 
too slow"
+       echo "when used on all of Haiku at once."
+       echo ""
+       echo "THIS SCRIPT *MUST* BE RUN FROM THE REPOSITORY ROOT."
+       echo ""
+       echo "Usage: <script> <project name> <path to project root>"
+       echo "e.g: create_project_file.sh Tracker src/kits/tracker/"
+       exit 1
+fi
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+NAME=$1
+ROOTDIR=$2
+
+printf "// Add predefined macros for your project here. For example:\n// 
#define THE_ANSWER 42\n" \
+       >$DIR/$NAME.config
+printf "[General]\n" >$DIR/$NAME.creator
+
+# Build lists of files
+find $ROOTDIR -type f | sed "s@^@../../@" >$DIR/$NAME.files
+find $ROOTDIR -type d | sed "s@^@../../@" >$DIR/$NAME.includes
+find headers -type d | sed "s@^@../../@" >>$DIR/$NAME.includes
+echo "Done. Project file: $DIR/$NAME.creator"
diff --git a/3rdparty/qtcreator/create_project_files.pl 
b/3rdparty/qtcreator/create_project_files.pl
deleted file mode 100644
index afdd626..0000000
--- a/3rdparty/qtcreator/create_project_files.pl
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/usr/bin/perl
-
-use warnings;
-use strict;
-
-=head1 create_project_files.pl
-
-This simple script traverses the haiku sources and creates (incomplete) *.pro
-files in order to make the haiku sources available within the qt-creator IDE.
-Additionally, it will add those files to svn:ignore of their parent directory
-(unless already contained there).
-
-=cut
-
-use File::Basename;
-use File::Find;
-
-if (!@ARGV) {
-       die "usage: $0 <haiku-top-path>\n";
-}
-
-my $haikuTop = shift @ARGV;
-if (!-e "$haikuTop/ReadMe.cross-compile") {
-       die "'$haikuTop/ReadMe.cross-compile' not found - not a haiku top!\n";
-}
-
-my %collection;
-
-print "scanning ...\n";
-find({ wanted => \&process, no_chdir => 1}, 
-       ("$haikuTop/headers", "$haikuTop/src"));
-
-writeProFile("$haikuTop/haiku.pro", { subdirs => ['headers', 'src'] });
-foreach my $dir (sort keys %collection) {
-       my $proFile = $dir.'/'.fileparse($dir).'.pro';
-       writeProFile($proFile, $collection{$dir});
-}
-
-sub process
-{
-       if (substr($_, -4, 4) eq '.svn') {
-               $File::Find::prune = 1;
-       } else {
-               return if $File::Find::dir eq $_;       # skip toplevel folders
-               my $name = (fileparse($_))[0];
-               if (-d $_) {
-                       $collection{$File::Find::dir}->{subdirs} ||= [];
-                       push @{$collection{$File::Find::dir}->{subdirs}}, $name;
-                       return;
-               }
-               elsif ($_ =~ m{\.(h|hpp)$}i) {
-                       $collection{$File::Find::dir}->{headers} ||= [];
-                       push @{$collection{$File::Find::dir}->{headers}}, $name;
-               }
-               elsif ($_ =~ m{\.(c|cc|cpp|s|asm)$}i) {
-                       $collection{$File::Find::dir}->{sources} ||= [];
-                       push @{$collection{$File::Find::dir}->{sources}}, $name;
-               }
-       }
-}
-
-sub writeProFile
-{
-       my ($proFile, $info) = @_;
-       
-       return if !$info;
-       
-       print "creating $proFile\n";
-       open(my $proFileFH, '>', $proFile)
-               or die "unable to write $proFile";
-       print $proFileFH "TEMPLATE = subdirs\n";
-       print $proFileFH "CONFIG += ordered\n";
-       if (exists $info->{subdirs}) {
-               print $proFileFH 
-                       "SUBDIRS = ".join(" \\\n\t", sort 
@{$info->{subdirs}})."\n";
-       }
-       if (exists $info->{headers}) {
-               print $proFileFH 
-                       "HEADERS = ".join(" \\\n\t", sort 
@{$info->{headers}})."\n";
-       }
-       if (exists $info->{sources}) {
-               print $proFileFH 
-                       "SOURCES = ".join(" \\\n\t", sort 
@{$info->{sources}})."\n";
-       }
-       close $proFileFH;
-       
-       updateSvnIgnore($proFile);
-}
-
-sub updateSvnIgnore
-{
-       my $proFile = shift;
-
-       my ($filename, $parentDir) = fileparse($proFile);
-
-       my $svnIgnore = qx{svn propget --strict svn:ignore $parentDir};
-       if (!grep { $_ eq $filename } split "\n", $svnIgnore) {
-               chomp $svnIgnore;
-               $svnIgnore .= "\n" unless !$svnIgnore;
-               $svnIgnore .= "$filename\n";
-               open(my $propsetFH, "|svn propset svn:ignore --file - 
$parentDir")
-                       or die "unable to open pipe to 'svn propset'";
-               print $propsetFH $svnIgnore;
-               close($propsetFH);
-       }
-}


Other related posts:

  • » [haiku-commits] haiku: hrev50614 - 3rdparty/qtcreator - waddlesplash