Skip to content

Commit

Permalink
Merge pull request #43 from kiwix/feature/final-versioning
Browse files Browse the repository at this point in the history
Final versioning / Remove downgraded versioning
  • Loading branch information
kelson42 committed Jan 19, 2024
2 parents aaf4ddf + d9698df commit 8aef461
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/info_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def as_project_yml(self):
"templates": ["ApplicationTemplate"],
"settings": {"base": {
# TODO: change to .semantic, once builds are OK
"MARKETING_VERSION": self.version.semantic_downgraded,
"MARKETING_VERSION": self.version.semantic,
"PRODUCT_BUNDLE_IDENTIFIER": self._bundle_id(),
"INFOPLIST_FILE": f"custom/{self._info_plist_path()}",
"INFOPLIST_KEY_CFBundleDisplayName": self._app_name(),
Expand Down
2 changes: 1 addition & 1 deletion src/tag_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _is_valid(tag):
# save the specific parts of the tag as temp files:
Path('.brand_name').write_text(f"{brand.name}")
Path('.build_number').write_text(f"{version.build_number}")
Path('.version_number').write_text(f"{version.semantic_downgraded}")
Path('.version_number').write_text(f"{version.semantic}")

# required as an output, we can pipe on:
print(f"{brand.name} {version.build_number}")
Expand Down
1 change: 0 additions & 1 deletion src/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def __init__(self, year: int, month: int, build_number: int):
raise ValueError(f"invalid year: {year}")

self.semantic = f"{year}.{month}.{build_number}"
self.semantic_downgraded = f"{year-1000}.{month}.{build_number}"
self.build_number = build_number

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions tests/custom_apps_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
class CustomAppsTest(unittest.TestCase):

def setUp(self):
self.custom = CustomApps()
self.custom = CustomApps(brands=["dwds"], build_number=1)

def test_custom_plist(self):
self.custom.create_plists(
custom_plist=Path()/"tests"/"Support"/"Info.plist")
custom_plist=Path("tests")/"Support"/"Info.plist")

def test_custom_project_creation(self):
self.custom.create_custom_project_file(
Expand Down
7 changes: 2 additions & 5 deletions tests/info_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class InfoParserTest(unittest.TestCase):

def setUp(self):
self.parser = InfoParser(Path("tests")/"test.json")
self.parser = InfoParser(Path("tests")/"test.json", build_number=1)

def test_json_to_project_yml(self):
project = self.parser.as_project_yml()
Expand Down Expand Up @@ -46,17 +46,14 @@ def test_excluded_languages(self):
self.assertIn("**/*.lproj", excluded)

def test_app_version_with_default_json_build_number(self):
self.assertEqual(self.parser.version.semantic, "2023.12.3")
self.assertEqual(self.parser.version.semantic_downgraded, "1023.12.3")
self.assertEqual(self.parser.version.semantic, "2023.12.1")

def test_app_version_using_a_specific_build_number(self):
parser = InfoParser(Path("tests")/"test.json", build_number=15)
self.assertEqual(parser.version.semantic, "2023.12.15")
self.assertEqual(parser.version.semantic_downgraded, "1023.12.15")

parser = InfoParser(Path("tests")/"test.json", build_number=33)
self.assertEqual(parser.version.semantic, "2023.12.33")
self.assertEqual(parser.version.semantic_downgraded, "1023.12.33")

def test_as_plist(self):
self.parser.create_plist(
Expand Down
4 changes: 0 additions & 4 deletions tests/version_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ def test_version_from_filename(self):
version = Version.from_file_name(
"dwds_de_dictionary_nopic_2023-11-20", build_number=10)
self.assertEqual(version.semantic, "2023.11.10")
self.assertEqual(version.semantic_downgraded, "1023.11.10")

version = Version.from_file_name(
"dwds_de_dictionary_nopic_2023-09-20", build_number=0)
self.assertEqual(version.semantic, "2023.9.0")
self.assertEqual(version.semantic_downgraded, "1023.9.0")

version = Version.from_file_name(
"dwds_de_dictionary_nopic_2023-01", build_number=7)
self.assertEqual(version.semantic, "2023.1.7")
self.assertEqual(version.semantic_downgraded, "1023.1.7")

version = Version.from_file_name(
"dwds_de_dictionary_nopic_2023-12", build_number=129)
self.assertEqual(version.semantic, "2023.12.129")
self.assertEqual(version.semantic_downgraded, "1023.12.129")

0 comments on commit 8aef461

Please sign in to comment.