data: added python sample project
This commit is contained in:
@@ -1,18 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<config>
|
<config>
|
||||||
<application>
|
<application>
|
||||||
<window_base_width>500</window_base_width>
|
<window_base_width>500</window_base_width>
|
||||||
<window_base_height>500</window_base_height>
|
<window_base_height>500</window_base_height>
|
||||||
</application>
|
</application>
|
||||||
<indexing>
|
<indexing>
|
||||||
<indexer_thread_count>0</indexer_thread_count>
|
<indexer_thread_count>0</indexer_thread_count>
|
||||||
</indexing>
|
</indexing>
|
||||||
<user>
|
<user>
|
||||||
<recent_projects>
|
<recent_projects>
|
||||||
<recent_project>./projects/tutorial/tutorial.srctrlprj</recent_project>
|
<recent_project>./projects/tutorial/tutorial.srctrlprj</recent_project>
|
||||||
<recent_project>./projects/tictactoe/tictactoe.srctrlprj</recent_project>
|
<recent_project>./projects/tictactoe_cpp/tictactoe_cpp.srctrlprj</recent_project>
|
||||||
|
<recent_project>./projects/tictactoe_py/tictactoe_py.srctrlprj</recent_project>
|
||||||
<recent_project>./projects/javaparser/javaparser.srctrlprj</recent_project>
|
<recent_project>./projects/javaparser/javaparser.srctrlprj</recent_project>
|
||||||
</recent_projects>
|
</recent_projects>
|
||||||
</user>
|
</user>
|
||||||
<version>6</version>
|
<version>7</version>
|
||||||
</config>
|
</config>
|
||||||
|
|||||||
+5
-3
@@ -81,14 +81,16 @@ int Field::SameInRow( Token token, int amount ) const {
|
|||||||
for ( int i = 0; i < 3; i++ ) {
|
for ( int i = 0; i < 3; i++ ) {
|
||||||
if ( grid_[i][0] + grid_[i][1] + grid_[i][2] == sum ) {
|
if ( grid_[i][0] + grid_[i][1] + grid_[i][2] == sum ) {
|
||||||
count++;
|
count++;
|
||||||
} else if ( grid_[0][i] + grid_[1][i] + grid_[2][i] == sum ) {
|
}
|
||||||
|
if ( grid_[0][i] + grid_[1][i] + grid_[2][i] == sum ) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( grid_[0][0] + grid_[1][1] + grid_[2][2] == sum ) {
|
if ( grid_[0][0] + grid_[1][1] + grid_[2][2] == sum ) {
|
||||||
count++;
|
count++;
|
||||||
} else if ( grid_[2][0] + grid_[1][1] + grid_[0][2] == sum ) {
|
}
|
||||||
|
if ( grid_[2][0] + grid_[1][1] + grid_[0][2] == sum ) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +119,7 @@ void Field::MakeMove( const Move& move, Token token ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Field::ClearMove( const Move& move ) {
|
void Field::ClearMove( const Move& move ) {
|
||||||
if ( !InRange( move ) || !IsEmpty( move ) || left_ == 9 ) {
|
if ( !InRange( move ) || IsEmpty( move ) || left_ == 9 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,309 @@
|
|||||||
|
from enum import Enum
|
||||||
|
from random import randint
|
||||||
|
|
||||||
|
|
||||||
|
def numberIn():
|
||||||
|
return int(input())
|
||||||
|
|
||||||
|
|
||||||
|
def numberOut(num):
|
||||||
|
print(str(num), end="")
|
||||||
|
|
||||||
|
|
||||||
|
def stringOut(str):
|
||||||
|
print(str, end="")
|
||||||
|
|
||||||
|
|
||||||
|
class GameObject:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Field(GameObject):
|
||||||
|
class Token(Enum):
|
||||||
|
TOKEN_NONE = 0
|
||||||
|
TOKEN_PLAYER_A = 1
|
||||||
|
TOKEN_PLAYER_B = 4
|
||||||
|
|
||||||
|
|
||||||
|
def opponent(self, token):
|
||||||
|
if token == Field.Token.TOKEN_PLAYER_A:
|
||||||
|
return Field.Token.TOKEN_PLAYER_B
|
||||||
|
elif token == Field.Token.TOKEN_PLAYER_B:
|
||||||
|
return Field.Token.TOKEN_PLAYER_A
|
||||||
|
return Field.Token.TOKEN_NONE
|
||||||
|
|
||||||
|
|
||||||
|
class Move:
|
||||||
|
def __init__(self):
|
||||||
|
self.row = None
|
||||||
|
self.col = None
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._grid = []
|
||||||
|
for j in range(0, 3):
|
||||||
|
row = []
|
||||||
|
for i in range(0, 3):
|
||||||
|
row.append(Field.Token.TOKEN_NONE)
|
||||||
|
self._grid.append(row)
|
||||||
|
self._left = 9
|
||||||
|
|
||||||
|
|
||||||
|
def clone(self):
|
||||||
|
field = Field()
|
||||||
|
for j in range(0, 3):
|
||||||
|
for i in range(0, 3):
|
||||||
|
field._grid[i][j] = self._grid[i][j]
|
||||||
|
field._left = self._left
|
||||||
|
return field
|
||||||
|
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
for j in range(0, 3):
|
||||||
|
for i in range(0, 3):
|
||||||
|
self._grid[i][j] = Field.Token.TOKEN_NONE
|
||||||
|
self._left = 9
|
||||||
|
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
stringOut(" 1 2 3\n")
|
||||||
|
for row in range(0, 3):
|
||||||
|
numberOut(row + 1)
|
||||||
|
stringOut(" ")
|
||||||
|
for col in range(0, 3):
|
||||||
|
if self._grid[row][col] == Field.Token.TOKEN_PLAYER_A:
|
||||||
|
stringOut(" X ")
|
||||||
|
elif self._grid[row][col] == Field.Token.TOKEN_PLAYER_B:
|
||||||
|
stringOut(" O ")
|
||||||
|
else:
|
||||||
|
stringOut(" ")
|
||||||
|
if col < 2:
|
||||||
|
stringOut("|")
|
||||||
|
if row < 2:
|
||||||
|
stringOut("\n -----------\n")
|
||||||
|
stringOut("\n\n")
|
||||||
|
|
||||||
|
|
||||||
|
def sameInRow(self, token, amount):
|
||||||
|
total = amount * token.value
|
||||||
|
count = 0
|
||||||
|
for i in range(0, 3):
|
||||||
|
if self._grid[i][0].value + self._grid[i][1].value + self._grid[i][2].value == sum:
|
||||||
|
count += 1
|
||||||
|
if self._grid[0][i].value + self._grid[1][i].value + self._grid[2][i].value == sum:
|
||||||
|
count += 1
|
||||||
|
if self._grid[0][0].value + self._grid[1][1].value + self._grid[2][2].value == sum:
|
||||||
|
count += 1
|
||||||
|
if self._grid[2][0].value + self._grid[1][1].value + self._grid[0][2].value == sum:
|
||||||
|
count += 1
|
||||||
|
return count
|
||||||
|
|
||||||
|
|
||||||
|
def inRange(self, move):
|
||||||
|
return move.row >= 0 and move.row < 3 and move.col >= 0 and move.col < 3
|
||||||
|
|
||||||
|
|
||||||
|
def isEmpty(self, move):
|
||||||
|
return self._grid[move.row][move.col] == Field.Token.TOKEN_NONE
|
||||||
|
|
||||||
|
|
||||||
|
def isFull(self):
|
||||||
|
return self._left == 0
|
||||||
|
|
||||||
|
|
||||||
|
def makeMove(self, move, token):
|
||||||
|
if not self.inRange(move):
|
||||||
|
return
|
||||||
|
if not self.isEmpty(move):
|
||||||
|
return
|
||||||
|
if token is Field.Token.TOKEN_NONE:
|
||||||
|
return
|
||||||
|
if self.isFull():
|
||||||
|
return
|
||||||
|
self._grid[move.row][move.col] = token
|
||||||
|
self._left -= 1
|
||||||
|
|
||||||
|
|
||||||
|
def clearMove(self, move):
|
||||||
|
if not self.inRange(move):
|
||||||
|
return
|
||||||
|
if self.isEmpty(move):
|
||||||
|
return
|
||||||
|
if self._left == 9:
|
||||||
|
return
|
||||||
|
self._grid[move.row][move.col] = Field.Token.TOKEN_NONE
|
||||||
|
self._left += 1
|
||||||
|
|
||||||
|
|
||||||
|
class Player(GameObject):
|
||||||
|
def __init__(self, token, name):
|
||||||
|
self.token = token
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
|
||||||
|
def turn(field):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
|
class HumanPlayer(Player):
|
||||||
|
def __init__(self, token, name):
|
||||||
|
Player.__init__(self, token, name)
|
||||||
|
|
||||||
|
|
||||||
|
def turn(self, field):
|
||||||
|
stringOut(self.name)
|
||||||
|
stringOut("\n")
|
||||||
|
while True:
|
||||||
|
move = self._input()
|
||||||
|
if self._check(field, move):
|
||||||
|
break
|
||||||
|
return move
|
||||||
|
|
||||||
|
|
||||||
|
def _input(self):
|
||||||
|
move = Field.Move()
|
||||||
|
stringOut("Insert row: ")
|
||||||
|
move.row = numberIn() - 1
|
||||||
|
stringOut("Insert col: ")
|
||||||
|
move.col = numberIn() - 1
|
||||||
|
stringOut("\n")
|
||||||
|
return move
|
||||||
|
|
||||||
|
|
||||||
|
def _check(self, field, move):
|
||||||
|
if not field.inRange(move):
|
||||||
|
stringOut("Wrong inpot!\n")
|
||||||
|
return False
|
||||||
|
elif not field.isEmpty(move):
|
||||||
|
stringOut("Is occupied!\n")
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class ArtificialPlayer(Player):
|
||||||
|
class Node:
|
||||||
|
def __init__(self):
|
||||||
|
self.move = None
|
||||||
|
self.value = 0
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, token, name):
|
||||||
|
Player.__init__(self, token, name)
|
||||||
|
|
||||||
|
|
||||||
|
def turn(self, field):
|
||||||
|
tempField = field.clone()
|
||||||
|
node = self._minMax(tempField, self.token)
|
||||||
|
return node.move
|
||||||
|
|
||||||
|
|
||||||
|
def _minMax(self, field, token, prefix = ""):
|
||||||
|
node = ArtificialPlayer.Node()
|
||||||
|
node.value = -10000
|
||||||
|
|
||||||
|
move = Field.Move()
|
||||||
|
sameMove = 0
|
||||||
|
|
||||||
|
for j in range(0, 3):
|
||||||
|
move.row = j
|
||||||
|
for i in range(0, 3):
|
||||||
|
move.col = i
|
||||||
|
|
||||||
|
if not field.isEmpty(move):
|
||||||
|
continue
|
||||||
|
|
||||||
|
field.makeMove(move, token)
|
||||||
|
|
||||||
|
turnValue = self._evaluate(field, token)
|
||||||
|
if turnValue == 0 and not field.isFull():
|
||||||
|
turnValue = -self._minMax(field, field.opponent(token), prefix + " ").value
|
||||||
|
|
||||||
|
field.clearMove(move)
|
||||||
|
|
||||||
|
if turnValue > node.value:
|
||||||
|
node.move = move
|
||||||
|
node.value = turnValue
|
||||||
|
sameMove = 1
|
||||||
|
elif turnValue == node.value:
|
||||||
|
sameMove += 1
|
||||||
|
if randint(0, sameMove - 1) == 0:
|
||||||
|
node.move = move
|
||||||
|
return node
|
||||||
|
|
||||||
|
|
||||||
|
def _evaluate(self, field, token):
|
||||||
|
if field.sameInRow(token, 3):
|
||||||
|
return 2
|
||||||
|
elif field.sameInRow(field.opponent(token), 2):
|
||||||
|
return -1
|
||||||
|
elif field.sameInRow(token, 2) > 1:
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
class TicTacToe:
|
||||||
|
def __init__(self):
|
||||||
|
self._field = Field()
|
||||||
|
self._players = [None, None]
|
||||||
|
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
self._reset()
|
||||||
|
stringOut("Tic Tac Toe\n\n[1] Human\n[2] Computer\n[3] Quit\n\n")
|
||||||
|
|
||||||
|
self._players[0] = self._selectPlayer(Field.Token.TOKEN_PLAYER_A, "Player A")
|
||||||
|
if self._players[0] is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
self._players[1] = self._selectPlayer(Field.Token.TOKEN_PLAYER_B, "Player B")
|
||||||
|
if self._players[1] is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
stringOut("\n")
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self._field.show()
|
||||||
|
playerIndex = 0
|
||||||
|
for i in range(0, 9):
|
||||||
|
player = self._players[playerIndex]
|
||||||
|
self._field.makeMove(player.turn(self._field), player.token)
|
||||||
|
self._field.show()
|
||||||
|
if self._field.sameInRow(player.token, 3):
|
||||||
|
stringOut(player.name)
|
||||||
|
stringOut(" won!\n\n")
|
||||||
|
return
|
||||||
|
playerIndex = (playerIndex + 1) % 2
|
||||||
|
stringOut("Game ends in draw!\n\n")
|
||||||
|
|
||||||
|
|
||||||
|
def _reset(self):
|
||||||
|
for i in range(0, 2):
|
||||||
|
self._players[i] = None
|
||||||
|
self._field.clear()
|
||||||
|
|
||||||
|
|
||||||
|
def _selectPlayer(self, token, name):
|
||||||
|
while (True):
|
||||||
|
stringOut("Choose ")
|
||||||
|
stringOut(name)
|
||||||
|
stringOut(": ")
|
||||||
|
selection = numberIn()
|
||||||
|
if selection == 1:
|
||||||
|
return HumanPlayer(token, name)
|
||||||
|
elif selection == 2:
|
||||||
|
return ArtificialPlayer(token, name)
|
||||||
|
elif selection == 3:
|
||||||
|
return None
|
||||||
|
stringOut("Wrong input!\n")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
tictactoe = TicTacToe()
|
||||||
|
while tictactoe.start():
|
||||||
|
tictactoe.run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<config>
|
||||||
|
<source_groups>
|
||||||
|
<source_group_b7e201f1-a5d5-4578-9629-b14152507962>
|
||||||
|
<name>TicTacToe Source Group</name>
|
||||||
|
<source_extensions>
|
||||||
|
<source_extension>.py</source_extension>
|
||||||
|
</source_extensions>
|
||||||
|
<source_paths>
|
||||||
|
<source_path>src</source_path>
|
||||||
|
</source_paths>
|
||||||
|
<status>enabled</status>
|
||||||
|
<type>Python Source Group</type>
|
||||||
|
</source_group_b7e201f1-a5d5-4578-9629-b14152507962>
|
||||||
|
</source_groups>
|
||||||
|
<version>7</version>
|
||||||
|
</config>
|
||||||
@@ -19,7 +19,11 @@ execute_process(
|
|||||||
)
|
)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${binPath} index --full ${projPath}/tictactoe/tictactoe.srctrlprj
|
COMMAND ${binPath} index --full ${projPath}/tictactoe_cpp/tictactoe_cpp.srctrlprj
|
||||||
|
)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${binPath} index --full ${projPath}/tictactoe_py/tictactoe_py.srctrlprj
|
||||||
)
|
)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
|
|||||||
@@ -41,11 +41,13 @@ mkdir -p $OUTPUT_DIR
|
|||||||
|
|
||||||
# user
|
# user
|
||||||
SAMPLE_JAVAPARSER_DIR=$ROOT_DIR/bin/app/user/projects/javaparser
|
SAMPLE_JAVAPARSER_DIR=$ROOT_DIR/bin/app/user/projects/javaparser
|
||||||
SAMPLE_TICTACTOE_DIR=$ROOT_DIR/bin/app/user/projects/tictactoe
|
SAMPLE_TICTACTOE_CPP_DIR=$ROOT_DIR/bin/app/user/projects/tictactoe_cpp
|
||||||
|
SAMPLE_TICTACTOE_PY_DIR=$ROOT_DIR/bin/app/user/projects/tictactoe_py
|
||||||
SAMPLE_TUTORIAL_DIR=$ROOT_DIR/bin/app/user/projects/tutorial
|
SAMPLE_TUTORIAL_DIR=$ROOT_DIR/bin/app/user/projects/tutorial
|
||||||
|
|
||||||
heat.exe dir $SAMPLE_JAVAPARSER_DIR -cg SampleJavaparserComponentGroup -var var.SampleJavaparserSourceDir -out build/sampleJavaparser.wxs -gg -sfrag -g1 -dr SampleProjects -t $SCRIPT_DIR/HeatTransform.xslt
|
heat.exe dir $SAMPLE_JAVAPARSER_DIR -cg SampleJavaparserComponentGroup -var var.SampleJavaparserSourceDir -out build/sampleJavaparser.wxs -gg -sfrag -g1 -dr SampleProjects -t $SCRIPT_DIR/HeatTransform.xslt
|
||||||
heat.exe dir $SAMPLE_TICTACTOE_DIR -cg SampleTictactoeComponentGroup -var var.SampleTictactoeSourceDir -out build/sampleTictactoe.wxs -gg -sfrag -g1 -dr SampleProjects -t $SCRIPT_DIR/HeatTransform.xslt
|
heat.exe dir $SAMPLE_TICTACTOE_CPP_DIR -cg SampleTictactoeCppComponentGroup -var var.SampleTictactoeCppSourceDir -out build/sampleTictactoeCpp.wxs -gg -sfrag -g1 -dr SampleProjects -t $SCRIPT_DIR/HeatTransform.xslt
|
||||||
|
heat.exe dir $SAMPLE_TICTACTOE_PY_DIR -cg SampleTictactoePyComponentGroup -var var.SampleTictactoePySourceDir -out build/sampleTictactoePy.wxs -gg -sfrag -g1 -dr SampleProjects -t $SCRIPT_DIR/HeatTransform.xslt
|
||||||
heat.exe dir $SAMPLE_TUTORIAL_DIR -cg SampleTutorialComponentGroup -var var.SampleTutorialSourceDir -out build/sampleTutorial.wxs -gg -sfrag -g1 -dr SampleProjects -t $SCRIPT_DIR/HeatTransform.xslt
|
heat.exe dir $SAMPLE_TUTORIAL_DIR -cg SampleTutorialComponentGroup -var var.SampleTutorialSourceDir -out build/sampleTutorial.wxs -gg -sfrag -g1 -dr SampleProjects -t $SCRIPT_DIR/HeatTransform.xslt
|
||||||
|
|
||||||
|
|
||||||
@@ -72,7 +74,8 @@ heat.exe dir $DATA_SYNTAX_HIGHLIGHTING_RULES_DIR -cg DataSyntaxHighlightingRules
|
|||||||
|
|
||||||
candle.exe -dProductVersion="$VERSION_STRING" -dProductGuid="$PRODUCT_GUID" -dWin64="$WIN_64" -arch $X_ARCH -out build/ \
|
candle.exe -dProductVersion="$VERSION_STRING" -dProductGuid="$PRODUCT_GUID" -dWin64="$WIN_64" -arch $X_ARCH -out build/ \
|
||||||
-dSampleJavaparserSourceDir="$SAMPLE_JAVAPARSER_DIR" build/sampleJavaparser.wxs \
|
-dSampleJavaparserSourceDir="$SAMPLE_JAVAPARSER_DIR" build/sampleJavaparser.wxs \
|
||||||
-dSampleTictactoeSourceDir="$SAMPLE_TICTACTOE_DIR" build/sampleTictactoe.wxs \
|
-dSampleTictactoeCppSourceDir="$SAMPLE_TICTACTOE_CPP_DIR" build/sampleTictactoeCpp.wxs \
|
||||||
|
-dSampleTictactoePySourceDir="$SAMPLE_TICTACTOE_PY_DIR" build/sampleTictactoePy.wxs \
|
||||||
-dSampleTutorialSourceDir="$SAMPLE_TUTORIAL_DIR" build/sampleTutorial.wxs \
|
-dSampleTutorialSourceDir="$SAMPLE_TUTORIAL_DIR" build/sampleTutorial.wxs \
|
||||||
-dDataColorSchemesSourceDir="$DATA_COLOR_SCHEMES_DIR" build/dataColorSchemes.wxs \
|
-dDataColorSchemesSourceDir="$DATA_COLOR_SCHEMES_DIR" build/dataColorSchemes.wxs \
|
||||||
-dDataCxxSourceDir="$DATA_CXX_DIR" build/dataCxx.wxs \
|
-dDataCxxSourceDir="$DATA_CXX_DIR" build/dataCxx.wxs \
|
||||||
@@ -88,7 +91,8 @@ candle.exe -dProductVersion="$VERSION_STRING" -dProductGuid="$PRODUCT_GUID" -dWi
|
|||||||
|
|
||||||
light.exe -ext WixUIExtension \
|
light.exe -ext WixUIExtension \
|
||||||
build/sampleJavaparser.wixobj \
|
build/sampleJavaparser.wixobj \
|
||||||
build/sampleTictactoe.wixobj \
|
build/sampleTictactoeCpp.wixobj \
|
||||||
|
build/sampleTictactoePy.wixobj \
|
||||||
build/sampleTutorial.wixobj \
|
build/sampleTutorial.wixobj \
|
||||||
build/dataColorSchemes.wixobj \
|
build/dataColorSchemes.wixobj \
|
||||||
build/dataCxx.wixobj \
|
build/dataCxx.wixobj \
|
||||||
|
|||||||
@@ -74,8 +74,9 @@ echo -e "$INFO building the app (64 bit)"
|
|||||||
if [ $UPDATE_DATABASES = true ]; then
|
if [ $UPDATE_DATABASES = true ]; then
|
||||||
echo -e "$INFO creating databases"
|
echo -e "$INFO creating databases"
|
||||||
|
|
||||||
rm bin/app/user/projects/tictactoe/tictactoe.srctrldb
|
|
||||||
rm bin/app/user/projects/tutorial/tutorial.srctrldb
|
rm bin/app/user/projects/tutorial/tutorial.srctrldb
|
||||||
|
rm bin/app/user/projects/tictactoe_cpp/tictactoe_cpp.srctrldb
|
||||||
|
rm bin/app/user/projects/tictactoe_py/tictactoe_py.srctrldb
|
||||||
rm bin/app/user/projects/javaparser/javaparser.srctrldb
|
rm bin/app/user/projects/javaparser/javaparser.srctrldb
|
||||||
rm -rf temp
|
rm -rf temp
|
||||||
|
|
||||||
@@ -87,12 +88,15 @@ if [ $UPDATE_DATABASES = true ]; then
|
|||||||
../build/win32/Release/app/Sourcetrail.exe config -t 8
|
../build/win32/Release/app/Sourcetrail.exe config -t 8
|
||||||
../build/win32/Release/app/Sourcetrail.exe config -M 1024
|
../build/win32/Release/app/Sourcetrail.exe config -M 1024
|
||||||
|
|
||||||
echo -e "$INFO creating database for tictactoe"
|
|
||||||
../build/win32/Release/app/Sourcetrail.exe index --full --project-file ../bin/app/user/projects/tictactoe/tictactoe.srctrlprj
|
|
||||||
|
|
||||||
echo -e "$INFO creating database for tutorial"
|
echo -e "$INFO creating database for tutorial"
|
||||||
../build/win32/Release/app/Sourcetrail.exe index --full --project-file ../bin/app/user/projects/tutorial/tutorial.srctrlprj
|
../build/win32/Release/app/Sourcetrail.exe index --full --project-file ../bin/app/user/projects/tutorial/tutorial.srctrlprj
|
||||||
|
|
||||||
|
echo -e "$INFO creating database for tictactoe_cpp"
|
||||||
|
../build/win32/Release/app/Sourcetrail.exe index --full --project-file ../bin/app/user/projects/tictactoe_cpp/tictactoe_cpp.srctrlprj
|
||||||
|
|
||||||
|
echo -e "$INFO creating database for tictactoe_py"
|
||||||
|
../build/win32/Release/app/Sourcetrail.exe index --full --project-file ../bin/app/user/projects/tictactoe_py/tictactoe_py.srctrlprj
|
||||||
|
|
||||||
echo -e "$INFO creating database for javaparser"
|
echo -e "$INFO creating database for javaparser"
|
||||||
../build/win32/Release/app/Sourcetrail.exe index --full --project-file ../bin/app/user/projects/javaparser/javaparser.srctrlprj
|
../build/win32/Release/app/Sourcetrail.exe index --full --project-file ../bin/app/user/projects/javaparser/javaparser.srctrlprj
|
||||||
|
|
||||||
@@ -210,8 +214,10 @@ if [ $CREATE_PORTABLE_ZIP = true ]; then
|
|||||||
|
|
||||||
mkdir -p $PORTABLE_PACKAGE_APP_DIR/user/projects/javaparser/
|
mkdir -p $PORTABLE_PACKAGE_APP_DIR/user/projects/javaparser/
|
||||||
cp -u -r bin/app/user/projects/javaparser/* $PORTABLE_PACKAGE_APP_DIR/user/projects/javaparser/
|
cp -u -r bin/app/user/projects/javaparser/* $PORTABLE_PACKAGE_APP_DIR/user/projects/javaparser/
|
||||||
mkdir -p $PORTABLE_PACKAGE_APP_DIR/user/projects/tictactoe/
|
mkdir -p $PORTABLE_PACKAGE_APP_DIR/user/projects/tictactoe_cpp/
|
||||||
cp -u -r bin/app/user/projects/tictactoe/* $PORTABLE_PACKAGE_APP_DIR/user/projects/tictactoe/
|
cp -u -r bin/app/user/projects/tictactoe_cpp/* $PORTABLE_PACKAGE_APP_DIR/user/projects/tictactoe_cpp/
|
||||||
|
mkdir -p $PORTABLE_PACKAGE_APP_DIR/user/projects/tictactoe_py/
|
||||||
|
cp -u -r bin/app/user/projects/tictactoe_py/* $PORTABLE_PACKAGE_APP_DIR/user/projects/tictactoe_py/
|
||||||
mkdir -p $PORTABLE_PACKAGE_APP_DIR/user/projects/tutorial/
|
mkdir -p $PORTABLE_PACKAGE_APP_DIR/user/projects/tutorial/
|
||||||
cp -u -r bin/app/user/projects/tutorial/* $PORTABLE_PACKAGE_APP_DIR/user/projects/tutorial/
|
cp -u -r bin/app/user/projects/tutorial/* $PORTABLE_PACKAGE_APP_DIR/user/projects/tutorial/
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "UserPaths.h"
|
#include "UserPaths.h"
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
|
|
||||||
const size_t ApplicationSettings::VERSION = 6;
|
const size_t ApplicationSettings::VERSION = 7;
|
||||||
|
|
||||||
std::shared_ptr<ApplicationSettings> ApplicationSettings::s_instance;
|
std::shared_ptr<ApplicationSettings> ApplicationSettings::s_instance;
|
||||||
|
|
||||||
@@ -80,7 +80,26 @@ bool ApplicationSettings::load(const FilePath& filePath, bool readOnly)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
migrator.addMigration(7, std::make_shared<SettingsMigrationLambda>(
|
||||||
|
[](const SettingsMigration* migration, Settings* settings)
|
||||||
|
{
|
||||||
|
std::vector<std::string> recentProjects;
|
||||||
|
recentProjects.push_back("./projects/tictactoe_py/tictactoe_py.srctrlprj");
|
||||||
|
utility::append(recentProjects, migration->getValuesFromSettings(
|
||||||
|
settings, "user/recent_projects/recent_project", std::vector<std::string>())
|
||||||
|
);
|
||||||
|
recentProjects.pop_back();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < recentProjects.size(); i++)
|
||||||
|
{
|
||||||
|
if (recentProjects[i] == "./projects/tictactoe/tictactoe.srctrlprj")
|
||||||
|
{
|
||||||
|
recentProjects[i] = "./projects/tictactoe_cpp/tictactoe_cpp.srctrlprj";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
migration->setValuesInSettings(settings, "user/recent_projects/recent_project", recentProjects);
|
||||||
|
}
|
||||||
|
));
|
||||||
bool migrated = migrator.migrate(this, ApplicationSettings::VERSION);
|
bool migrated = migrator.migrate(this, ApplicationSettings::VERSION);
|
||||||
if (migrated)
|
if (migrated)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user