Пример #1
0
    def _runInternal(self):

        self._packageMgr.setPathsForProjectPlatform(self._project, self._platform)

        if self._requestId == 'updateLinks':
            self._packageMgr.updateProjectJunctions(self._project, self._platform)

        elif self._requestId == 'openUnity':
            self._packageMgr.checkProjectInitialized(self._project, self._platform)
            self._unityHelper.openUnity(self._project, self._platform)

        elif self._requestId == 'getPathVars':
            self._outputAllPathVars()

        elif self._requestId == 'updateCustomSolution':
            self._projVsHelper.updateCustomSolution(self._project, self._platform)

        elif self._requestId == 'openCustomSolution':
            self._projVsHelper.openCustomSolution(self._project, self._platform)

        elif self._requestId == 'listPackages':
            infos = self._packageMgr.getAllPackageFolderInfos(self._project)
            for folderInfo in infos:
                self._outputContent('---\n')
                self._outputContent(YamlSerializer.serialize(folderInfo) + '\n')

        elif self._requestId == 'listProjects':
            projectNames = self._packageMgr.getAllProjectNames()
            for projName in projectNames:
                self._outputContent(projName + '\n')

        elif self._requestId == 'listReleases':
            for release in self._releaseSourceManager.lookupAllReleases():
                self._outputContent('---\n')
                self._outputContent(YamlSerializer.serialize(release) + '\n')

        elif self._requestId == 'installRelease':
            releaseName = self._param1
            packageRoot = self._param2
            versionCode = self._param3

            if versionCode == None or len(versionCode) == 0:
                versionCode = 0

            self._log.info("Installing release '{0}' into package dir '{1}' with version code '{2}'", releaseName, packageRoot, versionCode)
            self._releaseSourceManager.installReleaseById(releaseName, self._project, packageRoot, versionCode, True)

        elif self._requestId == 'createProject':
            newProjName = self._param1
            duplicateSettings = (self._param2 == 'True')
            self._log.info("Creating new project '{0}'", newProjName)
            self._packageMgr.createProject(newProjName, self._project if duplicateSettings else None)

        else:
            assertThat(False, "Invalid request id '{0}'", self._requestId)
Пример #2
0
    def _installReleaseInternal(self, projectName, packageRoot, releaseInfo, releaseSource, suppressPrompts = False):

        if not self._sys.directoryExists(packageRoot):
            self._sys.createDirectory(packageRoot)

        with self._log.heading("Installing release '{0}' (version {1})", releaseInfo.name, releaseInfo.version):
            installDirName = None
            for folderInfo in self._packageManager.getAllPackageFolderInfos(projectName):
                for packageInfo in folderInfo.packages:
                    installInfo = packageInfo.installInfo

                    if installInfo and installInfo.releaseInfo and installInfo.releaseInfo.id == releaseInfo.id:
                        if installInfo.releaseInfo.versionCode == releaseInfo.versionCode:
                            if not suppressPrompts:
                                shouldContinue = MiscUtil.confirmChoice(
                                    "Release '{0}' (version {1}) is already installed.  Would you like to re-install anyway?  Note that this will overwrite any local changes you've made to it.".format(releaseInfo.name, releaseInfo.version))

                                assertThat(shouldContinue, 'User aborted')
                        else:
                            self._log.info("Found release '{0}' already installed with version '{1}'", installInfo.releaseInfo.name, installInfo.releaseInfo.version)

                            installDirection = 'UPGRADE' if releaseInfo.versionCode > installInfo.releaseInfo.versionCode else 'DOWNGRADE'

                            if not suppressPrompts:
                                shouldContinue = MiscUtil.confirmChoice("Are you sure you want to {0} '{1}' from version '{2}' to version '{3}'? (y/n)".format(installDirection, releaseInfo.name, installInfo.releaseInfo.version, releaseInfo.version))
                                assertThat(shouldContinue, 'User aborted')

                        existingDir = self._varMgr.expand(os.path.join(folderInfo.path, packageInfo.name))

                        self._sys.deleteDirectory(existingDir)

                        # Retain original directory name in case it is referenced by other packages
                        installDirName = packageInfo.name

            installDirName = releaseSource.installRelease(packageRoot, releaseInfo, installDirName)

            destDir = self._varMgr.expand(os.path.join(packageRoot, installDirName))

            assertThat(self._sys.directoryExists(destDir), 'Expected dir "{0}" to exist', destDir)

            newInstallInfo = PackageInstallInfo()
            newInstallInfo.releaseInfo = releaseInfo
            newInstallInfo.installDate = datetime.utcnow()

            yamlStr = YamlSerializer.serialize(newInstallInfo)
            self._sys.writeFileAsText(os.path.join(destDir, InstallInfoFileName), yamlStr)

            self._log.info("Successfully installed '{0}' (version {1})", releaseInfo.name, releaseInfo.version)
Пример #3
0
    def _runInternal(self):

        self._packageMgr.setPathsForProjectPlatform(self._project,
                                                    self._platform)

        if self._requestId == 'updateLinks':
            isInit = self._packageMgr.isProjectPlatformInitialized(
                self._project, self._platform)
            self._packageMgr.updateProjectJunctions(self._project,
                                                    self._platform)
            if not isInit:
                self._packageMgr.updateLinksForAllProjects()

        elif self._requestId == 'openUnity':
            self._packageMgr.checkProjectInitialized(self._project,
                                                     self._platform)
            self._unityHelper.openUnity(self._project, self._platform)

        elif self._requestId == 'getPathVars':
            self._outputAllPathVars()

        elif self._requestId == 'updateCustomSolution':
            self._projVsHelper.updateCustomSolution(self._project,
                                                    self._platform)

        elif self._requestId == 'openCustomSolution':
            self._projVsHelper.openCustomSolution(self._project,
                                                  self._platform)

        elif self._requestId == 'listPackages':
            infos = self._packageMgr.getAllPackageFolderInfos(self._project)
            for folderInfo in infos:
                self._outputContent('---\n')
                self._outputContent(
                    YamlSerializer.serialize(folderInfo) + '\n')

        elif self._requestId == 'listProjects':
            projectNames = self._packageMgr.getAllProjectNames()
            for projName in projectNames:
                self._outputContent(projName + '\n')

        elif self._requestId == 'addPackage':
            self._log.debug("Running addPackage")
            self._projectConfigChanger.addPackage(self._project, self._param1,
                                                  True)

        elif self._requestId == 'setPackages':
            self._log.debug("Running setPackage")
            packages = ast.literal_eval(self._param1)
            if isinstance(packages, list):
                packages = [n.strip() for n in packages]
                self._projectConfigChanger.setPackagesForProject(
                    self._project, packages)
            else:
                self._log.debug("failing setPackage")

        elif self._requestId == 'listReleases':
            for release in self._releaseSourceManager.lookupAllReleases():
                self._outputContent('---\n')
                self._outputContent(YamlSerializer.serialize(release) + '\n')

        elif self._requestId == 'installRelease':
            releaseName = self._param1
            packageRoot = self._param2
            versionCode = self._param3

            if versionCode == None or len(versionCode) == 0:
                versionCode = 0

            self._log.info(
                "Installing release '{0}' into package dir '{1}' with version code '{2}'",
                releaseName, packageRoot, versionCode)
            self._releaseSourceManager.installReleaseById(
                releaseName, self._project, packageRoot, versionCode, True)

        elif self._requestId == 'createProject':
            newProjName = self._param1
            duplicateSettings = (self._param2 == 'True')
            self._log.info("Creating new project '{0}'", newProjName)
            self._packageMgr.createProject(
                newProjName, self._project if duplicateSettings else None)

        elif self._requestId == 'listDependencies':
            packageName = self._param1
            schema = self._schemaLoader.loadSchema(self._project,
                                                   self._platform)
            self._outputContent(
                YamlSerializer.serialize([
                    schema.packages[x].dirPath
                    for x in schema.packages[packageName].allDependencies
                ]))

        else:
            assertThat(False, "Invalid request id '{0}'", self._requestId)
Пример #4
0
 def _outputAllPathVars(self):
     self._outputContent(
         YamlSerializer.serialize(self._varMgr.getAllParameters()))
Пример #5
0
 def _saveProjectConfig(self, projectName, projectConfig):
     configPath = self._getProjectConfigPath(projectName)
     self._sys.writeFileAsText(configPath,
                               YamlSerializer.serialize(projectConfig))
Пример #6
0
    def _runInternal(self):

        self._packageMgr.setPathsForProjectPlatform(self._project,
                                                    self._platform)

        if self._requestId == 'updateLinks':
            self._packageMgr.updateProjectJunctions(self._project,
                                                    self._platform)

        elif self._requestId == 'openUnity':
            self._packageMgr.checkProjectInitialized(self._project,
                                                     self._platform)
            self._unityHelper.openUnity(self._project, self._platform)

        elif self._requestId == 'getPathVars':
            self._outputAllPathVars()

        elif self._requestId == 'updateCustomSolution':
            self._projVsHelper.updateCustomSolution(self._project,
                                                    self._platform)

        elif self._requestId == 'openCustomSolution':
            self._projVsHelper.openCustomSolution(self._project,
                                                  self._platform)

        elif self._requestId == 'listPackages':
            infos = self._packageMgr.getAllPackageFolderInfos(self._project)
            for folderInfo in infos:
                self._outputContent('---\n')
                self._outputContent(
                    YamlSerializer.serialize(folderInfo) + '\n')

        elif self._requestId == 'listProjects':
            projectNames = self._packageMgr.getAllProjectNames()
            for projName in projectNames:
                self._outputContent(projName + '\n')

        elif self._requestId == 'listReleases':
            for release in self._releaseSourceManager.lookupAllReleases():
                self._outputContent('---\n')
                self._outputContent(YamlSerializer.serialize(release) + '\n')

        elif self._requestId == 'installRelease':
            releaseName = self._param1
            packageRoot = self._param2
            versionCode = self._param3

            if versionCode == None or len(versionCode) == 0:
                versionCode = 0

            self._log.info(
                "Installing release '{0}' into package dir '{1}' with version code '{2}'",
                releaseName, packageRoot, versionCode)
            self._releaseSourceManager.installReleaseById(
                releaseName, self._project, packageRoot, versionCode, True)

        elif self._requestId == 'createProject':
            newProjName = self._param1
            duplicateSettings = (self._param2 == 'True')
            self._log.info("Creating new project '{0}'", newProjName)
            self._packageMgr.createProject(
                newProjName, self._project if duplicateSettings else None)

        else:
            assertThat(False, "Invalid request id '{0}'", self._requestId)
Пример #7
0
 def _outputAllPathVars(self):
     self._outputContent(YamlSerializer.serialize(self._varMgr.getAllParameters()))
Пример #8
0
 def _saveManifest(self):
     yamlStr = YamlSerializer.serialize(self._manifest)
     self._sys.writeFileAsText(os.path.join(self._args.directory, ReleaseManifestFileName), yamlStr)
Пример #9
0
 def _saveProjectConfig(self, projectName, projectConfig):
     configPath = self._getProjectConfigPath(projectName)
     self._sys.writeFileAsText(configPath, YamlSerializer.serialize(projectConfig))
 def _saveManifest(self):
     yamlStr = YamlSerializer.serialize(self._manifest)
     self._sys.writeFileAsText(
         os.path.join(self._args.directory, ReleaseManifestFileName),
         yamlStr)
Пример #11
0
    def _installReleaseInternal(self,
                                projectName,
                                packageRoot,
                                releaseInfo,
                                releaseSource,
                                suppressPrompts=False):

        if not self._sys.directoryExists(packageRoot):
            self._sys.createDirectory(packageRoot)

        with self._log.heading("Installing release '{0}' (version {1})",
                               releaseInfo.name, releaseInfo.version):
            installDirName = None
            for folderInfo in self._packageManager.getAllPackageFolderInfos(
                    projectName):
                for packageInfo in folderInfo.packages:
                    installInfo = packageInfo.installInfo

                    if installInfo and installInfo.releaseInfo and installInfo.releaseInfo.id == releaseInfo.id:
                        if installInfo.releaseInfo.versionCode == releaseInfo.versionCode:
                            if not suppressPrompts:
                                shouldContinue = MiscUtil.confirmChoice(
                                    "Release '{0}' (version {1}) is already installed.  Would you like to re-install anyway?  Note that this will overwrite any local changes you've made to it."
                                    .format(releaseInfo.name,
                                            releaseInfo.version))

                                assertThat(shouldContinue, 'User aborted')
                        else:
                            self._log.info(
                                "Found release '{0}' already installed with version '{1}'",
                                installInfo.releaseInfo.name,
                                installInfo.releaseInfo.version)

                            installDirection = 'UPGRADE' if releaseInfo.versionCode > installInfo.releaseInfo.versionCode else 'DOWNGRADE'

                            if not suppressPrompts:
                                shouldContinue = MiscUtil.confirmChoice(
                                    "Are you sure you want to {0} '{1}' from version '{2}' to version '{3}'? (y/n)"
                                    .format(installDirection, releaseInfo.name,
                                            installInfo.releaseInfo.version,
                                            releaseInfo.version))
                                assertThat(shouldContinue, 'User aborted')

                        existingDir = self._varMgr.expand(
                            os.path.join(folderInfo.path, packageInfo.name))

                        self._sys.deleteDirectory(existingDir)

                        # Retain original directory name in case it is referenced by other packages
                        installDirName = packageInfo.name

            installDirName = releaseSource.installRelease(
                packageRoot, releaseInfo, installDirName)

            destDir = self._varMgr.expand(
                os.path.join(packageRoot, installDirName))

            assertThat(self._sys.directoryExists(destDir),
                       'Expected dir "{0}" to exist', destDir)

            newInstallInfo = PackageInstallInfo()
            newInstallInfo.releaseInfo = releaseInfo
            newInstallInfo.installDate = datetime.utcnow()

            yamlStr = YamlSerializer.serialize(newInstallInfo)
            self._sys.writeFileAsText(
                os.path.join(destDir, InstallInfoFileName), yamlStr)

            self._log.info("Successfully installed '{0}' (version {1})",
                           releaseInfo.name, releaseInfo.version)