Added options to checkout and build specific tags for Synergy-Core.

master
DominikDeak 4 years ago
parent 5e45686338
commit 9e1be97a51
No known key found for this signature in database
GPG Key ID: 85514EC0CCE7007C
  1. 6
      Documentation/BuildingOnDarwin.md
  2. 6
      Documentation/BuildingOnLinux.md
  3. 6
      Documentation/BuildingOnWindows.md
  4. 45
      Scripts/Detail/Config.py
  5. 5
      Scripts/build.py
  6. 1
      Scripts/config.txt
  7. 2
      Synergy-Core

@ -35,6 +35,12 @@ Build the project with the following Python script. Packages will be copied into
./Scripts/build.py ./Scripts/build.py
``` ```
To build a specific version of the product, supply the appropriate tag name (or commit hash) as an argument:
```sh
./Scripts/build.py --checkout 1.13.1.3-snapshot
```
Similarly, one can clean the project, which resets Git repositories to a clean state: Similarly, one can clean the project, which resets Git repositories to a clean state:
```sh ```sh

@ -28,6 +28,12 @@ Build the project with the following Python script. Packages will be copied into
./Scripts/build.py ./Scripts/build.py
``` ```
To build a specific version of the product, supply the appropriate tag name (or commit hash) as an argument:
```sh
./Scripts/build.py --checkout 1.13.1.3-snapshot
```
Similarly, one can clean the project, which resets Git repositories to a clean state: Similarly, one can clean the project, which resets Git repositories to a clean state:
```sh ```sh

@ -42,6 +42,12 @@ Build the project with the following Python script. Packages will be copied into
python.exe Scripts\build.py python.exe Scripts\build.py
``` ```
To build a specific version of the product, supply the appropriate tag name (or commit hash) as an argument:
```sh
python.exe Scripts\build.py --checkout 1.13.1.3-snapshot
```
Similarly, one can clean the project, which resets Git repositories to a clean state: Similarly, one can clean the project, which resets Git repositories to a clean state:
```bat ```bat

@ -1,6 +1,6 @@
#!/bin/echo "This module must be imported by other Python scripts." #!/bin/echo "This module must be imported by other Python scripts."
import configparser, os, platform, re, sys import argparse, configparser, os, platform, re, sys
import Detail.Utility as utility import Detail.Utility as utility
@ -27,12 +27,23 @@ class Configuration():
productPackageName = "-".join( [ productName, productVersion, productStage ] ).lower() productPackageName = "-".join( [ productName, productVersion, productStage ] ).lower()
productRepoPath = "" productRepoPath = ""
productBuildPath = "" productBuildPath = ""
productVersionPath = "" productCheckout = ""
# Constructor # Constructor
def __init__( self, configPath ): def __init__( self, configPath ):
def programOptions( self ):
parser = argparse.ArgumentParser( description =
"This utility builds the Synergy-Core binaries. The product version is extracted from the most recent Git tag. One can also build older versions "
"by checking out specific git tags, see options below." )
parser.add_argument( "--checkout", dest = "productCheckout", help = "Checkout and build a specific Git tag (or commit hash) for the Synergy-Core submodule." )
for key, value in vars( parser.parse_args() ).items():
setattr( self, key, value )
def loadConfiguration( self, configPath ): def loadConfiguration( self, configPath ):
utility.printItem( "configPath: ", configPath ) utility.printItem( "configPath: ", configPath )
@ -87,7 +98,6 @@ class Configuration():
resolvePath( self, "productRepoPath" ) resolvePath( self, "productRepoPath" )
resolvePath( self, "productBuildPath", mustExist = False ) resolvePath( self, "productBuildPath", mustExist = False )
resolvePath( self, "productVersionPath", mustExist = False )
resolvePath( self, "binariesPath" ) resolvePath( self, "binariesPath" )
resolvePath( self, "toolsPath" ) resolvePath( self, "toolsPath" )
resolvePath( self, "libQtPath" ) resolvePath( self, "libQtPath" )
@ -116,6 +126,8 @@ class Configuration():
self.updateProductVersion() self.updateProductVersion()
programOptions( self )
utility.printHeading( "Loading configuration..." ) utility.printHeading( "Loading configuration..." )
loadConfiguration( self, configPath ) loadConfiguration( self, configPath )
@ -135,26 +147,19 @@ class Configuration():
def updateProductVersion( self ): def updateProductVersion( self ):
if not os.path.exists( self.productVersionPath ): os.chdir( self.productRepoPath )
utility.printWarning( "Unable to determine product version at this time; version file was missing:\n\t", self.productVersionPath ) lastTag = utility.captureCommandOutput( "git describe --tags --abbrev=0" )
else: matches = re.search( "v?(\d+(?:\.\d+)+)-(\w+)", lastTag )
versionFile = open( self.productVersionPath, "r" ) if not matches:
versionData = versionFile.read() utility.printError( "Unable to extract version information from Git tags." )
versionFile.close() raise SystemExit( 1 )
versionParts = re.findall( r'set \(SYNERGY_VERSION_\w+ "?(\w+)"?\)', versionData )
if len( versionParts ) == 0:
utility.printError( "Failed to extract version information." )
raise SystemExit( 1 )
self.productVersion = ".".join( versionParts[ 0:-1 ] )
self.productStage = versionParts[ -1 ]
self.productRevision = utility.captureCommandOutput( "git rev-parse --short=8 HEAD" )
self.productVersion = matches.group( 1 )
self.productStage = matches.group( 2 )
self.productRevision = utility.captureCommandOutput( "git rev-parse --short=8 HEAD" )
self.productPackageName = "-".join( [ self.productName, self.productVersion, self.productStage, self.platformVersion ] ).lower() self.productPackageName = "-".join( [ self.productName, self.productVersion, self.productStage, self.platformVersion ] ).lower()
utility.printItem( "productVersion: ", self.productVersion ) utility.printItem( "productVersion: ", self.productVersion )
@ -162,6 +167,8 @@ class Configuration():
utility.printItem( "productRevision: ", self.productRevision ) utility.printItem( "productRevision: ", self.productRevision )
utility.printItem( "productPackageName: ", self.productPackageName ) utility.printItem( "productPackageName: ", self.productPackageName )
os.chdir( self.toplevelPath )
# Property list # Property list
def propertyList( self ): def propertyList( self ):

@ -18,6 +18,11 @@ def configureSubmodules():
utility.runCommand( "git submodule update --init --remote --recursive" ) utility.runCommand( "git submodule update --init --remote --recursive" )
if config.productCheckoutTag:
os.chdir( config.productRepoPath )
utility.runCommand( "git checkout " + config.productCheckoutTag )
os.chdir( config.toplevelPath )
statusAfter = utility.captureCommandOutput( "git submodule status" ) statusAfter = utility.captureCommandOutput( "git submodule status" )
print( statusAfter ) print( statusAfter )

@ -7,7 +7,6 @@
productName = Synergy productName = Synergy
productRepoPath = ./Synergy-Core productRepoPath = ./Synergy-Core
productBuildPath = ./Synergy-Core/build productBuildPath = ./Synergy-Core/build
productVersionPath = ./Synergy-Core/cmake/Version.cmake
[Windows] [Windows]

@ -1 +1 @@
Subproject commit ede272185d5acae6466bfd19edeb8efed95ac429 Subproject commit 9c8a1c1e3d2c66ea535f6d91ce59f99c588ff2fc
Loading…
Cancel
Save