Exemplo n.º 1
0
  def __init__(self, workingDir, destination, spoofax=True, spoofaxRepo=None, spoofaxRepoLocal=False,
      langDev=True, lwbDev=True, moreRepos=None, moreIUs=None):
    if spoofaxRepoLocal:
      spoofaxRepo = MetaborgEclipseGenerator.spoofaxRepoLocal
    elif not spoofaxRepo:
      spoofaxRepo = MetaborgEclipseGenerator.spoofaxRepo

    if lwbDev:
      langDev = True

    if not moreRepos:
      moreRepos = []
    if not moreIUs:
      moreIUs = []

    presets = [Presets.platform.value, Presets.java.value, Presets.xml.value, Presets.git.value, Presets.maven.value, Presets.gradle.value]
    if langDev or lwbDev:
      presets.extend([Presets.plugin.value, Presets.plugin_maven.value])
    repos, ius = Presets.combine_presets(presets)

    repos.add(spoofaxRepo)
    ius.update(MetaborgEclipseGenerator.spoofaxIUs)
    if langDev or lwbDev:
      repos.update(MetaborgEclipseGenerator.spoofaxLangDevRepos)
      ius.update(MetaborgEclipseGenerator.spoofaxLangDevIUs)

    repos.update(moreRepos)
    ius.update(moreIUs)

    self.workingDir = workingDir
    self.destination = destination
    self.repos = repos
    self.ius = ius
Exemplo n.º 2
0
  def test_longrunning_eclipse_generate(self):
    destination = 'eclipse-single'
    shutil.rmtree(os.path.join(_DATA_DIR, destination), ignore_errors=True)

    repositories, installUnits = Presets.combine_presets([TestPreset()])
    generator = EclipseGenerator(workingDir=_DATA_DIR, destination=destination, repositories=repositories,
      installUnits=installUnits, name='eclipse-test-single')
    generator.generate()
Exemplo n.º 3
0
 def test_eclipse_generate_noop(self):
     repositories, installUnits = Presets.combine_presets([TestPreset()])
     generator = EclipseGenerator(workingDir=_DATA_DIR,
                                  destination='noop',
                                  repositories=repositories,
                                  installUnits=[],
                                  name='eclipse-test-noop',
                                  fixIni=False)
     generator.generate()
Exemplo n.º 4
0
  def test_longrunning_eclipse_multi_gen(self):
    destination = 'eclipse-multiple'
    shutil.rmtree(os.path.join(_DATA_DIR, destination), ignore_errors=True)

    repositories, installUnits = Presets.combine_presets([TestPreset()])
    generator = EclipseMultiGenerator(workingDir=_DATA_DIR, destination=destination,
      oss=[Os.windows.value, Os.macosx.value, Os.linux.value], archs=[Arch.x64.value], repositories=repositories,
      installUnits=installUnits, name='eclipse-test-multiple', addJre=True, archiveJreSeparately=True,
      archivePrefix='eclipse-test-multiple', archiveSuffix='-test-suffix')
    generator.generate()
Exemplo n.º 5
0
    def test_longrunning_eclipse_generate(self):
        destination = 'eclipse-single'
        shutil.rmtree(os.path.join(_DATA_DIR, destination), ignore_errors=True)

        repositories, installUnits = Presets.combine_presets([TestPreset()])
        generator = EclipseGenerator(workingDir=_DATA_DIR,
                                     destination=destination,
                                     repositories=repositories,
                                     installUnits=installUnits,
                                     name='eclipse-test-single')
        generator.generate()
Exemplo n.º 6
0
    def test_longrunning_eclipse_multi_gen(self):
        destination = 'eclipse-multiple'
        shutil.rmtree(os.path.join(_DATA_DIR, destination), ignore_errors=True)

        repositories, installUnits = Presets.combine_presets([TestPreset()])
        generator = EclipseMultiGenerator(
            workingDir=_DATA_DIR,
            destination=destination,
            oss=[Os.windows.value, Os.macosx.value, Os.linux.value],
            archs=[Arch.x64.value],
            repositories=repositories,
            installUnits=installUnits,
            name='eclipse-test-multiple',
            addJre=True,
            archiveJreSeparately=True,
            archivePrefix='eclipse-test-multiple',
            archiveSuffix='-test-suffix')
        generator.generate()
Exemplo n.º 7
0
    def __init__(self,
                 workingDir,
                 destination,
                 spoofax=True,
                 spoofaxRepo=None,
                 spoofaxRepoLocal=False,
                 langDev=True,
                 lwbDev=True,
                 moreRepos=None,
                 moreIUs=None):
        if spoofaxRepoLocal:
            spoofaxRepo = MetaborgEclipseGenerator.spoofaxRepoLocal
        elif not spoofaxRepo:
            spoofaxRepo = MetaborgEclipseGenerator.spoofaxRepo

        if lwbDev:
            langDev = True

        if not moreRepos:
            moreRepos = []
        if not moreIUs:
            moreIUs = []

        presets = [
            Presets.platform.value, Presets.java.value, Presets.xml.value,
            Presets.git.value, Presets.maven.value, Presets.gradle.value
        ]
        if langDev or lwbDev:
            presets.extend([Presets.plugin.value, Presets.plugin_maven.value])
        _, ius = Presets.combine_presets(presets)

        repos = {MetaborgEclipseGenerator.eclipsePhotonRepo}
        repos.add(spoofaxRepo)
        ius.update(MetaborgEclipseGenerator.spoofaxIUs)
        if langDev or lwbDev:
            ius.update(MetaborgEclipseGenerator.spoofaxLangDevIUs)

        repos.update(moreRepos)
        ius.update(moreIUs)

        self.workingDir = workingDir
        self.destination = destination
        self.repos = repos
        self.ius = ius
Exemplo n.º 8
0
 def test_eclipse_generate_noop(self):
   repositories, installUnits = Presets.combine_presets([TestPreset()])
   generator = EclipseGenerator(workingDir=_DATA_DIR, destination='noop', repositories=repositories,
     installUnits=[], name='eclipse-test-noop', fixIni=False)
   generator.generate()
Exemplo n.º 9
0
  def main(self, destination):
    if os.path.exists(destination):
      if os.path.isdir(destination) and os.listdir(destination):
        print('ERROR: destination {} is not empty'.format(destination))
        return 1
      print('ERROR: destination {} already exists'.format(destination))
      return 1

    presets = []
    for presetStr in self.presets:
      if not Presets.exists(presetStr):
        print('ERROR: preset {} does not exist'.format(presetStr))
        return 1
      presets.append(Presets[presetStr].value)

    oss = []
    if self.oss:
      for osStr in self.oss:
        if not Os.exists(osStr):
          print('ERROR: operating system {} does not exist'.format(osStr))
          return 1
        oss.append(Os[osStr].value)
    else:
      oss.append(Os.get_current())

    archs = []
    if self.archs:
      for archStr in self.archs:
        if not Arch.exists(archStr):
          print('ERROR: architecture {} does not exist'.format(archStr))
          return 1
        archs.append(Arch[archStr].value)
    else:
      archs.append(Arch.get_current())

    repositories, installUnits = Presets.combine_presets(presets)
    repositories.update(self.extraRepositories)
    installUnits.update(self.extraInstallUnits)

    if not repositories:
      print('ERROR: no presets or extra repositories were given')
      return 1
    if not installUnits:
      print('ERROR: no presets or extra units to install were given')
      return 1

    if len(oss) == 1 and len(archs) == 1:
      eclipseOs = oss[0]
      eclipseArch = archs[0]
      generator = EclipseGenerator(workingDir=os.getcwd(), destination=destination, os=eclipseOs, arch=eclipseArch,
        repositories=repositories, installUnits=installUnits, name=self.name, fixIni=self.fixIni, addJre=self.addJre,
        archive=self.archive, archiveJreSeparately=self.archiveJreSeparately, archivePrefix=self.archivePrefix,
        archiveSuffix=self.archiveSuffix)
      print('Generating Eclipse instance for {}, {} to path {}'.format(eclipseOs, eclipseArch, destination))
    else:
      generator = EclipseMultiGenerator(workingDir=os.getcwd(), destination=destination, oss=oss, archs=archs,
        repositories=repositories, installUnits=installUnits, name=self.name, fixIni=self.fixIni, addJre=self.addJre,
        archiveJreSeparately=self.archiveJreSeparately, archivePrefix=self.archivePrefix,
        archiveSuffix=self.archiveSuffix)
      print('Generating Eclipse instances for to path {}'.format(destination))
      print('Operating systems: {}'.format(', '.join([o.name for o in oss])))
      print('Architectures: {}'.format(', '.join([a.name for a in archs])))

    print('Repositories: ')
    for repository in repositories:
      print('  {}'.format(repository))
    print('Units to install: ')
    for installUnit in installUnits:
      print('  {}'.format(installUnit))
    print()

    generator.generate()

    return 0