Exemplo n.º 1
0
 def build( self ):
     br = MemoryReporter()
     execProg( "svn status --non-interactive --trust-server-cert " + self.__baseDir, br, self.__baseDir )
     
     files = re.findall('\?\s+([^\n]+)\n', br.getText() )
     for file in files:
         self.reporter.failure( "File \"" + file + "\" is not versioned" )
         
     if len(files):
         self.reporter.failure( str(len(files)) + " files not versioned" )
         return 0
         
     return 1
Exemplo n.º 2
0
    def do( self ):
        self.reporter.message( "DELETE: %s" % self.__dir )
        items = svnList(self.__dir, self.reporter)

        if not isList(items):
            if self.__failOnError:
                return 0
            else:
                return 1

        for path in items:
            command = "svn delete --force \"%s\" -m \"Build\"" % (self.__dir + "/" + path)
            self.reporter.message(command)
            execProg( command, self.reporter ) == 0
        return 1
Exemplo n.º 3
0
    def do( self ):
        command = []
        testSettingsCommand = ""
        if self.__testSettingsPath != "":
            testSettingsCommand = "/testsettings:\"%s\"" % self.__testSettingsPath

        if len(self.__csTestDllPath) == 0 and len(self.__baseDir) != 0:
            self.__csTestDllPath = MsTestFileFilter(self.__buildMode, self.__exclude).Filter(self.__baseDir)

        if type(self.__csTestDllPath) == str:
            command.append(["""MSTest.exe /testcontainer:\"%s\" %s""" % (self.__csTestDllPath, testSettingsCommand), self.__csTestDllPath])
        else:
            files = [file for file in self.__csTestDllPath if os.path.splitext(file)[1] == '.dll']

            for dllTestPath in files:
                command.append(["""MSTest.exe /testcontainer:\"%s\" %s""" % (dllTestPath, testSettingsCommand), dllTestPath])

        result = True
        for comm in command:
            self.reporter.message("RUN CS UNITTEST: %s" % comm[1])
            print(comm)
            result = execProg(comm[0], self.reporter, os.path.dirname(comm[1])) == 0
            if not result:
                break;
        return result
Exemplo n.º 4
0
    def process(self, item):
        self.reporter.message( "COMMIT: %s" % item )
        addResult = True
        if self.__add:
            command = "svn add --non-interactive --trust-server-cert --force *.*"
            addResult = execProg( command, self.reporter, item ) == 0

        if addResult :
            commitMessage = "Commited by Build"
            command = "svn commit --non-interactive --trust-server-cert -m \"%s\"" % commitMessage

            if self.__user:
                command += " --username %s --password %s" % (self.__user, self.__pwd)
            self.reporter.message( "SVN COMMIT DIR: %s" % item )
            return execProg( command, self.reporter, item ) == 0
        return False
Exemplo n.º 5
0
    def do( self ):
        self.reporter.message( "RUN CS NUNIT TEST: %s" % self.csTestDllPath )

        print(self.command)

        result = execProg( self.command, self.reporter, os.path.dirname(self.csTestDllPath) ) == 0
        return result
Exemplo n.º 6
0
    def do( self ):
        self.reporter.message( "RUN CS NUNIT TEST: %s" % self.csTestDllPath )

        print(self.command)

        result = execProg( self.command, self.reporter, os.path.dirname(self.csTestDllPath) ) == 0
        return result
Exemplo n.º 7
0
    def do( self ):
        self.reporter.message( "Git Commit and Push: %s" % self.__dir )
        addResult = True
        if self.__add:
            command = "git add *"
            addResult = execProg( command, self.reporter, self.__dir ) == 0

        commitResult = True
        if addResult :
            commitMessage = "Commited by Build"
            command = "git commit -m \"%s\"" % commitMessage
            self.reporter.message( command )
            commitResult = execProg( command, self.reporter, self.__dir ) == 0

        if not commitResult:
            return False

        command = "git push"
        self.reporter.message( command )
        return execProg( command, self.reporter, self.__dir ) == 0
Exemplo n.º 8
0
    def do(self):
        self.reporter.message("Git Commit and Push: %s" % self.__dir)
        addResult = True
        if self.__add:
            command = "git add *"
            addResult = execProg(command, self.reporter, self.__dir) == 0

        commitResult = True
        if addResult:
            commitMessage = "Commited by Build"
            command = "git commit -m \"%s\"" % commitMessage
            self.reporter.message(command)
            commitResult = execProg(command, self.reporter, self.__dir) == 0

        if not commitResult:
            return False

        command = "git push"
        self.reporter.message(command)
        return execProg(command, self.reporter, self.__dir) == 0
Exemplo n.º 9
0
    def do(self):
        versionNumber = ''
        if self.__versionFile is not None:
            f = None
            content = None
            try:
                if not self.__encoding is None:
                    f = codecs.open(self.__versionFile,
                                    'r',
                                    encoding=self.__encoding)
                else:
                    f = open(self.__versionFile, 'r')

                content = f.read()

            except IOError as e:
                self.reporter.failure(
                    "Can not read file: %s\nException: %s" %
                    self.__versionFile, e.message)
                return False
            finally:
                if f is not None:
                    f.close()

            version = None
            versionNumber = None
            if self.__includeRevision:
                version = re.search('(\d+)\.(\d+)\.(\d+)\.(\d+)', content)
                versionNumber = version.group(1) + '.' + version.group(
                    2) + '.' + version.group(3) + '.' + version.group(4)
            else:
                version = re.search('(\d+)\.(\d+)\.(\d+)', content)
                versionNumber = version.group(1) + '.' + version.group(
                    2) + '.' + version.group(3)
        elif self.__versionNumber is not None:
            versionNumber = self.__versionNumber
        else:
            self.reporter.failure(
                "Version file or Versio Number is None, please give a path to search version."
            )
            return False

        self.__dirTag = self.__dirTag + '/' + versionNumber

        self.reporter.message("TRUNK DIR: %s" % self.__dirTrunk)
        self.reporter.message("TAG DIR: %s" % self.__dirTag)
        commitMessage = "Created by Build"
        command = 'svn copy --non-interactive --trust-server-cert "' + self.__dirTrunk + '" "' + self.__dirTag + '" -m \"' + commitMessage + '\"'

        self.reporter.message("COMMAND: %s" % command)

        return execProg(command, self.reporter) == 0
Exemplo n.º 10
0
    def do( self ):
        self.reporter.message( "MAKING NUGET PACKAGE FROM: %s" % ntpath.basename(self.csProjectPath) )

        result = execProg("msbuild.exe \"%s\" /t:Rebuild /p:Configuration=Release;VisualStudioVersion=%s" % ( self.csProjectPath, self.visualStudioVersion ), self.reporter, self.solutionDir)
        if(not result == 0):
            return False

        result = execProg("nuget.exe pack \"%s\" -IncludeReferencedProjects -prop Configuration=Release -OutputDirectory \"%s\"" % (self.csProjectPath, self.tempDir), self.reporter)
        if(not result == 0):
            return False

        if(self.publishDir is not None):
            os.chdir(self.tempDir)
            files = glob.glob("*.nupkg")

            result = execProg("nuget.exe push \"%s\" -Source \"%s\"" % (files[0], self.publishDir), self.reporter)
            os.remove(files[0])
            if(not result == 0):
                return False


        return True
Exemplo n.º 11
0
    def do( self ):
        if self.__versionFile is not None:
            f = open(self.__versionFile, 'r', encoding=self.__encoding)
            content = f.read()
            f.close()
            version = re.search( '[\'\"](\d+)\.(\d+)\.(\d+)', content )
            versionNumber = version.group(1) + '.' + version.group(2) + '.' + version.group(3)
            self.__dirTag = self.__dirTag + '/' + versionNumber

        self.reporter.message( "TRUNK DIR: %s" % self.__dirTrunk )
        self.reporter.message( "TAG DIR: %s" % self.__dirTag )
        commitMessage = "Created by Build"
        command = 'svn copy "' + self.__dirTrunk + '" "' + self.__dirTag + '" -m \"'+commitMessage+'\"'

        self.reporter.message( "COMMAND: %s" % command )
        
        return execProg( command, self.reporter ) == 0
Exemplo n.º 12
0
    def do(self):
        if self.__versionFile is not None:
            f = open(self.__versionFile, 'r', encoding=self.__encoding)
            content = f.read()
            f.close()
            version = re.search('[\'\"](\d+)\.(\d+)\.(\d+)', content)
            versionNumber = version.group(1) + '.' + version.group(
                2) + '.' + version.group(3)
            self.__dirTag = self.__dirTag + '/' + versionNumber

        self.reporter.message("TRUNK DIR: %s" % self.__dirTrunk)
        self.reporter.message("TAG DIR: %s" % self.__dirTag)
        commitMessage = "Created by Build"
        command = 'svn copy "' + self.__dirTrunk + '" "' + self.__dirTag + '" -m \"' + commitMessage + '\"'

        self.reporter.message("COMMAND: %s" % command)

        return execProg(command, self.reporter) == 0
Exemplo n.º 13
0
    def do(self):
        versionNumber = ''
        if self.__versionFile is not None:
            f = None
            content = None
            try:
                if not self.__encoding is None:
                    f = codecs.open(self.__versionFile, 'r', encoding=self.__encoding)
                else:
                    f = open(self.__versionFile, 'r')

                content = f.read()

            except IOError as e:
                self.reporter.failure("Can not read file: %s\nException: %s" % self.__versionFile, e.message)
                return False
            finally:
                if f is not None:
                    f.close()

            version = None
            versionNumber = None
            if self.__includeRevision:
                version = re.search('(\d+)\.(\d+)\.(\d+)\.(\d+)', content)
                versionNumber = version.group(1) + '.' + version.group(2) + '.' + version.group(3) + '.' + version.group(4)
            else:
                version = re.search('(\d+)\.(\d+)\.(\d+)', content)
                versionNumber = version.group(1) + '.' + version.group(2) + '.' + version.group(3)
        elif self.__versionNumber is not None:
            versionNumber = self.__versionNumber
        else:
            self.reporter.failure("Version file or Versio Number is None, please give a path to search version.")
            return False

        self.__dirTag = self.__dirTag + '/' + versionNumber

        self.reporter.message("TRUNK DIR: %s" % self.__dirTrunk)
        self.reporter.message("TAG DIR: %s" % self.__dirTag)
        commitMessage = "Created by Build"
        command = 'svn copy --non-interactive --trust-server-cert "' + self.__dirTrunk + '" "' + self.__dirTag + '" -m \"' + commitMessage + '\"'

        self.reporter.message("COMMAND: %s" % command)

        return execProg(command, self.reporter) == 0
Exemplo n.º 14
0
    def do(self):
        command = []
        testSettingsCommand = ""
        if self.__testSettingsPath != "":
            testSettingsCommand = "/testsettings:\"%s\"" % self.__testSettingsPath

        if len(self.__csTestDllPath) == 0 and len(self.__baseDir) != 0:
            self.__csTestDllPath = MsTestFileFilter(
                self.__buildMode, self.__exclude).Filter(self.__baseDir)

        if type(self.__csTestDllPath) == str:
            command.append([
                """MSTest.exe /testcontainer:\"%s\" %s""" %
                (self.__csTestDllPath, testSettingsCommand),
                self.__csTestDllPath
            ])
        else:
            files = [
                file for file in self.__csTestDllPath
                if os.path.splitext(file)[1] == '.dll'
            ]

            for dllTestPath in files:
                command.append([
                    """MSTest.exe /testcontainer:\"%s\" %s""" %
                    (dllTestPath, testSettingsCommand), dllTestPath
                ])

        result = True
        for comm in command:
            self.reporter.message("RUN CS UNITTEST: %s" % comm[1])
            print(comm)
            result = execProg(comm[0], self.reporter,
                              os.path.dirname(comm[1])) == 0
            if not result:
                break
        return result
Exemplo n.º 15
0
 def do(self):
     self.reporter.message("SVN UPDATE DIR: %s" % self.dir)
     return execProg("svn update", self.reporter, self.dir) == 0
Exemplo n.º 16
0
 def do( self ):
     self.reporter.message( "Git Checkout %s on %s" % (self.__branch, self.__dir) )
     return execProg( "git checkout %s" % self.__branch, self.reporter, self.__dir ) == 0
Exemplo n.º 17
0
 def do(self):
     self.reporter.message("SVN UPDATE DIR: %s" % self.dir)
     return execProg("svn update --non-interactive --trust-server-cert",
                     self.reporter, self.dir) == 0
Exemplo n.º 18
0
 def do( self ):
     self.reporter.message( "BUILD CS PROJECT: %s" % self.csProjectPath )
     return execProg( self.command, self.reporter ) == 0
Exemplo n.º 19
0
 def do(self):
     self.reporter.message("BUILD CS PROJECT: %s" % self.csProjectPath)
     return execProg(self.command, self.reporter) == 0
Exemplo n.º 20
0
 def do( self ):
     self.reporter.message( "Svn Import: %s => %s" % ( self.dir, self.repo ) )
     commitMessage = "Commited by Build"
     command = "svn import -m \"%s\" \"%s\" \"%s\" " % ( commitMessage, self.dir, self.repo )
     return execProg( command, self.reporter, self.dir ) == 0
Exemplo n.º 21
0
 def do(self):
     self.reporter.message("Svn Import: %s => %s" % (self.dir, self.repo))
     commitMessage = "Commited by Build"
     command = "svn import -m \"%s\" \"%s\" \"%s\" " % (commitMessage,
                                                        self.dir, self.repo)
     return execProg(command, self.reporter, self.dir) == 0
Exemplo n.º 22
0
 def do( self ):
     self.reporter.message( self.command )
     self.reporter.message( self.csProjectPath )
     self.reporter.message( "BUILD CS PROJECT: %s" % self.csProjectPath )
     return execProg( self.command, self.reporter, os.path.dirname(self.csProjectPath) ) == 0
Exemplo n.º 23
0
 def do( self ):
     self.reporter.message( "SVN UPDATE DIR: %s" % self.dir )
     return execProg( "svn update --non-interactive --trust-server-cert", self.reporter, self.dir ) == 0
Exemplo n.º 24
0
 def do(self):
     self.reporter.message("Git Checkout %s on %s" %
                           (self.__branch, self.__dir))
     return execProg("git checkout %s" % self.__branch, self.reporter,
                     self.__dir) == 0
Exemplo n.º 25
0
 def do( self ):
     self.reporter.message( "RUN COMMAND: %s" % self.command )
     result = execProg( self.command, self.reporter, self.path) == 0
     return result
Exemplo n.º 26
0
 def do( self ):
     self.reporter.message( "Svn Import: %s => %s" % ( self.dir, self.repo ) )
     commitMessage = "Commited by Build"
     command = "svn import --non-interactive --trust-server-cert -m \"%s\" \"%s\" \"%s\" " % ( commitMessage, self.dir, self.repo )
     return execProg( command, self.reporter, self.dir ) == 0